/* ============================================================
   SPACE 51 - design system
   Dark table, bone documents, ink-red stamps.
   Type: Archivo (variable, width axis) / IBM Plex Mono / IBM Plex Sans
   ============================================================ */

@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo-latin-wdth-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Plex Sans';
  src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Plex Sans';
  src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}

:root {
  --bg: #0b0c0e;
  --bg-2: #101216;
  --paper: #e9e4d6;
  --paper-2: #e2dccb;
  --ink: #1a1b1d;
  --ink-soft: #45443f;
  --text: #d6d3c9;
  --dim: #8b887d;
  --line: rgba(214, 211, 201, 0.14);
  --red: #c2391f;
  --red-soft: rgba(194, 57, 31, 0.16);
  --green: #4caf6f;
  --amber: #d29a3a;
  --display: 'Archivo', system-ui, sans-serif;
  --mono: 'Plex Mono', ui-monospace, monospace;
  --sans: 'Plex Sans', system-ui, sans-serif;
  --pad: clamp(20px, 5vw, 64px);
  --w-cab: 1080px;
  --w-sheet: 760px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; }
a { color: inherit; }
::selection { background: var(--red); color: var(--paper); }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* film grain - dark surfaces only */
.grain {
  position: fixed; inset: -50%; width: 200%; height: 200%;
  opacity: 0.05; pointer-events: none; z-index: 2;
}

/* ---------------- top bar ---------------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--pad);
  background: linear-gradient(rgba(11,12,14,0.92), rgba(11,12,14,0.75) 70%, transparent);
  backdrop-filter: blur(2px);
}
.bar-mark {
  font-family: var(--display); font-stretch: 122%; font-weight: 800;
  font-size: 0.95rem; letter-spacing: 0.14em; text-decoration: none;
}
.bar-right { color: var(--dim); }
@media (max-width: 560px) { .bar-right { display: none; } }

/* ---------------- hero ---------------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: var(--pad);
}
/* hero planet canvas (homepage only) */
#stage { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#fallback-mars {
  position: fixed; z-index: 0; display: none; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at center, #000 60%, transparent 78%);
          mask-image: radial-gradient(circle at center, #000 60%, transparent 78%);
}
.hero-eyebrow { color: var(--dim); margin-bottom: 18px; }
.hero-title {
  font-family: var(--display); font-stretch: 125%; font-weight: 800;
  font-size: clamp(3.2rem, 13vw, 9.5rem);
  line-height: 0.95; letter-spacing: 0.02em; color: var(--paper);
  text-transform: uppercase; white-space: nowrap;
}
.hero-sub { color: var(--dim); margin-top: 22px; }
.hero-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  color: var(--dim); text-decoration: none; display: inline-flex; gap: 10px; align-items: center;
}
.hero-cue:hover { color: var(--paper); }
.cue-arrow { display: inline-block; animation: cue 2.2s ease-in-out infinite; }
@keyframes cue { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .cue-arrow { animation: none; } }

/* homepage planet layering + hybrid composition */
.home .hero { z-index: 1; background: transparent; }
.home-body {
  position: relative; z-index: 1;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='340'%3E%3Cg fill='%23e9e4d6'%3E%3Ccircle cx='24' cy='38' r='0.9' opacity='0.5'/%3E%3Ccircle cx='112' cy='20' r='0.6' opacity='0.4'/%3E%3Ccircle cx='198' cy='64' r='0.5' opacity='0.32'/%3E%3Ccircle cx='276' cy='30' r='0.8' opacity='0.45'/%3E%3Ccircle cx='320' cy='96' r='0.55' opacity='0.36'/%3E%3Ccircle cx='58' cy='120' r='0.6' opacity='0.4'/%3E%3Ccircle cx='150' cy='150' r='0.5' opacity='0.3'/%3E%3Ccircle cx='244' cy='132' r='0.7' opacity='0.42'/%3E%3Ccircle cx='300' cy='196' r='0.5' opacity='0.32'/%3E%3Ccircle cx='30' cy='210' r='0.7' opacity='0.44'/%3E%3Ccircle cx='120' cy='244' r='0.55' opacity='0.36'/%3E%3Ccircle cx='196' cy='226' r='0.6' opacity='0.38'/%3E%3Ccircle cx='268' cy='280' r='0.8' opacity='0.46'/%3E%3Ccircle cx='86' cy='300' r='0.5' opacity='0.3'/%3E%3Ccircle cx='168' cy='318' r='0.6' opacity='0.4'/%3E%3Ccircle cx='320' cy='250' r='0.55' opacity='0.34'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
}
@media (min-aspect-ratio: 1/1) {
  .home .hero { align-items: flex-start; text-align: left; }
  .home .hero-inner { max-width: min(60vw, 760px); }
  .home .hero-cue { left: var(--pad); transform: none; }
  .home .hero-sub { display: none; }
}

