/* ==========================================================================
   QPR India
   Palette taken from the original logo artwork, so the brand is the source:
   Blue-led, from the pale disc in the logo mark. The maroon in the
   wordmark stays inside the logo file and nowhere else.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ------------------------------------------------------------------------
     Chakra palette. Not decoration — the three colours map onto the method.
       Vishuddha  (throat)     speech, saying the unsayable     → Question
       Anahata    (heart)      compassion, staying with someone → Persuade
       Ajna       (third eye)  perception, pointing to help     → Refer
       Sahasrara  (crown)      the ground the page sits on
     Muladhara's root red is deliberately absent. Alarm and blood have no
     place on a suicide prevention site, including the crisis line.
     ---------------------------------------------------------------------- */

  --brand:        #0D6474;   /* Vishuddha */
  --brand-hover:  #0A4F5C;
  --brand-soft:   #E6F2F4;
  --brand-line:   #B4D8DE;
  --on-brand:     #FFFFFF;

  --heart:        #2E7D5B;   /* Anahata */
  --heart-soft:   #E8F3ED;
  --depth:        #2C2E5E;   /* Ajna */
  --accent:       #C8891F;   /* Manipura — rules and marks only, never text */

  --ink:          #1A1B2E;
  --paper:        #F7F5FA;   /* Sahasrara */
  --surface:      #FFFFFF;
  --slate:        #4C5068;
  --slate-light:  #5E6278;
  --rule:         #DFDCE9;
  --mist:         #B4D8DE;

  --band:         #1E2046;
  --band-text:    #DEDCF0;

  --shadow-panel: 0 18px 44px -22px rgba(26, 27, 46, 0.42), 0 2px 8px -4px rgba(26, 27, 46, 0.12);
  --shadow-stuck: 0 1px 20px -8px rgba(26, 27, 46, 0.24);

  --display: "Literata", Georgia, "Times New Roman", serif;
  --body:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --t-xs:   0.8125rem;
  --t-sm:   0.9375rem;
  --t-base: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --t-md:   clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --t-lg:   clamp(1.375rem, 1.2rem + 0.75vw, 1.875rem);
  --t-xl:   clamp(1.75rem, 1.4rem + 1.5vw, 2.75rem);
  --t-2xl:  clamp(2.25rem, 1.7rem + 2.4vw, 3.75rem);
  --t-hero: clamp(2.75rem, 1.9rem + 4.2vw, 6rem);

  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem; --s-8: 4.5rem; --s-9: 6.5rem;

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --measure: 62ch;
  --radius: 3px;
  --radius-lg: 6px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --bar-h: 3.25rem;
}

/* Dark theme. Resolves in CSS, so it is correct before any script runs and
   stays correct if none does. Ajna night carries the ground. */

[data-theme="dark"] {
  color-scheme: dark;
  --brand:        #67C6D4;
  --brand-hover:  #8FD7E1;
  --brand-soft:   #123038;
  --brand-line:   #24505C;
  --on-brand:     #08222A;

  --heart:        #6FBF95;
  --heart-soft:   #122C22;
  --depth:        #9698D6;
  --accent:       #E0A845;

  --ink:          #E9E7F4;
  --paper:        #12132A;
  --surface:      #1C1E3A;
  --slate:        #AEB0C8;
  --slate-light:  #8A8CA6;
  --rule:         #2E3058;
  --mist:         #4E5182;

  --band:         #0A0B18;
  --band-text:    #D6D4E8;

  --shadow-panel: 0 18px 44px -20px rgba(0, 0, 0, 0.72), 0 2px 8px -4px rgba(0, 0, 0, 0.5);
  --shadow-stuck: 0 1px 24px -8px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --brand: #67C6D4; --brand-hover: #8FD7E1; --brand-soft: #123038; --brand-line: #24505C; --on-brand: #08222A;
    --heart: #6FBF95; --heart-soft: #122C22; --depth: #9698D6; --accent: #E0A845;
    --ink: #E9E7F4; --paper: #12132A; --surface: #1C1E3A;
    --slate: #AEB0C8; --slate-light: #8A8CA6; --rule: #2E3058; --mist: #4E5182;
    --band: #0A0B18; --band-text: #D6D4E8;
    --shadow-panel: 0 18px 44px -20px rgba(0, 0, 0, 0.72), 0 2px 8px -4px rgba(0, 0, 0, 0.5);
    --shadow-stuck: 0 1px 24px -8px rgba(0, 0, 0, 0.6);
  }
}

