/* ===== tokens ===== */
:root {
  --bg: #07090a;
  --bg-2: #0d1112;
  --ink: #d8dbd3;
  --ink-dim: #8c958e;
  --ink-faint: #7a837c;          /* ~5:1 on --bg, readable for small mono text */
  --line: rgba(216, 219, 211, .12);
  --line-strong: rgba(216, 219, 211, .28);
  --yellow: #d4a72c;           /* Jonas's raincoat */
  --red: #b3261e;              /* the red string */
  --paper: #d9d2c1;
  --past: #c08d4a;
  --present: #5f9894;
  --future: #b8553a;
  --tint: var(--present);
  --haze: rgba(60, 100, 98, .16);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --display: 'Cinzel', 'Cormorant Garamond', serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: dark;
}
html[data-era="past"]    { --tint: var(--past);    --haze: rgba(150, 105, 50, .16); --bg: #0a0806; --bg-2: #120e0a; }
html[data-era="present"] { --tint: var(--present); --haze: rgba(60, 100, 98, .16); }
html[data-era="future"]  { --tint: var(--future);  --haze: rgba(140, 50, 30, .2);  --bg: #0a0606; --bg-2: #130b0a; }

/* ===== base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); transition: background-color 1.2s; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, var(--haze), transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--serif);
  overflow-x: hidden;
  transition: background-color 1.2s;
}
body.locked { overflow: hidden; }
::selection { background: var(--yellow); color: #000; }

/* scrollbars: a thin thread in the era's tint; Jonas-yellow while grabbed */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--tint) 45%, var(--bg));
  border: 2px solid var(--bg); border-radius: 0;
  transition: background .3s;
}
::-webkit-scrollbar-thumb:hover { background: var(--tint); }
::-webkit-scrollbar-thumb:active { background: var(--yellow); }
::-webkit-scrollbar-corner { background: var(--bg); }
.dossier::-webkit-scrollbar-track, .dossier::-webkit-scrollbar-corner { background: var(--bg-2); }
.dossier::-webkit-scrollbar-thumb { border-color: var(--bg-2); }
.board-wrap::-webkit-scrollbar-track { background: #14110d; }
.board-wrap::-webkit-scrollbar-thumb { background: var(--red); border-color: #14110d; }
.board-wrap::-webkit-scrollbar-thumb:hover { background: #d8382e; }
@supports (-moz-appearance: none) {
  html, .dossier, .tl-rail { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--tint) 55%, var(--bg)) var(--bg); }
  .board-wrap { scrollbar-width: thin; scrollbar-color: var(--red) #14110d; }
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 1px solid var(--yellow); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; letter-spacing: .12em; margin: 0; }
p { margin: 0; }

/* ===== atmosphere layers ===== */
#atmos, #wormhole { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#atmos { z-index: 0; opacity: .9; }
#wormhole { z-index: 90; opacity: 0; }
#wormhole.active { opacity: 1; }
.grain {
  position: fixed; inset: -50%; z-index: 80; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.vignette {
  position: fixed; inset: 0; z-index: 79; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .75) 100%);
}
#flash { position: fixed; inset: 0; z-index: 78; pointer-events: none; background: #dfe7ea; opacity: 0; }
#flash.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { opacity: 0; } 4% { opacity: .35; } 8% { opacity: .05; } 12% { opacity: .22; } 100% { opacity: 0; } }

#jump {
  position: fixed; inset: 0; z-index: 95; display: grid; place-content: center; text-align: center;
  pointer-events: none; opacity: 0; transition: opacity .3s;
}
#jump.on { opacity: 1; }
#jump-year { font: 400 clamp(4rem, 16vw, 11rem)/1 var(--mono); letter-spacing: .08em; color: var(--ink); text-shadow: 0 0 30px var(--tint); }
#jump small { font: 400 .8rem var(--mono); letter-spacing: .5em; text-transform: uppercase; color: var(--ink-dim); margin-top: 1rem; }

