/* =========================================================================
   AskRads — "The Reading Room"
   Editorial clinical archive · radiograph lightbox aesthetic
   Type: Fraunces (display serif) + IBM Plex Sans + IBM Plex Mono
   ========================================================================= */

:root {
  /* ===== Brand palette ===== */
  /* Deep clinical ink (used in light theme) */
  --ink-900: #0e1424;
  --ink-800: #161d33;
  --ink-700: #1d2541;
  --ink-600: #303a5c;
  --ink-500: #4a557a;
  --ink-400: #6a7596;

  /* Lightbox cyan — the luminous "unread X-ray on a viewbox" */
  --lume-50:  #eafaff;
  --lume-100: #c8f0ff;
  --lume-200: #92e1ff;
  --lume-300: #57cdff;
  --lume-400: #2eb6f6;
  --lume-500: #119edd;
  --lume-600: #007fb8;
  --lume-700: #00658f;

  /* Amber warm light source */
  --amber-100: #fde9c4;
  --amber-300: #f7c46c;
  --amber-500: #d8932c;
  --amber-700: #93611c;

  /* Bone / parchment / cream archive */
  --bone-50:  #fbf8f1;
  --bone-100: #f5efe2;
  --bone-200: #ebe2cc;
  --bone-300: #d9cdaa;

  /* Carbon / blue-black reading room */
  --carbon-950: #050811;
  --carbon-900: #0a101e;
  --carbon-850: #0f1626;
  --carbon-800: #131c33;
  --carbon-700: #1c2742;
  --carbon-600: #2a3656;

  --red-500:   #e5484d;
  --green-500: #30a46c;

  /* AskRads brand palette (logo / lockup). Hex fallback + modern oklch — second
     declaration wins in browsers that understand it (Safari 15.4+, Chrome 111+,
     Firefox 113+). Older browsers silently fall back to the hex. */
  --brand-purple: #2c1b5e;
  --brand-purple: oklch(0.32 0.13 295);
  --brand-green:  #2e8b5c;
  --brand-green:  oklch(0.55 0.14 152);
  --brand-ink:    #1a1721;
  --brand-muted:  rgba(26, 23, 33, 0.55);

  /* ===== Light theme (default) — Archive ===== */
  --bg:               var(--bone-50);
  --bg-subtle:        var(--bone-100);
  --bg-muted:         var(--bone-200);
  --bg-elevated:      #ffffff;
  --surface:          #ffffff;
  --surface-2:        var(--bone-50);
  --border:           #e6dec3;
  --border-strong:    #d3c79f;
  --text:             var(--ink-900);
  --text-muted:       var(--ink-500);
  --text-subtle:      var(--ink-400);
  --accent:           var(--ink-900);          /* dominant ink */
  --accent-hover:     var(--ink-700);
  --accent-fg:        var(--bone-50);
  --accent-soft:      rgba(14, 20, 36, 0.06);
  --highlight:        var(--amber-500);         /* warm lightbox accent */
  --highlight-soft:   var(--amber-100);
  --ring:             rgba(216, 147, 44, 0.4);

  --grid-color:       rgba(14, 20, 36, 0.045);
  --glow-color:       rgba(216, 147, 44, 0.18);

  --shadow-sm: 0 1px 0 rgba(14, 20, 36, 0.04), 0 1px 2px rgba(14, 20, 36, 0.06);
  --shadow-md: 0 4px 16px rgba(14, 20, 36, 0.06), 0 2px 4px rgba(14, 20, 36, 0.04);
  --shadow-lg: 0 30px 60px -20px rgba(14, 20, 36, 0.18), 0 8px 20px rgba(14, 20, 36, 0.06);

  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 22px;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans:    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --container: 1240px;
  --container-narrow: 880px;

  --header-h: 68px;
  --tx: 220ms cubic-bezier(0.22, 1, 0.36, 1);
  --tx-slow: 480ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  /* ===== Dark theme — Reading Room ===== */
  --bg:               var(--carbon-900);
  --bg-subtle:        var(--carbon-850);
  --bg-muted:         var(--carbon-800);
  --bg-elevated:      var(--carbon-800);
  --surface:          var(--carbon-800);
  --surface-2:        var(--carbon-850);
  --border:           rgba(180, 210, 255, 0.07);
  --border-strong:    rgba(180, 210, 255, 0.14);
  --text:             #e7eefb;
  --text-muted:       #9aa8c4;
  --text-subtle:      #6e7c98;
  --accent:           var(--lume-300);          /* luminous cyan */
  --accent-hover:     var(--lume-200);
  --accent-fg:        var(--carbon-950);
  --accent-soft:      rgba(87, 205, 255, 0.10);
  --highlight:        var(--amber-300);
  --highlight-soft:   rgba(247, 196, 108, 0.10);
  --ring:             rgba(87, 205, 255, 0.4);

  --grid-color:       rgba(140, 200, 255, 0.05);
  --glow-color:       rgba(87, 205, 255, 0.22);

  /* Brand colors — v3 inverted wordmark spec (white "ask", bright green "rads") */
  --brand-purple: #ffffff;
  --brand-green:  #42c070;
  --brand-green:  oklch(0.72 0.16 152);
  --brand-muted:  rgba(243, 241, 236, 0.6);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.55), 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7), 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* ===== Reset / base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02", "cv11";
  overflow-x: hidden;
}

