/* Solana History Map — formal interactive archive.
   The map stays the exhibit; interface chrome is restrained and source-led. */

/* Self-hosted variable fonts (latin subset) — zero third-party requests. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/Inter-var.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/JetBrainsMono-var.woff2") format("woff2");
}

:root {
  --bg: #07090d;
  --bg-2: #0b0f15;
  --panel: #0e131a;
  --panel-2: #11171f;
  --ink: #f4f7fb;
  --ink-dim: #c8d2dc;
  --muted: #8595a6;
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.16);
  --solana-green: #5df5b4;
  --solana-cyan: #3dd6ff;
  --archive-gold: #d7c08a;
  --danger: #ff476f;
  --amber: #f5c451;
  --font-ui: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --glow-green: 0 0 10px rgba(93, 245, 180, 0.22);
  --header-h: 60px;
  --ribbon-h: 34px;
}

* { box-sizing: border-box; }

html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(215, 192, 138, 0.045), transparent 60%),
    radial-gradient(900px 700px at 8% 110%, rgba(93, 245, 180, 0.035), transparent 60%),
    var(--bg);
  color: var(--ink);
}

a { color: inherit; }

/* ---------- archive header ---------- */
.site-header {
  position: relative; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  min-height: var(--header-h);
  padding: 10px clamp(14px, 3vw, 36px);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: rgba(7, 9, 13, 0.92);
  backdrop-filter: blur(16px);
}
.brand-mark { display: grid; gap: 1px; text-decoration: none; }
.brand-kicker,
.panel-topline,
.section-label,
.section-heading p,
.selected-meta,
.landmark-card p {
  margin: 0; font-family: var(--font-mono); font-size: 11px; line-height: 1.3;
  letter-spacing: 1.4px; color: var(--archive-gold); text-transform: uppercase;
}
.brand-title { font-weight: 800; font-size: 19px; line-height: 1; letter-spacing: 0.2px; }
.brand-mark:hover .brand-title { color: var(--ink); }

.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a, .source-actions a, .landmark-card button, .btn-hud {
  min-height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.14); border-radius: 3px; padding: 0 12px;
  color: var(--ink-dim); background: rgba(255, 255, 255, 0.025);
  text-decoration: none; font-family: var(--font-mono); font-weight: 700; font-size: 11px;
  letter-spacing: 0.7px; text-transform: uppercase; cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.nav-links a:hover, .source-actions a:hover, .landmark-card button:hover, .btn-hud:hover {
  border-color: rgba(215, 192, 138, 0.55); background: rgba(215, 192, 138, 0.08); color: var(--ink);
}
.nav-links a[data-archive] { color: var(--muted); }
.fx-toggle { font-size: 11px; }
.fx-toggle .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--archive-gold); margin-right: 6px; box-shadow: 0 0 6px rgba(215,192,138,0.55); }
body[data-fx="off"] .fx-toggle .dot { background: var(--muted); box-shadow: none; }

/* ---------- On this day ribbon ---------- */
.otd-ribbon {
  display: flex; align-items: center; gap: 12px;
  padding: 8px clamp(14px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px; color: var(--ink-dim);
}
.otd-ribbon .otd-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--archive-gold); white-space: nowrap;
}
.otd-ribbon a { color: var(--ink); text-decoration: none; border-bottom: 1px solid transparent; }
.otd-ribbon a:hover { border-bottom-color: var(--archive-gold); }
.otd-ribbon .otd-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- atlas layout ---------- */
.atlas-shell {
  position: relative;
  display: block;
  height: calc(100svh - var(--header-h) - var(--ribbon-h));
  min-height: 620px;
  overflow: hidden;
  background: #020305;
}

.map-stage {
  position: absolute; inset: 0; overflow: hidden; background: #020305;
  min-height: 0;
  height: 100%;
}
.map-viewport { position: absolute; inset: 0; cursor: default; touch-action: manipulation; }
.map-viewport.is-dragging { cursor: default; }
.map-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; --inv: 1; }
.map-world .atlas-map {
  display: block; width: auto; max-width: none; height: auto;
  user-select: none; -webkit-user-drag: none;
  filter: saturate(0.94) contrast(1.02) brightness(0.92);
}

/* CRT scanlines + slow flicker (chrome only, never over the story panel).
   NOTE: no mix-blend-mode here — it black-screens the GPU-composited map layer. */