/* ===== intro ===== */
#intro {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2rem; padding: 24px; background: #000; text-align: center;
  transition: opacity 1.4s ease, filter 1.4s ease;
}
#intro.gone { opacity: 0; filter: blur(8px); pointer-events: none; }
.intro-tri { width: 110px; height: 110px; color: var(--ink); opacity: .85; animation: spin 40s linear infinite, breathe 5s ease-in-out infinite; }
.intro-lines { font: 400 clamp(1.6rem, 5vw, 3rem)/1.3 var(--serif); font-style: italic; letter-spacing: .02em; }
.intro-lines span { display: block; opacity: 0; animation: rise 1.8s ease forwards; }
.intro-lines span:nth-child(2) { animation-delay: 1.4s; }
.intro-hint { font: 400 .78rem var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--ink-faint); opacity: 0; animation: rise 1.5s 2.6s ease forwards; }
.intro-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; opacity: 0; animation: rise 1.5s 3s ease forwards; }
.btn-main {
  font: 400 .85rem var(--mono); letter-spacing: .35em; text-transform: uppercase;
  padding: 1rem 2rem; border: 1px solid var(--yellow); background: transparent; color: var(--yellow); transition: .4s;
}
.btn-main:hover { background: var(--yellow); color: #000; box-shadow: 0 0 40px rgba(212, 167, 44, .35); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: .45; } }

/* ===== top bar ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; gap: 1.5rem;
  padding: 14px var(--gutter);
  background: linear-gradient(to bottom, rgba(0, 0, 0, .94), rgba(0, 0, 0, .55) 70%, transparent);
  border-bottom: 1px solid var(--line);
}
.mark { display: flex; align-items: center; gap: .6rem; text-decoration: none; font: 600 1.15rem var(--display); letter-spacing: .45em; color: #eef0ea; transition: color .3s; }
.mark:hover { color: var(--yellow); }
.mark svg { width: 30px; height: 30px; color: var(--yellow); --tri-stroke: 6; }  /* thicker stroke: 2.2 vanishes at this size */
.nav { display: flex; gap: 1.8rem; margin-left: auto; }
.nav a {
  font: 400 .8rem var(--mono); letter-spacing: .25em; text-transform: uppercase; text-decoration: none; color: var(--ink);
  padding: .3rem 0; border-bottom: 1px solid transparent; transition: color .3s, border-color .3s;
}
.nav a:hover { color: var(--yellow); border-bottom-color: var(--yellow); }
/* the section currently in view (set by bindScrollSpy) */
.nav a[aria-current="location"] { color: var(--yellow); border-bottom-color: var(--yellow); }
.mute {
  display: flex; align-items: center; justify-content: center; gap: 3px; height: 32px; padding: 0 .75rem;
  background: none; border: 1px solid var(--line-strong); transition: border-color .3s, color .3s;
}
.mute:hover { border-color: var(--yellow); color: var(--yellow); }
.mute i { width: 2px; height: 14px; background: currentColor; animation: eq 1.1s ease-in-out infinite; }
.mute i:nth-child(1) { height: 6px; } .mute i:nth-child(2) { animation-delay: .2s; } .mute i:nth-child(3) { height: 9px; animation-delay: .4s; }
.mute { position: relative; }
/* muted: bars freeze and dim, a diagonal stroke crosses them out */
/* every few seconds the bars twitch once, a quiet "I'm here" hint that sound can be turned on */
.mute[aria-pressed="true"] i { animation: eq-hint 5s ease-in-out infinite; opacity: .5; }
@keyframes eq-hint { 0%, 20%, 100% { transform: none; } 5% { transform: scaleY(.3); } 10% { transform: scaleY(1.15); } 15% { transform: scaleY(.45); } }
.mute[aria-pressed="true"]::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 1.5px;
  background: currentColor; transform: translate(-50%, -50%) rotate(-40deg);
}
/* state is shown by the bars; the label stays for screen readers and as a tooltip (title) */
.mute span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@keyframes eq { 50% { transform: scaleY(.3); } }
.lang-btn {
  font: 400 .74rem var(--mono); letter-spacing: .2em; height: 32px; padding: 0 .7rem;
  background: none; border: 1px solid var(--line-strong); color: var(--ink); transition: border-color .3s, color .3s;
}
.lang-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.topbar .lang-btn + .mute { margin-left: -.9rem; }
.intro-lang { position: absolute; top: 16px; right: var(--gutter); }
@media (max-width: 960px) { .nav { gap: 1.1rem; } .nav a { letter-spacing: .16em; } }
/* phones: the nav drops to its own full-width row instead of disappearing */
@media (max-width: 720px) {
  /* the two-row bar is tall; the desktop fade-out would let scrolling content show through its lower half */
  .topbar {
    flex-wrap: wrap; gap: .5rem 1rem; padding-top: 10px; padding-bottom: 8px;
    background: rgba(4, 5, 6, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .mark { letter-spacing: .35em; }
  .topbar .lang-btn { margin-left: auto; }
  .topbar .lang-btn + .mute { margin-left: -.4rem; }
  .nav { order: 3; width: 100%; margin-left: 0; gap: 0; justify-content: space-between; }
  .nav a { font-size: .7rem; letter-spacing: .12em; padding: .35rem 0; }
  .hero { padding-top: 140px; }
}

/* ===== back to top ===== */
.to-top {
  position: fixed; right: var(--gutter); bottom: 18px; z-index: 60; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  font: 400 1.1rem var(--mono); color: var(--ink);
  border: 1px solid var(--line-strong); background: rgba(5, 7, 8, .78); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .4s, transform .4s, visibility .4s, border-color .3s, color .3s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--yellow); color: var(--yellow); }
/* phones: the centered era switch fills the bottom row, so the button sits just above it */
@media (max-width: 480px) { .to-top { width: 40px; height: 40px; right: 12px; bottom: 82px; } }

/* ===== era switch ===== */
.era-switch {
  position: fixed; left: 50%; bottom: 18px; z-index: 60; transform: translateX(-50%);
  display: flex; border: 1px solid var(--line-strong); background: rgba(5, 7, 8, .78); backdrop-filter: blur(8px);
}
.era-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 104px;
  padding: .6rem 1rem; background: none; border: 0; border-right: 1px solid var(--line); transition: .4s;
}
.era-btn:last-child { border-right: 0; }
.era-btn b { font: 400 .72rem var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--ink-dim); }
.era-btn span { font: 400 1.05rem var(--mono); color: var(--ink-faint); }
.era-btn[data-era="past"]    { --c: var(--past); }
.era-btn[data-era="present"] { --c: var(--present); }
.era-btn[data-era="future"]  { --c: var(--future); }
.era-btn:hover b, .era-btn:hover span { color: var(--ink); }
.era-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 22%, transparent); box-shadow: inset 0 -2px 0 var(--c); }
.era-btn[aria-pressed="true"] b, .era-btn[aria-pressed="true"] span { color: var(--ink); }
@media (max-width: 420px) { .era-btn { min-width: 0; padding: .55rem .8rem; } }

