/* ============================================================
   PROTEUS FRAMEWORK — THERMOCLINE DESIGN TOKENS  v1.2
   Magma · Void · Ocean — dark-first, instrument-grade
   Fonts: Sora / Instrument Sans / Spline Sans Mono
   ============================================================ */

:root {
  /* ——— BRAND CORE ——— */
  --pt-magma:      #E23D28;  /* hot signal — use sparingly */
  --pt-mantle:     #8E1F12;  /* deep red, fills, hot fills */
  --pt-crimson:    #C2362B;  /* magma deepened for light surfaces */
  --pt-ocean:      #1B6FA8;  /* interactive, links */
  --pt-abyss:      #14406B;  /* deep blue, heading accents on light */
  --pt-azure:      #4FA3D9;  /* eyebrows, active nav on dark */
  --pt-ice:        #A8D4E8;  /* cool highlight on dark */

  /* ——— ACCENTS (sporadic highlight, extra data-series range) ——— */
  --pt-solar:      #E0A32E;  /* the star / MORS; bright, for dark surfaces and the data cycle */
  --pt-solar-deep: #C8860F;  /* solar deepened for light surfaces (3.06:1 on white) */
  --pt-verdant:    #57A05C;  /* habitable endpoint / surface; brand green, distinct from --pt-positive */

  /* ——— SURFACES · DARK (primary mode) ——— */
  --pt-void:       #05070B;  /* page background */
  --pt-basalt:     #0E131B;  /* raised surface, cards */
  --pt-basalt-2:   #12202E;  /* selected / hover surface */
  --pt-line-d:     #1A2230;  /* hairlines on dark */
  --pt-text-d:     #E9EEF2;  /* primary text on dark */
  --pt-text-d2:    #9FB0BE;  /* secondary text on dark */
  --pt-text-d3:    #5A6B7A;  /* muted labels on dark */

  /* ——— SURFACES · LIGHT ——— */
  --pt-paper:      #F2F5F7;  /* page background (cool white) */
  --pt-paper-2:    #FDFDFE;  /* raised card on light */
  --pt-paper-3:    #E3E9EE;  /* inset surface on light */
  --pt-line-l:     #D2DAE1;  /* hairlines on light */
  --pt-ink:        #10151B;  /* primary text on light */
  --pt-ink-2:      #3E4A55;  /* secondary text on light */
  --pt-ink-3:      #7A8894;  /* muted labels on light */

  /* ——— DATA VIZ — PHASE RAMP (diverging: magma → void → ocean) ——— */
  --pt-p1: #E23D28;
  --pt-p2: #8E1F12;
  --pt-p3: #3A120C;
  --pt-p4: #05070B;
  --pt-p5: #0E2A45;
  --pt-p6: #14406B;
  --pt-p7: #1B6FA8;
  --pt-p8: #4FA3D9;
  --pt-p9: #A8D4E8;

  /* ——— MODULE DOMAIN COLORS (stable across all artifacts) ——— */
  --pt-dom-interior:   #E23D28;  /* SPIDER, Aragog, Zalmoxis */
  --pt-dom-outgassing: #A03123;  /* CALLIOPE, Atmodeller */
  --pt-dom-tidal:      #593E74;  /* LovePy, Obliqua — red→blue midpoint (CVD-safe) */
  --pt-dom-chem:       #1B6FA8;  /* VULCAN, ZEPHYRUS */
  --pt-dom-atmos:      #4FA3D9;  /* AGNI, JANUS */
  --pt-dom-stellar:    #E0A32E;  /* MORS — solar gold, deepens on light for contrast */
  --pt-dom-accretion:  #A38F7A;  /* Morrigan, clay; sits clear of the reds and the blues */

  /* ——— SEMANTIC ——— */
  --pt-positive: #2E8B57;
  --pt-warning:  #C77726;
  --pt-danger:   #C2362B;
  --pt-info:     #1B6FA8;

  /* ——— TYPE ——— */
  --pt-font-display: "Sora", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pt-font-body:    "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pt-font-mono:    "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --pt-fs-12: 12px;  --pt-fs-13: 13px;  --pt-fs-14: 14px;
  --pt-fs-16: 16px;  --pt-fs-18: 18px;  --pt-fs-20: 20px;
  --pt-fs-24: 24px;  --pt-fs-32: 32px;  --pt-fs-44: 44px;
  --pt-fs-60: 60px;  --pt-fs-84: 84px;  --pt-fs-120: 120px;

  --pt-lh-tight: 1.05;
  --pt-lh-snug:  1.2;
  --pt-lh-body:  1.55;

  /* tracked mono labels (eyebrows, captions, metadata) */
  --pt-track-label: 0.18em;
  --pt-track-tag:   0.52em;

  /* ——— SPACING (8pt grid w/ 4 step) ——— */
  --pt-1: 4px;  --pt-2: 8px;   --pt-3: 12px;  --pt-4: 16px;
  --pt-5: 24px; --pt-6: 32px;  --pt-7: 48px;  --pt-8: 64px;
  --pt-9: 96px; --pt-10: 128px;

  /* ——— RADII — tight, instrument-grade ——— */
  --pt-r-0: 0;  --pt-r-1: 2px;  --pt-r-2: 4px;  --pt-r-3: 8px;
  --pt-r-pill: 999px;

  /* ——— ELEVATION — flat by default ——— */
  --pt-shadow-1: 0 1px 0 rgba(5,7,11,0.5);
  --pt-shadow-2: 0 8px 28px -10px rgba(5,7,11,0.6);
  --pt-glow-magma: 0 0 48px -8px rgba(226,61,40,0.45);   /* one per page max */
  --pt-glow-ocean: 0 0 48px -8px rgba(27,111,168,0.45);  /* one per page max */

  /* ——— BORDERS ——— */
  --pt-border-d:  1px solid var(--pt-line-d);
  --pt-border-l:  1px solid var(--pt-line-l);

  /* ——— GRADIENTS ——— */
  --pt-grad-phase: linear-gradient(90deg, #E23D28, #8E1F12 25%, #05070B 50%, #14406B 75%, #4FA3D9 92%, #A8D4E8);
  --pt-grad-hero:  linear-gradient(160deg, #8E1F12, #05070B 55%, #14406B 110%);
}

/* ============================================================
   LIGHT THEME — opt-in via [data-theme="light"] on <html>.
   Remaps the dark-named surface/text tokens to their light
   values so every rule that references them flips at once.
   ============================================================ */
:root { --pt-header-bg: rgba(5,7,11,0.85); }
[data-theme="light"] {
  --pt-header-bg: rgba(242,245,247,0.85);
  --pt-void:     #F2F5F7;
  --pt-basalt:   #FDFDFE;
  --pt-basalt-2: #E3E9EE;
  --pt-line-d:   #D2DAE1;
  --pt-text-d:   #10151B;
  --pt-text-d2:  #3E4A55;
  --pt-text-d3:  #7A8894;
  --pt-azure:    #1B6FA8;
  --pt-ice:      #14406B;
  --pt-shadow-2: 0 8px 28px -10px rgba(16,21,27,0.18);
  /* solar deepens on light for adequate contrast (mirrors magma/crimson) */
  --pt-solar:       #C8860F;
  --pt-dom-stellar: #C8860F;
}
/* regions that stay dark in BOTH themes (hero band, code blocks,
   API signatures): restore dark tokens for their subtree only. */
[data-theme="light"] .hero,
[data-theme="light"] pre.codeblock,
[data-theme="light"] .api-sig {
  --pt-text-d:  #E9EEF2;
  --pt-text-d2: #9FB0BE;
  --pt-text-d3: #5A6B7A;
  --pt-line-d:  #1A2230;
  --pt-azure:   #4FA3D9;
  --pt-ice:     #A8D4E8;
  --pt-solar:   #E0A32E;
  --pt-dom-stellar: #E0A32E;
}
[data-theme="light"] .foot-lockup .word,
[data-theme="light"] .lockup .word { color: var(--pt-ink); }

/* ——— base scopes ——— */
.pt-dark {
  font-family: var(--pt-font-body);
  color: var(--pt-text-d);
  background: var(--pt-void);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.pt-light {
  font-family: var(--pt-font-body);
  color: var(--pt-ink);
  background: var(--pt-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.pt-display { font-family: var(--pt-font-display); font-weight: 800; letter-spacing: -0.025em; }
.pt-mono    { font-family: var(--pt-font-mono); }
.pt-label   { font-family: var(--pt-font-mono); font-size: var(--pt-fs-12); letter-spacing: var(--pt-track-label); text-transform: uppercase; }

/* links */
.pt-dark a { color: var(--pt-azure); text-decoration: none; }
.pt-dark a:hover { color: var(--pt-ice); text-decoration: underline; text-underline-offset: 3px; }
.pt-light a { color: var(--pt-ocean); text-decoration: none; }
.pt-light a:hover { color: var(--pt-abyss); text-decoration: underline; text-underline-offset: 3px; }

/* focus — Magma outline, always visible */
.pt-dark :focus-visible, .pt-light :focus-visible {
  outline: 2px solid var(--pt-magma);
  outline-offset: 2px;
}