.map-stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 6;
  background-image: url("assets/scanlines.png");
  background-repeat: repeat; background-size: auto 3px;
  opacity: 0.045;
  animation: none;
}
/* vignette + signal tint */
.map-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 6;
  background:
    radial-gradient(120% 120% at 50% 50%, transparent 52%, rgba(2, 3, 5, 0.62) 100%),
    linear-gradient(180deg, rgba(7, 9, 13, 0) 58%, rgba(7, 9, 13, 0.46) 100%),
    linear-gradient(90deg, rgba(7, 9, 13, 0.24), transparent 18%, transparent 82%, rgba(7, 9, 13, 0.24));
}
@keyframes crt-flicker { 0%, 100% { opacity: 0.10; } 48% { opacity: 0.085; } 50% { opacity: 0.12; } 52% { opacity: 0.09; } }

/* map HUD: progress readout */
.map-hud {
  position: absolute; left: 16px; top: 14px; z-index: 8;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.progress-readout {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.3px;
  color: var(--archive-gold); text-shadow: none;
  background: rgba(7, 9, 13, 0.58); border: 1px solid rgba(215,192,138,0.22);
  padding: 5px 10px; border-radius: 3px;
}
.progress-track { width: 168px; height: 3px; border-radius: 4px; background: rgba(255,255,255,0.10); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--archive-gold), var(--solana-green)); transition: width .5s ease; }

