/* ==========================================================
   THE LONG ECHO — museum-dark timeline styles
   ========================================================== */

:root {
  --ink: #e8e0d0;
  --ink-dim: #b3a88f;
  --ink-faint: #7d745f;
  --gold: #c9a35c;
  --gold-bright: #e8c987;
  --gold-deep: #8a6d35;
  --spine: #c9a35c;
  --bg-top: #0b0e15;
  --bg-bottom: #140d05;
  --card-bg: rgba(20, 18, 14, 0.82);
  --card-border: rgba(201, 163, 92, 0.22);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --display: "Cinzel", "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --depth: 0; /* 0 at top of page → 1 at the bottom, set by JS */

  /* status colours */
  --st-living: #8fbf7f;
  --st-endangered: #d9a441;
  --st-extinct: #8d8577;
  --st-classical: #c9a35c;
  --st-liturgical: #b08cd9;
  --st-revived: #6cc5b9;
  --st-constructed: #d98cb3;
  --st-undeciphered: #d97b5f;
  --st-reconstructed: #7fa8d9;
  --st-unknowable: #9d94b8;
}

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

/* No global scroll-behavior: smooth — it makes Home/End, find-in-page and
   anchor jumps animate across ~90k px. Programmatic scrolls that should be
   smooth request it explicitly. */

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg-top);
  overflow-x: hidden;
  line-height: 1.6;
}

::selection { background: rgba(201, 163, 92, 0.35); }

/* ---------------- background layers ---------------- */

.bg { position: fixed; inset: 0; z-index: -2; }

.bg-base {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, #141a28 0%, transparent 55%),
    linear-gradient(180deg, #0b0e15 0%, #0d0f14 60%, #0f0d0a 100%);
}

/* deep-time layer crossfades in as user scrolls (opacity = depth) */
.bg-deep {
  position: absolute; inset: 0;
  opacity: calc(var(--depth) * 1);
  background:
    radial-gradient(ellipse 120% 80% at 50% 110%, #241405 0%, transparent 60%),
    linear-gradient(180deg, #0e0a06 0%, #140d05 100%);
  transition: opacity 0.4s linear;
}

/* parchment / manuscript grain via SVG turbulence */
.bg-texture {
  position: absolute; inset: 0;
  opacity: calc(0.35 + var(--depth) * 0.45);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.78 0 0 0 0 0.64 0 0 0 0 0.38 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  transition: opacity 0.4s linear;
}

.bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 85% at 50% 50%, transparent 55%, rgba(0,0,0,0.55) 100%);
}

/* ---------------- fixed year display ---------------- */

.year-display {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  text-align: center;
  pointer-events: none;
  width: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.year-display.visible { opacity: 1; }

.year-main {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(3.2rem, 11vw, 9.5rem);
  letter-spacing: 0.04em;
  color: rgba(201, 163, 92, 0.16);
  text-shadow: 0 0 60px rgba(201, 163, 92, 0.12);
  line-height: 1.05;
  transition: opacity 0.35s ease, transform 0.35s ease, color 0.35s ease;
  white-space: nowrap;
}
.year-sub {
  font-family: var(--sans);
  font-size: clamp(0.6rem, 1.4vw, 0.8rem);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: rgba(201, 163, 92, 0.28);
  margin-top: 0.8rem;
  transition: color 0.35s ease;
}

/* when a card is locked in focus, the year brightens and glows */
.year-display.locked .year-main {
  color: rgba(212, 178, 112, 0.30);
  text-shadow: 0 0 90px rgba(201, 163, 92, 0.28);
}
.year-display.locked .year-sub { color: rgba(212, 178, 112, 0.5); }

.year-display.switching .year-main { opacity: 0; transform: translateY(12px); }

/* ---------------- scroll progress rail ---------------- */

.progress-rail {
  position: fixed; top: 0; right: 0;
  width: 3px; height: 100vh;
  background: rgba(201, 163, 92, 0.07);
  z-index: 60;
}
.progress-fill {
  width: 100%; height: 0%;
  background: linear-gradient(180deg, rgba(201,163,92,0.25), rgba(201,163,92,0.8));
  box-shadow: 0 0 8px rgba(201, 163, 92, 0.5);
}

/* ---------------- hero ---------------- */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7rem 1.5rem 5rem;
  position: relative;
}

.hero-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2rem;
  animation: fadeUp 1.2s ease both;
}