/* redaction reveal: bar slides off to expose text */
.redact-line { position: relative; display: inline-block; }
.redact-line::after {
  content: ''; position: absolute; inset: 0.04em -0.08em;
  background: var(--ink); border: 1px solid rgba(214,211,201,0.18);
  transform: scaleX(1); transform-origin: right;
  transition: transform 0.7s cubic-bezier(0.77, 0, 0.18, 1);
}
.redact-line.declassified::after { transform: scaleX(0); }
.no-anim .redact-line::after { display: none; }

/* ---------------- index: archive ---------------- */
.cabinet { max-width: var(--w-cab); margin: 0 auto; padding: 0 var(--pad) 12vh; }

/* clearance gate - the designed cut from orbit into the archive */
.gate { max-width: var(--w-cab); margin: 0 auto; padding: 0 var(--pad) 1vh; }
.gate-band {
  width: 100vw; margin-left: calc(50% - 50vw);
  display: flex; justify-content: center; padding: 18px var(--pad);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(0deg, rgba(233,228,214,0.025) 0 1px, transparent 1px 4px);
  margin-bottom: 6vh;
}
.gate-line { color: var(--dim); letter-spacing: 0.2em; }
.gate-band .redact-line::after { background: var(--ink); }
.gate-label { color: var(--red); margin-bottom: 14px; }
.intro {
  max-width: 640px; color: var(--text); font-size: 1.05rem;
  border-left: 2px solid var(--red); padding-left: 22px; margin: 0;
}

/* classification divider */
.drawer { margin-top: 12vh; }
.drawer:first-of-type { margin-top: 9vh; }
.divider { margin-bottom: 30px; }
.divider-top { display: flex; justify-content: space-between; gap: 18px; color: var(--dim); margin-bottom: 12px; }
.divider-letter { color: var(--red); font-weight: 500; }
.divider-note { text-align: right; }
.divider-title {
  font-family: var(--display); font-stretch: 120%; font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 3.2rem); text-transform: uppercase;
  letter-spacing: 0.02em; color: var(--paper); line-height: 1;
}
.divider-rule {
  display: block; height: 1px; margin-top: 16px;
  background: linear-gradient(90deg, var(--red), var(--line) 38%, transparent);
}