/* Atmospheric body background: faint diagnostic grid + radial light source */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% -10%, var(--glow-color), transparent 70%);
}
main, header, footer { position: relative; z-index: 1; }

img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; transition: var(--tx); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--highlight); outline-offset: 3px; border-radius: 4px; }

/* ===== Typography ===== */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 0.4em;
  color: var(--text);
  font-feature-settings: "ss01", "ss02";
}
h1 {
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  letter-spacing: -0.04em;
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 96;
}
h2 {
  font-size: clamp(1.75rem, 3.8vw, 2.75rem);
  letter-spacing: -0.025em;
  font-variation-settings: "SOFT" 30, "opsz" 48;
}
h3 { font-size: 1.4rem; font-variation-settings: "opsz" 30; letter-spacing: -0.015em; }
h4 { font-size: 1.1rem; font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.01em; }
h5 { font-family: var(--font-sans); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--text-subtle); }
p  { margin: 0 0 1em; color: var(--text-muted); }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin: 0.2em 0; color: var(--text-muted); }
code, kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text);
  letter-spacing: 0;
}
strong, b { font-weight: 600; color: var(--text); }
em { font-style: italic; }

.display-serif { font-family: var(--font-display); font-feature-settings: "ss01"; }
.mono { font-family: var(--font-mono); }

/* ===== Eyebrow / tag labels ===== */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-subtle);
  margin-bottom: 18px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

/* ===== Layout ===== */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 32px; }
.container.narrow { max-width: var(--container-narrow); }
@media (max-width: 640px) { .container { padding: 0 20px; } }

main { min-height: calc(100vh - var(--header-h) - 280px); }

section { padding: 96px 0; }
@media (max-width: 700px) { section { padding: 64px 0; } }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /* Extend the header up under the device's status-bar safe area so the
     header background (and not the page content beneath) sits behind the
     phone's system icons. Without this the WebView paints from y=0 and the
     theme/menu buttons end up under the system clock/battery. */
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

/* Professional-use disclaimer banner shown directly under the header on every
   page. Liability protection + sets clinician expectations before they read
   any imaging recommendation. */
.prof-banner {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.prof-banner .container {
  padding: 9px 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.prof-banner strong { color: var(--text); font-weight: 600; }
.prof-banner a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  margin-left: auto;
  white-space: nowrap;
  padding-bottom: 1px;
}
.prof-banner a:hover { border-bottom-color: var(--text); }
@media (max-width: 640px) {
  .prof-banner a { margin-left: 0; }
}
.site-header .container {
  /* Pin the inner content to the var(--header-h) region BELOW the
     safe-area padding on the parent. Using 100% would stretch the flex
     box across the safe-area region too, pulling the wordmark and
     buttons back under the device's system bar. */
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand:hover .brand-lockup { letter-spacing: -0.035em; }

/* Wordmark v3 — "ask × rads" live HTML lockup.
   Inter Tight 700 for "ask"/"rads", 300 for the multiplication sign.
   Colors transition naturally via `color` when [data-theme] flips. */
.brand-lockup {
  font-family: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
  line-height: 0.95;
  display: inline-flex;
  align-items: baseline;
  transition: letter-spacing var(--tx);
}
.brand-lockup .ask  { color: var(--brand-purple); transition: color 320ms ease; }
.brand-lockup .rads { color: var(--brand-green);  transition: color 320ms ease; }
.brand-lockup .x {
  color: var(--brand-muted);
  font-weight: 300;
  padding: 0 0.06em;
  font-size: 0.69em;
  transform: translateY(-0.06em);
  display: inline-block;
  transition: color 320ms ease;
}

.site-footer .brand-lockup { font-size: 1.6rem; }
@media (max-width: 640px) {
  .brand-lockup { font-size: 1.3rem; }
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  transition: var(--tx);
  position: relative;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--highlight);
  border-radius: 1px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  /* Scope the transition to non-color properties. Chromium has an interop
     glitch where `transition: all` on a dynamically-inserted element whose
     `color: var(--x)` references a custom property that changed during the
     same tick leaves the computed color stuck on the pre-change value, even
     after the transition window elapses. That breaks the header buttons when
     the theme is set before renderHeader() inserts them. */
  transition: background-color var(--tx), border-color var(--tx);
}
.icon-btn:hover { background: var(--bg-muted); border-color: var(--border-strong); }
/* Stop SVG children from swallowing taps on touch devices — the click event
   should always land on the button, not a nested <line> or <path>. */
.icon-btn > * { pointer-events: none; }

.mobile-toggle { display: none; }
@media (max-width: 940px) {
  .nav { display: none; }
  .mobile-toggle { display: grid; }
  .nav.open {
    display: flex;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 22px 22px;
    gap: 0;
    box-shadow: var(--shadow-md);
  }
  .nav.open a { padding: 14px 12px; font-size: 1rem; border-radius: 6px; }
  .nav.open a.active::after { display: none; }
  .nav.open a.active { background: var(--bg-muted); }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: var(--tx);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, var(--shadow-md);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-fg); transform: translateY(-1px); }
