/* ═══════════════════════════════════════════════════
   HELIX EPISTEMICA · style.css
   Editio Quinta · SYNEICH · Tabula Unica
═══════════════════════════════════════════════════ */

/* ── VARIABLES ──────────────────────────────────── */
:root {
  --bg:          #131316;
  --bg-deep:     #0e0e10;
  --surface:     #1c1c20;
  --surface-2:   #242428;
  --surface-3:   #2c2c32;
  --surface-4:   #34343c;
  --border:      #2e2e36;
  --border-soft: #252530;
  --border-strong: #3a3a44;

  --text:        #e0e0d8;
  --text-bright: #f4f4ee;
  --text-dim:    #7a7a85;
  --text-muted:  #48485a;

  --gold:        #c4a05a;
  --gold-bright: #d8b66a;
  --gold-dim:    #6e5a30;
  --gold-deep:   #3a2e1a;
  --teal:        #4a9e95;
  --teal-bright: #5fb8af;
  --teal-dim:    #285550;
  --teal-deep:   #142a28;
  --red:         #c46060;
  --red-bright:  #d97474;
  --red-dim:     #5c2828;
  --red-deep:    #2a1010;
  --blue:        #5a80b8;
  --blue-dim:    #2a3a5a;
  --purple:      #8e7cb8;
  --purple-dim:  #3a325a;

  --radius:      6px;
  --radius-lg:   10px;
  --radius-xl:   14px;

  --font-serif:  'Cormorant Garamond', Georgia, serif;
  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Courier New', monospace;

  --nav-h:       58px;
  --max-w:       1240px;

  --shadow-sm:   0 1px 2px rgba(0,0,0,.3);
  --shadow:      0 2px 12px rgba(0,0,0,.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.5);
}

/* ── RESET ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold-bright); }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
button { font-family: inherit; }
ul { list-style: none; }
em { font-style: italic; color: var(--gold); }
strong { font-weight: 500; color: var(--text-bright); }

/* ── NAV ─────────────────────────────────────────── */
#nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(19,19,22,0.92);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-bright); font-size: 13px; font-weight: 500;
  white-space: nowrap; letter-spacing: .04em;
}
.nav-brand-glyph {
  color: var(--gold); font-size: 18px;
  animation: spin-slow 16s linear infinite;
  display: inline-block;
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
.nav-links {
  display: flex; gap: 2px; margin-left: auto;
}
.nav-link {
  color: var(--text-dim); font-size: 12.5px; padding: 6px 11px;
  border-radius: var(--radius); transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text-bright); background: var(--surface-2); }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 11px;
  cursor: pointer; font-family: var(--font-mono);
  font-size: 11px; color: var(--text-dim);
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}
.lang-btn:hover { border-color: var(--gold); color: var(--text); }
.lang-active { color: var(--gold); }
.lang-divider { color: var(--border); }

#scroll-progress {
  position: absolute; bottom: -1px; left: 0;
  height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  transition: width .1s;
}

