/* ==========================================================================
   Lumina Clinical Research — site styles
   Modern CSS: custom properties, nesting, logical properties, :has(),
   container and range media queries. Font sizes in rem so they follow the
   reader's browser text-size setting.

   Order: tokens · base · header · hero · sections · components (by page) ·
   inner pages · responsive · user preferences · dark theme.
   Keep that order: several components rely on later rules winning
   (e.g. .card after .status-l).
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --g950: #0b2117; --g900: #0f2b1d; --g800: #163a28; --g700: #1f4c35; --g100: #e3ebe5;
  --gold: #cfa957; --gold-l: #e6cd8f; --gold-d: #7d5f1e;
  --gold-wash: rgb(207 169 87 / .12);   /* tinted fill on dark surfaces */
  --ivory: #f6f3ec; --paper: #fffdf8; --ink: #17211c; --muted: #4a5650;
  --line: #ddd5c3; --line-d: rgb(207 169 87 / .35);
  /* text on the green surfaces (hero, .dark, band, footer) */
  --on-dark: #eef2ef;
  --on-dark-soft: #cfdcd4;
  --on-dark-muted: #bccbc2;
  --field: #8a7f68;          /* form-control border, ≥3:1 on white */
  --field-hover: #5f5747;
  --field-bg: #fff;
  --err: #a3321f;
  --focus: var(--g700);      /* focus ring on light surfaces (≥3:1) */
  --live: #3f8a5c;
  /* corner rounding: controls · cards and panels · large media */
  --r-sm: 8px; --r: 14px; --r-lg: 18px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --caps: "Cinzel", Georgia, serif;
  --sans: "Figtree", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --w: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
}

/* Dark surfaces switch the focus ring and error colour to light tones */
:is(.util, header.site, .hero, .phero, .dark, .band, .closing, footer, .mbar) {
  --focus: var(--gold);
  --err: #f0a28f;
}

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

html {
  scroll-padding-block: 96px 24px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img, video { max-inline-size: 100%; block-size: auto; }
a[href^="mailto:"] { overflow-wrap: anywhere; }

/* safety net: the build removes the other language, but hide it if a page is opened unbuilt */
html[lang="es"] .en, html[lang="en"] .es { display: none !important; }
[hidden] { display: none !important; }

a {
  color: var(--g700);
  text-underline-offset: 3px;
  &:hover { color: var(--gold-d); }
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.08; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
address { font-style: normal; }

.wrap { max-inline-size: var(--w); margin-inline: auto; padding-inline: var(--gutter); }

/* visually hidden, still announced */
.sr {
  position: absolute !important;
  inline-size: 1px; block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  inset-block-start: 8px; inset-inline-start: 8px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--gold);
  color: var(--g950);
  font-weight: 600;
  text-decoration: none;
  translate: 0 -200%;
  &:focus { translate: 0; outline: 3px solid var(--g950); outline-offset: 2px; color: var(--g950); }
}
@media (prefers-reduced-motion: no-preference) {
  .skip { transition: translate .15s; }
}

.eyebrow {
  font: 600 .75rem/1 var(--caps);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-d);
}
:is(.dark, .hero, .phero) .eyebrow { color: var(--gold); }