.btn-primary .arrow { transition: var(--tx); }
.btn-primary:hover .arrow { transform: translateX(3px); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-muted); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }
.btn svg { width: 16px; height: 16px; }
.btn-lg { padding: 16px 28px; font-size: 1rem; }

/* ===== Search input ===== */
.search-box {
  position: relative;
  width: 100%;
}
.search-box input {
  width: 100%;
  height: 60px;
  padding: 0 64px 0 56px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.02rem;
  box-shadow: var(--shadow-sm);
  transition: var(--tx);
}
.search-box input::placeholder { color: var(--text-subtle); font-style: italic; font-family: var(--font-display); font-weight: 400; }
.search-box input:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 6px var(--ring), var(--shadow-md);
}
.search-box .search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-subtle);
  pointer-events: none;
}
.search-box .search-kbd {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-subtle);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.1em;
}

/* ===== Brand mark (the radiograph reticle) ===== */
/* ===== Cards & feature blocks ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: var(--tx);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--glow-color), transparent 50%);
  opacity: 0;
  transition: var(--tx);
  pointer-events: none;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.card:hover::before { opacity: 1; }
.card .card-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  letter-spacing: 0.1em;
  margin-bottom: 24px;
  display: block;
}
.card h3 { margin-bottom: 8px; }
.card p { font-size: 0.97rem; margin: 0; line-height: 1.55; }
.card-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.card-arrow svg { transition: var(--tx); }
.card:hover .card-arrow { color: var(--highlight); }
.card:hover .card-arrow svg { transform: translateX(4px); }

.grid { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.grid > .card { border-radius: 0; border: none; background: var(--surface); }
.grid > .card:hover { background: var(--surface); transform: none; box-shadow: inset 0 0 0 9999px var(--accent-soft); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.plain { display: grid; background: transparent; border: none; gap: 24px; }
.grid.plain > .card { border-radius: var(--radius-lg); border: 1px solid var(--border); }
.grid.plain > .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===== Hero (editorial / asymmetric) ===== */
.hero {
  position: relative;
  padding: 80px 0 80px;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
}
.hero h1 {
  margin-bottom: 24px;
}
.hero h1 .accent-word {
  font-style: italic;
  color: var(--highlight);
  font-variation-settings: "SOFT" 80, "WONK" 1, "opsz" 96;
}
.hero h1 .strike {
  position: relative;
  display: inline-block;
}
.hero h1 .strike::after {
  content: "";
  position: absolute;
  left: -4px; right: -4px;
  top: 52%;
  height: 4px;
  background: var(--highlight);
  transform: rotate(-2deg);
  border-radius: 1px;
}
.hero .lead {
  font-size: clamp(1.1rem, 1.4vw, 1.25rem);
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 0 36px;
  line-height: 1.55;
}
.hero .search-box { max-width: 560px; margin-bottom: 18px; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero-meta a {
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 1px;
}
.hero-meta a:hover { color: var(--highlight); border-color: var(--highlight); }
.hero-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle); }