/* ===== hero ===== */
main { position: relative; z-index: 2; }
.hero {
  position: relative; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.4rem; padding: 110px var(--gutter) 140px; text-align: center; overflow: hidden;
}
.hero-tri {
  position: absolute; width: min(90vw, 760px); height: min(90vw, 760px); top: 50%; left: 50%;
  transform: translate(-50%, -50%); color: var(--tint); opacity: .07; animation: spin-c 120s linear infinite; transition: color 1.2s;
}
@keyframes spin-c { to { transform: translate(-50%, -50%) rotate(360deg); } }
.hero-place { font: 400 .78rem var(--mono); letter-spacing: .5em; text-transform: uppercase; color: var(--ink-dim); }
.logo { position: relative; line-height: .8; }
.logo-word, .logo-mirror {
  display: block; font: 400 clamp(4.5rem, 19vw, 13rem)/.9 var(--display); letter-spacing: .32em; margin-right: -.32em;
}
.logo-word {
  background: linear-gradient(180deg, #f1f2ec 0%, #9aa29b 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: flicker 9s infinite;
}
.logo-mirror {
  transform: scaleY(-1); margin-top: -.08em; color: var(--tint); opacity: .22; filter: blur(1.5px);
  -webkit-mask-image: linear-gradient(to top, #000, transparent 70%); mask-image: linear-gradient(to top, #000, transparent 70%);
  transition: color 1.2s;
}
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .55; } 94% { opacity: 1; } 96% { opacity: .7; } }
.hero-tag { font: italic 400 clamp(1.3rem, 3.4vw, 2rem) var(--serif); color: var(--ink); }
.hero-tag em { color: var(--yellow); }
.hero-clock { display: flex; flex-direction: column; align-items: center; gap: .2rem; margin-top: .6rem; }
.hero-clock-label { font: 400 .7rem var(--mono); letter-spacing: .35em; text-transform: uppercase; color: var(--ink-faint); }
.hero-year { font: 400 clamp(2.4rem, 7vw, 4rem)/1 var(--mono); letter-spacing: .15em; color: var(--tint); text-shadow: 0 0 24px var(--tint); transition: color 1.2s; }
.hero-lead { max-width: 560px; color: var(--ink-dim); }
.hero-lead b { color: var(--ink); font-weight: 600; }
.scroll-cue { width: 1px; height: 64px; background: var(--line); position: relative; overflow: hidden; margin-top: 1rem; }
.scroll-cue span { position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--ink); animation: drip 2.4s ease-in-out infinite; }
@keyframes drip { to { top: 100%; } }

