/* CITADEL design system components. Theme tokens live in tokens.css. */

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 17px; line-height: 1.6; letter-spacing: -.011em;
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .08em .4em; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: var(--narrow); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }

/* ── Type ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { letter-spacing: -.028em; line-height: 1.08; font-weight: 700; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5.2rem); letter-spacing: -.045em; line-height: 1.02; }
h2 { font-size: clamp(2rem, 4.2vw, 3.3rem); letter-spacing: -.038em; }
h3 { font-size: 1.22rem; letter-spacing: -.02em; line-height: 1.25; }
.display { font-size: clamp(3rem, 8.4vw, 6.6rem); }
.grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 600; letter-spacing: .02em; color: var(--accent); margin-bottom: 1.1rem; }
.eyebrow.pill { padding: .35rem .8rem; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--border); }
.lede { font-size: clamp(1.12rem, 1.8vw, 1.4rem); color: var(--text-2); line-height: 1.5; max-width: 40ch; margin-top: 1.4rem; letter-spacing: -.016em; }
.section-lede { font-size: 1.15rem; color: var(--text-2); max-width: 60ch; margin-top: 1rem; }
.muted { color: var(--text-2); }
.small { font-size: .88rem; }
.center { text-align: center; }
.center .lede, .center .section-lede { margin-left: auto; margin-right: auto; }

/* ── Header ───────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; height: 60px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand { gap: .65rem; }
.brand-name { font-size: 1.02rem; }
.nav { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.nav a, .nav-more-btn { color: var(--text-2); font-size: .9rem; font-weight: 500; padding: .45rem .75rem; border-radius: 999px; white-space: nowrap; -webkit-user-select: none; user-select: none; transition: color .2s, background .2s; }
.nav a:hover, .nav a[aria-current="page"], .nav-more-btn:hover, .nav-more-btn[aria-expanded="true"], .nav-more.has-current .nav-more-btn { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.nav-cure { color: var(--text); }
.nav a.nav-cure::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--grad); margin-right: .45rem; vertical-align: 1px; }
/* "More" dropdown: lower-priority pages live here so the bar never wraps */
.nav-more { position: relative; }
.nav-more-btn { display: inline-flex; align-items: center; gap: .3rem; border: 0; background: none; font-family: inherit; cursor: pointer; }
.nav-more-btn svg { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.nav-more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-more-menu { position: absolute; right: 0; top: calc(100% + 12px); display: none; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: .25rem 1rem; padding: .75rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 60; }
.nav-more-menu.open { display: grid; animation: pop .18s var(--ease); }
.nav-group { display: flex; flex-direction: column; }
.nav-group-label { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3, var(--text-2)); padding: .35rem .7rem .4rem; }
.nav-more-menu a { border-radius: 10px; padding: .5rem .7rem; }
.header-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.brand { flex-shrink: 0; }
.icon-btn.nav-toggle { display: none; }
@media (max-width: 900px) {
  .icon-btn.nav-toggle { display: inline-grid; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; max-height: calc(100vh - 60px); overflow-y: auto; flex-direction: column; align-items: stretch; gap: 0; padding: .5rem 16px 1.25rem; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: .8rem .5rem; border-radius: 0; border-bottom: 1px solid var(--border); font-size: 1.05rem; }
  .nav a:hover, .nav a[aria-current="page"] { background: none; }
  .nav a[aria-current="page"] { color: var(--accent); }
  /* On phones the "More" items are shown inline as labelled sections */
  .nav-more-btn { display: none; }
  .nav-more-menu, .nav-more-menu.open { position: static; display: block; padding: 0; border: 0; box-shadow: none; background: none; animation: none; }
  .nav-group { margin-top: 1rem; }
  .nav-group-label { padding: .25rem .5rem; }
  .nav-more-menu a { border-radius: 0; padding: .7rem .5rem; font-size: 1rem; }
  .header-actions { margin-left: auto; }
}
@media (max-width: 520px) { .header-actions .btn-primary { display: none; } }

