/* ============================================
   Тайны древних языков — modern editorial/research
   Two themes (editorial-light, research-dark)
   Three font pairs (modern, editorial, brutalist)
   ============================================ */

/* ---------- TOKENS ---------- */
:root {
  /* default: editorial-light theme */
  --bg:        #f7f6f3;
  --bg-soft:   #efece6;
  --surface:   #ffffff;
  --surface-2: #faf8f3;
  --border:    #e5e1d7;
  --border-strong: #d3cdbe;
  --ink:       #0a0a0a;
  --ink-mid:   #3a3833;
  --ink-soft:  #6b6557;
  --ink-mute:  #9c9587;
  --accent:    #c97a2a;
  --accent-soft: rgba(201, 122, 42, 0.10);
  --accent-deep: #8c4f15;
  --scholar:   #1a4d7a;
  --scholar-soft: rgba(26, 77, 122, 0.08);
  --success:   #2e7d4f;
  --error:     #b94a3f;

  /* default: modern font pair */
  --font-display: 'Newsreader', 'Times New Roman', serif;
  --font-body:    'Manrope', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', monospace;
  --font-glyph:   'Noto Sans Egyptian Hieroglyphs', serif;

  --maxw: 1280px;
  --gutter: 32px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(20, 16, 8, 0.04), 0 1px 1px rgba(20, 16, 8, 0.03);
  --shadow-md: 0 4px 18px rgba(20, 16, 8, 0.06), 0 2px 6px rgba(20, 16, 8, 0.04);
  --shadow-lg: 0 24px 60px rgba(20, 16, 8, 0.10), 0 8px 20px rgba(20, 16, 8, 0.06);
}

[data-theme="dark"] {
  --bg:        #0a0a0c;
  --bg-soft:   #111114;
  --surface:   #15151a;
  --surface-2: #1c1c22;
  --border:    rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --ink:       #f0eee8;
  --ink-mid:   #c9c5bb;
  --ink-soft:  #8a857a;
  --ink-mute:  #5c5950;
  --accent:    #d4a857;
  --accent-soft: rgba(212, 168, 87, 0.12);
  --accent-deep: #f0c674;
  --scholar:   #6aa6df;
  --scholar-soft: rgba(106, 166, 223, 0.10);
  --success:   #7ec48f;
  --error:     #e08a7f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55), 0 8px 20px rgba(0, 0, 0, 0.4);
}

[data-font="editorial"] {
  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
}

[data-font="brutalist"] {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter Tight', system-ui, sans-serif;
  --font-mono:    'Space Mono', monospace;
}

/* ---------- BASE ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}

::selection { background: var(--accent); color: var(--bg); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-weight: 400; }

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; }

/* ---------- TOPBAR ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: background-color .35s, border-color .35s;
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 14px var(--gutter);
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-glyph {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 6px;
  font-family: var(--font-glyph);
  font-size: 16px;
  line-height: 1;
}
.brand-text {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-text em {
  font-style: normal;
  color: var(--ink-soft);
  font-weight: 400;
  margin-left: 4px;
}
.nav {
  display: flex; gap: 4px;
  justify-content: center;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.nav a {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  transition: color .2s, background-color .2s;
}
.nav a:hover { color: var(--ink); background: var(--bg-soft); }
.nav a.active { color: var(--ink); background: var(--bg-soft); }

.topbar-end { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.theme-toggle {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink-soft);
  transition: all .2s;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--border-strong); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.cta-pill {
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  transition: opacity .2s;
}
.cta-pill:hover { opacity: 0.85; }

.burger { display: none; background: var(--surface); border: 1px solid var(--border); width: 34px; height: 34px; border-radius: 8px; flex-direction: column; gap: 3px; align-items: center; justify-content: center; }
.burger span { width: 14px; height: 1.5px; background: var(--ink); display: block; }

/* ---------- HERO ---------- */
.hero {
  padding: 140px var(--gutter) 80px;
  max-width: var(--maxw);
  margin: 0 auto;
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 80px;
  align-items: end;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero-title {
  font-size: clamp(48px, 8vw, 104px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  font-weight: 400;
  margin-bottom: 28px;
}
.hero-title .italic {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}
.hero-sub {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 520px;
  line-height: 1.55;
  margin-bottom: 36px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 48px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all .2s;
  cursor: pointer;
  background: none;
  color: var(--ink);
  text-decoration: none;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,0.18); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--bg-soft); }