/* ===== sections ===== */
.section { position: relative; max-width: 1280px; margin: 0 auto; padding: 120px var(--gutter) 40px; }
.section-head { max-width: 720px; margin-bottom: 3rem; }
.kicker { font: 400 .74rem var(--mono); letter-spacing: .4em; text-transform: uppercase; color: var(--tint); margin-bottom: 1rem; transition: color 1.2s; }
.section h2 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; margin-bottom: 1rem; }
.section-lead { color: var(--ink-dim); font-size: 1.2rem; }
.section-lead cite { font-style: normal; font: 400 .8rem var(--mono); letter-spacing: .2em; color: var(--ink-faint); }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1.2s ease, transform 1.2s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ===== chips ===== */
.grid-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  --fam: var(--ink-dim);
  font: 400 .72rem var(--mono); letter-spacing: .2em; text-transform: uppercase;
  padding: .45rem .9rem; background: none; border: 1px solid var(--line-strong); color: var(--ink-dim); transition: .3s;
}
.chip:hover { color: var(--ink); border-color: var(--fam); }
.chip.on { color: #000; background: var(--fam); border-color: var(--fam); }
.chip[data-family="all"].on { background: var(--ink); }
.era-note { font: 400 .74rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }

/* ===== character cards ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.4rem; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line);
  cursor: pointer; transition: transform .5s, border-color .5s, box-shadow .5s; outline-offset: 4px;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: var(--fam); box-shadow: 0 20px 50px -20px var(--fam); }
.card.shift { animation: shift .9s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes shift {
  0% { opacity: 0; filter: blur(10px) brightness(2); transform: scale(.96); clip-path: inset(0 0 100% 0); }
  40% { clip-path: inset(0 0 30% 0); }
  60% { filter: blur(0) brightness(1.3); transform: translateX(3px); }
  70% { transform: translateX(-3px); }
  100% { opacity: 1; filter: none; transform: none; clip-path: inset(0); }
}
.card-portrait { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #000; }
.card-portrait::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
}
.ph-svg, .ph-img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s ease; }
.card:hover .ph-svg, .card:hover .ph-img { transform: scale(1.04); }
html[data-era="past"] .ph-img    { filter: sepia(.65) contrast(1.05) brightness(.9); }
html[data-era="present"] .ph-img { filter: grayscale(.5) hue-rotate(-10deg) contrast(1.05) brightness(.85); }
html[data-era="future"] .ph-img  { filter: sepia(.4) hue-rotate(-25deg) saturate(1.3) contrast(1.15) brightness(.8); }
.ph-initials { font: 400 150px var(--display); fill: rgba(255, 255, 255, .06); letter-spacing: .05em; }
.ph-tag { font: 400 13px var(--mono); letter-spacing: .3em; fill: rgba(255, 255, 255, .45); }
.card-tri { position: absolute; top: 12px; right: 12px; display: flex; gap: 5px; }
.card-tri span { width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5); }
.card-tri span.on { background: var(--tint); border-color: var(--tint); box-shadow: 0 0 8px var(--tint); }
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .3rem; border-top: 2px solid var(--fam); }
.card-family { font: 400 .7rem var(--mono); letter-spacing: .25em; text-transform: uppercase; color: var(--fam); }
.card-name { font-size: 1.25rem; letter-spacing: .08em; }
.card-real { color: var(--ink-dim); font-style: italic; font-size: 1rem; }
.card-meta { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; font: 400 .76rem var(--mono); color: var(--ink-dim); letter-spacing: .05em; }

/* glitch on hover */
.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; opacity: 0; pointer-events: none;
}
.glitch::before { color: var(--tint); transform: translate(-2px, 0); }
.glitch::after { color: var(--red); transform: translate(2px, 0); }
.card:hover .glitch::before, .card:hover .glitch::after, .dz-head .glitch::before, .dz-head .glitch::after { animation: glitch 2.6s steps(1) infinite; }
.card:hover .glitch::after, .dz-head .glitch::after { animation-delay: .1s; }
@keyframes glitch {
  0%, 86%, 100% { opacity: 0; clip-path: inset(0); }
  87% { opacity: .8; clip-path: inset(10% 0 60% 0); }
  90% { opacity: .8; clip-path: inset(55% 0 20% 0); }
  93% { opacity: .8; clip-path: inset(30% 0 45% 0); }
  95% { opacity: 0; }
}