/* Icon buttons and the theme menu */
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .2s, transform .2s var(--ease); }
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.theme-wrap { position: relative; }
.theme-menu { position: absolute; right: 0; top: calc(100% + 10px); min-width: 200px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: none; z-index: 60; }
.theme-menu.open { display: block; animation: pop .18s var(--ease); }
.theme-menu button { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border: 0; background: none; color: var(--text); font: inherit; font-size: .9rem; border-radius: 9px; cursor: pointer; text-align: left; }
.theme-menu button:hover { background: var(--surface-2); }
.theme-menu button[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--accent); font-weight: 700; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-strong); flex: none; }
.swatch.system { background: linear-gradient(135deg, #fbfbfd 50%, #0b0c10 50%); }
.swatch.light { background: #fbfbfd; }
.swatch.dark { background: #14161c; }
.swatch.midnight { background: radial-gradient(circle at 30% 30%, #5ee1ff, #000 70%); }
.swatch.blue { background: radial-gradient(circle at 30% 30%, #6fd3ff, #1e6bff 45%, #071226 85%); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .78rem 1.35rem; border-radius: 999px; font: inherit; font-weight: 600; font-size: .95rem; letter-spacing: -.01em; border: 1px solid transparent; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, opacity .2s; white-space: nowrap; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { box-shadow: var(--shadow); }
.btn-grad { background: var(--grad); color: #fff; box-shadow: 0 8px 24px var(--aurora-2); }
.btn-grad:hover { box-shadow: 0 12px 34px var(--aurora-2); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text-3); }
.btn-link { padding: 0; background: none; color: var(--accent); font-weight: 600; }
.btn-link:hover { transform: none; text-decoration: underline; }
.btn-sm { padding: .5rem .95rem; font-size: .86rem; }
.btn-lg { padding: 1rem 1.7rem; font-size: 1.04rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.cta-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 2.2rem; align-items: center; }
.center .cta-row { justify-content: center; }

/* ── Sections & hero ──────────────────────────────────────────────────── */
section { padding: clamp(4.5rem, 9vw, 8rem) 0; position: relative; }
section.tight { padding: clamp(3rem, 6vw, 5rem) 0; }
section.alt { background: var(--bg-alt); }
.hero { padding: clamp(5rem, 12vw, 9.5rem) 0 clamp(4rem, 8vw, 7rem); overflow: hidden; isolation: isolate; }
.aurora { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.aurora::before, .aurora::after, .aurora span { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); }
.aurora::before { width: 60vw; height: 60vw; max-width: 820px; max-height: 820px; top: -30%; right: -12%; background: var(--aurora-2); animation: drift 22s ease-in-out infinite alternate; }
.aurora::after { width: 50vw; height: 50vw; max-width: 700px; max-height: 700px; bottom: -40%; left: -10%; background: var(--aurora-1); animation: drift 26s ease-in-out infinite alternate-reverse; }
.aurora span { width: 30vw; height: 30vw; max-width: 420px; max-height: 420px; top: 25%; left: 40%; background: var(--aurora-3); animation: drift 30s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(6%, 8%, 0) scale(1.12); } }
.grid-bg { position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%); opacity: .55; }
.page-hero { padding: clamp(4.5rem, 10vw, 7.5rem) 0 clamp(2.5rem, 5vw, 4rem); position: relative; overflow: hidden; isolation: isolate; }
.page-hero h1 { font-size: clamp(2.4rem, 5.6vw, 4.4rem); max-width: 18ch; }
.section-head { margin-bottom: clamp(2.2rem, 4vw, 3.5rem); }
.section-head h2 { max-width: 20ch; }
.center .section-head h2, .section-head.center h2 { margin-left: auto; margin-right: auto; }

/* ── Layout helpers ───────────────────────────────────────────────────── */
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.split.top { align-items: start; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } .split { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Cards & bento ────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.8rem; box-shadow: var(--shadow-sm); transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; position: relative; }
.card.hover:hover, a.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); text-decoration: none; }
a.card { color: inherit; display: block; }
.card h3 { margin-bottom: .55rem; }
.card p { color: var(--text-2); font-size: .98rem; }
.card .icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 1.2rem; }
.card .icon svg { width: 22px; height: 22px; }
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.1rem; }
.bento > * { grid-column: span 2; }
.bento .w3 { grid-column: span 3; }
.bento .w4 { grid-column: span 4; }
.bento .w6 { grid-column: span 6; }
@media (max-width: 960px) { .bento > *, .bento .w3, .bento .w4 { grid-column: span 3; } .bento .w6 { grid-column: span 6; } }
@media (max-width: 640px) { .bento { grid-template-columns: 1fr; } .bento > *, .bento .w3, .bento .w4, .bento .w6 { grid-column: auto; } }
.card.feature { padding: 2.2rem; overflow: hidden; min-height: 260px; display: flex; flex-direction: column; }
.card.feature h3 { font-size: 1.5rem; }
.card.feature .big { font-size: clamp(2.6rem, 5vw, 3.8rem); font-weight: 700; letter-spacing: -.05em; line-height: 1; margin-top: auto; padding-top: 1.5rem; }
.card.glow::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .7; pointer-events: none; }
.tag { display: inline-block; font-size: .74rem; font-weight: 600; padding: .22rem .62rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); margin-bottom: .9rem; letter-spacing: .01em; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; margin-bottom: 1.1rem; }