/* ── HERO ────────────────────────────────────────── */
#hero {
  min-height: 100vh;
  padding-top: var(--nav-h);
  display: flex; flex-direction: column;
  justify-content: center;
  position: relative; overflow: hidden;
  background: var(--bg);
}
.hero-bg-grid {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 50%, rgba(74,158,149,.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 20% 60%, rgba(196,160,90,.05) 0%, transparent 60%),
    linear-gradient(180deg, transparent 0%, var(--bg-deep) 100%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 60px 24px 60px;
  display: flex;
  align-items: center;
  gap: 80px;
  width: 100%;
}
.hero-text { flex: 1; min-width: 0; }
.hero-edition {
  font-size: 10.5px; letter-spacing: .14em;
  color: var(--text-muted); margin-bottom: 22px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(56px, 9vw, 110px);
  font-weight: 300; line-height: .95;
  color: var(--text-bright);
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}
.hero-title em {
  font-style: italic; color: var(--gold);
  font-weight: 400;
}
.hero-subtitle {
  font-size: 16px; color: var(--text-dim);
  line-height: 1.6; margin-bottom: 28px;
  font-weight: 300;
  max-width: 480px;
}
.hero-subtitle strong { color: var(--gold); font-weight: 500; }
.hero-foundations {
  display: flex; flex-wrap: wrap; gap: 4px; row-gap: 8px;
  margin-bottom: 32px;
}
.foundation-tag {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .08em; padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 3px;
  color: var(--text-muted); background: var(--surface);
  transition: border-color .2s, color .2s;
  text-transform: uppercase;
}
.foundation-tag:hover { border-color: var(--teal); color: var(--teal); }
.foundation-sep { color: var(--text-muted); font-size: 10px; align-self: center; }

.hero-cta-row {
  display: flex; flex-wrap: wrap; gap: 20px;
  margin-top: 8px;
}
.cta-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 0;
  font-size: 13px; color: var(--text-dim);
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.cta-link:hover { color: var(--gold); border-bottom-color: var(--gold-dim); }
.cta-arrow { font-family: var(--font-mono); font-size: 14px; }

/* Hero visual */
.hero-visual {
  display: flex; gap: 14px;
  align-items: flex-start;
  flex-shrink: 0;
}
.helix-svg {
  width: 90px; height: 380px;
  opacity: .9;
}
.helix-a, .helix-b {
  stroke-dasharray: 1100;
  stroke-dashoffset: 1100;
  animation: draw-strand 2.5s ease-out forwards;
}
.helix-b { animation-delay: .4s; }
@keyframes draw-strand { to { stroke-dashoffset: 0; } }

.phase-nodes circle {
  opacity: 0;
  animation: node-appear .4s ease-out forwards;
}
.phase-nodes circle:nth-child(1) { animation-delay: 1.0s; }
.phase-nodes circle:nth-child(2) { animation-delay: 1.15s; }
.phase-nodes circle:nth-child(3) { animation-delay: 1.30s; }
.phase-nodes circle:nth-child(4) { animation-delay: 1.45s; }
.phase-nodes circle:nth-child(5) { animation-delay: 1.60s; }
.phase-nodes circle:nth-child(6) { animation-delay: 1.75s; }
.phase-nodes circle:nth-child(7) { animation-delay: 1.90s; }
.phase-nodes circle:nth-child(8) { animation-delay: 2.05s; }
.phase-nodes circle:nth-child(9) { animation-delay: 2.20s; }
.phase-nodes circle:nth-child(10) { animation-delay: 2.35s; }
@keyframes node-appear { from { opacity: 0; transform: scale(0); transform-origin: center; } to { opacity: 1; } }
.critical-node { filter: drop-shadow(0 0 4px var(--red)); }

.helix-labels {
  display: flex; flex-direction: column;
  gap: 0; justify-content: space-between;
  height: 380px; padding: 1px 0;
}
.hlabel {
  font-size: 11px; color: var(--text-muted);
  line-height: 1; font-weight: 500;
}
.hlabel.critical { color: var(--red); }
.hlabel.new { color: var(--teal); }

.hero-motto {
  position: relative;
  padding: 16px 24px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 14px; color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
}

/* ── PATHOLOGY BAR ───────────────────────────────── */
.pathology-bar {
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 16px 24px;
  overflow: hidden;
}
.pathology-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
}
.pathology-label-tr, .pathology-label-en {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .08em; color: var(--red);
  white-space: nowrap;
}
.pathologies { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.pathology-item {
  font-size: 12px; color: var(--text-dim);
  transition: color .2s;
}
.pathology-item:hover { color: var(--text); }
.pathology-sep { color: var(--text-muted); }

/* ── SECTIONS ────────────────────────────────────── */
section {
  max-width: var(--max-w); margin: 0 auto;
  padding: 88px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.section-header { margin-bottom: 44px; max-width: 720px; }
.section-eyebrow {
  font-size: 10px; letter-spacing: .14em;
  color: var(--gold); margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 300; color: var(--text-bright);
  margin-bottom: 14px;
  line-height: 1.05;
}
.section-desc-tr, .section-desc-en {
  color: var(--text-dim); font-size: 14.5px;
  line-height: 1.6;
}

/* ── CONSTITUTIO VITAE ───────────────────────────── */
.root-axiom {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  margin-bottom: 32px;
  text-align: center;
  position: relative;
}
.root-axiom::before, .root-axiom::after {
  content: '❦';
  position: absolute;
  color: var(--gold-dim);
  font-size: 18px;
}
.root-axiom::before { top: 14px; left: 50%; transform: translateX(-50%); }
.root-axiom::after { bottom: 14px; left: 50%; transform: translateX(-50%); }
.root-axiom-label {
  font-size: 10px; letter-spacing: .15em;
  color: var(--gold); margin-bottom: 18px;
}
.root-axiom-latin {
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 400; color: var(--gold-bright);
  margin-bottom: 18px; line-height: 1.2;
}
.root-axiom-trans {
  font-family: var(--font-serif);
  font-size: 17px; color: var(--text-bright);
  font-style: italic; margin-bottom: 24px;
}
.root-axiom-note {
  font-size: 13.5px; color: var(--text-dim);
  line-height: 1.65; max-width: 640px;
  margin: 0 auto;
}

.constitutio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
.constitutio-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.constitutio-col.prohibita { border-top: 2px solid var(--red); }
.constitutio-col.disciplinae { border-top: 2px solid var(--gold); }
.constitutio-col.virtutes { border-top: 2px solid var(--teal); }
.col-eyebrow {
  font-size: 10px; letter-spacing: .14em;
  margin-bottom: 4px;
}
.constitutio-col.prohibita .col-eyebrow { color: var(--red); }
.constitutio-col.disciplinae .col-eyebrow { color: var(--gold); }
.constitutio-col.virtutes .col-eyebrow { color: var(--teal); }
.col-title {
  font-family: var(--font-serif); font-size: 18px;
  font-weight: 400; color: var(--text-bright);
  margin-bottom: 16px;
}
.constitutio-list li {
  font-size: 13px; color: var(--text-dim);
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
  line-height: 1.5;
}
.constitutio-list li:last-child { border-bottom: none; }

.transitiones {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}
.trans-header { margin-bottom: 18px; }
.trans-eyebrow {
  font-size: 10px; letter-spacing: .14em;
  color: var(--blue); display: block; margin-bottom: 6px;
}
.trans-note {
  font-size: 12px; color: var(--text-muted);
  font-style: italic;
}
.trans-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.trans-item {
  display: flex; gap: 12px; align-items: flex-start;
}
.trans-num {
  font-size: 16px; color: var(--blue);
  flex-shrink: 0; padding-top: 1px;
  min-width: 18px;
}
.trans-info { flex: 1; }
.trans-name {
  font-size: 14px; color: var(--text);
  margin-bottom: 3px;
}
.trans-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }

/* ── ARCHITECTURE FLOW ───────────────────────────── */
#mimari { padding-bottom: 64px; padding-top: 64px; }
.architecture-flow {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}
.flow-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; justify-content: center;
  margin-bottom: 20px;
}
.flow-node {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--gold); font-size: 14px; font-weight: 500;
  transition: all .2s;
}
.flow-node:hover { transform: scale(1.1); border-color: var(--gold); color: var(--gold-bright); }
.flow-node.new { color: var(--teal); border-color: var(--teal-dim); }
.flow-node.new:hover { border-color: var(--teal); color: var(--teal-bright); }
.flow-node.critical { color: var(--red); border-color: var(--red-dim); box-shadow: 0 0 8px rgba(196,96,96,.2); }
.flow-node.critical:hover { border-color: var(--red); color: var(--red-bright); }
.flow-arrow { color: var(--text-muted); font-size: 14px; }
.flow-loop { color: var(--teal); font-size: 22px; margin-left: 4px; }
.flow-legend {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 24px; padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text-dim);
}
.flow-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%;
}
.legend-dot.gold { background: var(--gold); }
.legend-dot.teal { background: var(--teal); }
.legend-dot.red { background: var(--red); }