/* ===== dossier ===== */
#dossier { padding: 0; border: 0; background: transparent; color: var(--ink); width: min(1100px, 100vw - 24px); max-width: none; max-height: calc(100svh - 24px); }
#dossier::backdrop { background: rgba(0, 0, 0, .82); backdrop-filter: blur(6px); }
#dossier[open] { animation: open .6s cubic-bezier(.2, .7, .2, 1); }
@keyframes open { from { opacity: 0; transform: translateY(20px) scale(.98); filter: blur(6px); } }
.dossier {
  position: relative; max-height: calc(100svh - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, var(--bg-2), var(--bg)); border: 1px solid var(--line-strong);
  padding: clamp(20px, 4vw, 48px);
}
.dz-close { position: sticky; top: 0; float: right; width: 40px; height: 40px; font-size: 1.6rem; line-height: 1; background: var(--bg); border: 1px solid var(--line-strong); z-index: 2; }
.dz-close:hover { border-color: var(--yellow); color: var(--yellow); }
.dz-head { border-left: 3px solid var(--fam); padding-left: 1.2rem; margin-bottom: 2.4rem; }
.dz-file { font: 400 .7rem var(--mono); letter-spacing: .3em; color: var(--ink-faint); margin-bottom: .6rem; }
.dz-head h2 { font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.15; }
.dz-epithet { font-style: italic; color: var(--fam); font-size: 1.3rem; }

.triptych { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 1rem; align-items: start; margin-bottom: 2.4rem; }
.tri-arrow { align-self: center; color: var(--ink-faint); font: 400 1.4rem var(--mono); margin-top: -40%; }
.tri-col { --c: var(--present); opacity: .8; transition: opacity .4s; }
.tri-col.past { --c: var(--past); } .tri-col.future { --c: var(--future); }
.tri-col.on, .tri-col:hover { opacity: 1; }
.tri-portrait { aspect-ratio: 3 / 4; border: 1px solid var(--line); border-bottom: 2px solid var(--c); overflow: hidden; margin-bottom: .8rem; }
.tri-col.on .tri-portrait { box-shadow: 0 0 40px -10px var(--c); }
.tri-era { font: 400 .7rem var(--mono); letter-spacing: .35em; text-transform: uppercase; color: var(--c); }
.tri-col h3 { font-size: 1.15rem; margin: .2rem 0 .3rem; }
.tri-meta { font: 400 .78rem/1.6 var(--mono); color: var(--ink-dim); margin-bottom: .6rem; }
.tri-desc { font-size: 1.02rem; color: var(--ink); }
@media (max-width: 760px) {
  .triptych { grid-template-columns: 1fr; }
  .tri-arrow { transform: rotate(90deg); margin: 0 auto; }
  .tri-col { opacity: 1; display: grid; grid-template-columns: 110px 1fr; column-gap: 1rem; }
  .tri-portrait { grid-row: span 4; margin: 0; }
}