/* The "sample card" preview on the right of hero — looks like a result */
.hero-preview {
  position: relative;
  padding: 4px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(140deg, var(--highlight-soft), transparent 60%),
    linear-gradient(320deg, var(--accent-soft), transparent 60%);
}
.hero-preview-inner {
  background: var(--surface);
  border-radius: calc(var(--radius-xl) - 4px);
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}
.hero-preview .preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-subtle);
}
.hero-preview .preview-meta .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-preview .preview-meta .live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 8px var(--green-500);
}
.hero-preview h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 6px;
  font-variation-settings: "SOFT" 30, "opsz" 30;
}
.hero-preview .study {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text);
  margin: 14px 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-preview .study .pill-modality {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--ink-900);
  color: var(--bone-50);
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.1em;
}
[data-theme="dark"] .hero-preview .study .pill-modality {
  background: var(--lume-300);
  color: var(--carbon-950);
}
.hero-preview p {
  font-size: 0.93rem;
  color: var(--text-muted);
  margin: 10px 0 16px;
  line-height: 1.55;
}
.hero-preview .preview-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-ink     { background: var(--ink-900); color: var(--bone-50); border-color: transparent; }
[data-theme="dark"] .badge-ink { background: var(--lume-300); color: var(--carbon-950); }
.badge-warm    { background: var(--highlight-soft); color: var(--amber-700); border-color: transparent; }
[data-theme="dark"] .badge-warm { background: rgba(247,196,108,0.16); color: var(--amber-300); }
.badge-cool    { background: var(--lume-50); color: var(--lume-700); border-color: transparent; }
[data-theme="dark"] .badge-cool { background: rgba(87,205,255,0.12); color: var(--lume-200); }
.badge-green   { background: rgba(48,164,108,0.12); color: var(--green-500); border-color: transparent; }
.badge-red     { background: rgba(229,72,77,0.12);  color: var(--red-500);   border-color: transparent; }

/* Modality tags use family colors */
.badge-CT  { background: var(--lume-50);  color: var(--lume-700);  border-color: transparent; }
.badge-MRI { background: var(--highlight-soft); color: var(--amber-700); border-color: transparent; }
.badge-US  { background: rgba(48,164,108,0.14); color: var(--green-500); border-color: transparent; }
.badge-XR  { background: var(--bg-muted); color: var(--text-muted); }
.badge-MG  { background: rgba(229,72,77,0.12); color: var(--red-500); border-color: transparent; }
[data-theme="dark"] .badge-CT  { background: rgba(87,205,255,0.15); color: var(--lume-200); }
[data-theme="dark"] .badge-MRI { background: rgba(247,196,108,0.15); color: var(--amber-300); }
[data-theme="dark"] .badge-US  { background: rgba(48,164,108,0.18); color: #6ddca2; }

/* ===== Filter pill row ===== */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--tx);
}
.pill:hover { color: var(--text); background: var(--bg-muted); }
.pill.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* ===== Callouts ===== */
.callout {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 20px 22px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  font-size: 0.95rem;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}
.callout::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--text-subtle);
}
.callout .callout-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}
.callout strong { color: var(--text); display: block; margin-bottom: 4px; font-family: var(--font-display); font-size: 1.05rem; font-weight: 400; }
.callout-warning { background: var(--highlight-soft); border-color: transparent; }
.callout-warning::before { background: var(--highlight); }
.callout-warning .callout-icon { color: var(--highlight); }
.callout-warning strong { color: var(--amber-700); }
[data-theme="dark"] .callout-warning strong { color: var(--amber-300); }
.callout-danger { background: rgba(229,72,77,0.08); border-color: transparent; }
.callout-danger::before { background: var(--red-500); }
.callout-danger .callout-icon { color: var(--red-500); }

/* ===== Tables ===== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
table.data th, table.data td {
  padding: 16px 22px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  background: var(--bg-subtle);
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg-subtle); }
table.data code { font-size: 0.85em; background: transparent; border: none; padding: 0; color: var(--text); font-weight: 500; }

/* ===== Footer ===== */
.site-footer {
  margin-top: 120px;
  border-top: 1px solid var(--border);
  background:
    linear-gradient(180deg, transparent, var(--bg-subtle) 40%);
  padding: 64px 0 36px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 56px;
  margin-bottom: 48px;
}
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h5 { margin-bottom: 16px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: 8px 0; }
.footer-grid a { color: var(--text-muted); font-size: 0.93rem; }
.footer-grid a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-subtle);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ===== Page-specific layouts ===== */
.page-header {
  padding: 72px 0 48px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.page-header h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); margin: 0 0 18px; }
.page-header p { font-size: 1.1rem; max-width: 680px; margin: 0; }