/* ── PHASE GRID ──────────────────────────────────── */
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}
.phase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.phase-card:hover { border-color: var(--gold-dim); transform: translateY(-1px); }
.phase-card.open { border-color: var(--gold); box-shadow: var(--shadow); }
.phase-card.critical-phase { border-left: 3px solid var(--red); }
.phase-card.new-phase { border-left: 3px solid var(--teal); }

.phase-header {
  padding: 20px 22px;
  display: flex; align-items: flex-start; gap: 14px;
}
.phase-number {
  font-family: var(--font-mono);
  font-size: 24px; font-weight: 500;
  color: var(--gold); line-height: 1;
  min-width: 42px;
  padding-top: 1px;
}
.phase-number.critical { color: var(--red); }
.phase-number.new { color: var(--teal); }
.phase-header-info { flex: 1; min-width: 0; }
.phase-latin {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: .08em;
  color: var(--text-muted); margin-bottom: 4px;
  text-transform: uppercase;
}
.phase-name {
  font-family: var(--font-serif);
  font-size: 19px; font-weight: 400; line-height: 1.2;
  color: var(--text-bright); margin-bottom: 7px;
}
.phase-function {
  font-size: 12.5px; color: var(--text-dim); line-height: 1.55;
}
.phase-header-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 6px; flex-shrink: 0;
}
.phase-badge {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .09em; padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}
.badge-new { background: var(--teal-deep); color: var(--teal); border: 1px solid var(--teal-dim); }
.badge-critical { background: var(--red-deep); color: var(--red); border: 1px solid var(--red-dim); }
.badge-required { background: var(--gold-deep); color: var(--gold); border: 1px solid var(--gold-dim); }
.phase-expand-icon {
  color: var(--text-muted); font-size: 14px;
  transition: transform .25s;
}
.phase-card.open .phase-expand-icon { transform: rotate(180deg); color: var(--gold); }