.dz-block { margin-bottom: 2rem; }
.dz-block h4 { font: 400 .74rem var(--mono); letter-spacing: .35em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 1rem; }
.lifeline { width: 100%; height: auto; overflow: visible; }
/* below this width the 790-wide chart's labels shrink to unreadable, so it scrolls instead */
@media (max-width: 600px) { .ll-wrap { overflow-x: auto; } .lifeline { min-width: 560px; } }
.ll-tick { stroke: var(--line); stroke-dasharray: 2 4; }
.ll-year { font: 400 12px var(--mono); fill: var(--ink-faint); text-anchor: middle; }
.ll-jump { font: 400 10px var(--mono); fill: var(--ink-faint); text-anchor: middle; letter-spacing: .1em; }
.ll-row { font: 400 11px var(--mono); letter-spacing: .15em; fill: var(--ink-faint); }
.ll-row.past { fill: var(--past); } .ll-row.present { fill: var(--present); } .ll-row.future { fill: var(--future); }
.ll-span { stroke-width: 2; opacity: .5; }
.ll-span.past, .ll-dot.past { stroke: var(--past); fill: var(--past); }
.ll-span.present, .ll-dot.present { stroke: var(--present); fill: var(--present); }
.ll-span.future, .ll-dot.future { stroke: var(--future); fill: var(--future); }
.ll-dot { stroke-width: 0; filter: drop-shadow(0 0 4px currentColor); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat { background: var(--bg-2); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; }
.stat b { font: 400 2.2rem/1 var(--mono); color: var(--tint); }
.stat span { font: 400 .68rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim); }

.dz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 760px) { .dz-grid { grid-template-columns: 1fr; } }
.rel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.rel button {
  width: 100%; display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; text-align: left;
  background: none; border: 0; border-left: 2px solid var(--fam); padding: .5rem .8rem; transition: background .3s;
}
.rel button:not(:disabled):hover { background: rgba(255, 255, 255, .04); }
.rel button:disabled { cursor: default; opacity: .7; }
.rel em { font: 400 .7rem var(--mono); letter-spacing: .15em; text-transform: uppercase; color: var(--ink-faint); font-style: normal; }
.dz-loop { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.dz-loop b { font-family: var(--display); font-weight: 400; letter-spacing: .1em; }
.dz-loop span { font: 400 .74rem var(--mono); color: var(--ink-dim); }
.dz-motto { margin: 1rem 0 0; padding: 1.6rem 0 0; border-top: 1px solid var(--line); font: italic 400 clamp(1.3rem, 3vw, 1.8rem) var(--serif); color: var(--ink); text-align: center; }

/* ===== timeline ===== */
.tl-rail { display: flex; align-items: center; gap: .4rem; overflow-x: auto; padding: .5rem 0 1.4rem; }
.tl-node {
  flex: 1 0 auto; min-width: 104px; display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: 1rem .6rem; background: var(--bg-2); border: 1px solid var(--line); transition: .4s;
}
.tl-node b { font: 400 1.5rem var(--mono); letter-spacing: .08em; }
.tl-node span { font: 400 .7rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim); }
.tl-node:hover { border-color: var(--line-strong); }
.tl-node.on { border-color: var(--tint); box-shadow: inset 0 -2px 0 var(--tint), 0 0 30px -12px var(--tint); }
.tl-node.on b { color: var(--tint); }
.tl-node.origin b { font-family: var(--display); font-size: 1.2rem; letter-spacing: .2em; }
.tl-jump { flex: 0 0 auto; font: 400 .7rem var(--mono); color: var(--ink-faint); letter-spacing: .1em; }
.tl-panel { border: 1px solid var(--line); padding: clamp(18px, 3vw, 36px); background: rgba(0, 0, 0, .35); min-height: 240px; }
.tl-panel h3 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 1.2rem; }
.tl-panel h3 small { font: 400 .74rem var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--tint); margin-left: .8rem; }
@media (max-width: 520px) { .tl-panel h3 small { display: block; margin: .5rem 0 0; } }
.tl-events { margin: 0 0 1.6rem; padding: 0; list-style: none; display: grid; gap: .6rem; }
.tl-events li { padding-left: 1.4rem; position: relative; }
.tl-events li::before { content: ''; position: absolute; left: 0; top: .7em; width: .7rem; height: 1px; background: var(--tint); }
.tl-sub { font: 400 .7rem var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: .8rem; }
.tl-people { display: flex; flex-wrap: wrap; gap: .5rem; }
.tl-person {
  --c: var(--present);
  display: flex; flex-direction: column; align-items: flex-start; padding: .45rem .8rem; background: none;
  border: 1px solid var(--line); border-left: 2px solid var(--fam); transition: .3s;
}
.tl-person.past { --c: var(--past); } .tl-person.future { --c: var(--future); }
.tl-person b { font-weight: 400; }
.tl-person span { font: 400 .68rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--c); }
.tl-person:hover { border-color: var(--c); background: rgba(255, 255, 255, .03); }
.tl-origin { font-size: 1.3rem; font-style: italic; max-width: 680px; }

