/* ============================================================
   platform.css: Platform page (R17 rebuild, formerly technology.css).
   Renamed from /technology to /platform. Builds the GPS-for-Health
   hero schematic, the gap/biotyping morph, the three-technology
   cards, coordinate anatomy, biotypes-across-scales, the 14-disorder
   brain map, threshold-vs-trajectory, and the cross-scale depression
   flagship (with its adaptive focus marker). Every color/font/spacing
   value below is a var(--...) token already defined in styles.css /
   site-extend.css. Nothing here overrides them, only adds to them.
   One new token is introduced (--magenta) for sparing accent-only use,
   consistent with brand guidance that magenta is accent-only.
   ============================================================ */

:root { --magenta: #E0309E; }

/* ---- shared: toggle chip button, used across visualizations ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip-toggle {
  font-family: var(--f-body); font-size: 13px; font-weight: 500;
  padding: 9px 15px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.chip-toggle:hover { border-color: rgba(110,91,209,0.32); transform: translateY(-1px); }
.chip-toggle[aria-pressed="true"] { background: var(--violet); border-color: var(--violet); color: #fff; }
.chip-toggle:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.dark .chip-toggle { background: rgba(255,255,255,0.05); border-color: rgba(180,166,232,0.22); color: var(--on-night-2); }
.dark .chip-toggle[aria-pressed="true"] { background: var(--violet); color: #fff; }

.viz-definition {
  margin-top: 14px; padding: 14px 16px; background: var(--bg-soft); border: 1px solid var(--hair);
  border-radius: 12px; font-size: 14px; color: var(--ink-2); line-height: 1.55; min-height: 1.5em;
}
.viz-definition strong { color: var(--ink); font-weight: 600; }

.viz-figure-note { margin-top: 18px; font-size: 12.5px; color: var(--faint); line-height: 1.6; max-width: 74ch; }

/* generic svg text labels used across diagrams */
.gps-label, .ca-label, .ca-axis-label, .th-label, .biotype-morph-label, .scale-label, .brain-label {
  font-family: var(--f-body); font-size: 11.5px; fill: var(--ink-2);
}
.ca-axis-label { font-size: 10.5px; fill: var(--faint); }

@media (prefers-reduced-motion: reduce) {
  .chip-toggle, .gps-layer, .ca-group, .th-view, .biotype-group, .scale-band, .brain-node, .focus-marker { transition: none !important; }
}

/* ---------------------------------------------------------------
   Hero: GPS for Health (now lives in the hero itself, id="platform")
   --------------------------------------------------------------- */
.tech-hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(28px, 5vw, 56px); align-items: start; }
.tech-hero-grid .page-hero-inner { max-width: none; }
.gps-figure { margin: 0; background: var(--bg-soft); border: 1px solid var(--hair); border-radius: 18px; padding: 14px; box-shadow: 0 24px 60px -32px rgba(81,69,168,0.3); }
.gps-figure svg { background: transparent; border-radius: 12px; display: block; width: 100%; height: auto; }
.gps-figure .figure-caption { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hair-soft); font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.gps-layer { transition: opacity var(--dur-base) var(--ease); }
.gps-layer.gps-dim { opacity: 0.16; }
.gps-pulse { animation: gpsPulse 2.4s var(--ease) infinite; transform-origin: center; transform-box: fill-box; }
@keyframes gpsPulse {
  0% { opacity: 0.55; transform: scale(0.9); }
  70% { opacity: 0; transform: scale(2); }
  100% { opacity: 0; transform: scale(2); }
}
@media (prefers-reduced-motion: reduce) {
  .gps-pulse { animation: none; opacity: 0.3; }
}
@media (max-width: 980px) {
  .tech-hero-grid { grid-template-columns: 1fr; }
  .gps-figure { max-width: 460px; width: 100%; margin: 24px auto 0; }
}