[hidden] { display: none; }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor jumps must clear the sticky header, not land beneath it. */
  scroll-padding-top: 6rem;
}

@media (max-width: 56rem) { html { scroll-padding-top: 9rem; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--brand-hover); }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: #14163A;
  color: #FFFFFF;
  padding: var(--s-3) var(--s-4);
  font-weight: 600;
}
.skip-link:focus { left: var(--s-4); top: var(--s-2); }

.wrap {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measure { max-width: var(--measure); }

/* --------------------------------------------------------------------------
   Crisis bar — first in the DOM, visible on every page, never collapsed
   -------------------------------------------------------------------------- */

.crisis {
  background: var(--band);
  color: var(--band-text);
  font-size: var(--t-xs);
}
.crisis__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  min-height: var(--bar-h);
  padding-block: var(--s-2);
}
.crisis__label { color: color-mix(in srgb, var(--band-text) 74%, transparent); }
.crisis__link {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  padding-bottom: 1px;
  white-space: nowrap;
}
.crisis__link:hover { color: #fff; border-bottom-color: #fff; }
.crisis__num { font-family: var(--display); font-size: 1.05rem; letter-spacing: 0.02em; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 249, 250, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  min-height: 4.5rem;
}
.brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; flex-shrink: 0; }
.brand img { width: 2.6rem; }
.brand__name {
  font-family: var(--display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.brand__name span {
  display: block;
  margin-top: 0.28em;
  font-family: var(--body);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--slate-light);
  letter-spacing: 0.04em;
}


/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 var(--s-5);
  border-radius: var(--radius);
  font-size: var(--t-sm);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.btn--primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.btn--line { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--line:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.btn--sm { min-height: 2.5rem; padding: 0 var(--s-4); font-size: var(--t-xs); }

/* --------------------------------------------------------------------------
   Hero — the three words are the brand, so they carry the page
   -------------------------------------------------------------------------- */

.hero { padding-block: var(--s-8) var(--s-7); position: relative; overflow: hidden; }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: center;
}

.steps { margin: 0; font-family: var(--display); font-weight: 400; }
.steps__word {
  display: block;
  font-size: var(--t-hero);
  line-height: 0.94;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.steps__word + .steps__word { margin-top: 0.06em; }

.hero__lede {
  margin: var(--s-5) 0 0;
  font-size: var(--t-md);
  line-height: 1.5;
  color: var(--slate);
  max-width: 30ch;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }

/* The mark's open circle at page scale. Drawn once, gap left open. */
.hero__arc { position: relative; display: grid; place-items: center; min-height: 340px; }
.hero__arc svg { width: min(100%, 460px); height: auto; }
.hero__arc circle {
  fill: none;
  stroke: var(--mist);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-dasharray: 74 100;
  stroke-dashoffset: 74;
  transform: rotate(-138deg);
  transform-origin: 50% 50%;
  animation: draw 2.4s var(--ease) 0.2s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.hero__arc-inner {
  position: absolute;
  text-align: center;
  max-width: 15rem;
  padding-inline: var(--s-2);
}
.hero__arc-inner p { margin: 0; font-size: var(--t-sm); color: var(--slate); line-height: 1.5; }
.hero__arc-inner strong { display: block; font-family: var(--display); font-size: var(--t-lg); color: var(--brand); line-height: 1.15; margin-bottom: var(--s-2); }

/* --------------------------------------------------------------------------
   Endorsement strip
   -------------------------------------------------------------------------- */

.endorse { background: var(--band); color: var(--band-text); padding-block: var(--s-5); }
.endorse p { margin: 0; font-size: var(--t-md); line-height: 1.55; max-width: 46ch; }
.endorse__grid { display: grid; gap: var(--s-4); }
@media (min-width: 60rem) {
  .endorse__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-8); align-items: center; }
}
.endorse__sub { margin: 0; font-size: var(--t-sm); line-height: 1.6; color: color-mix(in srgb, var(--band-text) 78%, transparent); max-width: 48ch; }
.endorse strong { color: #FFFFFF; font-weight: 600; }

/* --------------------------------------------------------------------------
   Section rhythm
   -------------------------------------------------------------------------- */

.section { padding-block: var(--s-8); }
.section--tint { background: var(--brand-soft); }
.section--surface { background: var(--surface); }

.section__head { margin-bottom: var(--s-7); }

@media (min-width: 60rem) {
  .section__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--s-7);
    align-items: end;
  }
  .section__head .section__intro { margin-top: 0; padding-bottom: 0.35em; }
}
.section__title {
  margin: 0;
  text-wrap: balance;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--t-xl);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 22ch;
}
.section__intro { margin: var(--s-3) 0 0; color: var(--slate); max-width: 58ch; }