.btn-ghost { color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

.hero-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  max-width: 540px;
}
.hero-meta dt {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.hero-meta dd {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.hero-meta dd .small {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
  letter-spacing: 0;
}

/* hero specimen card */
.hero-specimen {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 28px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.specimen-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.specimen-head .live {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent);
}
.specimen-head .live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.6); }
}
.specimen-glyph {
  font-family: var(--font-glyph);
  font-size: 140px;
  line-height: 1;
  color: var(--ink);
  text-align: center;
  padding: 30px 0;
  position: relative;
}
.specimen-glyph::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  width: 60px; height: 1px;
  background: var(--accent);
}
.specimen-foot {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.specimen-foot div {
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--r-sm);
}
.specimen-foot .label { color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.specimen-foot .value { color: var(--ink); font-size: 13px; }

/* drifting glyph background — subtle */
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
  opacity: 0.5;
}
[data-theme="dark"] .hero-bg { opacity: 0.35; }
.hero-bg-glyphs {
  position: absolute;
  top: 0; left: -10%;
  width: 130%;
  font-family: var(--font-glyph);
  font-size: 120px;
  line-height: 1.4;
  color: var(--ink);
  opacity: 0.025;
  letter-spacing: 0.3em;
  word-spacing: 0.5em;
  pointer-events: none;
  user-select: none;
  white-space: normal;
  animation: drift 90s linear infinite;
}
[data-theme="dark"] .hero-bg-glyphs { opacity: 0.05; }
@keyframes drift {
  0% { transform: translate(0,0); }
  100% { transform: translate(-3%, -4%); }
}

/* ---------- SECTION CHROME ---------- */
.section {
  padding: 100px var(--gutter);
  max-width: var(--maxw);
  margin: 0 auto;
}
.section-alt {
  max-width: none;
  padding: 0;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-alt-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.section-alt .section { padding-left: 0; padding-right: 0; }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 60px;
  margin-bottom: 64px;
  align-items: end;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 8px;
}
.kicker::before {
  content: ''; width: 14px; height: 1px; background: var(--ink-soft);
}
.section-head h2 {
  font-size: clamp(34px, 4.5vw, 56px);
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-top: 18px;
  font-weight: 400;
}
.section-head h2 .italic { font-style: italic; font-weight: 300; color: var(--accent); }
.lead {
  font-size: 18px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 540px;
}

/* ---------- SCRIPT CARDS ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.card {
  background: var(--surface);
  padding: 32px 28px 28px;
  position: relative;
  transition: background-color .3s, transform .3s;
  display: flex; flex-direction: column;
  min-height: 360px;
}
.card:hover { background: var(--surface-2); }
.card-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  margin-bottom: 28px;
}
.card-glyph {
  font-family: var(--font-glyph);
  font-size: 56px;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 24px;
}
.card.mystery .card-glyph { color: var(--accent); }
.card h3 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.card .card-where {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.card p {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.55;
  margin-bottom: 20px;
}
.card-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-samples {
  font-family: var(--font-glyph);
  font-size: 22px;
  color: var(--ink-mid);
  letter-spacing: 0.15em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
}
.status.ok { color: var(--success); background: color-mix(in oklab, var(--success) 12%, transparent); }
.status.ok::before { background: var(--success); }
.status.half { color: var(--accent-deep); background: var(--accent-soft); }
[data-theme="dark"] .status.half { color: var(--accent-deep); }
.status.half::before { background: var(--accent); }
.status.warn { color: var(--error); background: color-mix(in oklab, var(--error) 12%, transparent); }
.status.warn::before { background: var(--error); }

/* ---------- DECODER ---------- */
.decoder {
  max-width: var(--maxw);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.decoder-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.decoder-bar .dots { display: flex; gap: 5px; }
.decoder-bar .dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong);
}
.decoder-bar .path { color: var(--ink-soft); }
.decoder-bar .path b { color: var(--ink); font-weight: 500; }
.decoder-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.decoder-pane { padding: 28px; }
.decoder-pane + .decoder-pane { border-left: 1px solid var(--border); background: var(--bg-soft); }
.pane-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.pane-label .right { color: var(--ink-mute); }
.script-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 18px;
}
.script-btn {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .18s;
}
.script-btn .glyph { font-family: var(--font-glyph); font-size: 14px; color: var(--ink); }
.script-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.script-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.script-btn.active .glyph { color: var(--bg); }