.two-col {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 64px;
  padding: 56px 0;
}
@media (max-width: 940px) { .two-col { grid-template-columns: 1fr; gap: 32px; } }
.sidebar { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }
.sidebar h5 { margin-bottom: 14px; }
.sidebar ul { list-style: none; padding: 0; margin: 0 0 28px; }
.sidebar li { margin: 0; }
.sidebar a {
  display: block;
  padding: 10px 14px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.94rem;
  border-left: 2px solid transparent;
  transition: var(--tx);
}
.sidebar a:hover { background: var(--bg-muted); color: var(--text); }
.sidebar a.active {
  color: var(--text);
  background: var(--bg-muted);
  border-left-color: var(--highlight);
}

/* ===== Indication entries ===== */
.indication-list { display: grid; gap: 14px; }
.indication {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  transition: var(--tx);
  position: relative;
}
.indication:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.indication-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.indication-head h3 {
  margin: 0;
  font-size: 1.3rem;
  font-variation-settings: "SOFT" 30, "opsz" 24;
}
.indication-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.indication .study {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.indication .study .modality {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--ink-900);
  color: var(--bone-50);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
[data-theme="dark"] .indication .study .modality { background: var(--lume-300); color: var(--carbon-950); }
.indication .notes { font-size: 0.94rem; color: var(--text-muted); margin: 12px 0 0; line-height: 1.6; }

/* ===== Q&A accordion ===== */
.qa { border-top: 1px solid var(--border); }
.qa details {
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
}
.qa summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.18rem;
  font-variation-settings: "SOFT" 30, "opsz" 24;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  letter-spacing: -0.01em;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: "";
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-muted);
  background-image:
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor);
  background-size: 12px 1.5px, 1.5px 12px;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--text-muted);
  transition: var(--tx);
}
.qa details[open] summary::after {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 12px 1.5px;
  background-color: var(--highlight);
  color: var(--accent-fg);
}
.qa details > div { padding-top: 14px; max-width: 760px; }
.qa details p:last-child { margin-bottom: 0; }
.qa summary .badge { font-family: var(--font-mono); margin-left: auto; margin-right: 12px; }

/* ===== Stats strip ===== */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat {
  background: var(--surface);
  padding: 36px 24px;
  text-align: left;
}
.stat .stat-num {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 4vw, 3.75rem);
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.04em;
  margin-bottom: 6px;
  font-variation-settings: "SOFT" 30, "opsz" 96;
}
.stat .stat-num em {
  color: var(--highlight);
  font-style: italic;
  font-variation-settings: "SOFT" 80, "WONK" 1, "opsz" 96;
}
.stat .stat-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-subtle);
}
@media (max-width: 700px) { .stat-strip { grid-template-columns: 1fr; } }

/* ===== Numbered features (replaces card grid) ===== */
.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.feature-row .feature {
  background: var(--bg);
  padding: 40px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--tx);
  text-decoration: none;
}
.feature-row .feature:hover { background: var(--surface); }
.feature .feature-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--highlight);
}
.feature h3 {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 30, "opsz" 30;
  font-size: 1.5rem;
}
.feature p { font-size: 0.94rem; color: var(--text-muted); margin: 0; }
.feature .feature-cta {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--tx);
}
.feature:hover .feature-cta { color: var(--highlight); }
.feature:hover .feature-cta svg { transform: translateX(4px); }
.feature .feature-cta svg { transition: var(--tx); }
@media (max-width: 940px) { .feature-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .feature-row { grid-template-columns: 1fr; } }

