/* ==========================================================================
   FlexAID∆S design tokens + shared shell — Symphony Instrument Analysis
   Dark only. Rainbow is reserved for note-data; all chrome uses the triad.
   Vanilla CSS, no build step.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg:        #0a0e14;
  --bg-panel:  rgba(16, 20, 28, 0.92);
  --bg-card:   rgba(16, 20, 28, 0.80);
  --bg-alt:    rgba(12, 16, 22, 0.50);
  --bg-canvas: #070b12;

  /* Triad — ΔG = ΔH − TΔS */
  --teal:  #22D3EE;   /* ΔH  · primary, CTA          */
  --terra: #A78BFA;   /* TΔS · section labels, alerts */
  --gold:  #FBBF24;   /* ΔG  · stats, key results     */

  /* Text */
  --fg:       #d4dced;
  --fg-muted: #8a93a8;
  --on-teal:  #04222a;
  --on-gold:  #2a1c00;

  /* Alpha washes */
  --teal-06: rgba(34,211,238,0.06);
  --teal-08: rgba(34,211,238,0.08);
  --teal-10: rgba(34,211,238,0.10);
  --teal-15: rgba(34,211,238,0.15);
  --teal-20: rgba(34,211,238,0.20);
  --terra-10: rgba(167,139,250,0.10);
  --terra-12: rgba(167,139,250,0.12);
  --terra-25: rgba(167,139,250,0.25);
  --terra-35: rgba(167,139,250,0.35);
  --gold-06: rgba(251,191,36,0.06);
  --gold-10: rgba(251,191,36,0.10);
  --gold-12: rgba(251,191,36,0.12);
  --gold-35: rgba(251,191,36,0.35);

  /* Type. SF Pro is not redistributable with a public page, so the brand
     body face falls back to the system stack per the handoff note. */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Tracking */
  --tracking-tight: -0.02em;
  --tracking-wide:  0.08em;
  --tracking-label: 0.15em;
  --tracking-tag:   0.20em;

  /* Radii */
  --r-xs: 3px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 9999px;

  /* Glow, never drop shadow */
  --glow-teal:        0 0 18px rgba(34,211,238,0.30);
  --glow-teal-strong: 0 0 24px rgba(34,211,238,0.50);
  --glow-terra:       0 0 20px rgba(167,139,250,0.10);
  --glow-gold:        0 0 20px rgba(251,191,36,0.10);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 0.18s;
  --t-base: 0.25s;
  --t-slow: 0.7s;

  /* The one non-triad, non-crayon colour: a scored hit */
  --hit-ring: #b6ff55;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(34,211,238,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-mono); margin: 0; }
p { margin: 0; }
a { color: var(--teal); }

/* ───────── Sticky nav ───────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 40px);
  background: rgba(10, 14, 20, 0.82);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--teal-08);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 0 0 auto;
}
.brand-chip {
  width: 30px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--teal-20);
  border-radius: var(--r-xs);
  background: var(--teal-06);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--teal);
}
.brand-word {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 22px);
  font-family: var(--font-mono);
  font-size: 12px;
}
.nav-links a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color var(--t-base) var(--ease-out);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--teal); }
@media (max-width: 680px) { .nav-links { display: none; } }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--teal-15);
  border-radius: var(--r-sm);
  overflow: hidden;
  flex: 0 0 auto;
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.lang-switch button[aria-pressed="true"] { background: var(--teal); color: var(--on-teal); }

/* ───────── Page container ───────── */
.page {
  width: 100%;
  padding: clamp(16px, 2.4vw, 30px) clamp(14px, 3vw, 40px) 44px;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vw, 22px);
}