.hero-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(3rem, 9vw, 6.8rem);
  letter-spacing: 0.06em;
  line-height: 1.05;
  color: var(--ink);
  text-shadow: 0 0 80px rgba(201, 163, 92, 0.25);
  animation: fadeUp 1.2s 0.15s ease both;
}
.hero-title em {
  font-style: normal;
  color: var(--gold-bright);
}

.hero-subtitle {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-style: italic;
  color: var(--ink-dim);
  margin-top: 1.6rem;
  line-height: 1.7;
  animation: fadeUp 1.2s 0.3s ease both;
}

.hero-rule {
  display: flex; align-items: center; gap: 1.2rem;
  margin: 3rem 0;
  color: var(--gold);
  animation: fadeUp 1.2s 0.45s ease both;
}
.hero-rule::before, .hero-rule::after {
  content: "";
  display: block;
  width: clamp(60px, 14vw, 160px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-deep));
}
.hero-rule::after { background: linear-gradient(270deg, transparent, var(--gold-deep)); }

.hero-intro {
  max-width: 680px;
  text-align: left;
  font-family: var(--serif);
  font-size: 1.18rem;
  color: var(--ink-dim);
  animation: fadeUp 1.2s 0.6s ease both;
}
.hero-intro p + p { margin-top: 1.1rem; }
.hero-intro strong { color: var(--ink); font-weight: 600; }
.hero-intro em { color: var(--gold-bright); }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  margin-top: 3.5rem;
  animation: fadeUp 1.2s 0.75s ease both;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  color: var(--gold-bright);
}
.stat-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 0.3rem;
}

/* legend */
.legend {
  max-width: 860px;
  margin-top: 4rem;
  padding: 2rem clamp(1.2rem, 4vw, 2.5rem);
  border: 1px solid rgba(201, 163, 92, 0.16);
  border-radius: 6px;
  background: rgba(15, 14, 11, 0.55);
  backdrop-filter: blur(6px);
  animation: fadeUp 1.2s 0.9s ease both;
}
.legend-title {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.4rem;
}
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem 1.6rem;
  text-align: left;
}
.legend-item { display: flex; gap: 0.7rem; align-items: flex-start; }
.legend-icon {
  flex: 0 0 auto;
  width: 1.7rem; height: 1.7rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: 50%;
  color: var(--gold-bright);
  font-size: 0.85rem;
}
.legend-item b {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.legend-item span { font-size: 0.74rem; color: var(--ink-faint); line-height: 1.45; }
.legend-note {
  margin-top: 1.4rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faint);
  text-align: left;
  border-top: 1px solid rgba(201,163,92,0.12);
  padding-top: 1.1rem;
}

.scroll-cue {
  margin-top: 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold);
  animation: fadeUp 1.2s 1.05s ease both;
}
.scroll-cue-line {
  width: 1px; height: 70px;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: cuePulse 2.4s ease-in-out infinite;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes cuePulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---------------- filter bar ---------------- */

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 9, 0.88);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(201, 163, 92, 0.14);
  border-bottom: 1px solid rgba(201, 163, 92, 0.14);
  padding: 0.7rem clamp(0.8rem, 3vw, 2rem);
}
.filter-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 190px;
}
.search-icon {
  position: absolute; left: 0.75rem; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--ink-faint);
  pointer-events: none;
}
#searchInput {
  width: 100%;
  padding: 0.55rem 0.9rem 0.55rem 2.3rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink);
  background: rgba(232, 224, 208, 0.05);
  border: 1px solid rgba(201, 163, 92, 0.2);
  border-radius: 99px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