/* ===== Editorial divider ===== */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 48px 0;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* ===== Page-load entrance animation (staggered reveal) ===== */
@keyframes rc-fade-up {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
.reveal {
  opacity: 0;
  animation: rc-fade-up 480ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.reveal[data-delay="0"]   { animation-delay: 0ms;   }
.reveal[data-delay="1"]   { animation-delay: 80ms;  }
.reveal[data-delay="2"]   { animation-delay: 160ms; }
.reveal[data-delay="3"]   { animation-delay: 240ms; }
.reveal[data-delay="4"]   { animation-delay: 320ms; }
.reveal[data-delay="5"]   { animation-delay: 400ms; }
.reveal[data-delay="6"]   { animation-delay: 480ms; }

/* Hover lift for any element */
.lift { transition: var(--tx); }
.lift:hover { transform: translateY(-2px); }

/* ===== Utility ===== */
.text-muted   { color: var(--text-muted); }
.text-subtle  { color: var(--text-subtle); }
.text-center  { text-align: center; }
.italic       { font-style: italic; }
.serif        { font-family: var(--font-display); font-feature-settings: "ss01"; }
.mono-tag     { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-subtle); }
.mt-0  { margin-top: 0; }
.mt-2  { margin-top: 8px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 36px; }
.mt-12 { margin-top: 56px; }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.mb-8  { margin-bottom: 36px; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus { top: 8px; color: var(--accent-fg); }

/* =========================================================================
   PHASE 2 — Search-first home & rich answer cards
   ========================================================================= */

/* ===== Massive hero search ===== */
.search-hero {
  padding: 100px 0 60px;
  text-align: center;
  position: relative;
}
.search-hero .eyebrow { justify-content: center; }
.search-hero .eyebrow::after {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}
.search-hero h1 {
  font-size: clamp(2.5rem, 5.5vw, 4.5rem);
  line-height: 1.05;
  max-width: 820px;
  margin: 0 auto 24px;
  letter-spacing: -0.035em;
}
.search-hero h1 em {
  font-style: italic;
  color: var(--highlight);
  font-variation-settings: "SOFT" 80, "WONK" 1, "opsz" 96;
}
.search-hero .lead {
  font-size: clamp(1.05rem, 1.3vw, 1.18rem);
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 44px;
  line-height: 1.6;
}

.search-jumbo {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}
.search-jumbo input {
  width: 100%;
  height: 76px;
  padding: 0 200px 0 64px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  box-shadow: var(--shadow-md);
  transition: var(--tx);
}
.search-jumbo input::placeholder {
  color: var(--text-subtle);
  font-style: italic;
  font-family: var(--font-display);
  font-weight: 400;
}
.search-jumbo input:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 8px var(--ring), var(--shadow-lg);
}
.search-jumbo .search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  color: var(--text-subtle);
  pointer-events: none;
}
.search-jumbo .search-go {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 60px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: var(--tx);
}
.search-jumbo .search-go:hover { background: var(--accent-hover); transform: translateY(-50%) translateX(-2px); }
.search-jumbo .search-go svg { transition: var(--tx); }
.search-jumbo .search-go:hover svg { transform: translateX(2px); }
.search-jumbo .search-kbd {
  position: absolute;
  right: 24px;
  bottom: -28px;
  font-size: 0.7rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}
@media (max-width: 640px) {
  .search-jumbo input { height: 64px; padding: 0 64px 0 56px; font-size: 1rem; }
  .search-jumbo .search-icon { left: 22px; width: 18px; height: 18px; }
  .search-jumbo .search-go { display: none; }
}

.try-row {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.try-row a {
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 1px;
}
.try-row a:hover { color: var(--highlight); border-color: var(--highlight); }
.try-row .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle); display: inline-block; }

/* ===== Browse switcher (segmented + dynamic pills) ===== */
.browse {
  padding: 24px 0 80px;
}
.browse-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.browse-head h2 {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  margin: 0;
}
.segmented {
  display: inline-flex;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.segmented button {
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.86rem;
  color: var(--text-muted);
  transition: var(--tx);
  cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.browse-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ===== Recent searches (file-card stack) ===== */
.recent {
  padding: 0 0 80px;
}
.recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.recent-head h2 {
  font-size: 1.5rem;
  margin: 0;
  font-variation-settings: "SOFT" 30, "opsz" 30;
}
.recent-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.recent-meta button {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  text-transform: uppercase;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 1px;
}
.recent-meta button:hover { color: var(--highlight); border-color: var(--highlight); }

.recent-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.recent-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  transition: var(--tx);
  position: relative;
}
.recent-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px) rotate(-0.4deg);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.recent-card .recent-when {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.recent-card .recent-q {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variation-settings: "SOFT" 30, "opsz" 24;
}
.recent-card .recent-result {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recent-card .recent-result svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--highlight);
}
.recent-empty {
  padding: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-subtle);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1rem;
}

/* Tiny privacy footnote */
.privacy-note {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 14px;
}

/* ===== Appropriateness chip ===== */
.appro {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.appro::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px currentColor, 0 0 8px currentColor;
}
.appro-preferred     { color: var(--green-500); background: rgba(48,164,108,0.10); }
.appro-acceptable    { color: var(--amber-500); background: var(--highlight-soft); }
[data-theme="dark"] .appro-acceptable { color: var(--amber-300); background: rgba(247,196,108,0.12); }
.appro-not-preferred { color: var(--red-500);   background: rgba(229,72,77,0.12); }

/* ===== Expanded answer card (within indication entry) ===== */
.indication.expanded {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.indication-body {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 14px;
  display: grid;
  gap: 14px;
}
.answer-block { display: flex; flex-direction: column; gap: 6px; }
.answer-block .answer-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-subtle);
}
.answer-block .answer-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-variation-settings: "SOFT" 30, "opsz" 24;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