/* ───────── Card ───────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--teal-08);
  border-radius: var(--r-lg);
  padding: 14px 16px 18px;
}
.card-sm { border-radius: var(--r-md); }

/* ───────── Eyebrow / divider / meta ───────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--tracking-tag);
  text-transform: uppercase;
  color: var(--terra);
}
.eyebrow::before { content: "// "; }
.eyebrow-page { color: var(--teal); }
.meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wide);
  color: var(--fg-muted);
}
.divider {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.2), transparent);
}
.head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* ───────── Stat block ───────── */
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-muted);
  display: block;
}
.stat-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  display: block;
}
.n-teal { color: var(--teal); }
.n-gold { color: var(--gold); }
.n-terra { color: var(--terra); }

/* ───────── Buttons ───────── */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 20px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--teal); color: var(--on-teal); box-shadow: var(--glow-teal); }
.btn-primary:hover { background: #3fdcf2; box-shadow: var(--glow-teal-strong); }
.btn-outline { background: transparent; color: var(--fg); border-color: var(--teal-20); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }
.btn-muted { background: transparent; color: var(--fg-muted); border-color: rgba(138,147,168,0.2); }
.btn-muted:hover { border-color: var(--fg-muted); color: var(--fg); }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ───────── Pills ───────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--r-pill);
  border: 1px solid var(--teal-20);
  background: var(--teal-06);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  padding: 4px 11px;
}
.pill[hidden] { display: none; }
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,211,238,0.5); }
  100% { box-shadow: 0 0 0 7px rgba(34,211,238,0); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1);     text-shadow: 0 0 22px rgba(34,211,238,0.18); }
  50%      { transform: scale(1.022); text-shadow: 0 0 40px rgba(34,211,238,0.4), 0 0 60px rgba(251,191,36,0.14); }
}
.breathe { animation: breathe 4s ease-in-out infinite; transform-origin: left bottom; }

/* ───────── Hero — content-driven height, never a fixed box ───────── */
.hero {
  position: relative;             /* no height here, on purpose */
  overflow: hidden;
  border: 1px solid var(--teal-10);
  border-radius: var(--r-lg);
  background: var(--bg-canvas);
}
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg-canvas);
}
.hero-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg,
    rgba(8,12,20,0.94) 0%,
    rgba(8,12,20,0.80) 40%,
    rgba(8,12,20,0.30) 68%,
    transparent 90%);
}
.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(22px, 4vh, 44px);
  padding: clamp(22px, 3vw, 38px);
}
.hero-copy { display: flex; flex-direction: column; gap: 15px; max-width: min(640px, 66%); }
.hero-copy h1 {
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--fg);
  margin: 0;
}
.hero-lead {
  font-size: clamp(0.94rem, 1.4vw, 1.06rem);
  line-height: 1.6;
  max-width: 60ch;
  color: var(--fg-muted);
}
.hero-stats {
  display: flex;
  align-items: flex-end;
  gap: clamp(18px, 3vw, 40px);
  flex-wrap: wrap;
}
.hero-stats > div { position: relative; }
.hero-stats > div + div { padding-left: clamp(18px, 3vw, 40px); }
.hero-stats > div + div::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 2px;
  width: 1px;
  background: var(--teal-15);
}

/* ───────── Footer ───────── */
.site-foot {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--fg-muted);
}
.site-foot a { color: var(--fg-muted); }
.site-foot a:hover { color: var(--teal); }

/* ───────── Reduced motion ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .breathe, .dot { animation: none !important; }
}

/* ───────── Narrow shell: hero copy drops below the canvas ───────── */
.page[data-narrow="1"] .hero-canvas { position: relative; height: 190px; }
.page[data-narrow="1"] .hero-scrim { display: none; }
.page[data-narrow="1"] .hero-content {
  min-height: 0 !important;
  background: var(--bg-card);
  border-top: 1px solid var(--teal-08);
}
.page[data-narrow="1"] .hero-copy { max-width: 100%; }

/* Long bilingual CTA labels must wrap rather than push the page sideways. */
.page[data-narrow="1"] .btn {
  white-space: normal;
  max-width: 100%;
}
.cta-row .btn { max-width: 100%; }