.platform-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 32px; }
.pc-col { padding: 20px 22px; border-radius: 14px; background: var(--bg-soft); border: 1px solid var(--hair); }
.pc-col--good { background: rgba(91,191,188,0.09); border-color: rgba(91,191,188,0.28); }
.pc-label { display: block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.pc-col--good .pc-label { color: var(--teal); }
.pc-col p { font-family: var(--f-serif); font-style: italic; font-size: 16px; color: var(--ink-2); line-height: 1.5; margin: 0; }
@media (max-width: 720px) { .platform-compare { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------
   The gap: stat cards + market-failure callout + fix-in-one-line
   --------------------------------------------------------------- */
.gap-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 32px; }
.gap-stat-card { padding: 20px 20px 22px; background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; }
.gap-stat-num { font-family: var(--f-display); font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 600; color: var(--violet); letter-spacing: -0.02em; line-height: 1.1; }
.gap-stat-card p { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; margin: 8px 0 0; }
.gap-fix-callout { margin-top: 28px; padding: 22px 24px; border-radius: 16px; background: linear-gradient(135deg, rgba(110,91,209,0.08), rgba(59,125,214,0.06)); border: 1px solid rgba(110,91,209,0.18); }
.gap-fix-callout .gfc-kicker { display: block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--violet); margin-bottom: 8px; }
.gap-fix-callout p { font-size: 15.5px; color: var(--ink); line-height: 1.55; margin: 0; }
.gap-transdiagnostic { margin-top: 18px; font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 74ch; }

/* ---------------------------------------------------------------
   The gap hook: depression, biotyped (static diagram, no auto-cycle)
   --------------------------------------------------------------- */
.biotype-viz-wrap { margin-top: 8px; margin-bottom: 32px; }
.biotype-figure svg { background: var(--bg-soft); border-radius: 12px; display: block; width: 100%; height: auto; }
.biotype-group { transition: opacity var(--dur-base) var(--ease); cursor: pointer; }
.biotype-group.is-dim { opacity: 0.3; }
.biotype-root-label { font-family: var(--f-display); font-size: 15px; font-weight: 600; fill: var(--ink); }
.biotype-branch-label { font-family: var(--f-display); font-size: 12.5px; font-weight: 600; }
.biotype-sub-label { font-family: var(--f-body); font-size: 11px; fill: var(--muted); }
.biotype-response-label { font-family: var(--f-body); font-size: 11.5px; fill: var(--ink-2); }
@media (prefers-reduced-motion: reduce) {
  .biotype-group { transition: none !important; }
}

/* ---------------------------------------------------------------
   Three technologies: linked card row (id="technologies")
   --------------------------------------------------------------- */
.tech-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 36px; }
.tech-card {
  padding: 26px 24px 24px; background: var(--surface); border: 1px solid var(--hair); border-radius: 18px;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.tech-card:hover, .tech-card:focus-within { transform: translateY(-3px); box-shadow: 0 22px 48px -26px rgba(81,69,168,0.28); border-color: rgba(110,91,209,0.28); }
.tech-card-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; background: var(--bg-soft); }
.tech-card-icon svg { display: block; }
.tech-card .chapter-label { display: block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--violet); margin-bottom: 8px; }
.tech-card h3 { font-family: var(--f-display); font-size: 17px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 10px; line-height: 1.32; }
.tech-card p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin: 0; }
.tech-card[data-tech="cytoscope"] .tech-card-icon { background: rgba(59,125,214,0.1); }
.tech-card[data-tech="cytonome"] .tech-card-icon { background: rgba(91,191,188,0.12); }
.tech-card[data-tech="cytoverse"] .tech-card-icon { background: rgba(110,91,209,0.1); }

.tech-loop-label {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 22px;
  font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase;
}
.tech-loop-label .arr { color: var(--violet-300); }