.map-zoom { position: absolute; right: 14px; bottom: 14px; z-index: 12; display: flex; flex-direction: column; gap: 6px; }
.btn-zoom { width: 38px; height: 38px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--ink); background: rgba(7, 9, 13, 0.74); border: 1px solid var(--line-2); border-radius: 8px; cursor: pointer; backdrop-filter: blur(6px); transition: border-color .18s ease, color .18s ease; }
.btn-zoom:hover { border-color: var(--solana-green); color: var(--solana-green); }
.map-curator-note {
  position: absolute; right: 18px; top: 16px; z-index: 11;
  display: grid; gap: 4px; max-width: 320px;
  padding: 10px 12px; border: 1px solid rgba(255,255,255,0.12); border-radius: 3px;
  background: rgba(7, 9, 13, 0.50); color: var(--ink-dim); pointer-events: none;
  backdrop-filter: blur(8px);
}
.map-curator-note span {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.3px;
  color: var(--archive-gold); text-transform: uppercase;
}
.map-curator-note strong { font-size: 13px; line-height: 1.35; font-weight: 650; }
.map-learn-cta { pointer-events: auto; margin-top: 3px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .3px; color: var(--solana-green); text-decoration: none; border-bottom: 1px dotted rgba(93,245,180,.5); width: max-content; }
.map-learn-cta:hover { color: #bdeaff; }
.map-hint { position: absolute; left: 16px; bottom: 14px; z-index: 11; font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); background: rgba(7, 9, 13, 0.48); padding: 4px 8px; border-radius: 3px; pointer-events: none; opacity: .85; transition: opacity .5s ease; }
.map-hint a { pointer-events: auto; color: var(--solana-cyan); text-decoration: none; border-bottom: 1px dotted rgba(61,214,255,.5); }
.map-hint a:hover { color: #bdeaff; }
.map-hint.hide { opacity: 0; }

/* ---------- markers: unified, high-contrast; counter-scaled to stay constant
   on-screen size at any zoom (--inv = 1/worldScale). Single meaning:
   unlit = not opened yet, lit green = opened. No per-category colors. ---------- */
.marker-layer { position: absolute; inset: 0; z-index: 7; }
.map-marker {
  --size: calc(30px * var(--inv, 1));
  position: absolute; left: var(--x); top: var(--y);
  /* pin: the circle sits ABOVE the landmark point (a stem points down at it) so it never covers the art */
  transform: translate(-50%, calc(-100% - 7px * var(--inv,1)));
  width: var(--size); height: var(--size); padding: 0;
  border: calc(1.3px * var(--inv, 1)) solid rgba(210, 224, 227, 0.82); border-radius: 50%;
  background: rgba(6, 10, 16, 0.72);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 0 0 calc(2px * var(--inv,1)) rgba(6, 10, 16, 0.55), 0 calc(2px*var(--inv,1)) calc(10px*var(--inv,1)) rgba(0, 0, 0, 0.6);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.map-marker::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: calc(1.6px * var(--inv,1)); height: calc(7px * var(--inv,1));
  background: linear-gradient(rgba(210,224,227,0.85), rgba(210,224,227,0.35));
  transform: translateX(-50%); pointer-events: none;
}
.map-marker.is-explored::after { background: linear-gradient(rgba(215,192,138,0.9), rgba(215,192,138,0.4)); }
.map-marker .marker-num {
  font-family: var(--font-mono); font-size: calc(12.5px * var(--inv, 1)); font-weight: 800;
  color: #f1f7fb; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}
.map-marker .marker-tag {
  position: absolute; left: 50%; bottom: calc(100% + 8px * var(--inv,1)); transform: translateX(-50%) translateY(4px);
  white-space: nowrap; font-family: var(--font-mono); font-size: calc(11px * var(--inv,1)); letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink); background: rgba(7, 9, 13, 0.95);
  border: calc(1px*var(--inv,1)) solid rgba(255,255,255,0.16); border-radius: calc(3px*var(--inv,1));
  padding: calc(3px*var(--inv,1)) calc(7px*var(--inv,1));
  opacity: 0; pointer-events: none; transition: opacity .16s ease, transform .16s ease;
}
.map-marker:hover .marker-tag, .map-marker:focus-visible .marker-tag, .map-marker.is-active .marker-tag {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.map-marker:hover, .map-marker:focus-visible {
  transform: translate(-50%, calc(-100% - 7px * var(--inv,1))) scale(1.16); border-color: var(--archive-gold);
  box-shadow: 0 0 0 calc(2px*var(--inv,1)) rgba(6,10,16,0.6), 0 0 calc(12px*var(--inv,1)) rgba(215, 192, 138, 0.34); outline: none; z-index: 30;
}
.map-marker.is-explored {
  background: #d7c08a; border-color: #fff0bd;
  box-shadow: 0 0 0 calc(2px*var(--inv,1)) rgba(6, 10, 16, 0.45), 0 0 calc(12px*var(--inv,1)) rgba(215, 192, 138, 0.36);
}
.map-marker.is-explored .marker-num { color: #04130c; text-shadow: none; }
.map-marker.is-active { z-index: 40; transform: translate(-50%, calc(-100% - 7px * var(--inv,1))) scale(1.16); }
.map-marker.is-active::before {
  content: ""; position: absolute; inset: calc(-3px * var(--inv,1)); border-radius: 50%;
  border: calc(1.6px*var(--inv,1)) solid rgba(215, 192, 138, 0.88);
}
@keyframes marker-pulse { from { transform: scale(1); opacity: 0.75; } to { transform: scale(2.4); opacity: 0; } }

/* ---------- record panel ---------- */
.landmark-panel {
  position: absolute; left: 50%; bottom: clamp(14px, 2.2vw, 24px); z-index: 14;
  width: min(1040px, calc(100% - 48px));
  max-height: min(260px, calc(100% - 96px));
  transform: translateX(-50%);
  display: grid; grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.45fr) max-content;
  align-items: center; column-gap: clamp(18px, 2.5vw, 34px); row-gap: 7px;
  padding: clamp(16px, 1.8vw, 22px);
  border: 1px solid rgba(215, 192, 138, 0.22);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(12, 15, 18, 0.86), rgba(8, 10, 13, 0.94));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  min-height: 0;
  overflow-y: auto;
}
.panel-topline { color: var(--archive-gold); }
.selected-title {
  position: relative; margin: 0; font-size: clamp(24px, 2.8vw, 36px);
  line-height: 1.02; letter-spacing: 0; font-weight: 800;
}
.selected-title.is-updated { animation: title-settle .26s ease-out 1; }
@keyframes title-settle { from { opacity: .55; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

.selected-meta { color: var(--muted); }
.selected-tldr { margin: 0; color: var(--ink); font-size: clamp(15px, 1.2vw, 17px); line-height: 1.48; font-weight: 600; }
.story-block { display: grid; gap: 11px; }
.story-block section { display: grid; gap: 5px; }
.story-block h4 {
  margin: 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--archive-gold); font-weight: 700;
}
.story-block p { margin: 0; color: var(--ink-dim); font-size: 14px; line-height: 1.55; }
.story-empty { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }

/* evidence drawer (console-styled sources) */
.evidence { border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.025); overflow: hidden; }
.evidence > summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--archive-gold); display: flex; align-items: center; gap: 8px;
}
.evidence > summary::-webkit-details-marker { display: none; }
.evidence > summary::before { content: "▸"; color: var(--muted); transition: transform .15s ease; }
.evidence[open] > summary::before { transform: rotate(90deg); }
.evidence .evidence-body { padding: 4px 14px 14px; display: grid; gap: 8px; }
.source-line { display: grid; gap: 2px; }
.source-line .src-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.source-line a { color: var(--ink); font-size: 13px; text-decoration: none; border-bottom: 1px solid rgba(215,192,138,0.3); width: max-content; }
.source-line a:hover { border-bottom-color: var(--archive-gold); }
.affiliation-note { margin: 2px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4; }

