/* ==========================================================================
   BRAND SETTINGS - change these to match the Squarespace site.
   Contrast notes (WCAG 2.1 AA needs 4.5:1 for text, 3:1 for borders/controls):
   if you change colours, check pairs with e.g. webaim.org/resources/contrastchecker
   ========================================================================== */
:root {
  /* Taken from lianedavidscounselling.co.uk: a black page, so the widget sits
     as pale cards on black, with the site's blue accent. All text pairs are
     at least 4.8:1 (AA needs 4.5:1); borders/controls are above 3:1. */
  --color-bg: transparent;        /* around the cards: transparent shows the Squarespace page behind the frame */
  --color-surface: #eaeaee;       /* cards (the site's pale grey) */
  --color-text: #111111;          /* main text */
  --color-muted: #4a4f57;         /* secondary text */
  --color-primary: #105f96;       /* buttons, highlights (a touch darker than the site's #1470af, which just misses AA) */
  --color-primary-hover: #0b4a78;
  --color-on-primary: #ffffff;    /* text on primary buttons */
  --color-soft: #d3e4f3;          /* soft tinted panels (pale blue) */
  --color-border: #6b7078;        /* form control borders */
  --color-line: #c5c8cf;          /* decorative dividers */
  --color-focus: #0b4a78;         /* keyboard focus ring */

  /* System fonts, as on the main site: nothing is downloaded, so no
     third-party consent needed. */
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-heading: Verdana, Geneva, sans-serif;

  --radius: 14px;
  --max-width: 40rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.0625rem;      /* 17px */
  line-height: 1.6;
}

/* The .widget wrapper is what we measure to report the iframe height.
   Deliberately NO min-height: 100vh here, or the iframe could never shrink. */
.widget {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1rem; }

/* Headings receive focus when a screen changes (for screen readers);
   they shouldn't look like a focused control. */
[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Cards and screens ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
}

.muted { color: var(--color-muted); }
.small { font-size: 0.9375rem; }

.teaser { text-align: center; }
.teaser .btn-row { justify-content: center; }

.privacy-note {
  background: var(--color-soft);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  min-height: 2.75rem;                /* comfortable touch target (44px) */
  padding: 0.65rem 1.4rem;
  border: 2px solid var(--color-primary);
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
}
.btn-secondary:hover { background: var(--color-soft); color: var(--color-primary-hover); }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }

/* Visible keyboard focus on everything interactive */
a:focus-visible, button:focus-visible, .option:has(input:focus-visible) {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---------- Progress ---------- */
.progress-text { font-size: 0.9375rem; color: var(--color-muted); margin-bottom: 0.4rem; }
.progress-bar { height: 6px; background: var(--color-line); border-radius: 999px; overflow: hidden; margin-bottom: 1.25rem; }
.progress-fill { height: 100%; background: var(--color-primary); border-radius: 999px; }

/* ---------- Questions ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 1rem; }
.q-prompt { display: block; font-size: 0.9375rem; color: var(--color-muted); margin-bottom: 0.35rem; }
.q-statement { display: block; font-family: var(--font-heading); font-size: 1.2rem; line-height: 1.4; }

.option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.6rem 1rem;
  margin-bottom: 0.6rem;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  cursor: pointer;
}
.option:hover { background: var(--color-soft); }
.option input { width: 1.25rem; height: 1.25rem; accent-color: var(--color-primary); flex: none; margin: 0; }
.option:has(input:checked) { border-color: var(--color-primary); background: var(--color-soft); }

.hint {
  color: var(--color-text);
  background: var(--color-soft);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin: 0.5rem 0 0;
}

/* ---------- Results ---------- */
.reflections { padding-left: 1.2rem; margin: 0 0 1rem; }
.reflections li { margin-bottom: 0.4rem; }

.panel {
  background: var(--color-soft);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
}
.panel h3 { margin-top: 0; }

/* ---------- Breathing ---------- */
.breath-stage { text-align: center; padding: 0.5rem 0; }
.breath-circle-wrap { display: flex; align-items: center; justify-content: center; height: 11rem; }
.breath-circle {
  width: 8rem; height: 8rem;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.85;
  transform: scale(0.55);
  transition-property: transform;
  transition-timing-function: ease-in-out;
  /* transition-duration is set from JS to match the breathing timings */
}
.breath-circle.expanded { transform: scale(1); }
.breath-cue { font-family: var(--font-heading); font-size: 1.4rem; min-height: 2.2rem; margin: 0.5rem 0 0.75rem; }

/* ---------- Crisis footer ---------- */
.crisis {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 0.9375rem;
}
.crisis h2 { font-size: 1.1rem; font-family: var(--font-body); font-weight: 700; margin-bottom: 0.4rem; }
.crisis ul { list-style: none; margin: 0; padding: 0; }
.crisis li { margin-bottom: 0.3rem; }
.crisis a { color: var(--color-primary-hover); font-weight: 700; }

.noscript { padding: 1rem; }

/* ---------- Larger screens ---------- */
@media (min-width: 40em) {
  .widget { padding: 1.5rem; }
  .card { padding: 2rem; }
  h1 { font-size: 1.85rem; }
}

/* ---------- Reduced motion ----------
   Removes the circle animation entirely. The words "Breathe in / out" still
   guide the exercise, so nothing is lost. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