.phase-body {
  max-height: 0; overflow: hidden;
  transition: max-height .45s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 0 solid var(--border);
}
.phase-card.open .phase-body {
  max-height: 4000px;
  border-top-width: 1px;
}
.phase-body-inner { padding: 22px; }

.phase-tabs {
  display: flex; gap: 2px;
  margin-bottom: 22px;
  background: var(--surface-2);
  border-radius: var(--radius); padding: 3px;
}
.phase-tab {
  flex: 1; padding: 7px 10px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .05em; color: var(--text-muted);
  background: transparent; border: none; cursor: pointer;
  border-radius: 4px; transition: background .15s, color .15s;
  text-transform: uppercase;
}
.phase-tab.active { background: var(--surface-3); color: var(--text-bright); }
.phase-tab:hover:not(.active) { color: var(--text-dim); }

.phase-panel { display: none; animation: fade-in-up .25s ease-out; }
.phase-panel.active { display: block; }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.content-block { font-size: 14px; line-height: 1.7; color: var(--text-dim); }
.content-block h4 {
  font-family: var(--font-serif); font-size: 17px; font-weight: 500;
  color: var(--text-bright); margin: 18px 0 10px;
}
.content-block h4:first-child { margin-top: 0; }
.content-block p { margin-bottom: 12px; }
.content-block ul { padding-left: 18px; margin-bottom: 12px; list-style: disc; }
.content-block ul li { margin-bottom: 6px; padding-left: 4px; }
.content-block strong { color: var(--text-bright); }
.content-block em { color: var(--gold); font-style: italic; }
.content-block code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-3); padding: 2px 6px;
  border-radius: 3px; color: var(--teal);
}

.quaestio-box {
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius); padding: 16px 18px;
  font-size: 14px; color: var(--text-bright);
  font-style: italic; line-height: 1.6;
  font-family: var(--font-serif);
}
.quaestio-label {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .12em; color: var(--gold);
  margin-bottom: 8px; display: block; font-style: normal;
}