.alt-list { display: grid; gap: 0; }
.alt-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
  align-items: baseline;
}
.alt-row:first-child { border-top: none; padding-top: 0; }
.alt-row .alt-when {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.alt-row .alt-study {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: var(--text);
}
.alt-row .alt-study .modality {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--ink-900);
  color: var(--bone-50);
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
[data-theme="dark"] .alt-row .alt-study .modality { background: var(--lume-300); color: var(--carbon-950); }
@media (max-width: 640px) {
  .alt-row { grid-template-columns: 1fr; gap: 6px; }
}

.watch-list { display: grid; gap: 6px; }
.watch-row {
  padding: 10px 14px;
  border: 1px solid rgba(229,72,77,0.25);
  background: rgba(229,72,77,0.05);
  border-radius: var(--radius);
  border-left-width: 3px;
}
.watch-row strong {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
  margin-bottom: 2px;
}
.watch-row p { margin: 0; font-size: 0.91rem; color: var(--text-muted); }

.pearl-list { display: grid; gap: 6px; padding-left: 0; list-style: none; }
.pearl-list li {
  position: relative;
  padding-left: 20px;
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.pearl-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--highlight);
  border-radius: 50%;
}

.entry-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
}
.entry-footer .review-info { display: inline-flex; align-items: center; gap: 6px; }
.entry-footer .review-info::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 6px var(--green-500);
}

/* "Reviewed YYYY-MM" pill shown on cards and search results.
   Signals content freshness to clinicians and makes tampering visible. */
.reviewed-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(48,164,108,0.08);
  color: var(--green-500);
  border: 1px solid rgba(48,164,108,0.25);
}
.reviewed-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green-500);
}

/* ===== Cross-link strip (small editorial nav from home) ===== */
.crosslink-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 80px 0 0;
}
.crosslink-strip .cl {
  background: var(--bg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: var(--tx);
  color: var(--text);
}
.crosslink-strip .cl:hover { background: var(--surface); color: var(--text); }
.crosslink-strip .cl .cl-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--highlight);
}
.crosslink-strip .cl h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3rem;
  font-variation-settings: "SOFT" 30, "opsz" 30;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}
.crosslink-strip .cl p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}
@media (max-width: 940px) { .crosslink-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .crosslink-strip { grid-template-columns: 1fr; } }

/* ===== Indication clickable affordance ===== */
.indication {
  cursor: pointer;
}
.indication-toggle {
  position: absolute;
  right: 20px;
  top: 22px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: var(--tx);
  pointer-events: none;
}
.indication:hover .indication-toggle { color: var(--text); border-color: var(--border-strong); }
.indication.expanded .indication-toggle {
  background: var(--highlight);
  color: var(--accent-fg);
  border-color: transparent;
  transform: rotate(45deg);
}
.indication-toggle svg { width: 14px; height: 14px; transition: var(--tx); }
.indication.expanded .indication-toggle svg { transform: rotate(-45deg); }

.indication[data-empty="true"] .indication-toggle { display: none; }
.indication[data-empty="true"] { cursor: default; }

/* =========================================================================
   PHASE 3 — Minimal post-search view
   When ?q= is active, strip the page chrome and surface a single focused
   recommendation. Other matches show as a compact list.
   ========================================================================= */

body.searching .page-header { display: none; }
body.searching .pill-row     { display: none; }
body.searching [data-guide-count] { display: none; }

/* Tighten the search input so it doesn't dominate after results land */
body.searching .search-box {
  max-width: 560px;
}
body.searching .search-box input {
  height: 48px;
  padding: 0 56px 0 48px;
  font-size: 0.95rem;
  border-radius: 999px;
}
body.searching .search-box .search-icon { left: 18px; width: 16px; height: 16px; }
body.searching .search-box .search-kbd { display: none; }

/* The minimal result view container */
.result-view {
  display: grid;
  gap: 14px;
}

.result-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 0;
  flex-wrap: wrap;
}
.result-view-head .result-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.result-view-head .result-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}
.result-view-head .result-eyebrow .query {
  color: var(--text);
  text-transform: none;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 30;
}
.result-view-head .result-clear {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: var(--tx);
  text-decoration: none;
}
.result-view-head .result-clear:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-muted);
}

/* The single dominant primary result */
.result-primary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.result-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--glow-color), transparent 55%);
  opacity: 0.7;
  pointer-events: none;
}
.result-primary > * { position: relative; }
@media (max-width: 640px) {
  .result-primary { padding: 18px 18px; }
}

.result-primary .result-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.result-primary h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 0 0 2px;
  font-variation-settings: "SOFT" 30, "opsz" 48;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.result-primary .result-presentation {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 12px;
  font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 24;
}