/* Stats band */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.stat { background: var(--surface); padding: 1.8rem 1.5rem; }
.stat .num { font-size: clamp(2rem, 3.6vw, 2.8rem); font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.stat .lbl { color: var(--text-2); font-size: .9rem; margin-top: .5rem; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Source strip */
.sources { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 2.4rem; color: var(--text-3); font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; }
.sources span { display: inline-flex; align-items: center; gap: .5rem; }
.sources span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--grad); }

/* Product preview window */
.window { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.window-bar { display: flex; align-items: center; gap: 6px; padding: .8rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.window-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.window-bar b { margin-left: .6rem; font-size: .78rem; font-weight: 500; color: var(--text-3); }
.window-body { padding: 1.2rem; display: grid; gap: .6rem; }
.wrow { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: .92rem; }
.wrow .what { margin-left: auto; color: var(--text-3); font-size: .8rem; font-family: var(--mono); }
.wrow .pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Callouts, FAQ, tables ────────────────────────────────────────────── */
.callout { border-radius: var(--r-lg); padding: 1.6rem 1.8rem; background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; }
.callout::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.callout strong { display: block; margin-bottom: .35rem; font-size: 1.05rem; }
.callout p { color: var(--text-2); }
.callout.warn::before { background: var(--warn); }
.faq { display: grid; gap: .7rem; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 0 1.4rem; transition: border-color .2s; }
.faq details[open] { border-color: var(--border-strong); }
.faq summary { cursor: pointer; list-style: none; padding: 1.2rem 0; font-weight: 600; font-size: 1.05rem; display: flex; justify-content: space-between; gap: 1rem; letter-spacing: -.015em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--text-3); transition: transform .25s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 0 1.3rem; color: var(--text-2); }
.faq details > div p + p { margin-top: .7rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-3); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.mono, .mono { font-family: var(--mono); font-size: .86rem; }

/* ── Prose (blog, legal, research) ────────────────────────────────────── */
.prose { font-size: 1.08rem; line-height: 1.75; color: var(--text); }
.prose > * + * { margin-top: 1.25rem; }
.prose h2 { font-size: 1.75rem; margin-top: 2.8rem; letter-spacing: -.03em; }
.prose h3 { font-size: 1.25rem; margin-top: 2rem; }
.prose p, .prose li { color: var(--text-2); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .45rem; }
.prose blockquote { border-left: 3px solid var(--accent); padding: .3rem 0 .3rem 1.2rem; color: var(--text); font-size: 1.15rem; }
.prose .table-wrap { margin-top: 1.5rem; }
.post { padding: clamp(3.5rem, 8vw, 6rem) 0 clamp(4rem, 8vw, 7rem); }
.post h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.post-meta { color: var(--text-3); font-size: .9rem; margin-top: 1rem; }
.post .prose { margin-top: 2.5rem; padding-top: 2.5rem; border-top: 1px solid var(--border); }
.back-link { display: table; font-size: .9rem; font-weight: 500; margin-bottom: 2rem; color: var(--text-2); }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
@media (max-width: 960px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .post-grid { grid-template-columns: 1fr; } }
.post-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.8rem; color: inherit; transition: transform .35s var(--ease), box-shadow .35s var(--ease); min-height: 250px; }
.post-card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow); }
.post-card .tag { align-self: flex-start; }
.post-card h3 { font-size: 1.3rem; margin-bottom: .6rem; }
.post-card p { color: var(--text-2); font-size: .97rem; }
.post-card .post-meta { margin-top: auto; padding-top: 1.3rem; }
.legal-meta { color: var(--text-3); font-size: .92rem; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1.1rem; }
.field label { font-size: .88rem; font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea, .input {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: .85rem 1rem; color: var(--text); font: inherit; font-size: 1rem; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field textarea { min-height: 150px; resize: vertical; }
.hp { position: absolute; left: -9999px; }
.form-msg { margin-top: 1rem; font-size: .95rem; min-height: 1.4em; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--bad); }

/* Big search (Find Your Cure entry points) */
.cure-search { display: flex; gap: .5rem; padding: .45rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); max-width: 640px; transition: box-shadow .25s, border-color .25s; }
.cure-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft), var(--shadow-lg); }
.cure-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: 1.08rem; padding: .6rem 1.1rem; }
.cure-search input::placeholder { color: var(--text-3); }
.center .cure-search { margin-left: auto; margin-right: auto; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.center .chips { justify-content: center; }
.chip { font: inherit; font-size: .85rem; padding: .42rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: border-color .2s, color .2s; }
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
@media (max-width: 520px) { .cure-search { border-radius: 20px; flex-direction: column; } .cure-search .btn { width: 100%; } }

/* ── Status dots ──────────────────────────────────────────────────────── */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .5rem; vertical-align: 1px; background: var(--text-3); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.dot.wait { background: var(--warn); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.status-err { color: var(--bad); }

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 4rem 0 2.5rem; background: var(--bg-alt); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 2rem; }
.footer-grid h4 { font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: .9rem; letter-spacing: 0; }
.footer-grid ul { list-style: none; display: grid; gap: .55rem; }
.footer-grid a { color: var(--text-2); }
.footer-grid a:hover { color: var(--text); }
.footer-about p { color: var(--text-2); margin-top: 1rem; max-width: 34ch; }
.footer-bottom { margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; color: var(--text-3); font-size: .82rem; }
.disclaimer { max-width: 90ch; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } .footer-about { grid-column: 1 / -1; } }