/* card grid */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.tone-green { --card-tone: var(--green); }
.tone-red   { --card-tone: var(--red); }
.tone-amber { --card-tone: var(--amber); }
.tone-paper { --card-tone: var(--paper); }
.file {
  position: relative; display: flex; flex-direction: column;
  text-decoration: none; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.file:hover, .file:focus-visible {
  transform: translateY(-4px); border-color: var(--card-tone, var(--paper));
  box-shadow: 0 18px 40px rgba(0,0,0,0.5);
}

/* thumb */
.file-thumb { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: #07080a; }
.file-thumb--photo img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(0.8) contrast(1.04) brightness(0.85);
  transition: filter 0.3s ease, transform 0.5s ease;
}
.file:hover .file-thumb--photo img { filter: saturate(1) contrast(1.05) brightness(1); transform: scale(1.03); }
.file-thumb--doc { display: flex; align-items: center; justify-content: center; }
.doc-no { position: absolute; font-size: clamp(1rem, 3vw, 1.5rem); color: var(--dim); opacity: 0.32; letter-spacing: 0.1em; }
.doc-note { position: absolute; bottom: 8px; left: 11px; color: var(--dim); opacity: 0.5; font-size: 0.58rem; }
.redact-bar {
  position: absolute; left: 0; right: 0; top: 39%; height: 22%; background: var(--ink);
  border-top: 1px solid rgba(214,211,201,0.14); border-bottom: 1px solid rgba(214,211,201,0.14);
  transform: scaleX(1); transform-origin: left;
  transition: transform 0.45s cubic-bezier(.77,0,.18,1);
}
.file:hover .redact-bar, .file:focus-visible .redact-bar { transform: scaleX(0); }
.no-anim .redact-bar { transform: scaleX(0); }

/* body */
.file-body { display: flex; flex-direction: column; gap: 9px; padding: 16px 16px 18px; }
.file-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--dim); }
.file-tag { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 500; }
.file-title {
  font-family: var(--display); font-stretch: 116%; font-weight: 700;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); text-transform: uppercase;
  letter-spacing: 0.02em; color: var(--paper); line-height: 1.05;
}
.file-sum {
  color: var(--dim); font-size: 0.92rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* corner registration ticks (on hover) */
.file::before, .file::after {
  content: ''; position: absolute; width: 9px; height: 9px; pointer-events: none; z-index: 2;
  border-color: var(--card-tone, var(--paper)); opacity: 0; transition: opacity 0.22s ease;
}
.file::before { top: 7px; left: 7px; border-top: 1px solid; border-left: 1px solid; }
.file::after { bottom: 7px; right: 7px; border-bottom: 1px solid; border-right: 1px solid; }
.file:hover::before, .file:hover::after, .file:focus-visible::before, .file:focus-visible::after { opacity: 0.85; }

/* status dots (reused) */
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot-green { background: var(--green); box-shadow: 0 0 8px rgba(76,175,111,0.7); }
.dot-red   { background: var(--red);   box-shadow: 0 0 8px rgba(194,57,31,0.7); }
.dot-amber { background: var(--amber); box-shadow: 0 0 8px rgba(210,154,58,0.6); }
.dot-paper { background: var(--paper); box-shadow: 0 0 8px rgba(233,228,214,0.5); }

@media (max-width: 700px) {
  .divider-top { flex-direction: column; gap: 4px; }
  .divider-note { text-align: left; }
  .files-grid { grid-template-columns: 1fr; }
}

/* ---------------- file cover ---------------- */
.cover {
  position: relative; max-width: var(--w-cab); margin: 0 auto;
  padding: calc(70px + 9vh) var(--pad) 7vh;
}
.cover-no { color: var(--red); font-weight: 500; margin-bottom: 14px; }
.cover-title {
  font-family: var(--display); font-stretch: 123%; font-weight: 800;
  font-size: clamp(2.4rem, 7.5vw, 5.6rem); line-height: 1;
  text-transform: uppercase; letter-spacing: 0.01em; color: var(--paper);
  max-width: 14ch;
}
.stamp {
  position: absolute; top: calc(70px + 9vh); right: var(--pad);
  font-family: var(--mono); font-weight: 500; font-size: clamp(0.8rem, 1.6vw, 1.05rem);
  letter-spacing: 0.22em; padding: 0.55em 0.9em 0.5em 1.1em;
  border: 3px double currentColor; border-radius: 3px;
  transform: rotate(-7deg); opacity: 0.92;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.6' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.92 0.08'/%3E%3C/filter%3E%3Crect width='120' height='120' fill='%23fff' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp-green { color: var(--green); }
.stamp-red { color: var(--red); }
.stamp-amber { color: var(--amber); }
.stamp-paper { color: var(--paper); }
@media (max-width: 760px) {
  .stamp { position: static; display: inline-block; margin: 26px 0 0; transform: rotate(-4deg); }
}
.cover-meta {
  display: flex; flex-wrap: wrap; gap: 8px 48px;
  margin: 5vh 0 0; padding-top: 22px; border-top: 1px solid var(--line);
}
.cover-meta dt { color: var(--dim); }
.cover-meta dd { color: var(--paper); font-weight: 500; margin-top: 2px; }
.cover-summary {
  margin-top: 4vh; max-width: 560px; color: var(--dim); font-size: 1.05rem;
  border-left: 2px solid var(--red); padding-left: 22px;
}

/* ---------------- paper documents ---------------- */
.sheet-wrap { max-width: var(--w-sheet); margin: 0 auto; padding: 2vh var(--pad) 6vh; }

.doc {
  background: var(--paper); color: var(--ink);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(233,228,214,0.07), 0 18px 50px rgba(0,0,0,0.5);
  margin-bottom: 34px;
}
.doc-head {
  display: flex; gap: 16px; align-items: baseline;
  padding: 13px 26px; border-bottom: 1px solid rgba(26,27,29,0.18);
  color: var(--ink-soft);
}
.doc-kind { color: var(--red); font-weight: 500; flex: none; }
.doc-date { flex: none; }
.doc-name { margin-left: auto; text-align: right; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .doc-name { display: none; } }
.doc-body { padding: 26px 26px 30px; }
.doc-body p { margin-bottom: 1.1em; }
.doc-body p:last-child { margin-bottom: 0; }
.doc-body a { color: var(--ink); text-decoration-color: rgba(194,57,31,0.55); text-underline-offset: 2px; }
.doc-body a:hover { color: var(--red); }
.doc-body blockquote {
  border-left: 3px solid var(--red); padding: 2px 0 2px 18px; margin: 1.2em 0;
  color: var(--ink-soft); font-style: italic;
}
.doc-body em { color: var(--ink-soft); }
@media (min-width: 700px) { .doc-body { padding: 34px 44px 40px; font-size: 1.02rem; } }

/* field update - the 2026 voice, dark card */
.field-update {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 2px;
  margin: 44px 0 34px; position: relative;
}
.field-update::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.tone-green.field-update::before { background: var(--green); }
.tone-red.field-update::before { background: var(--red); }
.tone-amber.field-update::before { background: var(--amber); }
.tone-paper.field-update::before { background: var(--paper); }
.fu-head {
  display: flex; justify-content: space-between;
  padding: 13px 26px; border-bottom: 1px solid var(--line); color: var(--dim);
}
.fu-head span:first-child { color: var(--paper); font-weight: 500; }
.fu-body { padding: 24px 26px; }
.fu-body p { margin-bottom: 1.1em; color: var(--text); }
.fu-body p:last-child { margin-bottom: 0; }
.fu-foot { padding: 11px 26px; border-top: 1px solid var(--line); color: var(--dim); opacity: 0.7; }
@media (min-width: 700px) { .fu-body { padding: 30px 40px; font-size: 1.02rem; } }

.missing {
  border: 1px dashed rgba(214,211,201,0.35); color: var(--dim);
  padding: 26px; text-align: center; margin-bottom: 34px; border-radius: 2px;
}

/* ---------------- evidence ---------------- */
.contact-sheet {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start;
  margin-bottom: 34px;
}
@media (max-width: 700px) { .contact-sheet { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.frame {
  background: var(--paper); padding: 7px 7px 4px; border-radius: 1px; cursor: zoom-in;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45);
  transition: transform 0.18s ease;
}
.frame:hover { transform: translateY(-3px) rotate(-0.4deg); }
.frame img { width: 100%; height: auto; display: block; filter: saturate(0.85) contrast(1.02); }
.frame figcaption { color: var(--ink-soft); padding: 6px 2px 4px; font-size: 0.62rem; }

.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,9,10,0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 5vh 4vw;
}
.lightbox img { max-width: 100%; max-height: 82vh; box-shadow: 0 30px 80px rgba(0,0,0,0.7); }
.lb-close {
  position: absolute; top: 18px; right: 22px; background: none; border: 1px solid var(--line);
  color: var(--text); padding: 8px 14px; cursor: pointer; border-radius: 2px;
}
.lb-close:hover { border-color: var(--paper); }
.lb-cap { color: var(--dim); }

/* ---------------- file nav + footer ---------------- */
.filenav {
  max-width: var(--w-sheet); margin: 0 auto; padding: 0 var(--pad) 4vh;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center;
}
.filenav a { text-decoration: none; color: var(--dim); display: flex; flex-direction: column; gap: 4px; }
.filenav a:hover strong { color: var(--paper); }
.filenav strong { color: var(--text); font-family: var(--display); font-stretch: 114%; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.85rem; }
.filenav-next { text-align: right; align-items: flex-end; }
.filenav-up { align-items: center; color: var(--red); }
@media (max-width: 560px) { .filenav strong { display: none; } }

.foot {
  border-top: 1px solid var(--line);
  max-width: var(--w-cab); margin: 0 auto; padding: 9vh var(--pad) 7vh;
}
.quote p {
  font-family: var(--display); font-stretch: 116%; font-weight: 600;
  font-size: clamp(1.3rem, 3.4vw, 2.1rem); color: var(--paper);
  text-transform: none; max-width: 22ch; line-height: 1.25;
}
.quote cite { display: block; margin-top: 16px; color: var(--dim); font-style: normal; }
.foot-meta {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  margin-top: 7vh; color: var(--dim);
}
.foot-meta a { color: var(--text); text-decoration-color: var(--red); }

/* ---------------- colophon ---------------- */
.colo { max-width: 680px; margin: 0 auto; padding: calc(70px + 8vh) var(--pad) 10vh; }
.colo .cover-title { font-size: clamp(2.2rem, 6vw, 4rem); margin-bottom: 5vh; }
.colo-body p { margin-bottom: 1.2em; color: var(--text); max-width: 58ch; }
.colo-quote { margin: 7vh 0; }
.colo-quote cite { max-width: 48ch; }
.colo-credit { margin: 6vh 0 3vh; color: var(--dim); }
.colo a { text-decoration-color: var(--red); }

/* reveal default state handled by JS; without JS everything is visible */
.reveal { opacity: 1; }