#searchInput::placeholder { color: var(--ink-faint); }
#searchInput:focus {
  border-color: rgba(201, 163, 92, 0.55);
  box-shadow: 0 0 14px rgba(201, 163, 92, 0.15);
}

.filter-controls {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.filters-toggle { display: none; }

.filter-selects { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-selects select {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-dim);
  background: rgba(232, 224, 208, 0.05);
  border: 1px solid rgba(201, 163, 92, 0.2);
  border-radius: 99px;
  padding: 0.5rem 0.9rem;
  outline: none;
  cursor: pointer;
  max-width: 175px;
  transition: border-color 0.25s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%237d745f'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
}
.filter-selects select:focus, .filter-selects select.active {
  border-color: rgba(201, 163, 92, 0.6);
  color: var(--gold-bright);
}
.filter-selects select option { background: #14120e; color: var(--ink); }

.filter-meta {
  display: flex; align-items: center; gap: 0.8rem;
  margin-left: auto;
}
.result-count {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}
.reset-btn {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
  background: none;
  border: 1px solid rgba(201, 163, 92, 0.4);
  border-radius: 99px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: background 0.25s;
}
.reset-btn:hover { background: rgba(201, 163, 92, 0.12); }

/* ---------------- timeline ---------------- */

.timeline-wrap {
  position: relative;
  padding: 4rem 0 6rem;
}

.timeline {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(0.8rem, 3vw, 2rem);
}

/* central spine — soft glow built from a wide gradient (a box-shadow on an
   element this tall is far too expensive to rasterize) */
.timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 17px;
  transform: translateX(-8.5px);
  background:
    linear-gradient(90deg,
      transparent 0%,
      rgba(201, 163, 92, 0.06) 30%,
      rgba(201, 163, 92, 0.38) 49%,
      rgba(201, 163, 92, 0.38) 51%,
      rgba(201, 163, 92, 0.06) 70%,
      transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 3%, #000 97%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 3%, #000 97%, transparent 100%);
}

/* era dividers */
.era-divider {
  position: relative;
  text-align: center;
  padding: 5rem 1rem 3.5rem;
  z-index: 2;
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.era-divider.revealed { opacity: 1; transform: none; }
.era-divider .era-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.6vw, 2.4rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 0 40px rgba(201, 163, 92, 0.3);
}
.era-divider .era-range {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--gold);
  margin-top: 0.4rem;
  letter-spacing: 0.08em;
}
.era-divider .era-desc {
  max-width: 560px;
  margin: 1.1rem auto 0;
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--ink-faint);
  font-style: italic;
}
.era-divider::before {
  content: "✦";
  display: block;
  color: var(--gold);
  font-size: 0.85rem;
  margin-bottom: 1.6rem;
  text-shadow: 0 0 18px rgba(201, 163, 92, 0.8);
}

/* entry rows: grid with center gutter for the spine */
.entry {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  align-items: center;
  margin: 0 0 3.2rem;
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.entry.revealed { opacity: 1; transform: none; }
.entry.hidden { display: none; }

/* deeper eras reveal a touch more slowly — time gets heavier */
.era-bronze .entry, .era-deeptime .entry { transition-duration: 1.3s; }

/* node on the spine */
.entry-node {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #191510;
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 163, 92, 0.08);
  transition: box-shadow 0.4s ease, background 0.4s ease, transform 0.4s ease;
  z-index: 2;
}
.entry.focused .entry-node {
  background: var(--gold-bright);
  transform: scale(1.35);
  box-shadow:
    0 0 0 5px rgba(201, 163, 92, 0.15),
    0 0 22px 4px rgba(201, 163, 92, 0.55);
}

/* year tick beside the node, on the side opposite the card */
.entry-tick {
  grid-row: 1;
  font-family: var(--display);
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  white-space: nowrap;
  transition: color 0.4s ease, text-shadow 0.4s ease;
}
.entry.left .entry-tick  { grid-column: 3; justify-self: start; padding-left: 1.6rem; }
.entry.right .entry-tick { grid-column: 1; justify-self: end;  padding-right: 1.6rem; text-align: right; }
.entry.focused .entry-tick {
  color: var(--gold-bright);
  text-shadow: 0 0 20px rgba(201, 163, 92, 0.45);
}