/* ── Motion ───────────────────────────────────────────────────────────── */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal.d1 { transition-delay: .08s; } .js .reveal.d2 { transition-delay: .16s; } .js .reveal.d3 { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ── Find Your Cure agent ─────────────────────────────────────────────── */
.agent-shell { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; align-items: start; }
.agent-shell > * { min-width: 0; }
@media (max-width: 960px) { .agent-shell { grid-template-columns: 1fr; } .agent-steps { position: static; } }
.agent-steps { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.4rem; }
@media (max-width: 900px) { .agent-steps { position: static; } }
.agent-steps h3 { font-size: 1rem; margin-bottom: 1rem; }
.astep { display: grid; grid-template-columns: 22px 1fr auto; gap: .7rem; align-items: center; padding: .55rem 0; font-size: .92rem; color: var(--text-2); }
.astep .st { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); }
.astep.run .st { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.astep.ok .st { border-color: var(--ok); background: var(--ok); box-shadow: inset 0 0 0 3px var(--surface); }
.astep.bad .st { border-color: var(--bad); background: var(--bad); box-shadow: inset 0 0 0 3px var(--surface); }
.astep.ok, .astep.bad { color: var(--text); }
.astep .ms { font-family: var(--mono); font-size: .76rem; color: var(--text-3); }
@keyframes spin { to { transform: rotate(360deg); } }
.agent-out > * + * { margin-top: 1.4rem; }
.outlook { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.outlook > div { background: var(--surface); padding: 1.3rem 1.2rem; }
.outlook .num { font-size: 1.9rem; font-weight: 700; letter-spacing: -.04em; line-height: 1.05; }
.outlook .lbl { font-size: .82rem; color: var(--text-2); margin-top: .35rem; }
@media (max-width: 760px) { .outlook { grid-template-columns: repeat(2, 1fr); } }
.cands { display: grid; gap: 1rem; }
.cand { display: grid; grid-template-columns: 1fr 120px; gap: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); }
.cand.flagged { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.cand.withdrawn { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.cand h3 { font-size: 1.3rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cand .rank { font-size: .78rem; font-weight: 700; color: var(--text-3); }
.cand .meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 .9rem; }
.badge { font-size: .74rem; font-weight: 600; padding: .22rem .6rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.cand p { color: var(--text-2); font-size: .96rem; }
.cand .flag { margin-top: .7rem; padding: .6rem .8rem; border-radius: 10px; background: var(--warn-soft); color: var(--text); font-size: .88rem; }
.cand.withdrawn .flag { background: var(--bad-soft); }
.cand .src { margin-top: .8rem; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .84rem; }
.ring { --p: 0; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ring > div { position: relative; text-align: center; line-height: 1.1; }
.ring b { font-size: 1.45rem; letter-spacing: -.03em; display: block; }
.ring small { font-size: .66rem; color: var(--text-3); display: block; max-width: 80px; margin: .15rem auto 0; }
.ring.na { background: var(--surface-2); }
.ring.done { background: conic-gradient(var(--ok) 100%, var(--surface-2) 0); }
.cand-side { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.cand-side .why { font-size: .72rem; color: var(--text-3); text-align: center; }
@media (max-width: 600px) { .cand { grid-template-columns: 1fr; } .cand-side { flex-direction: row; justify-content: flex-start; } .cand-side .why { text-align: left; } }
.answer-panel { border: 1px solid var(--accent); }
.answer-points { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.answer-points li { line-height: 1.45; }
.answer-points .btn { margin-left: .4rem; padding: .15rem .6rem; font-size: .78rem; }
.cand-group { margin-bottom: 1.6rem; }
.cand-group h4 { font-size: 1.1rem; margin: 0; }
.cand-group.avoid h4 { color: var(--danger, #e5484d); }
.cand-group details summary { cursor: pointer; font-weight: 600; margin-bottom: .8rem; }
.why-rank { margin: .55rem 0 0; font-size: .9rem; color: var(--text-2); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.6rem; }
.panel h3 { font-size: 1.1rem; margin-bottom: .8rem; }
.panel ul { padding-left: 1.2rem; color: var(--text-2); }
.panel li + li { margin-top: .35rem; }
.empty { padding: 2.5rem; text-align: center; color: var(--text-2); }
.skeleton { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Agent chat (Find Your Cure) ─────────────────────────────────────── */
.chat { margin-top: 2.2rem; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.chat-log { min-height: 220px; max-height: 620px; overflow-y: auto; padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.chat-log > * { min-width: 0; }
.msg { max-width: 88%; padding: .85rem 1.05rem; border-radius: 18px; line-height: 1.55; font-size: .97rem; overflow-wrap: anywhere; }
.msg p { margin: 0 0 .6rem; } .msg p:last-child { margin-bottom: 0; }
.msg ul { margin: 0 0 .6rem; padding-left: 1.2rem; }
.msg.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 6px; }
.msg.agent { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.error { border-color: var(--bad); background: var(--bad-soft); }
.msg-steps { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
.msg-steps .step { font-size: .74rem; padding: .2rem .55rem; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.msg-steps .step.bad { background: var(--bad-soft); color: var(--bad); }
.msg-meta { margin-top: .55rem; font-size: .76rem; color: var(--text-3); }
.msg-rate { margin-top: .45rem; font-size: .8rem; color: var(--text-2); display: flex; align-items: center; gap: .3rem; }
.msg-rate button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .1rem .5rem; cursor: pointer; }
.thinking { color: var(--text-2); }
.dots { display: inline-flex; gap: 3px; margin-left: 6px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-form { border-top: 1px solid var(--border); padding: .9rem; display: grid; gap: .7rem; background: var(--surface); }
.chat-form textarea { width: 100%; resize: vertical; min-height: 54px; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: .75rem .9rem; }
.chat-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chat-controls .btn { margin-left: auto; }
.toggle { display: inline-flex; align-items: center; gap: .4rem; font-size: .86rem; color: var(--text-2); cursor: pointer; }
.chat-note { text-align: center; padding: 0 1rem .9rem; margin: 0; }
@media (max-width: 640px) { .msg { max-width: 100%; } .chat-log { padding: 1rem; } }

/* ---------- Cura, the Master Disease Agent's pet, and the Obsidian second brain ---------- */
.plan-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.plan-head h3 { margin: 0; }
.plan-pet { width: 60px; height: 60px; flex: none; }
.plan-pet:empty { display: none; }
.cura-chat { margin-top: 2.2rem; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 2rem; align-items: start; }
.cura-chat .chat { margin-top: 0; }
.cura { position: sticky; top: 88px; text-align: center; }
.cura-pet .ags-stage { width: 240px; --ag-dot: #5eead4; --ag-aura: #5eead4; }
.cura-copy { margin-top: 1.2rem; }
.cura-copy h3 { font-size: 1.25rem; letter-spacing: -.02em; margin: 0 0 .4rem; }
.cura-copy p { margin: 0; }
.cura-brain { margin-top: 1rem; display: flex; align-items: center; justify-content: center; gap: .55rem; flex-wrap: wrap; font-size: .88rem; color: var(--text-2); }
.cura-brain .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.cura-brain .dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.msg.note { align-self: center; background: var(--warn-soft); color: var(--text-2); padding: .45rem .8rem; }
.msg-notes { margin-top: .7rem; font-size: .78rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.note-chip { padding: .15rem .55rem; border-radius: 999px; background: rgba(124, 58, 237, .12); color: #7c3aed; }
.msg-rate { flex-wrap: wrap; }
.msg-rate .rate { display: inline-flex; align-items: center; gap: .3rem; margin-left: auto; }
.msg-act { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: .15rem .65rem; font: inherit; font-size: .76rem; cursor: pointer; }
.msg-act:hover { color: var(--text); border-color: var(--border-strong); }
.brain-dlg { margin: auto; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 1.6rem; box-shadow: var(--shadow-lg); }
.brain-dlg::backdrop { background: rgba(5, 8, 15, .5); backdrop-filter: blur(4px); }
.brain-dlg h3 { margin: 0 2rem .5rem 0; font-size: 1.3rem; letter-spacing: -.02em; }
.brain-x { position: absolute; top: 1rem; right: 1rem; margin: 0; }
.brain-opt { border: 1px solid var(--border); border-radius: var(--r); padding: 1rem 1.1rem; margin-top: 1rem; background: var(--surface-2); }
.brain-opt h4 { margin: 0 0 .5rem; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.brain-opt ol { margin: 0 0 .8rem; padding-left: 1.2rem; color: var(--text-2); }
.brain-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .8rem; }
.brain-fields label { display: grid; gap: .3rem; color: var(--text-2); }
.brain-fields input { font: inherit; font-size: .92rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; min-width: 0; }
.brain-file { cursor: pointer; margin: .2rem .4rem 0 0; }
#brainMsg { margin: 1rem 0 0; min-height: 1.2em; }
#brainMsg.ok { color: var(--ok); } #brainMsg.bad { color: var(--bad); }
.brain-actions { display: flex; justify-content: space-between; margin-top: 1rem; }
@media (max-width: 900px) {
  /* The pet rides along at the top of the screen, beside a one-line intro, so it stays in view while you chat. */
  .cura-chat { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .cura { top: 64px; z-index: 5; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: .8rem; align-items: center; text-align: left;
          padding: .5rem .8rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--header-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .cura-pet .ags-stage { width: 96px; }
  .cura-pet .ags-ring, .cura-pet .ags-status { display: none; }
  .cura-copy { margin: 0; }
  .cura-copy h3 { font-size: 1rem; margin: 0; }
  .cura-copy p { display: none; }
  .cura-brain { justify-content: flex-start; margin-top: .3rem; font-size: .8rem; }
}
@media (max-width: 640px) { .brain-fields { grid-template-columns: 1fr; } }
.cura .ags-status { color: #fff; }


/* ── Cure tracker, symptom checker, world medicine ─────────────────────── */
.pbar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.pbar > span { position: absolute; inset: 0 auto 0 0; background: var(--grad); border-radius: 999px; transition: width .8s var(--ease); }
.pbar.seg { display: flex; gap: 2px; background: transparent; border: 0; height: 12px; }
.pbar.seg > i { position: relative; display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.pbar.seg > i > b { position: absolute; inset: 0 auto 0 0; background: var(--grad); }
.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.ct-card { display: flex; flex-direction: column; gap: .7rem; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.ct-card h3 { font-size: 1.08rem; margin: 0; }
.ct-num { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.ct-num small { font-size: .85rem; font-weight: 500; color: var(--text-3); margin-left: .35rem; letter-spacing: 0; }
.ct-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--text-2); }
.ct-ms { display: grid; grid-template-columns: 9.5rem 1fr 3.4rem; gap: .5rem .9rem; align-items: center; font-size: .9rem; margin: 1rem 0; }
.ct-ms .note { grid-column: 1 / -1; color: var(--text-2); font-size: .84rem; margin: -.2rem 0 .4rem; }
.ct-dlg { max-width: 720px; width: calc(100% - 32px); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 1.8rem; box-shadow: var(--shadow-lg); }
.ct-dlg::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(4px); }
.chip.on, .chip.on:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sx-pick { display: flex; flex-wrap: wrap; gap: .45rem; max-height: 340px; overflow: auto; padding: .2rem; }
.sx-pick .chip { font-size: .85rem; }
.triage { border-radius: var(--r-lg); padding: 1.2rem 1.4rem; border: 1px solid var(--border); background: var(--surface); margin-bottom: 1rem; }
.triage strong { display: block; font-size: 1.05rem; margin-bottom: .3rem; }
.triage.emergency { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.triage.urgent { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.triage.see_doctor { border-color: var(--accent); }
.triage ul { margin: .5rem 0 0 1.1rem; padding: 0; }
.sx-res { padding: 1.3rem 1.4rem; margin-bottom: .9rem; }
.sx-res header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.sx-res h3 { margin: 0; font-size: 1.12rem; }
.sx-res .pct { font-weight: 700; font-size: 1.3rem; }
.sx-res details { margin-top: .7rem; }
.sx-res summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.grade { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem; border-radius: 6px; font-weight: 700; font-size: .8rem; color: #fff; }
.grade.A { background: var(--ok); } .grade.B { background: var(--accent); } .grade.C { background: var(--warn); } .grade.X { background: var(--bad); }
.rm { border-top: 1px solid var(--border); padding: .8rem 0; }
.rm:first-child { border-top: 0; }
.rm h4 { margin: 0 0 .25rem; font-size: .98rem; }
.rm .warn-list { color: var(--bad); font-size: .85rem; margin: .35rem 0 0 1rem; padding: 0; }
.rm .use { font-size: .88rem; margin: .3rem 0; display: flex; gap: .55rem; align-items: flex-start; }
@media (max-width: 640px) { .ct-ms { grid-template-columns: 7rem 1fr 3rem; } }

/* Clickable medicine: drug and disease names open their own page (site/assets/medlinks.js). */
a.medlink { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-decoration-thickness: 1.5px;
  text-underline-offset: 3px; text-decoration-color: var(--accent, currentColor); font-weight: 600; }
a.medlink:hover, a.medlink:focus-visible { text-decoration-style: solid; color: var(--accent, inherit); }
.msg.user a.medlink { color: #fff; }
.cand h3 a.medlink { text-decoration-thickness: 2px; }
.cand .src a.cand-more { font-weight: 600; }
.free-note { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--text-2); }
.free-note b { color: var(--ok, inherit); }
.home-agent { margin-top: clamp(2rem, 5vw, 3rem); text-align: left; }
.home-agent .cura-chat { max-width: 1040px; margin: 0 auto; }