.productum-box {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius); padding: 16px 18px;
  font-size: 13px; color: var(--text-dim); line-height: 1.65;
}
.productum-label {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .12em; color: var(--teal);
  margin-bottom: 8px; display: block;
}

.example-box {
  background: linear-gradient(135deg, rgba(90,128,184,.07), rgba(90,128,184,.03));
  border: 1px solid var(--blue-dim);
  border-radius: var(--radius); padding: 18px;
  font-size: 13px; line-height: 1.65; color: var(--text-dim);
}
.example-context {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .08em; color: var(--blue);
  margin-bottom: 10px; text-transform: uppercase;
}
.example-box p { margin-bottom: 8px; }
.example-box strong { color: var(--text); }

.conf-scale {
  display: grid; grid-template-columns: auto 1fr; gap: 8px 14px;
  align-items: baseline; margin: 14px 0;
}
.conf-grade {
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--gold); white-space: nowrap; font-weight: 500;
}
.conf-desc { font-size: 13px; color: var(--text-dim); }

.tier-table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.tier-table th {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .08em; color: var(--text-muted);
  text-align: left; padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}
.tier-table td {
  padding: 8px 10px; font-size: 12px; color: var(--text-dim);
  border-bottom: 1px solid var(--border-soft);
}
.tier-table tr:last-child td { border-bottom: none; }
.tier-num { font-family: var(--font-mono); color: var(--gold); font-weight: 500; }

.qtype-list { margin: 12px 0; }
.qtype-item {
  display: flex; gap: 14px; padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}
.qtype-item:last-child { border-bottom: none; }
.qtype-name {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--teal); min-width: 168px; flex-shrink: 0;
  font-weight: 500;
}
.qtype-desc { font-size: 12.5px; color: var(--text-dim); }

/* ── PROTOCOLS ───────────────────────────────────── */
.protocol-list { display: flex; flex-direction: column; gap: 10px; }
.protocol-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  cursor: pointer; transition: border-color .2s;
}
.protocol-item:hover { border-color: var(--teal-dim); }
.protocol-item.open { border-color: var(--teal); }
.protocol-header {
  padding: 18px 22px;
  display: flex; align-items: center; gap: 16px;
}
.protocol-id {
  font-family: var(--font-mono); font-size: 20px;
  color: var(--teal); min-width: 30px;
  font-weight: 500;
}
.protocol-info { flex: 1; }
.protocol-latin {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: 3px;
  text-transform: uppercase;
}
.protocol-name { font-size: 15.5px; color: var(--text-bright); font-weight: 500; }
.protocol-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }
.protocol-expand {
  color: var(--text-muted); transition: transform .2s;
  font-size: 14px;
}
.protocol-item.open .protocol-expand { transform: rotate(180deg); color: var(--teal); }
.protocol-body {
  max-height: 0; overflow: hidden;
  transition: max-height .4s cubic-bezier(0.4,0,0.2,1);
  border-top: 0 solid var(--border);
}
.protocol-item.open .protocol-body { max-height: 2200px; border-top-width: 1px; }
.protocol-body-inner { padding: 22px; font-size: 14px; color: var(--text-dim); line-height: 1.7; }
.protocol-body-inner p { margin-bottom: 11px; }
.protocol-body-inner strong { color: var(--text-bright); }
.protocol-body-inner em { color: var(--gold); }
.protocol-body-inner code { font-family: var(--font-mono); font-size: 12px; color: var(--teal); background: var(--surface-2); padding: 2px 6px; border-radius: 3px; }
.protocol-body-inner ul { padding-left: 18px; margin-bottom: 11px; list-style: disc; }
.protocol-body-inner li { margin-bottom: 5px; padding-left: 4px; }