.tech-card details { margin-top: 16px; }
.tech-card summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--violet); list-style: none; display: flex; align-items: center; gap: 6px; }
.tech-card summary::-webkit-details-marker { display: none; }
.tech-card summary::after { content: '+'; font-family: var(--f-mono); font-size: 14px; margin-left: 2px; }
.tech-card details[open] summary::after { content: '−'; }
.tech-card .today-then-list { margin-top: 12px; list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tech-card .today-then-list li { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.tech-card .tt-today { color: var(--faint); font-weight: 600; }
.tech-card .tt-cg { color: var(--violet); font-weight: 600; }
.tech-card .decide-box { margin-top: 14px; padding: 14px 16px; background: var(--bg-soft); border-radius: 12px; }
.tech-card .decide-box h4 { font-family: var(--f-display); font-size: 12.5px; font-weight: 600; color: var(--ink); margin: 0 0 8px; }
.tech-card .decide-box ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.tech-card .decide-box li { font-size: 12px; color: var(--ink-2); line-height: 1.5; }

@media (max-width: 980px) {
  .tech-cards-grid { grid-template-columns: 1fr; }
}

/* ca-figure kept inside the Cytoverse card's <details> */
.ca-figure svg { background: var(--bg-soft); border-radius: 12px; display: block; width: 100%; height: auto; }
.ca-group { transition: opacity var(--dur-base) var(--ease); }
.ca-group.ca-dim { opacity: 0.14; }
.ca-point-btn { cursor: pointer; }
.ca-point-btn:focus-visible { outline: 2px solid var(--violet); outline-offset: 5px; border-radius: 50%; }
.ca-evidence-panel { margin-top: 14px; padding: 16px 18px; background: var(--bg-soft); border: 1px solid var(--hair);
  border-radius: 12px; display: none; }
.ca-evidence-panel.is-open { display: block; }
.ca-evidence-panel h4 { font-family: var(--f-display); font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 10px; }
.ca-evidence-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 8px; }
.ca-evidence-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.ca-evidence-name { width: 148px; flex-shrink: 0; }
.ca-evidence-bar { flex: 1; height: 6px; border-radius: 4px; background: var(--hair); overflow: hidden; }
.ca-evidence-fill { display: block; height: 100%; background: var(--violet); border-radius: 4px; }
.ca-evidence-pct { font-family: var(--f-mono); font-size: 12px; color: var(--muted); width: 36px; text-align: right; flex-shrink: 0; }
.ca-evidence-note { font-size: 12px; color: var(--faint); margin: 4px 0 0; }

/* ---------------------------------------------------------------
   Biotypes across scales (id="biotypes-scales")
   --------------------------------------------------------------- */
.scales-figure-wrap { margin-top: 32px; }
.scales-figure { background: var(--bg-soft); border: 1px solid var(--hair); border-radius: 16px; padding: 24px; }
.scales-figure svg { display: block; width: 100%; height: auto; }
.scale-band { opacity: 0; transform: translateX(-8px); transition: opacity 560ms var(--ease), transform 560ms var(--ease); }
.scale-band.is-shown { opacity: 1; transform: translateX(0); }
.scale-connector { opacity: 0; transition: opacity 460ms var(--ease); }
.scale-connector.is-shown { opacity: 0.55; }
.scales-reveal-btn { margin-top: 16px; }
.scale-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.scale-legend span { display: inline-flex; align-items: center; gap: 6px; }
.scale-legend .dot { width: 8px; height: 8px; border-radius: 50%; }
@media (prefers-reduced-motion: reduce) {
  .scale-band, .scale-connector { transition: none !important; opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------
   14 disorders mapped: brain circuit map + tissue-N bar list
   --------------------------------------------------------------- */
.disorders-layout { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 40px; margin-top: 36px; align-items: start; }
.brain-map-figure { background: var(--bg-soft); border: 1px solid var(--hair); border-radius: 16px; padding: 24px; position: sticky; top: 96px; }
.brain-map-figure svg { display: block; width: 100%; height: auto; }
.brain-node { cursor: pointer; transition: opacity var(--dur-base) var(--ease); }
.brain-node circle { transition: r var(--dur-fast) var(--ease); }
.brain-node:hover circle, .brain-node:focus circle { r: 8; }
.brain-edge { transition: opacity var(--dur-base) var(--ease), stroke-width var(--dur-base) var(--ease); }
.brain-edge.is-active { opacity: 1 !important; stroke-width: 3.5; }
.brain-map-readout { margin-top: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.5; min-height: 2.6em; }
.brain-map-readout strong { color: var(--ink); }

.disorder-bar-list { display: flex; flex-direction: column; gap: 6px; }
.disorder-bar-row { display: grid; grid-template-columns: 148px 1fr 60px; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; background: transparent; border: 1px solid transparent; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.disorder-bar-row:hover, .disorder-bar-row.is-active { background: var(--bg-soft); border-color: var(--hair); }
.disorder-bar-name { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.disorder-bar-track { height: 10px; border-radius: 5px; background: var(--hair); overflow: hidden; }
.disorder-bar-fill { display: block; height: 100%; border-radius: 5px; }
.disorder-bar-n { font-family: var(--f-mono); font-size: 11px; color: var(--muted); text-align: right; }
.disorder-domain-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.disorder-domain-legend span { display: inline-flex; align-items: center; gap: 6px; }
.disorder-domain-legend .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.disorder-gap-note { margin-top: 4px; font-size: 11.5px; color: var(--faint); font-style: italic; }

@media (max-width: 980px) {
  .disorders-layout { grid-template-columns: 1fr; }
  .brain-map-figure { position: static; }
}

/* ---------------------------------------------------------------
   Threshold vs trajectory (lead-in above the cross-scale flagship)
   --------------------------------------------------------------- */
.th-figure svg { background: var(--bg-soft); border-radius: 12px; display: block; width: 100%; height: auto; }
.th-view { transition: opacity var(--dur-base) var(--ease); }
.th-view[hidden] { display: none; }
.th-toggle-row { display: inline-flex; border: 1px solid var(--hair); border-radius: 999px; padding: 3px; gap: 2px; margin-top: 4px; }
.th-toggle-row .chip-toggle { border: none; padding: 8px 16px; }
.th-toggle-row .chip-toggle[aria-pressed="true"] { box-shadow: 0 4px 12px -4px rgba(81,69,168,0.45); }
.th-lead-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 4px; }

/* ---------------------------------------------------------------
   Depression flagship: cross-scale viz + adaptive focus marker
   --------------------------------------------------------------- */
.viz-card { margin-top: 12px; padding: 4px; }
.viz-controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.viz-slider-label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); flex: 1; min-width: 200px; }
.viz-step-readout { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink); font-weight: 500; }
#vizSlider { width: 100%; accent-color: var(--violet); }
#vizSvg { background: var(--bg-soft); border-radius: 12px; display: block; width: 100%; height: auto; }
.viz-lane-label { font-family: var(--f-body); font-size: 12px; font-weight: 500; fill: var(--ink-2); }
.viz-focus-callout { margin-top: 10px; padding: 10px 14px; background: rgba(224,48,158,0.06); border: 1px solid rgba(224,48,158,0.22); border-radius: 10px; font-size: 12.5px; color: var(--ink-2); display: none; }
.viz-focus-callout.is-visible { display: block; }
.viz-focus-callout strong { color: var(--magenta); }
.focus-marker { transition: cx 620ms var(--ease), cy 620ms var(--ease); }
.focus-marker-ring { animation: focusPulse 2.2s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
@keyframes focusPulse {
  0% { opacity: 0.7; transform: scale(0.92); }
  70% { opacity: 0.05; transform: scale(1.5); }
  100% { opacity: 0; transform: scale(1.5); }
}
@media (prefers-reduced-motion: reduce) {
  .focus-marker { transition: none; }
  .focus-marker-ring { animation: none; opacity: 0.35; }
}
.viz-reading { margin-top: 16px; padding: 16px 18px; background: var(--bg-soft); border: 1px solid var(--hair); border-radius: 12px; }
.viz-reading-time { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--violet); margin-bottom: 6px; }
.viz-reading-text { font-size: 14px; color: var(--ink-2); line-height: 1.55; margin: 0; }
.viz-recommendation { margin-top: 12px; padding: 12px 14px; background: rgba(91,191,188,0.1); border: 1px solid rgba(91,191,188,0.3); border-radius: 10px; }
.viz-rec-label { display: block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: #2f8b88; margin-bottom: 4px; }
.viz-recommendation p { font-size: 13.5px; color: var(--ink-2); margin: 0; line-height: 1.5; }
.viz-caption { margin-top: 16px; font-size: 12.5px; color: var(--faint); line-height: 1.6; max-width: 78ch; }

/* ---------------------------------------------------------------
   Hero: two-column layout carried over for other page grids
   --------------------------------------------------------------- */
@media (max-width: 720px) {
  .gap-stats-row, .tech-cards-grid { gap: 16px; }
}

/* ---------------------------------------------------------------
   Psychoverse bridge: 4-scale strip reuses .tech-card visuals
   --------------------------------------------------------------- */
.psy-scale-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 32px 0 8px; }
.psy-scale-card { padding: 16px 16px 18px; background: var(--bg-soft); border: 1px solid var(--hair); border-radius: 14px; text-align: center; }
.psy-scale-card .psc-dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 10px; }
.psy-scale-card h4 { font-family: var(--f-display); font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.psy-scale-card p { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin: 0; }
@media (max-width: 860px) {
  .psy-scale-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------
   Two connected paths: Psychoverse / Yar cards (kept from #technology)
   --------------------------------------------------------------- */
.neuropsych-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-top: 8px; }
.neuropsych-card {
  padding: 30px 28px 28px; background: var(--surface); border: 1px solid var(--hair); border-radius: 18px;
  display: flex; flex-direction: column; align-items: flex-start;
}
.neuropsych-card .series-label { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--violet); margin-bottom: 10px; }
.neuropsych-card h3 { font-family: var(--f-display); font-size: var(--fs-h5); font-weight: 500; color: var(--ink); margin: 0 0 10px; letter-spacing: -0.01em; }
.neuropsych-card p { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; margin: 0 0 16px; }
.neuropsych-card ul { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.neuropsych-card ul li { position: relative; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.neuropsych-card ul li::before { content: ''; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--violet); }

@media (max-width: 720px) {
  .dashboard-grid, .neuropsych-grid, .neuro-axis-grid { gap: 16px; }
}