/* --------------------------------------------------------------------------
   The three steps, explained. A real sequence, so it is numbered.
   -------------------------------------------------------------------------- */

.chain { display: grid; gap: 0; counter-reset: step; list-style: none; margin: 0; padding: 0; }
.chain__item {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: start;
  gap: var(--s-5);
  padding-block: var(--s-6);
  border-top: 1px solid var(--rule);
}
.chain__item:last-child { border-bottom: 1px solid var(--rule); }
.chain__mark {
  counter-increment: step;
  font-family: var(--display);
  font-size: var(--t-lg);
  color: var(--brand);
  line-height: 1;
  padding-top: 0.1em;
}
.chain__mark::before { content: counter(step); }
.chain__body h3 {
  margin: 0 0 var(--s-2);
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-lg);
  letter-spacing: -0.015em;
}
.chain__body p { margin: 0; color: var(--slate); max-width: 62ch; }

/* --------------------------------------------------------------------------
   Audience paths
   -------------------------------------------------------------------------- */

.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: var(--s-4); }
.path {
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s var(--ease);
}
.path:hover { border-color: var(--brand); color: inherit; }
.path h3 {
  margin: 0 0 var(--s-2);
  font-family: var(--display);
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.path p { margin: 0 0 var(--s-4); font-size: var(--t-sm); color: var(--slate); }
.path__go { margin-top: auto; font-size: var(--t-sm); font-weight: 600; color: var(--brand); }

/* --------------------------------------------------------------------------
   Proof — the Andhra Pradesh programme
   -------------------------------------------------------------------------- */

.proof__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--s-5); margin-top: var(--s-6); }
.proof__fig { border-top: 2px solid var(--brand); padding-top: var(--s-3); }
.proof__num { display: block; font-family: var(--display); font-size: var(--t-xl); line-height: 1; color: var(--ink); letter-spacing: -0.02em; }
.proof__cap { display: block; margin-top: var(--s-2); font-size: var(--t-sm); color: var(--slate); }

/* --------------------------------------------------------------------------
   Enquiry band
   -------------------------------------------------------------------------- */