.result-primary .result-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 12px;
}
.result-primary .result-meta-row .modality {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--ink-900);
  color: var(--bone-50);
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}
[data-theme="dark"] .result-primary .result-meta-row .modality {
  background: var(--lume-300);
  color: var(--carbon-950);
}
.result-primary .result-notes {
  font-size: 0.96rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 12px;
}

/* Reuse answer-block etc. inside .result-primary */
.result-primary .indication-body {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
.result-primary .entry-footer { margin-top: 12px; }

/* Other matches list */
.result-others {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.result-others h3 {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-subtle);
  margin: 0 0 8px;
  font-weight: 500;
  font-variation-settings: normal;
}
.result-others-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0;
}
.result-others-list li { margin: 0; }
.result-others-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--border);
  color: var(--text);
  transition: var(--tx);
}
.result-others-list a:hover {
  color: var(--text);
  padding-left: 12px;
  background: var(--bg-subtle);
}
.result-others-list a:last-child { border-bottom: none; }
.result-others-list .other-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  font-variation-settings: "SOFT" 30, "opsz" 24;
  letter-spacing: -0.01em;
}
.result-others-list .other-study {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.result-others-list .other-study .modality {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: var(--bg-muted);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.14em;
}
@media (max-width: 640px) {
  .result-others-list a {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* Empty result state */
.result-empty {
  padding: 28px 20px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.result-empty .result-empty-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 4px;
  font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 36;
}
.result-empty p { margin: 0; }

/* =========================================================================
   PHASE 4 — Search autocomplete dropdown + inline result rendering on home
   ========================================================================= */

/* Ensure search wrapper outranks sibling .reveal stacks (which have transform
   from the keyframe, creating their own stacking contexts). */
.search-hero .reveal { position: relative; }
.search-hero .reveal:has(.search-jumbo) { z-index: 40; }
.search-hero .try-row { position: relative; z-index: 1; }

/* Dropdown anchored to .search-jumbo */
.search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 10px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 460px;
  overflow-y: auto;
  z-index: 60;
  display: none;
  text-align: left;
  padding: 6px;
}
.search-dropdown.open { display: block; }

.search-dropdown .dropdown-section-label {
  padding: 10px 14px 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background 100ms ease;
  font-family: inherit;
}
.dropdown-item + .dropdown-item { margin-top: 0; }
.dropdown-item:hover,
.dropdown-item.active {
  background: var(--bg-subtle);
  outline: none;
}
.dropdown-item .dropdown-item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
}
.dropdown-item .dropdown-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.96rem;
  color: var(--text);
  line-height: 1.4;
}
.dropdown-item .dropdown-study {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}
.dropdown-item .dropdown-study .modality {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  background: var(--ink-900);
  color: var(--bone-50);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.14em;
}
[data-theme="dark"] .dropdown-item .dropdown-study .modality {
  background: var(--lume-300);
  color: var(--carbon-950);
}
.dropdown-item .dropdown-tags {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-subtle);
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .dropdown-item .dropdown-item-row { grid-template-columns: 1fr; gap: 4px; }
  .dropdown-item .dropdown-study { justify-self: start; }
}

.dropdown-empty {
  padding: 24px 18px 22px;
  text-align: center;
  color: var(--text-muted);
}
.dropdown-empty .dropdown-empty-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 6px;
  font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 24;
}
.dropdown-empty .dropdown-empty-tip {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.dropdown-empty .dropdown-empty-tip a {
  font-weight: 500;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
}

.dropdown-clear {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
}
.dropdown-clear:hover { color: var(--highlight); background: var(--bg-subtle); }

/* ===== Inline result on home ===== */
.home-result {
  padding: 0;
  display: none;
}
.home-result .container {
  padding: 16px 32px 32px;
}
@media (max-width: 640px) { .home-result .container { padding: 12px 20px 28px; } }

/* When searching, on home: hide hero text, browse, recent; show result */
body[data-page="index"].searching .search-hero .eyebrow,
body[data-page="index"].searching .search-hero h1,
body[data-page="index"].searching .search-hero .lead,
body[data-page="index"].searching .search-hero .try-row,
body[data-page="index"].searching .home-browse,
body[data-page="index"].searching .home-recent {
  display: none;
}
body[data-page="index"].searching .search-hero {
  padding: 56px 0 24px;
}
body[data-page="index"].searching .home-result {
  display: block;
}

/* Tighten the jumbo search a touch when result is showing */
body[data-page="index"].searching .search-jumbo input {
  height: 64px;
}
body[data-page="index"].searching .search-jumbo .search-go { height: 50px; }
body[data-page="index"].searching .search-jumbo .search-kbd { display: none; }