/* ---------------- card ---------------- */

.card {
  grid-row: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1.5rem 1.6rem 1.4rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
  position: relative;
  overflow: hidden;
}
.entry.left .card  { grid-column: 1; }
.entry.right .card { grid-column: 3; }

/* faint illuminated-corner ornament */
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201, 163, 92, 0.5), transparent);
  opacity: 0.5;
  transition: opacity 0.4s ease;
}

.entry.focused .card {
  border-color: rgba(201, 163, 92, 0.5);
  box-shadow:
    0 12px 46px rgba(0, 0, 0, 0.55),
    0 0 32px rgba(201, 163, 92, 0.10);
  transform: translateY(-2px);
}
.entry.focused .card::before { opacity: 1; }

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.7rem;
}
.card-date {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.evidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid rgba(201, 163, 92, 0.25);
  border-radius: 99px;
  padding: 0.22rem 0.65rem;
  white-space: nowrap;
}
.evidence-badge .ev-icon { color: var(--gold-bright); font-size: 0.75rem; }

.card-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.15;
  color: var(--ink);
}
.card-endonym {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-dim);
  margin-top: 0.15rem;
}

.card-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem 1.2rem;
  margin: 1rem 0 0.9rem;
  padding: 0.9rem 0;
  border-top: 1px solid rgba(201, 163, 92, 0.12);
  border-bottom: 1px solid rgba(201, 163, 92, 0.12);
}
.meta-item { min-width: 0; }
.meta-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.15rem;
}
.meta-value {
  font-size: 0.83rem;
  color: var(--ink-dim);
  line-height: 1.4;
}
.meta-value .branch { color: var(--ink-faint); font-size: 0.76rem; display: block; }

.status-chip {
  display: inline-block;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.24rem 0.7rem;
  border-radius: 99px;
  border: 1px solid currentColor;
  line-height: 1.4;
}

.card-blurb {
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--ink-dim);
}
.card-blurb::first-letter {
  font-size: 1.5em;
  color: var(--gold-bright);
  font-weight: 500;
}

.card-note {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-faint);
  background: rgba(201, 163, 92, 0.05);
  border-left: 2px solid rgba(201, 163, 92, 0.35);
  border-radius: 0 4px 4px 0;
}
.card-note .note-icon { color: var(--gold); flex: 0 0 auto; }
.card-note b { color: var(--ink-dim); font-weight: 600; letter-spacing: 0.05em; }

.no-results {
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--ink-faint);
  padding: 5rem 1rem;
}

/* ---------------- deep-era tinting ---------------- */
/* the deeper the era, the warmer/older the cards feel */

.era-classical .card { background: rgba(22, 18, 13, 0.84); }
.era-ironage .card   { background: rgba(24, 18, 11, 0.86); border-color: rgba(201, 155, 80, 0.26); }
.era-bronze .card    { background: rgba(26, 18, 10, 0.88); border-color: rgba(206, 152, 72, 0.3); }
.era-deeptime .card  {
  background: rgba(24, 15, 9, 0.9);
  border-color: rgba(212, 148, 62, 0.32);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.6);
}
.era-deeptime .card-blurb, .era-bronze .card-blurb { color: #bcac8e; }

/* ---------------- finale ---------------- */

.finale {
  position: relative;
  padding: 7rem 1.5rem 6rem;
  text-align: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 163, 92, 0.05), transparent 70%);
}
.finale-inner { max-width: 900px; margin: 0 auto; }

.finale-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.6rem;
}
.finale-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: 0.08em;
  color: var(--ink);
  text-shadow: 0 0 70px rgba(201, 163, 92, 0.25);
}
.finale-lede {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--ink-dim);
  max-width: 640px;
  margin: 1.8rem auto 0;
}