textarea#dec-input {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  padding: 16px;
  min-height: 200px;
  resize: vertical;
  border-radius: var(--r-sm);
  line-height: 1.5;
  transition: border-color .2s;
}
textarea#dec-input:focus { outline: none; border-color: var(--ink); }

.dec-output-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 20px;
  min-height: 200px;
  display: flex; flex-direction: column;
  gap: 16px;
  position: relative;
}
.dec-output-frame::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0.4;
}
#dec-output {
  font-family: var(--font-glyph);
  font-size: 30px;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: 0.12em;
  word-spacing: 0.25em;
  word-break: break-word;
  flex: 1;
  position: relative;
}
.dec-actions { display: flex; gap: 8px; justify-content: flex-end; position: relative; }

/* ---------- QUIZ ---------- */
.quiz {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 40px;
  box-shadow: var(--shadow-md);
}
.quiz-progress {
  display: flex; gap: 6px;
  margin-bottom: 18px;
}
.quiz-progress span {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: var(--bg-soft);
  transition: background-color .3s;
}
.quiz-progress span.done { background: var(--accent); }
.quiz-progress span.current {
  background: var(--ink);
}
.quiz-meta {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}
.quiz-card h3 {
  font-size: 26px;
  line-height: 1.25;
  margin-bottom: 28px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 15.5px;
  border-radius: var(--r-md);
  transition: all .2s;
  display: flex; align-items: center; gap: 14px;
}
.quiz-opt .marker {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: all .2s;
}
.quiz-opt:hover { border-color: var(--ink); background: var(--bg-soft); }
.quiz-opt:hover .marker { color: var(--ink); border-color: var(--ink); }
.quiz-opt.correct { border-color: var(--success); background: color-mix(in oklab, var(--success) 10%, transparent); color: var(--ink); }
.quiz-opt.correct .marker { background: var(--success); color: var(--bg); border-color: var(--success); }
.quiz-opt.wrong { border-color: var(--error); background: color-mix(in oklab, var(--error) 10%, transparent); color: var(--ink); }
.quiz-opt.wrong .marker { background: var(--error); color: var(--bg); border-color: var(--error); }
.quiz-opt:disabled { cursor: default; }

.quiz-feedback {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--bg-soft);
  border-left: 2px solid var(--accent);
  color: var(--ink-mid);
  font-size: 14.5px;
  line-height: 1.55;
  border-radius: var(--r-sm);
}
.quiz-feedback strong { color: var(--ink); font-weight: 600; }
.quiz-next { margin-top: 22px; width: 100%; justify-content: center; }

.quiz-result { text-align: center; padding: 20px 0; }
.quiz-result h3 { font-size: 36px; margin-bottom: 16px; }
.quiz-result .score-big {
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 16px 0;
}
.quiz-result .score-big small { font-size: 36px; color: var(--ink-soft); }
.quiz-result p { color: var(--ink-soft); margin-bottom: 24px; }

/* ---------- TIMELINE ---------- */
.timeline {
  max-width: 920px;
  margin: 0 auto;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 130px; top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}