.enquire { background: var(--band); color: var(--band-text); padding-block: var(--s-8); }
.enquire h2 { margin: 0; text-wrap: balance; line-height: 1.12; font-family: var(--display); font-weight: 400; font-size: var(--t-xl); letter-spacing: -0.02em; color: #FFFFFF; max-width: 20ch; }
.enquire p { margin: 0 0 var(--s-5); max-width: 52ch; color: color-mix(in srgb, var(--band-text) 88%, transparent); }
.enquire__grid { display: grid; gap: var(--s-6); }
@media (min-width: 60rem) {
  .enquire__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-8); align-items: start; }
}
.enquire .btn--primary { background: #FFFFFF; color: #0D3B47; border-color: #FFFFFF; }
.enquire .btn--primary:hover { background: #DCEEF1; color: #0D3B47; border-color: #DCEEF1; }
.enquire .btn--line { color: #fff; border-color: rgba(255,255,255,0.45); }
.enquire .btn--line:hover { background: rgba(255,255,255,0.1); border-color: #fff; color: #fff; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.foot { background: var(--band); color: color-mix(in srgb, var(--band-text) 80%, transparent); padding-block: var(--s-7) var(--s-5); font-size: var(--t-sm); }
.foot__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--s-6); }
.foot h2 { margin: 0 0 var(--s-3); font-size: var(--t-xs); font-weight: 600; color: #FFFFFF; letter-spacing: 0.02em; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.foot a { color: color-mix(in srgb, var(--band-text) 80%, transparent); text-decoration: none; }
.foot a:hover { color: #FFFFFF; text-decoration: underline; }
.foot__about { max-width: 34ch; line-height: 1.6; }
.foot__note {
  margin-top: var(--s-7);
  padding-top: var(--s-4);
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  font-size: var(--t-xs);
  color: color-mix(in srgb, var(--band-text) 62%, transparent);
}
.foot__note p { margin: 0; }

/* --------------------------------------------------------------------------
   Narrow screens
   -------------------------------------------------------------------------- */

@media (max-width: 60rem) {
  .hero__grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .hero__arc { min-height: 300px; margin-top: var(--s-4); }
  .hero__arc svg { width: min(88%, 340px); }
  .foot__grid { grid-template-columns: 1fr 1fr; gap: var(--s-5); }
  .foot__about { grid-column: 1 / -1; }
}

@media (max-width: 44rem) {
  .chain__item { grid-template-columns: 2.5rem minmax(0, 1fr); gap: var(--s-4); }
  .hero { padding-block: var(--s-6) var(--s-6); }
  .foot__grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .hero__actions .btn, .enquire .btn { width: auto; flex: 1 1 14rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__arc circle { stroke-dashoffset: 0; animation: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --------------------------------------------------------------------------
   Page lede — h1 on interior pages
   -------------------------------------------------------------------------- */

.section--lede { padding-block: var(--s-7) var(--s-4); }
.section__title--page { font-size: var(--t-2xl); max-width: 20ch; }

/* --------------------------------------------------------------------------
   Course listing
   -------------------------------------------------------------------------- */

.courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr)); gap: var(--s-4); }

.course {
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.section--tint .course { background: var(--surface); }

.course__name {
  margin: 0 0 var(--s-4);
  font-family: var(--display);
  font-size: var(--t-md);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.course__meta { margin: 0 0 var(--s-4); display: grid; gap: var(--s-2); }
.course__meta > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--s-3); }
.course__meta dt { font-size: var(--t-xs); color: var(--slate-light); }
.course__meta dd { margin: 0; font-size: var(--t-xs); color: var(--ink); font-weight: 500; }

.course__blurb { margin: 0 0 var(--s-5); font-size: var(--t-sm); color: var(--slate); }
.course .btn { margin-top: auto; align-self: flex-start; }

@media (max-width: 44rem) {
  .course__meta > div { grid-template-columns: 7rem minmax(0, 1fr); }
  .course .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   Prose — policy pages and long-form sections
   -------------------------------------------------------------------------- */

.prose { max-width: 68ch; }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 {
  margin-top: var(--s-7);
  margin-bottom: var(--s-3);
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--t-lg);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--slate); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul { padding-left: 1.15rem; margin-block: var(--s-4); }
.prose li + li { margin-top: var(--s-2); }
.prose .muted-note {
  margin-top: var(--s-7);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
  font-size: var(--t-xs);
  color: var(--slate-light);
}
.path__go a { color: var(--brand); text-decoration: none; font-weight: 600; }
.path__go a:hover { text-decoration: underline; }

/* A group with a single course shouldn't stretch across the whole grid. */
.courses:has(> .course:only-child) { grid-template-columns: minmax(0, min(34rem, 100%)); }

/* A lede with no intro paragraph shouldn't reserve space for one. */
.section--lede .section__head { margin-bottom: 0; }
.section--lede + .section { padding-top: var(--s-6); }

/* ==========================================================================
   NAVIGATION
   Desktop: glass header that firms up on scroll, with dropdown panels.
   Mobile: a panel that animates to its own height, never the whole screen.
   Without JavaScript everything renders as plain nested lists.
   ========================================================================== */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease),
              box-shadow 0.25s var(--ease);
}
.masthead.is-stuck {
  background: var(--paper);
  border-bottom-color: var(--rule);
  box-shadow: var(--shadow-stuck);
}
.masthead__inner { position: relative; }

.nav { margin-left: var(--s-2); }

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__item { position: relative; }
.nav__item--cta { margin-left: var(--s-3); }

/* Top-level items are buttons when they open a panel, links when they don't.
   They must look identical either way. */
.nav__top {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: var(--s-2) var(--s-3);
  background: none;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}
.nav__top-group {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  transition: background-color 0.16s var(--ease);
}
.nav__item--has-panel.is-open > .nav__top-group,
.nav__top-group:hover { background: var(--brand-soft); }
.nav__item--has-panel.is-open .nav__top,
.nav__top-group:hover .nav__top { color: var(--brand); }

.nav__top:hover { background: var(--brand-soft); color: var(--brand); }
.nav__top-group .nav__top:hover { background: none; }
.nav__top[aria-current="page"] { color: var(--brand); }

.nav__disclosure {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-2) var(--s-3) var(--s-2) 0;
  margin-left: -0.35rem;
  background: none;
  border: 0;
  color: var(--slate);
  cursor: pointer;
}
.nav__disclosure:hover { color: var(--brand); }
.u-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.nav__chev {
  width: 0.42em;
  height: 0.42em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.14em) rotate(45deg);
  transition: transform 0.22s var(--ease);
}
.nav__disclosure[aria-expanded="true"] .nav__chev { transform: translateY(0.06em) rotate(-135deg); }