/* ===== red-string board ===== */
.board-wrap {
  overflow-x: auto; border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(120, 95, 60, .18), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 6px),
    #14110d;
}
.board { display: block; width: 100%; min-width: 860px; height: auto; }
.string { fill: none; stroke: var(--red); stroke-width: 1.6; opacity: .75; transition: opacity .3s, stroke-width .3s; }
.string.loop { stroke-dasharray: 6 5; animation: march 1.6s linear infinite; }
@keyframes march { to { stroke-dashoffset: -22; } }
.board.focusing .string { opacity: .12; }
.board.focusing .string.hot { opacity: 1; stroke-width: 2.6; filter: drop-shadow(0 0 4px rgba(220, 40, 30, .7)); }
.note { cursor: default; transition: opacity .3s; }
.note.main { cursor: pointer; }
.note rect:first-child { fill: var(--paper); filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, .6)); }
.note-fam { fill: var(--fam); }
.note text { font: 600 15px var(--serif); fill: #1c1a16; letter-spacing: .02em; }
.note:not(.main) text { font-weight: 400; font-style: italic; fill: #4b463d; }
.pin { fill: #c8281e; stroke: #5a0f0b; stroke-width: 1; }
.board.focusing .note:not(.hot) { opacity: .55; }
.note.hot rect:first-child { fill: #fff6d8; }
.legend { list-style: none; display: flex; gap: 2rem; padding: 0; margin: 1rem 0 0; font: 400 .72rem var(--mono); letter-spacing: .15em; text-transform: uppercase; color: var(--ink-dim); }
.legend i { display: inline-block; width: 28px; height: 0; vertical-align: middle; margin-right: .6rem; border-top: 2px solid var(--red); }
.legend .lg-loop { border-top-style: dashed; }

/* ===== loops ===== */
.loop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.4rem; }
.loop { border: 1px solid var(--line); padding: 1.4rem; background: var(--bg-2); transition: border-color .4s; }
.loop:hover { border-color: var(--tint); }
.loop-svg { width: 100%; max-width: 300px; display: block; margin: 0 auto 1rem; overflow: visible; }
.lp-ring { fill: none; stroke: var(--line); }
.lp-arc { fill: none; stroke: var(--tint); stroke-width: 1.4; stroke-dasharray: 4 5; animation: march 2.2s linear infinite; }
.lp-head { fill: var(--tint); }
.lp-dot { fill: var(--bg); stroke: var(--ink); stroke-width: 1.4; }
.lp-label { font: 400 15px var(--mono); fill: var(--ink-dim); }
.loop-n { font: 400 .66rem var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--tint); }
.loop h3 { font-size: 1.2rem; margin: .3rem 0 .6rem; }
.loop p:last-child { color: var(--ink-dim); font-size: 1.02rem; }

/* ===== footer ===== */
.footer { position: relative; z-index: 2; text-align: center; padding: 120px var(--gutter) 130px; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.footer-tri { width: 54px; height: 54px; color: var(--yellow); opacity: .8; animation: spin 60s linear infinite; }
.sic { font: 400 clamp(1rem, 3vw, 1.5rem) var(--display); letter-spacing: .5em; margin-right: -.5em; text-wrap: balance; }
.fine { max-width: 620px; font: 400 .72rem/1.8 var(--mono); color: var(--ink-faint); }
.fine a { color: var(--ink-dim); text-underline-offset: 3px; }
.fine a:hover { color: var(--yellow); }

/* ===== reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .grain { display: none; }
  .reveal { opacity: 1; transform: none; }
}
