/* A Living Century of Antibiotics — design system (docs/08-design-system.md + approved renders) */

:root {
  --ink: #153d42;
  --teal-900: #00565a;
  --teal-800: #0b686b;
  --teal-700: #17777a;
  --teal-400: #6ea7a5;
  --teal-100: #d7e6e3;
  --coral-500: #ef8065;
  --coral-600: #d96448;
  --coral-200: #f5c1ae;
  --coral-100: #fbe4d8;
  --ivory-50: #fbf7ef;
  --ivory-100: #f4eee3;
  --sand-300: #d9cdbd;
  --sand-200: #e7ddce;
  --muted: #667574;
  --white: #fffdf8;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --border: 1px solid rgba(21, 61, 66, 0.16);
  --border-warm: 1px solid rgba(217, 205, 189, 0.9);
  --shadow: 0 1px 2px rgba(21, 61, 66, 0.06), 0 6px 24px -12px rgba(21, 61, 66, 0.18);
  --focus: 3px solid var(--coral-600);
  --maxw: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--ivory-50);
  /* subtle riso grain via SVG feTurbulence, per doc 08 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.24 0 0 0 0 0.26 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; color: var(--ink); margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--teal-800); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: var(--focus); outline-offset: 2px; border-radius: 4px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--teal-900); color: var(--white); padding: 10px 18px; z-index: 100; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }

/* ---------- header: frosted glass, sticky ---------- */
.site-header {
  display: flex; align-items: center; gap: 24px;
  position: sticky; top: 0; z-index: 50;
  padding: 14px max(24px, calc(50vw - 620px));
  background: rgba(251, 247, 239, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
  border-bottom: 1px solid rgba(217, 205, 189, 0.65);
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: rgba(251, 247, 239, 0.96); }
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-dish { width: 38px; height: 38px; flex: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-of { font-style: italic; font-weight: 400; }
.site-nav { display: flex; gap: 6px; margin-left: auto; }
.site-nav a, .mobile-nav a {
  text-decoration: none; color: var(--ink); font-weight: 500; font-size: 0.95rem;
  padding: 8px 14px; border-radius: 999px; border: 1px solid transparent;
}
.site-nav a:hover { background: var(--ivory-100); }
.site-nav a[aria-current="page"], .mobile-nav a[aria-current="page"] {
  background: var(--teal-900); color: var(--white);
}
.nav-toggle { display: none; margin-left: auto; background: none; border: var(--border); border-radius: 10px; padding: 9px 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }
.mobile-nav { display: none; flex-direction: column; padding: 4px 16px 14px; gap: 4px; }
.mobile-nav a { padding: 12px 16px; border-radius: 12px; }
@media (max-width: 860px) {
  .site-nav { display: none; }
  .nav-toggle { display: block; }
  .mobile-nav:not([hidden]) { display: flex; }
}

/* ---------- layout ---------- */
.view { max-width: var(--maxw); margin: 0 auto; padding: 12px 24px 64px; }
@media (max-width: 640px) { .view { padding: 8px 14px 48px; } .site-header { padding: 12px 14px; } }

/* ---------- scroll reveal (decorative; disabled under reduced motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.55s ease, transform 0.55s ease; }
  .reveal.reveal-in { opacity: 1; transform: none; }
}

/* ---------- gradient-beam CTA (ThreeUI-inspired) ---------- */
@property --beam { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.btn-beam { position: relative; box-shadow: 0 0 16px rgba(239, 128, 101, 0.3); }
.btn-beam::before {
  /* ring only: gradient masked to a 2.5px border so it never covers the button */
  content: ""; position: absolute; inset: -3px; border-radius: 15px; padding: 3px;
  background: conic-gradient(from var(--beam),
    var(--coral-500), var(--teal-400), var(--ivory-100), var(--coral-200), var(--coral-500));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: beamspin 4.5s linear infinite;
  pointer-events: none;
}
@keyframes beamspin { to { --beam: 360deg; } }
@media (prefers-reduced-motion: reduce) { .btn-beam::before { animation: none; } }

.card {
  background: var(--white); border: var(--border-warm); border-radius: var(--radius-md);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.card-teal {
  background: var(--teal-900); color: var(--ivory-50); border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-md); padding: 20px 22px; box-shadow: var(--shadow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 0.95 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.card-teal h2, .card-teal h3 { color: var(--ivory-50); }
.card-teal a { color: var(--coral-200); }
.card-cream { background: var(--ivory-100); border: var(--border-warm); border-radius: var(--radius-md); padding: 20px 22px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 0.95rem; font-weight: 600;
  padding: 11px 20px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--teal-900); background: var(--teal-900); color: var(--white);
  transition: background 150ms, transform 150ms;
}
.btn:hover { background: var(--teal-800); }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: transparent; color: var(--teal-900); }
.btn-secondary:hover { background: var(--teal-100); }
.btn-coral { background: var(--coral-600); border-color: var(--coral-600); }
.btn-coral:hover { background: var(--coral-500); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.card-teal .btn-secondary { color: var(--ivory-50); border-color: rgba(251, 247, 239, 0.75); }
.card-teal .btn-secondary:hover { background: rgba(251, 247, 239, 0.16); }
.card-teal .btn[disabled] { opacity: 0.55; }
.btn-small { padding: 7px 14px; font-size: 0.85rem; border-radius: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
}
.badge-live { background: #d9ead9; color: #1d5c33; border: 1px solid #8fbf9a; }
.badge-stale { background: #f7ecd2; color: #7a5b12; border: 1px solid #d9bd7a; }
.badge-demo { background: var(--coral-100); color: var(--coral-600); border: 1px solid var(--coral-200); }
.badge-error { background: #f6dcd7; color: #8c2f1d; border: 1px solid #e0a294; }
.badge-neutral { background: var(--ivory-100); color: var(--muted); border: var(--border-warm); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.hint { font-size: 0.85rem; color: var(--muted); }
.divider-coral { width: 48px; height: 3px; background: var(--coral-500); border: none; margin: 14px 0 18px; border-radius: 2px; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.field select, .field input[type="text"] {
  font-family: var(--sans); font-size: 0.95rem; color: var(--ink);
  padding: 11px 12px; border-radius: 12px; border: var(--border);
  background: var(--white); width: 100%;
}
.field select:disabled { opacity: 0.5; }

/* segmented control */
.segmented { display: inline-flex; background: var(--ivory-100); border: var(--border-warm); border-radius: 999px; padding: 4px; gap: 2px; }
.segmented button {
  border: none; background: transparent; font: inherit; font-weight: 600; font-size: 0.9rem;
  color: var(--ink); padding: 8px 20px; border-radius: 999px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--teal-900); color: var(--white); }

/* ---------- petri dish ---------- */
.dish-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dish-svg { width: min(100%, 540px); height: auto; display: block; }
.dish-caption { font-size: 0.85rem; color: var(--muted); text-align: center; max-width: 60ch; }
.dot-susceptible { fill: var(--teal-400); }
.dot-resistant { fill: var(--coral-500); stroke: var(--coral-600); stroke-width: 1.4; }
.dot-neutral { fill: var(--sand-300); }
.dish-legend { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; font-size: 0.85rem; }
.dish-legend .key { display: inline-flex; align-items: center; gap: 7px; }
.key-swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.key-susceptible { background: var(--teal-400); }
.key-resistant { background: var(--coral-500); box-shadow: inset 0 0 0 2px var(--coral-600); }
.key-neutral { background: var(--sand-300); }

/* history drug markers */
.drug-marker { cursor: pointer; }
.drug-marker circle.halo { fill: transparent; transition: fill 200ms; }
.drug-marker:hover circle.halo, .drug-marker:focus-visible circle.halo { fill: rgba(239, 128, 101, 0.15); }
.drug-marker[aria-pressed="true"] circle.halo { fill: rgba(239, 128, 101, 0.22); }
.drug-marker text { font-family: var(--sans); font-size: 11px; fill: var(--ivory-50); pointer-events: none; }
.drug-marker .marker-ring { fill: none; stroke: var(--coral-500); stroke-width: 2; }

/* ---------- timeline ---------- */
.timeline { width: 100%; max-width: 640px; margin: 4px auto 0; }
.timeline-row { display: flex; align-items: center; gap: 12px; }
.timeline-year {
  font-family: var(--serif); font-weight: 700; font-size: 1.35rem; min-width: 76px; text-align: center;
  background: var(--teal-900); color: var(--white); border-radius: 10px; padding: 4px 8px;
}
.timeline input[type="range"] { flex: 1; accent-color: var(--teal-900); height: 32px; }
.timeline-bounds { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); padding: 0 4px; }
.timeline-ticks { position: relative; height: 16px; margin: 0 2px; }
.timeline-ticks span { position: absolute; top: 0; width: 1px; height: 8px; background: var(--sand-300); }
.timeline-ticks span.tick-event { background: var(--coral-500); height: 12px; width: 2px; }

/* ---------- grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 980px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

.history-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.6fr) minmax(0, 1.05fr); gap: 24px; align-items: start; margin-top: 8px; }
@media (max-width: 1080px) { .history-layout { grid-template-columns: 1fr; } }

.lab-layout { display: grid; grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.7fr) minmax(260px, 1.1fr); gap: 22px; align-items: start; }
@media (max-width: 1080px) { .lab-layout { grid-template-columns: 1fr; } }

/* ---------- stat cards ---------- */
.stat-figure { font-family: var(--serif); font-size: 2.4rem; font-weight: 700; line-height: 1; }
.stat-figure .unit { font-size: 1.2rem; font-weight: 400; }
.stat-coral { color: var(--coral-500); }

/* ---------- results panel ---------- */
.result-rate { font-family: var(--serif); font-size: 3.2rem; font-weight: 700; color: var(--coral-500); line-height: 1; }
.result-rows { border-top: 1px dashed rgba(251,247,239,0.35); margin-top: 14px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; }
.result-row { display: flex; justify-content: space-between; gap: 12px; }
.result-row dt { color: var(--teal-100); }
.result-row dd { margin: 0; font-weight: 600; text-align: right; }
.callout { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.9rem; margin-top: 12px; }
.callout-means { background: rgba(110, 167, 165, 0.18); border: 1px solid rgba(110, 167, 165, 0.5); }
.callout-notmeans { background: rgba(239, 128, 101, 0.12); border: 1px solid rgba(239, 128, 101, 0.45); }
.callout-warn { background: #f7ecd2; border: 1px solid #d9bd7a; color: #5c450e; }
.card-teal .callout-means { background: rgba(110,167,165,0.25); color: var(--ivory-50); }
.card-teal .callout-notmeans { background: rgba(239,128,101,0.22); color: var(--ivory-50); }
.card-teal .callout-warn { background: rgba(247,236,210,0.16); border-color: rgba(217,189,122,0.6); color: #f2e3bd; }

/* ---------- drug panel ---------- */
.drug-panel h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.class-chip { font-family: var(--sans); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; background: var(--coral-500); color: #40150a; padding: 4px 10px; border-radius: 999px; }
.drug-facts { display: flex; flex-direction: column; gap: 0; margin: 12px 0; }
.drug-fact { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid rgba(251,247,239,0.18); font-size: 0.92rem; }
.drug-fact dt { color: var(--teal-100); font-weight: 500; }
.drug-fact dd { margin: 0; }
.card .drug-fact { border-top: 1px solid rgba(21,61,66,0.1); }
.card .drug-fact dt { color: var(--muted); }
@media (max-width: 480px) { .drug-fact { grid-template-columns: 1fr; gap: 2px; } }

.citation-list { font-size: 0.85rem; padding-left: 18px; margin: 6px 0 0; }
.citation-list li { margin-bottom: 5px; }

/* culture sim */
.culture-sim { margin-top: 14px; border-top: 1px solid rgba(251,247,239,0.2); padding-top: 14px; }
.culture-stage-label { font-weight: 600; font-size: 0.95rem; min-height: 3em; }
.culture-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- mechanism explainer dialog / drawers ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(21, 61, 66, 0.45); z-index: 90; /* above the full-screen dish overlay */
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.dialog {
  background: var(--ivory-50); border-radius: var(--radius-lg); max-width: 760px; width: 100%;
  max-height: min(86vh, 900px); overflow-y: auto; padding: 28px 30px; position: relative;
  border: var(--border-warm); box-shadow: 0 24px 80px -20px rgba(0,0,0,0.4);
}
.dialog-close { position: absolute; top: 14px; right: 14px; background: var(--ivory-100); border: var(--border-warm); border-radius: 50%; width: 38px; height: 38px; font-size: 1.1rem; cursor: pointer; color: var(--ink); }
@media (max-width: 640px) { .dialog { padding: 22px 16px; } }

.step-dots { display: flex; gap: 8px; margin: 10px 0 16px; }
.step-dots button { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--teal-900); background: transparent; color: var(--teal-900); font-weight: 700; cursor: pointer; }
.step-dots button[aria-current="step"] { background: var(--teal-900); color: var(--white); }

/* evidence inspector rows */
.evidence-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.evidence-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 12px 8px 0; vertical-align: top; width: 160px; border-top: 1px solid rgba(21,61,66,0.1); }
.evidence-table td { padding: 8px 0; border-top: 1px solid rgba(21,61,66,0.1); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; word-break: break-all; }

/* ---------- source registry ---------- */
.source-card { display: flex; gap: 14px; align-items: flex-start; }
.source-logo { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--teal-900); color: var(--ivory-50); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem; letter-spacing: 0.03em; }
.source-body { min-width: 0; flex: 1; }
.source-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.source-head h3 { margin: 0; }

/* gap chart */
.gap-chart { width: 100%; height: auto; }
.gap-chart text { font-family: var(--sans); font-size: 12px; fill: var(--ink); }
.gap-chart .gap-years { font-weight: 700; fill: var(--coral-600); }
.gap-chart .gap-bar { fill: var(--teal-400); }
.gap-chart .gap-bar.fast { fill: var(--coral-500); }

/* compare */
.compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .compare-cols { grid-template-columns: 1fr; } }
.compare-head { border-radius: var(--radius-md) var(--radius-md) 0 0; margin: -20px -22px 16px; padding: 14px 22px; background: var(--teal-900); color: var(--ivory-50); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compare-head h3 { color: var(--ivory-50); margin: 0; font-size: 1.3rem; }
.compare-rate { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; color: var(--coral-600); line-height: 1; }

/* lanes timeline (compare) */
.lane { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(21,61,66,0.1); }
@media (max-width: 640px) { .lane { grid-template-columns: 1fr; } }
.lane-name { font-weight: 600; }
.lane-name .hint { display: block; font-weight: 400; }
.lane-svg { width: 100%; height: 44px; }

/* research lists */
.pub-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 10px; }
.pub-list li { border: var(--border-warm); background: var(--white); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.9rem; }
.pub-list .pub-meta { color: var(--muted); font-size: 0.8rem; }

.status-line { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; }

/* glossary */
.glossary dt { font-weight: 700; margin-top: 10px; }
.glossary dd { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }

/* footer */
.site-footer { border-top: var(--border-warm); background: var(--ivory-100); margin-top: 30px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 24px 34px; font-size: 0.85rem; color: var(--muted); }
.footer-inner p { max-width: 90ch; }

/* skeleton / loading */
.loading { color: var(--muted); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.loading::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--sand-300); border-top-color: var(--teal-800); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-box { background: #f6dcd7; border: 1px solid #e0a294; color: #6d2517; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.9rem; }

/* ---------- living dish ---------- */
.livedish { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.livedish-canvas { width: 100%; height: auto; display: block; border-radius: 12px; cursor: crosshair; }
.livedish-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.livedish-status { font-size: 0.92rem; color: var(--ink); background: var(--ivory-100); border: var(--border-warm); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0; max-width: 62ch; text-align: center; min-height: 2.4em; }
.livedish-counts { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin: 0; text-align: center; }
.livedish:fullscreen, .livedish-expanded { background: var(--ivory-50); padding: 18px; justify-content: center; }
.livedish:fullscreen .livedish-canvas, .livedish-expanded .livedish-canvas { flex: 1 1 auto; min-height: 0; }
.livedish:fullscreen .livedish-status, .livedish-expanded .livedish-status { font-size: 1.05rem; max-width: 80ch; }
.livedish-expanded { position: fixed; inset: 0; z-index: 70; margin: 0; overflow: auto; }
.culture-sim .livedish-status { color: var(--ink); }

/* ---------- microscope zoom panel ---------- */
.zoom-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(240px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 700px) { .zoom-layout { grid-template-columns: 1fr; } }
.zoom-canvas { width: 100%; height: auto; display: block; border-radius: 14px; }
.zoom-3d-holder { border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 42% 38%, #14212a 0%, #0a1218 62%, #05090c 100%); }
.zoom-3d-holder canvas { cursor: grab; }
.zoom-3d-holder canvas:active { cursor: grabbing; }
.zoom-mode-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.zoom-mode-row .btn[aria-pressed="true"] { background: var(--teal-900); color: var(--white); }
.zoom-mode-row .btn[aria-pressed="false"] { background: transparent; color: var(--teal-900); }
.zoom-controls { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.zoom-controls input[type="range"] { accent-color: var(--teal-900); height: 28px; }
.zoom-info .drug-fact { border-top: 1px solid rgba(21, 61, 66, 0.1); }
.zoom-info .drug-fact dt { color: var(--muted); }

/* ---------- patient chart (process page) ---------- */
.chart {
  max-width: 900px; margin: 10px auto 0; background: var(--white);
  border: var(--border-warm); border-radius: 6px; box-shadow: var(--shadow);
  padding: 0 clamp(18px, 4vw, 44px) 40px; position: relative;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(21, 61, 66, 0.05) 31px 32px);
}
.chart-head { border-bottom: 3px double var(--teal-900); padding: 22px 0 14px; }
.chart-facility {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.78rem;
  font-weight: 700; letter-spacing: 0.1em; color: var(--teal-900); margin-bottom: 14px;
}
.chart-cross { color: var(--coral-600); font-size: 1.1rem; }
.chart-stamp {
  margin-left: auto; border: 2.5px solid var(--coral-600); color: var(--coral-600);
  padding: 4px 12px; border-radius: 4px; transform: rotate(-4deg); letter-spacing: 0.14em;
}
.chart-id { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 20px; margin: 0; }
@media (max-width: 720px) { .chart-id { grid-template-columns: 1fr; } }
.chart-id-field dt { font-family: ui-monospace, Menlo, monospace; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.chart-id-field dd { margin: 0; font-weight: 600; font-size: 0.95rem; }
.chart-allergies {
  margin: 16px 0 0; background: #f6dcd7; border: 1.5px solid #d96448; color: #6d2517;
  border-radius: 6px; padding: 10px 14px; font-size: 0.9rem;
}
.chart-vitals { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.chart-vital { flex: 1 1 140px; border: var(--border-warm); background: var(--ivory-100); border-radius: 8px; padding: 10px 12px; text-align: center; }
.chart-vital-value { display: block; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; color: var(--teal-900); }
.chart-vital-label { font-size: 0.75rem; color: var(--muted); }
.chart-purpose { margin: 18px 0 0; font-size: 0.97rem; max-width: 75ch; }
.chart-section-title {
  font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--teal-900); border-bottom: 2px solid var(--teal-900);
  padding: 26px 0 6px; margin: 10px 0 14px;
}
.chart-note { border: var(--border-warm); border-left: 4px solid var(--teal-800); border-radius: 6px; background: rgba(255, 253, 248, 0.92); padding: 14px 18px; margin-bottom: 16px; }
.chart-note-head { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; font-size: 0.8rem; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.chart-note-n { font-weight: 700; color: var(--coral-600); }
.chart-note-type { font-weight: 700; color: var(--teal-900); text-transform: uppercase; letter-spacing: 0.06em; }
.chart-cc { margin: 10px 0; font-size: 0.98rem; }
.chart-cc q { font-style: italic; }
.chart-field { font-family: ui-monospace, Menlo, monospace; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chart-soap { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.chart-soap-row { display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.chart-soap-row dt { font-family: ui-monospace, Menlo, monospace; font-weight: 700; color: var(--teal-800); border: 1.5px solid var(--teal-400); border-radius: 4px; text-align: center; height: 22px; line-height: 20px; font-size: 0.8rem; }
.chart-soap-row dd { margin: 0; font-size: 0.93rem; }
.chart-plan { margin: 0; padding-left: 18px; }
.chart-plan li { margin-bottom: 3px; }
.chart-complication { margin: 10px 0 0; font-size: 0.9rem; background: rgba(239, 128, 101, 0.09); border-left: 3px solid var(--coral-500); padding: 8px 12px; border-radius: 0 6px 6px 0; }
.chart-films { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.chart-film { margin: 0; background: #141310; border-radius: 8px; overflow: hidden; border: 1px solid #3a352a; }
.chart-film img { width: 100%; height: 190px; object-fit: cover; display: block; }
.chart-film figcaption { color: var(--ivory-100); font-size: 0.78rem; padding: 10px 12px; line-height: 1.45; }
.chart-mar { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.chart-mar th { text-align: left; font-family: ui-monospace, Menlo, monospace; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 6px 0; border-bottom: 1.5px solid var(--teal-900); }
.chart-mar td { padding: 8px 10px 8px 0; border-bottom: 1px solid rgba(21, 61, 66, 0.12); vertical-align: top; }
.chart-discharge { font-size: 0.95rem; max-width: 78ch; }
.chart-sign { display: flex; gap: 40px; flex-wrap: wrap; margin-top: 22px; }
.chart-sigline { display: block; font-family: var(--serif); font-style: italic; font-size: 1.25rem; border-bottom: 1.5px solid var(--ink); padding: 0 30px 2px 4px; }

/* ---------- landing gallery ---------- */
.bleed { width: 100vw; margin-inline: calc(50% - 50vw); }
.home-hero { position: relative; min-height: min(78vh, 760px); overflow: hidden; background: #16140f; }
.hero-bg { position: absolute; inset: 0; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(100deg, rgba(14, 12, 9, 0.78) 0%, rgba(14, 12, 9, 0.38) 44%, rgba(14, 12, 9, 0) 68%),
    linear-gradient(to top, rgba(14, 12, 9, 0.65), rgba(14, 12, 9, 0) 38%);
}
.hero-overlay {
  position: relative; z-index: 2; height: 100%; min-height: inherit;
  max-width: var(--maxw); margin: 0 auto; padding: clamp(24px, 6vh, 72px) 24px 120px;
  display: flex; flex-direction: column; justify-content: center;
}
.hero-copy { max-width: 560px; }
.hero-eyebrow { color: var(--coral-200); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px; }
.hero-title { color: var(--ivory-50); font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.04; margin-bottom: 18px; text-shadow: 0 2px 30px rgba(0,0,0,0.55); }
.hero-desc { color: rgba(251,247,239,0.88); font-size: 1.05rem; max-width: 46ch; text-shadow: 0 1px 14px rgba(0,0,0,0.6); }
.hero-ctas { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-top: 22px; }
.hero-underline { color: var(--ivory-50); font-weight: 600; text-decoration: underline; text-underline-offset: 5px; }
.hero-pager {
  position: absolute; right: clamp(14px, 3vw, 44px); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 3;
}
.hero-pager::before { content: ""; width: 1px; height: 44px; background: rgba(251,247,239,0.4); order: 1; margin: 8px 0; }
.hero-pager button {
  background: none; border: none; color: rgba(251,247,239,0.55); font: 600 0.9rem var(--sans);
  cursor: pointer; padding: 6px 10px; border-radius: 8px;
}
.hero-pager button[aria-current="true"] { color: var(--ivory-50); font-size: 1.05rem; }
.hero-pager button:first-child { order: 0; }
.hero-pager button:nth-child(2) { order: 2; }
.hero-pager button:nth-child(3) { order: 3; }
.hero-caption { position: absolute; left: 24px; bottom: 96px; z-index: 3; max-width: 420px; }
.hero-caption-title { color: var(--coral-200); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 4px; }
.hero-caption-stat { color: var(--ivory-50); font-size: 0.95rem; margin: 0 0 6px; text-shadow: 0 1px 10px rgba(0,0,0,0.7); }
.hero-caption-link { color: var(--coral-200); font-weight: 600; font-size: 0.9rem; }
.hero-pause {
  position: absolute; right: clamp(14px, 3vw, 44px); bottom: 96px; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid rgba(251,247,239,0.7);
  background: rgba(20,18,14,0.55); color: var(--ivory-50); font-size: 1rem; cursor: pointer;
}
.gallery-row {
  position: relative; z-index: 4; margin-top: -84px;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px;
  padding: 0 24px; max-width: calc(var(--maxw) + 48px); margin-inline: auto;
}
.gallery-card {
  position: relative;
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--white); border: var(--border-warm); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow); color: var(--ink);
  transition: transform 160ms, box-shadow 160ms;
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px -14px rgba(21,61,66,0.35); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  /* cursor tilt + sheen sweep, driven by --rx/--ry/--mx/--my from js/delight.js */
  .gallery-card:hover {
    transform: perspective(700px) rotateY(var(--rx, 0deg)) rotateX(var(--ry, 0deg)) translateY(-4px);
  }
  .gallery-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 253, 240, 0.28), transparent 62%);
    opacity: 0; transition: opacity 180ms;
  }
  .gallery-card:hover::after { opacity: 1; }
}
.gallery-thumb { width: 100%; height: 96px; object-fit: cover; display: block; }
.gallery-n { color: var(--coral-600); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.08em; padding: 10px 14px 0; }
.gallery-title { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; padding: 2px 14px 0; }
.gallery-desc { color: var(--muted); font-size: 0.8rem; padding: 2px 14px 14px; }
@media (max-width: 1080px) { .gallery-row { grid-template-columns: repeat(3, 1fr); margin-top: -60px; } }
@media (max-width: 760px) { .gallery-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) {
  /* caption + pager flow in-document on small screens instead of overlapping the copy */
  .hero-overlay { padding-bottom: 110px; }
  .hero-caption { position: static; margin-top: 26px; max-width: none; }
  .hero-pager { position: static; transform: none; flex-direction: row; margin-top: 14px; align-self: flex-start; }
  .hero-pager::before { width: 30px; height: 1px; margin: 0 6px; }
  .hero-pause { bottom: 20px; }
}
@media (max-width: 560px) { .gallery-row { grid-template-columns: 1fr; } }

/* hero */
.hero { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.4fr); gap: 32px; align-items: center; padding: 18px 0 8px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