/* ── FORMULAE ────────────────────────────────────── */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.formula-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color .2s, transform .2s;
}
.formula-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.formula-card.primary { border-top: 2px solid var(--gold); }
.formula-card.derived { border-top: 2px solid var(--teal); }
.formula-card.threshold { border-top: 2px solid var(--blue); }
.formula-name-mono {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .12em;
  margin-bottom: 6px; text-transform: uppercase;
}
.formula-card.primary .formula-name-mono { color: var(--gold); }
.formula-card.derived .formula-name-mono { color: var(--teal); }
.formula-card.threshold .formula-name-mono { color: var(--blue); }
.formula-name {
  font-family: var(--font-serif); font-size: 18px;
  color: var(--text-bright); font-weight: 500;
  margin-bottom: 14px;
}
.formula-eq {
  font-family: var(--font-mono); font-size: 16px;
  color: var(--gold-bright); padding: 14px 12px;
  background: var(--bg-deep); border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: .03em;
  word-break: break-word;
}
.formula-desc {
  font-size: 12.5px; color: var(--text-dim);
  line-height: 1.55;
}
.formula-desc strong { color: var(--text); }

/* ── SCALES ──────────────────────────────────────── */
.scale-tabs {
  display: flex; gap: 8px; margin-bottom: 28px;
  flex-wrap: wrap;
}
.scale-tab {
  padding: 9px 22px;
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: .06em; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: all .15s; text-transform: uppercase;
}
.scale-tab:hover { color: var(--text-bright); border-color: var(--gold-dim); }
.scale-tab.active { color: var(--gold); border-color: var(--gold); background: var(--surface-2); box-shadow: 0 0 0 1px rgba(196,160,90,.2); }

.scale-panels { position: relative; }
.scale-panel { display: none; }
.scale-panel.active { display: block; animation: fade-in-up .3s ease-out; }
.scale-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.scale-meta {
  display: flex; gap: 12px; margin-bottom: 20px;
  flex-wrap: wrap;
}
.scale-time, .scale-phases, .scale-tag {
  font-size: 11px; letter-spacing: .07em;
  color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 10px;
}
.scale-tag { color: var(--gold); border-color: var(--gold-dim); }
.scale-name {
  font-family: var(--font-serif); font-size: 26px;
  font-weight: 400; color: var(--text-bright); margin-bottom: 14px;
  font-style: italic;
}
.scale-when {
  font-size: 14px; color: var(--text-dim);
  margin-bottom: 26px; line-height: 1.6;
}
.scale-when strong { color: var(--gold); }
.scale-structure { margin-bottom: 26px; }
.scale-phase-row {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 14px 0; border-bottom: 1px solid var(--border-soft);
}
.scale-phase-row:last-child { border-bottom: none; }
.scale-ph-id { color: var(--gold); font-size: 14px; min-width: 32px; padding-top: 1px; font-weight: 500; }
.scale-ph-info { flex: 1; }
.scale-ph-name { font-size: 14.5px; color: var(--text-bright); margin-bottom: 4px; }
.scale-ph-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.scale-dur { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); }