.t-item {
  position: relative;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 40px;
  padding: 14px 0 32px;
}
.t-year {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  text-align: right;
  padding-right: 22px;
  padding-top: 4px;
  white-space: nowrap;
}
.t-item::before {
  content: '';
  position: absolute;
  left: 126px; top: 12px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--ink);
  z-index: 1;
}
.t-item.accent::before { border-color: var(--accent); background: var(--accent); }
.t-body { padding-top: 0; }
.t-body h4 {
  font-size: 19px;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.t-body p { color: var(--ink-soft); font-size: 15px; line-height: 1.55; }

/* ---------- HEROES (new section) ---------- */
.heroes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .35s, box-shadow .35s;
}
.hero-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.portrait {
  aspect-ratio: 4 / 5;
  background: var(--bg-soft);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.portrait::before, .portrait::after {
  content: '';
  position: absolute; inset: 0;
}
.portrait::before {
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0,
    transparent 14px,
    color-mix(in oklab, var(--ink) 6%, transparent) 14px,
    color-mix(in oklab, var(--ink) 6%, transparent) 15px
  );
}
.portrait .initials {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 110px;
  font-weight: 300;
  letter-spacing: -0.04em;
  color: var(--ink);
  z-index: 1;
}
.portrait .tag {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-radius: 4px;
  z-index: 2;
}
.portrait .glyph-watermark {
  position: absolute;
  bottom: -20px; right: -10px;
  font-family: var(--font-glyph);
  font-size: 200px;
  color: var(--ink);
  opacity: 0.08;
  line-height: 1;
  z-index: 1;
}
.hero-card-body { padding: 24px 24px 28px; }
.hero-card-body .dates {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.hero-card-body h3 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  line-height: 1.1;
}
.hero-card-body .nationality {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 18px;
}
.hero-card-body p {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 20px;
}
.hero-fact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.hero-fact .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  align-self: center;
}
.hero-fact .value {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* ---------- FOOTER ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 64px var(--gutter) 40px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 56px;
}
.footer-brand h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  line-height: 1.1;
}
.footer-brand p {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 320px;
  line-height: 1.55;
}
.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 16px;
  font-weight: 500;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col li a {
  font-size: 14px;
  color: var(--ink-soft);
  transition: color .2s;
}
.footer-col li a:hover { color: var(--ink); }
.footer-col li .glyph { font-family: var(--font-glyph); margin-right: 6px; color: var(--ink); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-wrap: wrap;
}
.footer-bottom .glyphs {
  font-family: var(--font-glyph);
  font-size: 18px;
  color: var(--ink-soft);
  letter-spacing: 0.6em;
}

/* ---------- REVEAL ANIMATION ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1);
}
.reveal.in { opacity: 1; transform: none; }

/* progress bar at top */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 200;
  transition: width .1s linear;
}

/* ---------- TWEAKS PANEL ---------- */
.tweaks-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 90;
  width: 48px; height: 48px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform .25s;
}
.tweaks-fab:hover { transform: rotate(15deg) scale(1.05); }
.tweaks-fab.visible { display: grid; place-items: center; }
.tweaks-fab svg { width: 20px; height: 20px; }

.tweaks-panel {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 95;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: none;
  font-family: var(--font-body);
  transform: translateY(8px);
  opacity: 0;
  transition: opacity .2s, transform .2s;
}
.tweaks-panel.open { display: block; opacity: 1; transform: none; }
.tweaks-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.tweaks-head h6 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.tweaks-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: none;
  color: var(--ink-soft);
  display: grid; place-items: center;
  cursor: pointer;
}
.tweaks-close:hover { background: var(--border); color: var(--ink); }
.tweak-section { margin-bottom: 18px; }
.tweak-section:last-child { margin-bottom: 0; }
.tweak-section label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 10px;
}
.tweak-radio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 3px;
}
.tweak-radio.three { grid-template-columns: 1fr 1fr 1fr; }
.tweak-radio button {
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s;
}
.tweak-radio button:hover { color: var(--ink); }
.tweak-radio button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tweak-radio.font-pair button {
  font-family: var(--preview-font, var(--font-body));
  font-size: 14px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: 56px; }
  .section-head { grid-template-columns: 1fr; gap: 16px; }
  .decoder-body { grid-template-columns: 1fr; }
  .decoder-pane + .decoder-pane { border-left: none; border-top: 1px solid var(--border); }
  .heroes-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 700px) {
  .nav { display: none; position: fixed; top: 68px; left: 16px; right: 16px; flex-direction: column; padding: 12px; gap: 4px; border-radius: 16px; box-shadow: var(--shadow-lg); }
  .nav.open { display: flex; }
  .nav a { padding: 10px 14px; }
  .burger { display: flex; }
  .topbar-inner { grid-template-columns: auto 1fr auto; }
  .topbar-end .cta-pill { display: none; }
  .hero { padding: 110px 20px 60px; }
  .section { padding: 70px 20px; }
  .timeline::before { left: 8px; }
  .t-item { grid-template-columns: 1fr; gap: 6px; padding-left: 28px; }
  .t-item::before { left: 4px; top: 8px; }
  .t-year { text-align: left; padding: 0; }
  .quiz { padding: 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-title { font-size: 56px; }
  .specimen-glyph { font-size: 90px; }
  .tweaks-panel { right: 12px; left: 12px; width: auto; bottom: 12px; }
  .tweaks-fab { right: 12px; bottom: 12px; }
}