.finale-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.6rem;
  margin-top: 3.5rem;
  text-align: left;
}
.finale-card {
  background: rgba(28, 20, 11, 0.85);
  border: 1px solid rgba(212, 158, 72, 0.35);
  border-radius: 10px;
  padding: 2.2rem 2rem;
  box-shadow: 0 16px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(232,201,135,0.12);
  position: relative;
}
.finale-card-glyphs {
  font-size: 2rem;
  color: rgba(232, 201, 135, 0.5);
  margin-bottom: 1.2rem;
  text-shadow: 0 0 24px rgba(201, 163, 92, 0.4);
}
.finale-card h3 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--gold-bright);
}
.finale-card-date {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0.5rem 0 1rem;
}
.finale-card p:last-child {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink-dim);
  line-height: 1.65;
}

.finale-divider {
  margin: 4rem 0 3rem;
  color: var(--gold);
  letter-spacing: 1em;
  font-size: 0.8rem;
  opacity: 0.7;
}

.finale-coda { max-width: 680px; margin: 0 auto; text-align: left; }
.finale-coda h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-align: center;
  margin-bottom: 1.6rem;
}
.finale-coda p {
  font-family: var(--serif);
  font-size: 1.14rem;
  color: var(--ink-dim);
  line-height: 1.75;
}
.finale-coda p + p { margin-top: 1.2rem; }
.finale-coda em { color: var(--gold-bright); }
.finale-last {
  text-align: center;
  font-style: italic;
  color: var(--ink) !important;
  padding-top: 1rem;
}

/* ---------------- footer ---------------- */

.site-footer {
  text-align: center;
  padding: 3rem 1.5rem 4rem;
  border-top: 1px solid rgba(201, 163, 92, 0.12);
}
.site-footer p {
  max-width: 620px;
  margin: 0 auto;
  font-size: 0.78rem;
  color: var(--ink-faint);
  line-height: 1.7;
}
.footer-mark {
  margin-top: 1.6rem !important;
  font-size: 0.62rem !important;
  letter-spacing: 0.45em;
  color: var(--gold-deep) !important;
}

/* ---------------- responsive: single column ---------------- */

@media (max-width: 820px) {
  .timeline::before { left: 22px; }

  .entry {
    grid-template-columns: 44px 1fr;
    margin-bottom: 2.4rem;
  }
  .entry-node { grid-column: 1; grid-row: 1; align-self: start; margin-top: 1.9rem; }
  .entry.left .entry-tick, .entry.right .entry-tick {
    grid-column: 2; grid-row: 2;
    justify-self: start;
    padding: 0.5rem 0 0 0;
    font-size: 0.95rem;
    text-align: left;
  }
  .entry.left .card, .entry.right .card { grid-column: 2; grid-row: 1; }

  .year-display { top: auto; bottom: 8%; max-width: 100vw; overflow: hidden; }
  .year-main { font-size: clamp(1.7rem, 9.5vw, 3rem); }

  .era-divider { text-align: left; padding-left: 44px; }
  .era-divider::before { margin-left: 0.2rem; text-align: left; }
  .era-divider .era-desc { margin-left: 0; }

  .filter-meta { margin-left: 0; width: 100%; justify-content: space-between; }

  /* collapse filters behind a toggle so the sticky bar stays small */
  .filters-toggle {
    display: inline-block;
    font-family: var(--sans);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--ink-dim);
    background: rgba(232, 224, 208, 0.05);
    border: 1px solid rgba(201, 163, 92, 0.2);
    border-radius: 99px;
    padding: 0.5rem 1rem;
    cursor: pointer;
  }
  .filters-toggle.active { color: var(--gold-bright); border-color: rgba(201, 163, 92, 0.6); }
  .filter-controls { display: none; width: 100%; }
  .filter-bar.open .filter-controls { display: flex; }
  .search-wrap { flex: 1 1 auto; min-width: 0; }
}

/* ---------------- shareability & navigation features ---------------- */

.era-divider .era-title { margin: 0; }

mark {
  background: rgba(201, 163, 92, 0.28);
  color: var(--gold-bright);
  border-radius: 3px;
  padding: 0 2px;
}