.landmark-panel .panel-topline { grid-column: 1; grid-row: 1; align-self: end; }
.landmark-panel .selected-title { grid-column: 1; grid-row: 2; align-self: start; }
.landmark-panel .selected-meta { grid-column: 1; grid-row: 3; }
.landmark-panel .selected-tldr { grid-column: 2; grid-row: 1 / span 2; }
.landmark-panel .story-block { grid-column: 2; grid-row: 3; }
.landmark-panel .story-block section:nth-child(n+2),
.landmark-panel .evidence,
.landmark-panel .affiliation-note { display: none; }
.panel-actions {
  grid-column: 3; grid-row: 1 / span 3;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-content: center;
  max-width: 210px; padding-top: 0;
}
.btn-story {
  color: #10100c;
  background: linear-gradient(90deg, #d7c08a, #e6d9b0);
  border-color: rgba(215, 192, 138, 0.72);
}
.btn-story:hover { color: #10100c; background: linear-gradient(90deg, #ead9a2, #f2e5c4); }

/* ---------- secondary sections + footer ---------- */
.landmark-rail-section, .proof-split { padding: clamp(28px, 5vw, 56px) clamp(14px, 3vw, 36px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: clamp(24px, 3.6vw, 38px); }
.landmark-rail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.landmark-card { border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.03); overflow: hidden; transition: border-color .2s ease, transform .2s ease; }
.landmark-card:hover { border-color: rgba(93,245,180,0.4); transform: translateY(-2px); }
.landmark-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; background: var(--panel-2); }
.landmark-card > div { display: grid; gap: 8px; padding: 13px; }
.landmark-card h3 { margin: 0; font-size: 16px; line-height: 1.15; }
.landmark-card span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.landmark-card button { width: max-content; }

.proof-split { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1fr); gap: clamp(18px, 4vw, 48px); border-top: 1px solid var(--line); background: var(--bg-2); }
.proof-split p { margin: 0; color: var(--ink-dim); font-size: 16px; line-height: 1.7; }

.site-footer {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  min-height: 64px; padding: 16px clamp(14px, 3vw, 36px);
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.site-footer .foot-brand { color: var(--ink); font-weight: 800; }
.site-footer a { color: var(--muted); text-decoration: none; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.5px; }
.site-footer a:hover { color: var(--archive-gold); }
.site-footer .foot-spacer { margin-left: auto; }

/* page-shell (about/sources) */
.page-shell { width: min(1100px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 64px; }
.page-shell h1 { margin: 0 0 14px; font-size: clamp(34px, 5.5vw, 60px); line-height: 1; }
.page-shell > p { max-width: 760px; margin: 0 0 28px; color: var(--ink-dim); font-size: 17px; line-height: 1.6; }
.source-list, .about-grid { display: grid; gap: 14px; }
.source-row, .about-block { border: 1px solid var(--line); border-radius: 8px; padding: 18px; background: rgba(255,255,255,0.03); }
.source-row h2, .about-block h2 { margin: 0 0 10px; font-size: 20px; }
.source-row p, .about-block p, .about-block li { color: var(--ink-dim); line-height: 1.6; }
.source-row a { color: var(--solana-cyan); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .atlas-shell { height: auto; min-height: 0; overflow: visible; }
  .map-stage { position: relative; min-height: 64vh; height: 64vh; }
  .atlas-map { min-height: 60vh; }
  .landmark-panel {
    position: relative; left: auto; bottom: auto; transform: none; width: auto; max-height: none;
    display: flex; margin: 0; border-left: 0; border-right: 0; border-radius: 0; overflow: visible;
  }
  .landmark-panel .panel-topline,
  .landmark-panel .selected-title,
  .landmark-panel .selected-meta,
  .landmark-panel .selected-tldr,
  .landmark-panel .story-block,
  .panel-actions { grid-column: auto; grid-row: auto; }
  .landmark-rail, .proof-split { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .site-header { flex-wrap: wrap; }
  .nav-links a { font-size: 11px; padding: 0 9px; }
  .map-marker { --size: 22px; }
  .otd-ribbon .otd-text { white-space: normal; }
}

/* ---------- reduced motion + fx kill switch ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .map-stage::before { animation: none; }
  .map-marker.is-active::before { animation: none; }
  .selected-title.glitch::before, .selected-title.glitch::after { animation: none; opacity: 0; }
  .map-marker, .landmark-card, .progress-fill { transition: none; }
}
body[data-fx="off"] .map-stage::before { animation: none; opacity: 0.06; }
body[data-fx="off"] .map-marker.is-active::before { animation: none; }
body[data-fx="off"] .selected-title.glitch::before, body[data-fx="off"] .selected-title.glitch::after { animation: none; opacity: 0; }
body[data-fx="off"] .brand-mark:hover .brand-title, body[data-fx="off"] .progress-readout { text-shadow: none; }