.scale-template {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
}
.template-header {
  font-size: 10px; letter-spacing: .12em;
  color: var(--text-muted); padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.template-pre {
  padding: 18px; font-size: 12.5px;
  color: var(--text-dim); line-height: 1.55;
  font-family: var(--font-mono);
  white-space: pre-wrap;
}

.scale-unskippable {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.unskip-label {
  font-size: 10px; letter-spacing: .08em; color: var(--red);
  text-transform: uppercase;
}
.unskip-item {
  font-size: 12px; color: var(--text-dim);
  background: var(--surface-3); padding: 3px 9px;
  border-radius: 3px; border: 1px solid var(--border);
}
.unskip-item.critical { border-color: var(--red-dim); color: var(--red); background: var(--red-deep); }

.quinta-overview {
  font-size: 14px; color: var(--text-dim); line-height: 1.7;
  margin-bottom: 26px;
}
.quinta-overview p { margin-bottom: 12px; }
.quinta-overview ul { list-style: none; padding-left: 0; }
.quinta-overview li {
  padding: 6px 0 6px 22px; position: relative;
  border-bottom: 1px solid var(--border-soft);
}
.quinta-overview li:last-child { border-bottom: none; }
.quinta-overview li::before {
  content: '▸'; position: absolute; left: 4px;
  color: var(--gold); font-size: 12px;
}
.quinta-overview strong { color: var(--gold); font-weight: 500; }

/* ── SYNEICH CODE WINDOW ─────────────────────────── */
.code-window {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
}
.code-window-chrome {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.code-window-chrome .dot {
  width: 11px; height: 11px; border-radius: 50%;
  display: inline-block;
}
.dot-r { background: #c46060; }
.dot-y { background: #c4a05a; }
.dot-g { background: #4a9e95; }
.code-filename {
  margin-left: 12px;
  font-size: 11px; color: var(--text-muted);
  letter-spacing: .04em;
}
.code-block {
  padding: 24px 28px;
  font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.65;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}
.c-comment   { color: var(--text-muted); font-style: italic; }
.c-keyword   { color: var(--purple); font-weight: 500; }
.c-namespace { color: var(--gold-bright); font-weight: 500; }
.c-type      { color: var(--teal-bright); }
.c-fn        { color: var(--blue); }
.c-const     { color: var(--gold); }
.c-attr      { color: var(--purple); }
.c-accept    { color: #6ec48c; font-weight: 600; }
.c-reject    { color: var(--red-bright); font-weight: 600; }
.c-suspend   { color: var(--gold-bright); font-weight: 600; }

.syneich-explainer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.exp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex; gap: 16px; align-items: flex-start;
}
.exp-num {
  font-size: 22px; color: var(--gold);
  min-width: 42px; line-height: 1;
  padding-top: 2px; font-weight: 500;
}
.exp-info { flex: 1; }
.exp-title {
  font-size: 14.5px; color: var(--text-bright);
  margin-bottom: 6px; font-weight: 500;
}
.exp-desc {
  font-size: 12.5px; color: var(--text-dim);
  line-height: 1.6;
}

/* ── AXIOMS ──────────────────────────────────────── */
.axiom-list { display: flex; flex-direction: column; gap: 10px; }
.axiom-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  display: grid; grid-template-columns: auto 1fr;
  gap: 18px; align-items: start;
  transition: border-color .2s;
}
.axiom-item:hover { border-color: var(--gold-dim); }
.axiom-num {
  font-family: var(--font-mono); font-size: 20px;
  color: var(--gold); padding-top: 1px; min-width: 32px;
  font-weight: 500;
}
.axiom-name {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .07em; color: var(--text-muted);
  margin-bottom: 8px; text-transform: uppercase;
}
.axiom-content { font-size: 14px; color: var(--text-dim); line-height: 1.65; }
.axiom-content strong { color: var(--text-bright); }
.axiom-content em { color: var(--gold); }

/* ── SUBSTRATUM (theoretical traditions) ─────────── */
.substratum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.sub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: border-color .2s, transform .2s;
}
.sub-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.sub-thinker {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .12em; color: var(--gold);
  margin-bottom: 8px; text-transform: uppercase;
}
.sub-name {
  font-family: var(--font-serif); font-size: 17px;
  font-weight: 500; color: var(--text-bright);
  margin-bottom: 10px; line-height: 1.25;
}
.sub-content {
  font-size: 12.5px; color: var(--text-dim); line-height: 1.6;
}
.sub-content em { color: var(--gold); }
.sub-content strong { color: var(--text-bright); }

/* ── CONTEXTS ────────────────────────────────────── */
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px; margin-bottom: 56px;
}
.context-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.context-card.ai-safety { border-top: 2px solid var(--teal); }
.context-card.comp-neuro { border-top: 2px solid var(--gold); }
.context-card.philosophy { border-top: 2px solid var(--blue); }
.context-card.self-applied { border-top: 2px solid var(--purple); }
.context-type {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .1em; margin-bottom: 12px;
  text-transform: uppercase;
}
.type-ai-safety { color: var(--teal); }
.type-neuro { color: var(--gold); }
.type-philo { color: var(--blue); }
.type-self { color: var(--purple); }
.context-card h3 {
  font-family: var(--font-serif); font-size: 19px;
  font-weight: 500; color: var(--text-bright); margin-bottom: 12px;
  line-height: 1.25;
}
.context-card p { font-size: 13px; color: var(--text-dim); line-height: 1.65; margin-bottom: 10px; }
.context-card p:last-child { margin-bottom: 0; }
.context-card strong { color: var(--text-bright); }
.context-card em { color: var(--gold); }
.context-card ul { padding-left: 18px; list-style: disc; margin-bottom: 10px; }
.context-card li { font-size: 12.5px; color: var(--text-dim); margin-bottom: 5px; line-height: 1.55; }

/* Fitzgerald quote */
.fitzgerald-quote {
  text-align: center; padding: 56px 24px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin: 16px 0;
}
.fitzgerald-quote blockquote {
  font-family: var(--font-serif); font-size: clamp(18px, 2.6vw, 24px);
  font-weight: 300; color: var(--text); line-height: 1.5;
  font-style: italic; max-width: 760px; margin: 0 auto 18px;
}
.fitzgerald-quote cite {
  font-size: 12px; color: var(--text-muted);
  font-family: var(--font-mono); letter-spacing: .06em;
}

.closing-mottoes {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 32px; padding: 24px 0;
}
.cm-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; text-align: center;
}
.cm-latin {
  font-family: var(--font-serif); font-size: 16px;
  color: var(--gold); font-style: italic;
}
.cm-trans {
  font-size: 11px; color: var(--text-muted);
  letter-spacing: .04em;
}

/* ── FOOTER ──────────────────────────────────────── */
#footer {
  padding: 48px 24px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-deep);
}
.footer-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; justify-content: space-between;
  align-items: flex-start; flex-wrap: wrap; gap: 28px;
}
.footer-title {
  font-size: 13px; letter-spacing: .12em; color: var(--gold);
  margin-bottom: 8px;
}
.footer-edition { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.footer-tagline {
  font-size: 14px; color: var(--text-dim);
  font-style: italic; font-family: var(--font-serif);
}
.footer-sub {
  font-size: 11.5px; color: var(--text-muted);
  margin-bottom: 8px; max-width: 480px;
  line-height: 1.5;
}
.footer-scales { font-size: 10px; letter-spacing: .07em; color: var(--text-muted); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .hero-inner { flex-direction: column; gap: 40px; padding: 40px 16px 60px; }
  .hero-visual { align-self: flex-start; }
  .helix-svg { width: 70px; height: 320px; }
  .helix-labels { height: 320px; }
  section { padding: 56px 16px; }
  .constitutio-grid { grid-template-columns: 1fr; }
  .syneich-explainer { grid-template-columns: 1fr; }
  .code-block { padding: 18px 16px; font-size: 11.5px; }
  .root-axiom { padding: 32px 24px; }
}
@media (max-width: 640px) {
  .phase-grid { grid-template-columns: 1fr; }
  .formula-grid { grid-template-columns: 1fr; }
  .substratum-grid { grid-template-columns: 1fr; }
  .context-grid { grid-template-columns: 1fr; }
  .scale-tabs { flex-wrap: wrap; }
  .footer-inner { flex-direction: column; }
  .pathology-inner { flex-direction: column; gap: 8px; align-items: flex-start; }
  .hero-cta-row { flex-direction: column; gap: 12px; }
  .scale-content { padding: 22px 18px; }
  .scale-meta { gap: 6px; }
  .closing-mottoes { gap: 18px; }
}
@media (max-width: 480px) {
  .hero-title { font-size: 48px; }
  .root-axiom-latin { font-size: 26px; }
  .nav-brand-text { display: none; }
}

/* ── PRINT ───────────────────────────────────────── */
@media print {
  #nav, .hero-cta-row, .lang-btn, .hero-bg-grid { display: none !important; }
  body { background: white; color: black; }
  .phase-card.open .phase-body { max-height: none; }
}