/* small caps label used on cards, steps and the footer (colour set per component) */
:is(.path .k, .person .role, .step .k, .card .k, footer h2) {
  font: 600 .6875rem/1 var(--caps);
  letter-spacing: .2em;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-block-size: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: 600 .9375rem/1.2 var(--sans);
  letter-spacing: .01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  &[disabled] { opacity: .55; cursor: wait; }
}
.btn-gold { background: var(--gold); color: var(--g950);
  &:hover { background: var(--gold-l); color: var(--g950); }
  &:active { background: #b8933f; } }
.btn-line { border-color: var(--gold); color: var(--gold-l); background: transparent;
  &:hover { background: var(--gold-wash); color: #fff; } }
.btn-green { background: var(--g800); color: #fff;
  &:hover { background: var(--g700); color: #fff; } }
.btn-out { border-color: var(--g800); color: var(--g800); background: transparent;
  &:hover { background: var(--g100); color: var(--g900); } }

/* controls that only work with JavaScript */
html:not(.js) :is(.theme-btn, .cmd button) { display: none; }

/* a row of buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* image placeholders */
.ph {
  display: grid; place-items: center;
  padding: 16px;
  text-align: center;
  font: .75rem/1.4 var(--mono);
  color: #6a604c;
  background: repeating-linear-gradient(135deg, #e9e3d5 0 9px, #f1ece1 9px 18px);
  border: 1px solid var(--line);
}

/* ---------- utility bar ---------- */
.util {
  background: var(--g950);
  color: var(--on-dark-soft);
  font-size: .8125rem;
  & .wrap { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: center; min-block-size: 40px; }
  & a { color: #e9e1cc; text-decoration: none; &:hover { color: var(--gold-l); text-decoration: underline; } }
}
.lang {
  display: flex; flex: none;
  border: 1px solid var(--line-d);
  & :is(a, span[aria-current]) {
    display: grid; place-items: center;
    min-block-size: 40px; min-inline-size: 40px;
    padding: 0 10px;
    color: var(--on-dark-soft);
    font: 600 .75rem/1 var(--sans);
    letter-spacing: .08em;
    text-decoration: none;
  }
  & a:hover { color: #fff; text-decoration: none; }
  & [aria-current] { background: var(--gold); color: var(--g950); }
}

/* ---------- header ---------- */
header.site {
  position: sticky; inset-block-start: 0; z-index: 30;
  background: var(--g900);
  border-block-end: 1px solid var(--line-d);
  & .wrap { display: flex; align-items: center; gap: clamp(16px, 2vw, 28px); min-block-size: 76px; max-inline-size: 1400px; }
}
.brand {
  display: flex; flex-direction: column;
  line-height: 1;
  text-decoration: none;
  & b { font: 600 1.625rem/1 var(--caps); letter-spacing: .14em; color: var(--gold); text-transform: uppercase; }
  & small { font: 500 .625rem/1 var(--sans); letter-spacing: .34em; color: var(--gold-l); margin-block-start: 6px; text-transform: uppercase; }
  &:hover b { color: var(--gold-l); }
  /* header logo image (the footer keeps the text version) */
  & img { display: block; block-size: 60px; inline-size: auto; }
  &:hover img { filter: brightness(1.12); }
}
nav.main {
  display: flex; flex: 1; align-items: center; justify-content: center; gap: clamp(14px, 1.4vw, 22px);
  & a {
    padding: 6px 0;
    white-space: nowrap;
    color: var(--on-dark);
    font-size: .90625rem; font-weight: 500;
    text-decoration: none;
    border-block-end: 1px solid transparent;
    &:hover { color: var(--gold-l); border-color: var(--gold); }
    &[aria-current="page"] { color: var(--gold-l); border-color: var(--gold); border-block-end-width: 2px; }
  }
  & .menu-only { display: none; }
  &.open .menu-only { display: block; }
}
.hdr-cta {
  display: flex; gap: 10px;
  & .btn { min-block-size: 42px; padding: 0 16px; font-size: .875rem; white-space: nowrap; }
  & a[aria-current="page"] { color: var(--gold-l); border-color: var(--gold); }
}
.theme-btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-block-size: 42px;
  padding: 0 14px;
  background: none;
  border: 1px solid var(--line-d);
  color: var(--gold-l);
  font: 600 .8125rem/1 var(--sans);
  letter-spacing: .04em;
  cursor: pointer;
  &::before {
    content: "";
    inline-size: 10px; block-size: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--gold);
    background: linear-gradient(90deg, var(--gold) 50%, transparent 50%);
  }
  &:hover { border-color: var(--gold); color: #fff; }
  &[aria-pressed="true"] { border-color: var(--gold); &::before { background: var(--gold); } }
}
.menu-btn {
  display: none;
  margin-inline-start: auto;
  min-block-size: 44px;
  padding: 0 14px;
  background: none;
  border: 1px solid var(--line-d);
  color: var(--gold-l);
  font: 600 .875rem var(--sans);
  cursor: pointer;
  &[aria-expanded="true"] { background: var(--gold-wash); }
}

/* ---------- hero ---------- */
.hero {
  background: radial-gradient(120% 90% at 80% 20%, #1d4a33 0%, var(--g900) 60%);
  color: var(--on-dark);
  & .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 64px;
    align-items: center;
    padding-block: 88px;
  }
  & h1 { font-size: clamp(2.625rem, 5.4vw, 4.5rem); color: #fff; margin-block: 22px; }
  & h1 em { font-style: italic; color: var(--gold-l); }
  & p.lead { font-size: 1.1875rem; color: var(--on-dark-soft); max-inline-size: 560px; }
}
.loc {
  display: flex; gap: 10px; align-items: center;
  margin-block-start: 28px;
  font-size: .9375rem;
  color: #e6dcc2;
  & i { inline-size: 7px; block-size: 7px; background: var(--gold); rotate: 45deg; flex: none; }
}
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-block-start: 40px; }
.path {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px;
  border: 1px solid var(--line-d);
  color: var(--on-dark);
  text-decoration: none;
  transition: background .15s, border-color .15s;
  &:hover { background: rgb(207 169 87 / .08); border-color: var(--gold); color: #fff; }
  & .k { color: var(--gold); }
  & :is(h2, h3) { font-size: 1.625rem; color: #fff; }
  & p { font-size: .90625rem; color: var(--on-dark-muted); }
  & .go { margin-block-start: auto; padding-block-start: 8px; font-weight: 600; font-size: .90625rem; color: var(--gold-l); }
}
.hero-mark {
  position: relative;
  inline-size: 100%; max-inline-size: 560px;
  justify-self: end;
  box-shadow: 0 30px 80px rgb(0 0 0 / .35);
  & img { inline-size: 100%; block-size: auto; display: block; }
}

/* tel pill + highlights in the hero */
.cmd {
  display: flex; align-items: center; gap: 12px;
  inline-size: min(380px, 100%);
  margin-block-start: 22px;
  padding: 5px 5px 5px 16px;
  border: 1px solid var(--line-d);
  font: .9375rem/1 var(--mono);
  & .p { color: var(--gold); }
  & code { flex: 1; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  & a { color: #fff; text-decoration: none; &:hover { color: var(--gold-l); text-decoration: underline; } }
  & button {
    flex: none;
    min-block-size: 36px;
    padding: 0 12px;
    background: var(--gold-wash);
    border: 1px solid var(--line-d);
    color: var(--gold-l);
    font: 600 .75rem/1 var(--sans);
    letter-spacing: .04em;
    cursor: pointer;
    &:hover { border-color: var(--gold); color: #fff; }
  }
}
.copied { color: #9fd0b0 !important; }
.plats {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  margin: 18px 0 0; padding: 0;
  list-style: none;
  font-size: .875rem;
  color: var(--on-dark-soft);
  & > li { display: inline-flex; align-items: center; gap: 8px;
    &::before { content: ""; inline-size: 6px; block-size: 6px; background: var(--gold); rotate: 45deg; } }
}

/* ---------- sections ---------- */
section.blk { padding-block: clamp(64px, 9vw, 104px); }
/* section heading: .sh is the two-column header row; .sec-h / .sec-p are the same styles used standalone */
.sh {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  margin-block-end: 56px;
}
:is(.sh h2, .sec-h) { font-size: clamp(2.25rem, 4vw, 3.375rem); margin-block-start: 16px; }
:is(.sh p, .sec-p) { color: var(--muted); font-size: 1.09375rem; }
.sec-p { margin-block-start: 16px; }
.sec-p + .actions { margin-block-start: 28px; }
/* where a form used to be: a short pointer to the matching tab on contact.html */
.cta-box {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 18px;
  & p { color: var(--muted); }
}
.topics-h { font-size: 1.625rem; margin-block-end: 16px; }
.topics {
  display: grid; gap: 10px;
  margin: 0; padding: 0; list-style: none;
  & a {
    display: grid; gap: 4px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    &:hover { border-color: var(--gold); }
    &::after { content: "→"; justify-self: end; margin-block-start: -24px; color: var(--gold-d); }
  }
  & b { font-weight: 600; }
  & a > span { color: var(--muted); font-size: .9375rem; padding-inline-end: 24px; }
}
.paper { background: var(--paper); border-block: 1px solid var(--line); }

/* dark (green) sections */
.dark {
  background: var(--g900);
  color: var(--on-dark);
  & :is(h2, h3) { color: #fff; }
  & :is(.sh p, .cta-box p, .req-note, .chk, .note) { color: var(--on-dark-muted); }
  & .ph {
    background: repeating-linear-gradient(135deg, #183f2b 0 9px, #143524 9px 18px);
    color: var(--on-dark-muted);
    border-color: var(--line-d);
  }
  & .f :is(label, legend) { color: #fff; }
  & .chk.invalid { color: #fff; }
  & .note { border-color: var(--line-d); }
}

/* ---------- studies status ---------- */
.status {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  border: 1px solid var(--line);
  background: var(--paper);
}
.status-l {
  display: flex; flex-direction: column; gap: 18px;
  padding: 40px;
  border-inline-end: 1px solid var(--line);
  & h3 { font-size: 2rem; }
  & p { color: var(--muted); }
}
.status-r { padding: 40px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--ivory);
  color: var(--muted);
  font-size: .8125rem; font-weight: 600;
  & i { inline-size: 8px; block-size: 8px; border-radius: 50%; background: #b3a47f; }
  & i.live { background: var(--live); }
}
.phero .pill { background: transparent; border-color: var(--line-d); color: var(--on-dark);
  & i.live { background: #5fb37f; } }
.upd { font: .75rem var(--mono); color: #6f665a; margin-block-start: auto; }

/* ---------- forms ---------- */
form { container: form / inline-size; display: grid; gap: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.req-note { font-size: .8125rem; color: var(--muted); }
.f {
  display: grid; gap: 7px;
  & :is(label, legend) { font-size: .875rem; font-weight: 600; color: var(--ink); }
  & .req { color: var(--gold-d); }
  & :is(input, select, textarea) {
    inline-size: 100%;
    min-block-size: 48px;
    padding: 10px 14px;
    font: 1rem var(--sans);
    color: var(--ink);
    background: var(--field-bg);
    border: 1px solid var(--field);
    border-radius: var(--r-sm);
    &:hover { border-color: var(--field-hover); }
    &:focus-visible, &:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--field-hover); }
  }
  & textarea { min-block-size: 110px; resize: vertical; }
  & .err { display: none; font-size: .84375rem; color: var(--err); }
  &.invalid {
    & :is(input, select, textarea) { border-color: var(--err); border-width: 2px; }
    & .err { display: block; }
  }
}
.err::before { content: "⚠ " / ""; }
.chk {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: .875rem; line-height: 1.5;
  color: var(--muted);
  cursor: pointer;
  /* square, custom-drawn box (the browser's own checkbox has rounded corners it won't let CSS change) */
  & input {
    appearance: none;
    display: grid; place-items: center;
    inline-size: 24px; block-size: 24px; margin: 1px 0 0; flex: none; cursor: pointer;
    background: var(--field-bg) no-repeat center / 16px 16px;
    border: 1.5px solid var(--field);
    border-radius: 0;
    &:hover { border-color: var(--field-hover); }
    &:checked {
      background-color: var(--chk-on, var(--g800)); border-color: var(--chk-on, var(--g800));
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E");
    }
  }
  &.invalid { color: var(--ink); & input { outline: 2px solid var(--err); outline-offset: 2px; } }
}
/* error line the script adds after a required checkbox */
.chk-err { display: none; margin-block-start: -10px; font-size: .84375rem; color: var(--err); }
.chk.invalid + .chk-err { display: block; }
/* shown under the submit button when a form could not be sent */
.send-err { font-size: .90625rem; color: var(--err); }
.note { font-size: .84375rem; color: var(--muted); border-block-start: 1px solid var(--line); padding-block-start: 14px; }
.ok {
  display: none; gap: 8px;
  padding: 24px;
  border: 1px solid var(--g700);
  background: var(--g100);
  &.show { display: grid; }
  & h3 { font-size: 1.625rem; color: var(--g900); }
  & p { color: var(--g800); font-size: .9375rem; }
}
/* honeypot field, off-screen for people, still filled in by bots */
.hp { position: absolute; inset-inline-start: -9999px; }

/* ---------- steps ---------- */
.steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0; padding: 0; list-style: none;
  border-block-start: 1px solid var(--line);
}
.step {
  display: flex; flex-direction: column; gap: 14px;
  padding: 36px 32px 40px 0;
  & + .step { padding-inline-start: 32px; border-inline-start: 1px solid var(--line); }
  & .n { font: 500 4rem/1 var(--serif); color: var(--gold-d); }
  & .k { color: var(--muted); }
  & h3 { font-size: 1.875rem; }
  & p { color: var(--muted); }
}
.callout {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between;
  margin-block-start: 40px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  background: var(--paper);
  & p { max-inline-size: 680px; color: var(--muted); font-size: .96875rem; }
  & strong { color: var(--ink); }
}

/* ---------- team ---------- */
.team { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.team4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.person {
  display: grid; gap: 14px;
  & .photo { aspect-ratio: 4 / 5; }
  & .photo img { object-position: center top; }
  & .role { color: var(--gold-d); }
  & h3 { font-size: 1.625rem; }
  & p { font-size: .90625rem; color: var(--muted); }
}
/* team page: share row tracks across cards so roles, names and bios start on the same line.
   Each card has exactly four children: photo, role, name, .bio */
.team-aligned { row-gap: 56px;
  & > .person { grid-row: span 4; grid-template-rows: subgrid; row-gap: 14px; align-content: start; }
  & .bio { display: grid; gap: 14px; align-content: start; }
}

/* ---------- sponsors ---------- */
.caps {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block-start: 1px solid var(--line-d);
  border-inline-start: 1px solid var(--line-d);
}
.cap {
  display: flex; flex-direction: column; gap: 10px;
  padding: 28px 24px;
  border-inline-end: 1px solid var(--line-d);
  border-block-end: 1px solid var(--line-d);
  & .n { font: .75rem var(--mono); color: var(--gold); }
  & h3 { font-size: 1.5rem; }
  & p { font-size: .90625rem; color: var(--on-dark-muted); }
}
.sp-cta {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 56px;
  align-items: start;
  margin-block-start: 72px;
  & :is(h2, h3) { font-size: 2.5rem; margin-block: 14px 16px; }
  & .side p { color: var(--on-dark-muted); }
  & .side p + p { margin-block-start: 16px; }
  & .side > .btn { margin-block-start: 24px; }
}
section.blk > .sp-cta { margin-block-start: 0; }
/* ---------- FAQ ---------- */
.faq {
  border-block-start: 1px solid var(--line);
  & details { border-block-end: 1px solid var(--line); }
  & summary {
    display: grid; grid-template-columns: 56px 1fr 32px; gap: 12px; align-items: center;
    padding-block: 24px;
    list-style: none;
    font: 500 1.625rem/1.2 var(--serif);
    cursor: pointer;
    &::-webkit-details-marker { display: none; }
    &:hover { color: var(--g700); }
    & .n { font: .8125rem var(--mono); color: var(--gold-d); }
    & .pm { display: grid; place-items: center; inline-size: 32px; block-size: 32px; border: 1px solid var(--line); font: 400 1.25rem/1 var(--sans); color: var(--g800); }
  }
  & details[open] .pm { background: var(--g800); color: #fff; border-color: var(--g800); }
  /* plus / minus drawn as two bars so they sit exactly in the middle (a "+" glyph doesn't) */
  & .pm::after {
    content: ""; inline-size: 12px; block-size: 12px;
    background:
      linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
      linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
  }
  & details[open] .pm::after { background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; }
  & .a { padding: 0 44px 28px 68px; color: var(--muted); max-inline-size: 860px; }
}

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 56px; }
.map { display: block; inline-size: 100%; aspect-ratio: 16 / 10; margin-block-start: 28px; border: 1px solid var(--line); }
.map-link { margin-block-start: 12px; font-size: .90625rem; }
.tabs {
  display: flex; flex-wrap: wrap;
  margin-block-end: 24px;
  border: 1px solid var(--line);
  & button {
    flex: 1 1 auto;
    min-block-size: 48px;
    padding: 0 14px;
    white-space: nowrap;
    background: var(--paper);
    border: 0;
    color: var(--muted);
    font: 600 .875rem var(--sans);
    cursor: pointer;
    &:hover { background: var(--ivory); color: var(--ink); }
    &[aria-selected="true"] { background: var(--g800); color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
    &:focus-visible { outline-offset: -3px; }
  }
  & button + button { border-inline-start: 1px solid var(--line); }
}
[role="tabpanel"]:focus-visible { outline-offset: 6px; }

/* ---------- closing ---------- */
.closing {
  padding-block: clamp(88px, 12vw, 140px) clamp(80px, 10vw, 120px);
  text-align: center;
  background: radial-gradient(60% 80% at 50% 100%, #1d4a33 0%, var(--g900) 70%);
  color: var(--on-dark);
  & .q { max-inline-size: 760px; margin-inline: auto; font: italic 500 clamp(1.875rem, 4vw, 3rem)/1.15 var(--serif); color: var(--on-dark-soft);
    & em { color: var(--gold-l); } }
  & .mk { display: flex; align-items: center; justify-content: center; gap: 14px; margin-block-start: 56px;
    & b { font: 600 2rem/1 var(--caps); letter-spacing: .14em; color: var(--gold); text-transform: uppercase; } }
  & h2 { margin-block-start: 18px; font-size: clamp(1.75rem, 3.2vw, 2.5rem); color: #fff;
    & em { font-style: italic; color: var(--gold-l); } }
  & .actions { justify-content: center; margin-block-start: 32px; }
}

/* ---------- rounded corners ----------
   Small controls use --r-sm, cards and panels --r, large photos and media --r-lg.
   Boxes whose inner parts have their own background clip them with overflow: hidden. */
:is(.theme-btn, .menu-btn, .cmd, .topics a) { border-radius: var(--r-sm); }
.cmd button { border-radius: 6px; }
.lang { border-radius: var(--r-sm);
  & > :first-child { border-start-start-radius: calc(var(--r-sm) - 1px); border-end-start-radius: calc(var(--r-sm) - 1px); }
  & > :last-child { border-start-end-radius: calc(var(--r-sm) - 1px); border-end-end-radius: calc(var(--r-sm) - 1px); } }
:is(.path, .card, .scard, .callout, .ok, .ph, .empty) { border-radius: var(--r); }
:is(.status, .tabs) { border-radius: var(--r); overflow: hidden; }
:is(.photo, .map) { border-radius: var(--r-lg); }
.hero-mark { border-radius: var(--r-lg); overflow: hidden; }
.pill { border-radius: 999px; }
.draft { border-radius: 6px; }

/* ---------- footer ---------- */
footer {
  background: var(--g950);
  color: #b6c5bc;
  font-size: .90625rem;
  & .wrap { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 40px; padding-block: 72px 48px; }
  & address { margin-block-start: 20px; max-inline-size: 300px; }
  & h2 { color: var(--gold); margin: 0 0 18px; }
  & ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
  & a { color: #dfe7e2; text-decoration: none; &:hover { color: var(--gold-l); text-decoration: underline; } }
  & .legal {
    grid-column: 1 / -1;
    display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
    padding-block-start: 24px;
    border-block-start: 1px solid rgb(207 169 87 / .2);
    font-size: .8125rem;
    color: #8fa298;
  }
}
.mbar { display: none; }

/* ---------- inner pages ---------- */
.phero {
  background: radial-gradient(120% 120% at 85% 0%, #1d4a33 0%, var(--g900) 60%);
  color: var(--on-dark);
  & .wrap { padding-block: clamp(44px, 7vw, 72px); }
  & h1 { font-size: clamp(2.5rem, 5vw, 4.125rem); color: #fff; margin-block-start: 18px; max-inline-size: 900px; }
  & p.lead { margin-block-start: 20px; color: var(--on-dark-soft); font-size: 1.1875rem; max-inline-size: 700px; }
  & .lead a { color: var(--gold-l); &:hover { color: #fff; } }
  & .actions { margin-block-start: 32px; }
}
.phero-404 { min-block-size: 60vh; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-block-start: 24px; }
.hero-upd { font: .8125rem var(--mono); color: var(--on-dark-muted); }
.crumb {
  margin-block-end: 28px;
  font-size: .8125rem;
  color: var(--on-dark-muted);
  & ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
  & li + li::before { content: "/"; content: "/" / ""; margin-inline-end: 8px; }
  & a { color: var(--gold-l); text-decoration: none; &:hover { color: #fff; text-decoration: underline; } }
}
.photo {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #ddd;
  & img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
  & figcaption { position: absolute; inset-inline-start: 0; inset-block-end: 0; padding: 7px 12px; background: rgb(11 33 23 / .86); color: var(--on-dark); font-size: .78125rem; letter-spacing: .02em; }
}
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: center; }
.split-top { align-items: start; }
.prose {
  display: grid; gap: 16px;
  max-inline-size: 760px;
  & h2 { font-size: clamp(1.875rem, 3.2vw, 2.5rem); margin-block-start: 16px; }
  & h3 { font-size: 1.625rem; margin-block-start: 8px; }
  & :is(p, li) { color: var(--muted); }
  & ul { display: grid; gap: 8px; margin: 0; padding-inline-start: 20px; }
  & strong { color: var(--ink); }
}
/* label / value list. .spec-sm is the compact version used for contact details */
.spec {
  container: spec / inline-size;
  display: grid;
  margin: 0;
  border-block-start: 1px solid var(--line);
  & div { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding-block: 20px; border-block-end: 1px solid var(--line); }
  & dt { font: 600 .6875rem/1.9 var(--caps); letter-spacing: .18em; color: var(--gold-d); }
  & dd { margin: 0; color: var(--ink); }
}
.spec-sm {
  align-content: start;
  & div { grid-template-columns: 120px 1fr; gap: 16px; padding-block: 18px; font-size: 1rem; }
}
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card {
  display: grid; gap: 10px; align-content: start;
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--paper);
  & .k { color: var(--gold-d); }
  & h3 { font-size: 1.625rem; }
  & :is(p, li) { color: var(--muted); font-size: .96875rem; }
  & ul { display: grid; gap: 6px; margin: 0; padding-inline-start: 18px; }
}
.card-lg { padding: 36px; }
.card-solo { max-inline-size: 760px; }
/* added by the site Worker: the link under the home page's study cards, and a professional with no photo yet */
.home-more { margin-block-start: 28px; }
.photo-empty { aspect-ratio: 900 / 1034; background: var(--g100); }
.preview-bar { position: sticky; inset-block-start: 0; z-index: 40; padding: 8px 16px; text-align: center; font: .8125rem/1.3 var(--mono); background: #f3e9cf; color: #5e470f; border-block-end: 1px solid #e0cd9a; }
.dark .card {
  background: rgb(0 0 0 / .12);
  border-color: var(--line-d);
  & :is(p, li) { color: var(--on-dark-muted); }
  & .k { color: var(--gold); }
  & a { color: var(--gold-l); &:hover { color: #fff; } }
}
.draft {
  display: inline-flex; align-self: flex-start;
  padding: 5px 9px;
  font: .75rem/1.3 var(--mono);
  background: #f3e9cf;
  color: #5e470f;
  border: 1px solid #e0cd9a;
}
:is(.dark, .phero) .draft { background: var(--gold-wash); color: var(--gold-l); border-color: var(--line-d); }
.band {
  background: var(--g900);
  color: var(--on-dark);
  & .wrap { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; justify-content: space-between; padding-block: 56px; }
  & h2 { font-size: clamp(1.875rem, 3.4vw, 2.75rem); color: #fff; max-inline-size: 640px; }
}
/* .toolbar, .scard, .draft, .hero-meta and .toc are also used by the study templates in templates/ */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: end;
  margin-block-end: 28px;
  & .f { min-inline-size: 200px; }
  & .upd { margin-inline-start: auto; }
}
.scard {
  display: grid; gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s;
  &:hover { border-color: var(--g700); color: var(--ink); & .go { text-decoration: underline; } }
  & :is(.pill, .draft) { justify-self: start; }   /* the card is a grid, so align-self alone doesn't keep them text-width */
  & h3 { font-size: 1.625rem; }
  & .meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: .875rem; color: var(--muted); }
  & .go { font-weight: 600; color: var(--g700); }
}
.empty { margin-block-start: 24px; padding: 40px; border: 1px dashed #a99d82; text-align: center; color: var(--muted); }
.tl {
  display: grid;
  margin: 0; padding: 0; list-style: none;
  border-block-start: 1px solid var(--line);
  & > li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px; padding-block: 24px; border-block-end: 1px solid var(--line); }
  & .n { font: 500 2.5rem/1 var(--serif); color: var(--gold-d); }
  & h3 { font-size: 1.5rem; margin-block-end: 6px; }
  & p { color: var(--muted); }
}
.dark .tl {
  &, & > li { border-color: var(--line-d); }
  & .n { color: var(--gold); }
  & p { color: var(--on-dark-muted); }
}
.toc {
  position: sticky; inset-block-start: 110px; align-self: start;
  display: grid; gap: 4px;
  padding-inline-start: 20px;
  border-inline-start: 1px solid var(--line);
  & a { padding-block: 5px; color: var(--muted); font-size: .90625rem; text-decoration: none; &:hover { color: var(--g700); text-decoration: underline; } }
}
.withtoc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; }
.withtoc-body { display: grid; gap: 56px; }

/* ---------- responsive ---------- */
@container form (width < 460px) { .row2 { grid-template-columns: 1fr; } }
@container spec (width < 480px) { .spec:not(.spec-sm) div { grid-template-columns: 1fr; gap: 6px; } }
@container spec (width < 380px) { .spec-sm div { grid-template-columns: 1fr; gap: 4px; } }

@media (width <= 1024px) {
  .caps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  footer .wrap { grid-template-columns: 1fr 1fr; }
  .contact { gap: 40px; }
}

/* collapse to the menu button before the Spanish nav + language switch (≈1385px) runs out of room.
   The head script adds .js to <html>; without JavaScript the menu button could not open,
   so the links wrap onto their own row under the brand instead. */
@media (width <= 1400px) {
  header.site .wrap { position: relative; }
  .hdr-cta { display: none; }
  header.site .lang { margin-inline-start: auto; }
  header.site .theme-btn + .menu-btn { margin-inline-start: 0; }

  .js nav.main { display: none; }
  .js nav.main.open {
    display: flex; flex-direction: column; gap: 4px;
    position: absolute; inset-block-start: 100%; inset-inline: 0;
    padding: 16px 32px 24px;
    background: var(--g900);
    border-block-end: 1px solid var(--line-d);
    & a { padding-block: 12px; font-size: 1.0625rem; }
  }
  .js .menu-btn { display: block; }

  html:not(.js) header.site .wrap { flex-wrap: wrap; row-gap: 4px; padding-block: 12px; }
  html:not(.js) nav.main {
    order: 1; flex-basis: 100%;
    flex-wrap: wrap; justify-content: flex-start; gap: 0 18px;
    & .menu-only { display: block; }
  }
}

@media (width <= 860px) {
  .util .addr { display: none; }
  .hero .wrap { grid-template-columns: 1fr; padding-block: 56px 64px; gap: 40px; }
  .hero-mark { justify-self: start; max-inline-size: 320px; }
  .paths, .sh, .status, .sp-cta, .contact,
  .split, .grid2, .grid3, .withtoc { grid-template-columns: 1fr; }
  .split, .grid2, .grid3, .withtoc { gap: 28px; }
  .sh { gap: 16px; margin-block-end: 36px; }
  .status-l { border-inline-end: 0; border-block-end: 1px solid var(--line); }
  .status-l, .status-r { padding: 24px; }
  .steps { grid-template-columns: 1fr; }
  .step, .step + .step { padding: 28px 0; border-inline-start: 0; }
  .step + .step { border-block-start: 1px solid var(--line); }
  .team { grid-template-columns: 1fr 1fr; }
  .faq summary { grid-template-columns: 40px 1fr 32px; font-size: 1.3125rem; }
  .faq .a { padding: 0 0 24px 52px; }
  .toc { display: none; }
  body { padding-block-end: calc(68px + env(safe-area-inset-bottom, 0px)); }
  html { scroll-padding-block-end: 92px; }
  .mbar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--g950);
    border-block-start: 1px solid var(--line-d);
  }
}

@media (width <= 520px) {
  .team, .caps { grid-template-columns: 1fr; }
  .team-aligned .photo { inline-size: min(220px, 60%); }
  footer .wrap { grid-template-columns: 1fr; gap: 32px; }
  .util .mail { display: none; }
  /* icon-only theme button: the label stays for screen readers (same rules as .sr) */
  header.site .theme-btn {
    padding: 0 12px;
    & > span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    &::before { inline-size: 14px; block-size: 14px; }
  }
}

/* At high zoom / short viewports the sticky header would cover the page */
@media (height <= 500px) {
  header.site { position: static; }
  html { scroll-padding-block: 16px; }
  .mbar { display: none; }
  body { padding-block-end: 0; }
}

/* ---------- user preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (prefers-contrast: more) {
  :root { --muted: var(--ink); --line: #8a7f68; --field: #4d4639; }
  .dark, .phero, .hero, footer { --line-d: var(--gold); }
}

@media (forced-colors: active) {
  .lang [aria-current],
  .tabs button[aria-selected="true"],
  .theme-btn::before { forced-color-adjust: none; border-color: ButtonText; background: linear-gradient(90deg, ButtonText 50%, transparent 50%); }
  .theme-btn[aria-pressed="true"]::before { background: ButtonText; }
  .pill i, .loc i { forced-color-adjust: none; background: CanvasText; }
  .chk.invalid input, .f.invalid :is(input, select, textarea) { outline: 2px solid Mark; }
  .faq .pm::after { forced-color-adjust: none; color: CanvasText; }
  .chk input { appearance: auto; }   /* high contrast: use the system checkbox so the tick stays visible */
}

/* ==========================================================================
   Dark theme (toggle in header; defaults to the OS preference)
   Most surfaces follow the tokens; the rules below cover the rest.
   ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;
  --ivory: #0f0f0d; --paper: #161614; --ink: #ece8de; --muted: #aaa69b;
  --line: #2a2a26; --line-d: #3a3832; --g100: #1e1e1b; --gold-d: #d6b469;
  --field: #6f8f7d; --field-hover: #9fbfad; --field-bg: #0a140f;
  --err: #f0a28f; --focus: var(--gold); --live: #5fb37f;
  --accent: #2a6646;         /* selected tabs, open FAQ, green buttons */
  --accent-line: #6fae88;
  --link: #9fd0b0;

  & a { color: var(--link); &:hover { color: var(--gold-l); } }
  & .btn-gold { color: var(--g950); &:hover { color: var(--g950); } }
  & .btn-green { background: var(--accent); color: #fff; &:hover { background: #337a54; color: #fff; } }
  & .btn-line { color: var(--gold-l); &:hover { color: #fff; } }
  & .btn-out { border-color: var(--accent-line); color: #cfe6d7; &:hover { background: #1e1e1b; color: #fff; } }
  & :is(.ph, .dark .ph) { background: repeating-linear-gradient(135deg, #1c1c19 0 9px, #171715 9px 18px); color: #a8a498; border-color: var(--line); }
  & .chk input { --chk-on: var(--accent); }
  & .ok { background: #1e1e1b; border-color: #3d7a57; & h3 { color: #fff; } & p { color: #cfe6d7; } }
  & .draft { background: var(--gold-wash); color: var(--gold-l); border-color: rgb(207 169 87 / .35); }
  & .upd { color: var(--muted); }
  & .faq summary:hover { color: var(--gold-l); }
  & .faq summary .pm { color: var(--ink); }
  & .faq details[open] .pm { background: var(--accent); border-color: var(--accent); }
  & .tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); }
  & .closing { background: radial-gradient(60% 80% at 50% 100%, #1e1d19 0%, #0f0f0d 70%); }
  & .scard:hover { border-color: var(--accent-line); }
  & .scard .go { color: var(--link); }
  & .empty { border-color: var(--field); }
  & :is(.hero, .phero) { background: radial-gradient(120% 100% at 85% 0%, #1e1d19 0%, #0f0f0d 60%); }
  & :is(.dark, .band) { background: #131311; }
  & .dark .card { background: rgb(255 255 255 / .02); }
  & :is(.util, footer, .mbar) { background: #0a0a09; }
  & :is(header.site, nav.main.open) { background: #121210; }
}