.card-top-right { display: inline-flex; align-items: center; gap: 0.45rem; }

.copy-link {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1;
  transition: color 0.2s;
}
.copy-link:hover { color: var(--gold-bright); }
.copy-link.copied { color: var(--st-living); }
.copy-link svg { width: 14px; height: 14px; }

.card-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(201, 163, 92, 0.12);
}
.card-related { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.rel-label {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: 0.15rem;
}
.related-chip {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--ink-dim);
  background: rgba(232, 224, 208, 0.05);
  border: 1px solid rgba(201, 163, 92, 0.22);
  border-radius: 99px;
  padding: 0.22rem 0.68rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.related-chip:hover { color: var(--gold-bright); border-color: rgba(201, 163, 92, 0.55); }
.card-wiki {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
}
.card-wiki:hover { color: var(--gold-bright); text-decoration: underline; }

.random-btn {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  background: none;
  border: 1px solid rgba(201, 163, 92, 0.25);
  border-radius: 99px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.25s, background 0.25s;
}
.random-btn:hover { color: var(--gold-bright); background: rgba(201, 163, 92, 0.12); }

/* navigated-to card pulse */
@keyframes cardFlash {
  0%   { box-shadow: 0 0 0 2px rgba(232, 201, 135, 0.95), 0 0 44px rgba(201, 163, 92, 0.5); }
  100% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }
}
.entry.flash .card { animation: cardFlash 1.8s ease-out; }

/* ---------------- era rail ---------------- */

.era-rail {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 13px;
  z-index: 55;
}
.era-rail-item {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 163, 92, 0.45);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s, box-shadow 0.25s;
}
.era-rail-item:hover, .era-rail-item.active {
  background: var(--gold-bright);
  box-shadow: 0 0 10px rgba(201, 163, 92, 0.6);
}
.era-rail-item::after {
  content: attr(data-label);
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: rgba(10, 10, 9, 0.92);
  border: 1px solid rgba(201, 163, 92, 0.25);
  padding: 0.28rem 0.65rem;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.era-rail-item:hover::after { opacity: 1; }
@media (max-width: 1099px) { .era-rail { display: none; } }

/* ---------------- to-scale strip ---------------- */

.scale-section {
  padding: 6rem 1.5rem 4rem;
  text-align: center;
}
.scale-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.4rem;
}
.scale-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  letter-spacing: 0.1em;
  color: var(--ink);
  text-shadow: 0 0 60px rgba(201, 163, 92, 0.2);
  margin: 0;
}
.scale-lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-dim);
  max-width: 620px;
  margin: 1.4rem auto 0;
}
.scale-wrap { max-width: 1000px; margin: 3rem auto 0; }
.scale-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 1.8rem 0 0.5rem;
}
.scale-bar {
  position: relative;
  height: 56px;
  background: linear-gradient(180deg, rgba(22, 18, 13, 0.92), rgba(13, 11, 8, 0.92));
  border: 1px solid rgba(201, 163, 92, 0.25);
  border-radius: 6px;
}
.scale-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: rgba(201, 163, 92, 0.45);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, box-shadow 0.15s;
}
.scale-tick:hover {
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(201, 163, 92, 0.85);
  z-index: 2;
}
.scale-writing {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(201, 163, 92, 0.06), rgba(201, 163, 92, 0.22));
  border-left: 1px solid rgba(201, 163, 92, 0.5);
  pointer-events: none;
}
.scale-caption {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-faint);
  max-width: 640px;
  margin: 0.9rem auto 0;
}
.scale-caption em { color: var(--gold-bright); font-style: inherit; }

/* ---------------- reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .entry, .era-divider { opacity: 1; transform: none; transition: none; }
  .entry.flash .card { animation: none; }
  .hero-kicker, .hero-title, .hero-subtitle, .hero-rule, .hero-intro,
  .hero-stats, .legend, .scroll-cue { animation: none; }
  .scroll-cue-line { animation: none; }
  .year-display.switching .year-main { opacity: 1; transform: none; }
}