/* ---- dropdown panels ---- */

.nav__panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 0;
  min-width: 20rem;
  padding: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  opacity: 0;
  transform: translateY(-0.4rem);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.nav__panel[hidden] { display: block; }          /* animate instead of snapping */
.nav__item--has-panel.is-open > .nav__panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.nav__item:last-of-type .nav__panel,
.nav__item:nth-last-of-type(2) .nav__panel { left: auto; right: 0; }

.nav__sub { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav__sub a {
  display: block;
  padding: var(--s-3);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: background-color 0.14s var(--ease);
}
.nav__sub a:hover { background: var(--brand-soft); color: var(--ink); }
.nav__sub strong { display: block; font-size: var(--t-sm); font-weight: 600; }
.nav__sub span { display: block; margin-top: 0.15rem; font-size: var(--t-xs); color: var(--slate-light); line-height: 1.45; }

/* ---- toggle ---- */

.nav-toggle {
  display: none;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
  padding: var(--s-2) var(--s-3);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle__bars { display: grid; gap: 4px; width: 18px; }
.nav-toggle__bars span {
  display: block;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.26s var(--ease), opacity 0.16s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* --------------------------------------------------------------------------
   Narrow screens
   -------------------------------------------------------------------------- */

@media (max-width: 56rem) {

  .masthead__inner { flex-wrap: wrap; }
  .js .nav-toggle { display: inline-flex; }

  .nav__top-group { display: flex; width: 100%; align-items: stretch; justify-content: space-between; }
  .nav__top-group:hover { background: none; }
  .nav__top-group .nav__top { flex: 1; }
  .nav__disclosure { padding: var(--s-4) 0 var(--s-4) var(--s-4); margin-left: 0; }

  .nav { width: 100%; margin-left: 0; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__item { border-top: 1px solid var(--rule); }
  .nav__item--cta { margin: var(--s-4) 0 var(--s-2); border-top: 0; }
  .nav__item--cta .btn { width: 100%; }

  .nav__top { width: 100%; justify-content: space-between; padding: var(--s-4) 0; font-size: var(--t-base); border-radius: 0; }
  .nav__top:hover, .nav__top[aria-expanded="true"] { background: none; }

  .nav__panel {
    position: static;
    min-width: 0;
    padding: 0 0 var(--s-3);
    background: none;
    border: 0;
    box-shadow: none;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
  }
  .nav__sub a { padding: var(--s-3) 0 var(--s-3) var(--s-4); border-left: 2px solid var(--rule); border-radius: 0; }
  .nav__sub a:hover { background: none; border-left-color: var(--brand); }

  /* JS present: collapse the whole nav, and each sub-panel, to zero height.
     grid-template-rows animates to auto height, which max-height cannot. */
  .js .nav {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.32s var(--ease), opacity 0.2s var(--ease);
    opacity: 0;
    overflow: hidden;
  }
  .js .nav > * { min-height: 0; }
  .js .nav.is-open { grid-template-rows: 1fr; opacity: 1; }

  .js .nav__panel[hidden] { display: grid; }
  .js .nav__panel {
    display: grid;
    grid-template-rows: 0fr;
    padding-bottom: 0;
    transition: grid-template-rows 0.28s var(--ease);
    overflow: hidden;
  }
  .js .nav__panel > * { min-height: 0; }
  .js .nav__item--has-panel.is-open > .nav__panel { grid-template-rows: 1fr; padding-bottom: var(--s-3); }
}

@media (prefers-reduced-motion: reduce) {
  .nav, .nav__panel, .nav__chev, .nav-toggle__bars span, .masthead { transition: none !important; }
}


/* ==========================================================================
   THEME TOGGLE
   Three states in cycle: system, light, dark. Exactly one icon shows, resolved
   from data-theme in CSS so the control is correct before any script runs.
   ========================================================================== */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--slate);
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.theme-toggle__icon { display: none; }
[data-theme="system"] .theme-toggle__icon--system,
[data-theme="light"]  .theme-toggle__icon--light,
[data-theme="dark"]   .theme-toggle__icon--dark { display: block; }

@media (max-width: 56rem) {
  .theme-toggle { margin-left: var(--s-2); }
}


/* The three steps take their chakra colour only where they are named. */
.chain__item:nth-child(1) .chain__mark { color: var(--brand); }
.chain__item:nth-child(2) .chain__mark { color: var(--heart); }
.chain__item:nth-child(3) .chain__mark { color: var(--depth); }
[data-theme="dark"] .chain__item:nth-child(3) .chain__mark,
:root:not([data-theme="light"]) .chain__item:nth-child(3) .chain__mark { color: var(--depth); }

.steps__word:nth-child(1) { color: var(--ink); }
.hero__arc circle { stroke: var(--brand); opacity: 0.55; }

/* Crisis line reads through weight and clarity rather than alarm colour. */
.crisis__inner { min-height: var(--bar-h); }
.crisis__num { font-size: 1.2rem; font-weight: 600; }


/* The logo mark is maroon lettering inside a pale disc. On a dark ground it
   needs that disc made explicit, or the wordmark disappears. */
[data-theme="dark"] .brand img,
:root:not([data-theme="light"]) .brand img { background: transparent; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img {
    background: #EFEDF7;
    border-radius: 50%;
    padding: 2px;
  }
}
[data-theme="dark"] .brand img {
  background: #EFEDF7;
  border-radius: 50%;
  padding: 2px;
}
[data-theme="light"] .brand img { background: transparent; padding: 0; }

/* Toggle keeps its own spacing when the header wraps on narrow screens. */
@media (max-width: 56rem) {
  /* Brand, theme control and menu button share one row; only the nav wraps.
     The brand absorbs the free space — an auto margin on the theme control
     was consuming it and pushing the menu button onto a second row. */
  .masthead__inner { gap: var(--s-2); }
  .brand { margin-right: auto; }
  .theme-toggle { margin-left: 0; margin-right: 0; }
  .js .nav-toggle { margin-left: 0; }
  .nav { margin-left: 0; }
}

/* On the narrowest phones the strapline costs more room than it earns. */
@media (max-width: 26rem) {
  .brand__name span { display: none; }
  .brand img { width: 2.2rem; }
}

.prose--spaced { margin-top: var(--s-7); }
