/* ==========================================================================
   MSSPL Archive: styles.css  (Surveyor)
   Dark, clinical, eerie. Reds are decoration only; text stays high contrast.
   Sections: 1 tokens · 2 base · 3 utilities · 4 scan/atmosphere · 5 nav ·
   6 hero · 7 sections/grid/cards · 8 stamps · 9 paper/article · 10 documents ·
   11 logs · 12 timeline · 13 redact · 14 widgets/form · 15 routes ·
   16 mirror · 17 footer · 18 animation · 19 reduced motion · 20 responsive
   ========================================================================== */

/* 1. TOKENS -------------------------------------------------------------- */
:root {
  --void: #050405;
  --panel: #0D0A0B;
  --rule: #1E1416;
  --red-1: #3A0B10;
  --red-2: #6E1118;
  --red-3: #A3202B;
  --text: #A89C9A;
  --head: #D9CFCB;
  --amber: #C9A24A;

  --panel-2: #120d0f;
  --focus: #E0B85A;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --gutter: 16px;
  --maxw: 1100px;
  --measure: 62ch;
  --nav-h: 44px;
  color-scheme: dark;
}

/* 2. BASE ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
  background: var(--void);
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, .55) 100%),
    radial-gradient(ellipse 70% 40% at 50% -5%, rgba(58, 11, 16, .22), transparent 70%),
    var(--void);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; }
p { margin: 0 0 1em; }
a {
  color: var(--head);
  text-decoration: underline;
  text-decoration-color: var(--red-3);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--mono);
  color: var(--head);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 .6em;
}
em, i { font-style: italic; }
strong { color: var(--head); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
code, kbd, samp { font-family: var(--mono); font-size: .88em; color: var(--head); }
blockquote { margin: 1.4em 0; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: .35em; }
::selection { background: var(--red-2); color: #fff; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 1px; }
:focus:not(:focus-visible) { outline: none; }

/* subtle scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--red-2) var(--panel); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--panel); }
::-webkit-scrollbar-thumb { background: var(--red-1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--red-2); }

/* 3. UTILITIES ----------------------------------------------------------- */
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 1000;
  padding: .6em 1em;
  background: var(--head);
  color: var(--void);
  font-family: var(--mono);
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* 4. SCAN LINE + ATMOSPHERE --------------------------------------------- */
.scan {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: var(--red-2);
  opacity: .28;
  pointer-events: none;
  z-index: 900;
  box-shadow: 0 0 6px rgba(110, 17, 24, .5);
  animation: scan-roll 8s linear infinite;
}
@keyframes scan-roll {
  0% { transform: translateY(-2px); }
  100% { transform: translateY(100vh); }
}
/* extremely faint horizontal texture, gradients only */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 899;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .012) 0 1px, transparent 1px 3px);
  opacity: .6;
}

/* 5. NAV ----------------------------------------------------------------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  background: rgba(5, 4, 5, .82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  font-family: var(--mono);
}
.topnav::-webkit-scrollbar { display: none; }
.topnav__list {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.topnav__list li { flex: 0 0 auto; margin: 0; padding: 0; }
.topnav a {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.topnav a:hover { color: var(--head); border-bottom-color: var(--red-3); }
.topnav button, #reduce-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 5px 10px;
  font: 500 11px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.topnav button:hover, #reduce-toggle:hover { border-color: var(--red-2); color: var(--head); }
#reduce-toggle[aria-pressed="true"] { color: var(--head); border-color: var(--red-3); background: var(--red-1); }

/* 6. HERO ---------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
  min-height: calc(100svh - var(--nav-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px var(--gutter) 96px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 60% 50% at 30% 45%, rgba(110, 17, 24, .12), transparent 70%);
  pointer-events: none;
}
.hero__org {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--text);
  margin: 0 0 1.6rem;
  padding-left: 14px;
  border-left: 2px solid var(--red-2);
}
.hero__title {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(1.7rem, 7.2vw, 4.2rem);
  line-height: 1.1;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--head);
  margin: 0 0 1.6rem;
  max-width: 18ch;
  overflow-wrap: break-word;
  hyphens: manual;
}
.hero__status {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text);
  margin: 0 0 .5rem;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--text);
  margin: 0;
}
.heartbeat {
  flex: 0 0 auto;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--red-3);
  box-shadow: 0 0 8px 1px rgba(163, 32, 43, .6);
  animation: heart 4s ease-in-out infinite;
}
.scroll-cue {
  position: absolute;
  left: var(--gutter);
  bottom: 28px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text);
  text-decoration: none;
  padding: 8px 0;
}
.scroll-cue::after {
  content: "";
  display: block;
  width: 1px; height: 28px;
  margin: 8px 0 0 4px;
  background: linear-gradient(var(--red-3), transparent);
}
.scroll-cue:hover { color: var(--head); }

/* 7. SECTIONS / GRID / CARDS -------------------------------------------- */
.sec {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 72px var(--gutter);
  border-top: 1px solid var(--rule);
}
.sec__title {
  font-size: clamp(1.15rem, 3.4vw, 1.6rem);
  margin: 0 0 1rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.sec__title::after {
  content: "";
  position: absolute; left: 0; bottom: -1px;
  width: 56px; height: 1px;
  background: var(--red-3);
}
.sec__intro { max-width: var(--measure); margin-bottom: 2rem; }
.sec > p, .sec > ul, .sec > ol { max-width: var(--measure); }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.card {
  position: relative;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 20px;
  transition: border-color .25s ease, transform .25s ease;
}
.card:hover { border-color: var(--red-2); transform: translateY(-2px); }
.card:focus-within { border-color: var(--red-2); }
.card__tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--amber);
  margin: 0 0 .5rem;
}
.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1;
  padding: 4px 8px;
  margin: 0 4px 6px 0;
  color: var(--head);
  background: var(--red-1);
  border: 1px solid var(--red-2);
  vertical-align: middle;
}
.card__title {
  font-size: 1rem;
  line-height: 1.4;
  margin: .3rem 0 .7rem;
  overflow-wrap: anywhere;
}
.card__excerpt { font-size: 16px; line-height: 1.6; margin: 0 0 1rem; }
.card__excerpt p:last-child { margin-bottom: 0; }
.card__foot {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--text);
  margin: 1rem 0 0;
  padding-top: .7rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.card.paper .stamp { margin: .2rem 0 .8rem; }

/* 8. STAMPS -------------------------------------------------------------- */
.stamp {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .16em;
  line-height: 1.2;
  padding: 4px 10px;
  color: var(--head);
  border: 2px solid var(--red-3);
  background: rgba(58, 11, 16, .35);
  transform: rotate(-2.5deg);
  transform-origin: left center;
  user-select: none;
}
.stamp--withdrawn { border-color: var(--red-3); transform: rotate(-3deg); }
.stamp--retracted { border-color: var(--red-2); border-style: double; border-width: 4px; transform: rotate(2deg); }
.stamp--not-issued { border-color: var(--amber); border-style: dashed; color: var(--amber); background: transparent; transform: rotate(-1.5deg); }

/* 9. PAPERS / ARTICLES --------------------------------------------------- */
details.paper-full {
  margin-top: 1rem;
  border-top: 1px solid var(--rule);
}
details.paper-full > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--head);
  user-select: none;
}
details.paper-full > summary::-webkit-details-marker { display: none; }
details.paper-full > summary::before {
  content: "+";
  flex: 0 0 auto;
  width: 20px; height: 20px;
  line-height: 18px;
  text-align: center;
  border: 1px solid var(--red-2);
  color: var(--head);
  font-size: 14px;
}
details.paper-full[open] > summary::before { content: "\2212"; background: var(--red-1); }
details.paper-full > summary:hover { color: #fff; }
details.paper-full > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
details.paper-full[open] > summary { border-bottom: 1px solid var(--rule); margin-bottom: 1.2rem; }

.article {
  font-size: 17px;
  line-height: 1.7;
  max-width: var(--measure);
  overflow-wrap: break-word;
}
.article > *:last-child { margin-bottom: 0; }
.article h1, .article h2, .article h3, .article h4 { margin: 1.8em 0 .6em; }
.article h1 { font-size: 1.25rem; }
.article h2 { font-size: 1.05rem; color: var(--head); }
.article h3 { font-size: .95rem; }
.article h4 { font-size: .85rem; color: var(--text); }
.article__head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text);
  padding: 8px 12px;
  margin: 0 0 1.4rem;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--red-2);
}
.article__head strong { color: var(--amber); font-weight: 500; }
.pullquote {
  margin: 1.8em 0;
  padding: .3em 0 .3em 1.2em;
  border-left: 3px solid var(--red-3);
  font-size: 1.15em;
  font-style: italic;
  color: var(--head);
  line-height: 1.55;
}
.pullquote p:last-child { margin-bottom: 0; }
.margin-note {
  display: block;
  margin: 1em 0;
  padding: 2px 0 2px 10px;
  border-left: 1px solid var(--amber);
  font-family: var(--mono);
  font-size: 12px;
  font-variant: small-caps;
  text-transform: lowercase;
  letter-spacing: .08em;
  line-height: 1.5;
  color: var(--amber);
}
.divider-withheld {
  position: relative;
  margin: 2rem 0;
  padding: 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text);
  background: repeating-linear-gradient(135deg, var(--red-1) 0 6px, var(--panel) 6px 12px);
  border-top: 1px solid var(--red-2);
  border-bottom: 1px solid var(--red-2);
}
.table-wrap, .article .table-scroll { overflow-x: auto; max-width: 100%; margin: 1.4em 0; }
table.data {
  display: block;               /* scrolls inside itself without widening the page */
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}
table.data caption { text-align: left; caption-side: top; padding: 0 0 .5em; color: var(--head); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
table.data th, table.data td {
  padding: 8px 12px;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
table.data th { background: var(--panel-2); color: var(--head); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
table.data tbody tr:nth-child(even) td { background: rgba(13, 10, 11, .7); }
table.data tbody tr:hover td { background: var(--red-1); }
table.data td.wrap, table.data th.wrap { white-space: normal; min-width: 180px; }
.reviewer-box, .editor-note {
  margin: 1.6em 0;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--red-2);
  font-size: .95em;
}
.editor-note { border-left-color: var(--amber); }
.reviewer-box > :last-child, .editor-note > :last-child { margin-bottom: 0; }
.reviewer-box h4, .editor-note h4, .reviewer-box strong:first-child, .editor-note strong:first-child {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--head);
}
.article ul, .article ol { margin-bottom: 1.1em; }
.article ul { list-style: none; padding-left: 1.2em; }
.article ul > li { position: relative; }
.article ul > li::before { content: ""; position: absolute; left: -1em; top: .75em; width: 5px; height: 1px; background: var(--red-3); }
.article ol > li::marker { font-family: var(--mono); color: var(--head); font-size: .85em; }
.article .footnotes, .article .footnote, .article ol.footnotes {
  margin-top: 2.2em;
  padding-top: 1em;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.article sup { font-family: var(--mono); font-size: .7em; line-height: 0; color: var(--amber); }
.article figure { margin: 1.5em 0; }
.article figcaption { font-family: var(--mono); font-size: 12px; color: var(--text); margin-top: .5em; }

/* 10. DOCUMENTS ---------------------------------------------------------- */
.doc {
  position: relative;
  margin: 0 0 24px;
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: 0 0 0 4px var(--void), 0 0 0 5px var(--rule);
  max-width: 78ch;
}
.doc__head {
  padding: 14px 20px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--red-2);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  line-height: 1.6;
  color: var(--head);
}
.doc__head > * { margin: 0; }
.doc__head .card__tag { margin-bottom: .2rem; }
.doc__head h3, .doc__head .doc__title { font-size: 1rem; margin: .3rem 0 0; }
.doc__body { padding: 20px; font-size: 17px; line-height: 1.7; }
.doc__body > :last-child { margin-bottom: 0; }
.doc__body p { max-width: var(--measure); }
.doc__sig {
  margin: 0 20px 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  line-height: 1.6;
  color: var(--text);
}
.doc__sig strong { display: block; color: var(--head); font-weight: 500; }

/* 11. LOGS --------------------------------------------------------------- */
details.log-group { margin: 0 0 14px; border: 1px solid var(--rule); background: var(--panel); }
details.log-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--head);
  display: flex;
  align-items: center;
  gap: 12px;
}
details.log-group > summary::-webkit-details-marker { display: none; }
details.log-group > summary::before {
  content: "+";
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  border: 1px solid var(--red-2); flex: 0 0 auto;
}
details.log-group[open] > summary::before { content: "\2212"; background: var(--red-1); }
details.log-group[open] > summary { border-bottom: 1px solid var(--rule); }
details.log-group > summary:hover { background: var(--panel-2); }
details.log-group > summary:focus-visible { outline-offset: -3px; }
details.log-group > .log:last-child { margin-bottom: 0; }
.log {
  margin: 0;
  padding: 18px;
  border-bottom: 1px solid var(--rule);
  border-left: 2px solid transparent;
}
.log:hover { border-left-color: var(--red-2); }
.log:last-child { border-bottom: 0; }
.log__meta {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--amber);
  margin: 0 0 .6rem;
  overflow-wrap: anywhere;
}
.log__body { font-style: italic; max-width: var(--measure); margin: 0 0 .7rem; }
.log__body p { margin-bottom: .7em; }
.log__note, .log__flag {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: .03em;
  color: var(--text);
  margin: 0 0 .3rem;
  max-width: 70ch;
}
.log__note { padding-left: 10px; border-left: 1px solid var(--rule); }
.log__flag { color: var(--head); }
.log__flag::before { content: "\25AA\00a0"; color: var(--red-3); }

/* 12. TIMELINE ----------------------------------------------------------- */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 28px;
  max-width: 80ch;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(var(--red-3), var(--red-2) 40%, var(--rule));
}
.timeline__item { position: relative; margin: 0 0 1.6rem; padding: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -28px; top: .55em;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--void);
  border: 2px solid var(--red-3);
}
.timeline__item time, .timeline__date {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--amber);
  margin-bottom: .2rem;
}
.timeline__item p:last-child { margin-bottom: 0; }

/* 13. REDACTIONS --------------------------------------------------------- */
.redact {
  position: relative;
  display: inline;
  padding: 0 .3em;
  color: var(--red-1);
  background: var(--red-1);
  border-bottom: 1px solid var(--red-2);
  cursor: pointer;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: color .2s, background-color .2s;
}
.redact::after {
  content: attr(data-code);
  position: relative;
  top: -.5em;
  margin-left: .35em;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--head);
  background: var(--void);
  border: 1px solid var(--red-2);
  padding: 0 3px;
  line-height: 1.4;
  user-select: none;
}
.redact:hover, .redact:focus-visible, .redact.is-revealed {
  color: var(--head);
  background: #1c0b0e;
  border-bottom-color: var(--red-3);
}
.redact.is-revealed::after { color: var(--amber); }

/* 14. WIDGETS / FORM / FICTION NOTE ------------------------------------- */
#stair-widget {
  display: inline-flex;
  align-items: baseline;
  gap: .4em;
  margin: 1rem 0 1.5rem;
  padding: 14px 24px;
  font-family: var(--mono);
  font-size: clamp(2.4rem, 11vw, 4.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: .04em;
  color: var(--head);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-bottom: 2px solid var(--red-2);
  font-variant-numeric: tabular-nums;
}
#stair-widget span { display: inline-block; min-width: 2ch; text-align: center; }
#stair-widget #stair-up { color: var(--text); }

.fiction-note {
  margin: 1.4rem 0;
  padding: 12px 16px;
  max-width: var(--measure);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: .03em;
  color: var(--head);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--amber);
}

#report form, #log-form { max-width: 68ch; }
#log-form label {
  display: block;
  margin-bottom: .5rem;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--head);
}
#log-form input[type="text"], #log-form input[type="email"], #log-form select, #log-form textarea, #log-text {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  font: 400 16px/1.6 var(--serif);
  color: var(--head);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 0;
  caret-color: var(--red-3);
  transition: border-color .2s, background-color .2s;
}
#log-text { min-height: 180px; resize: vertical; }
#log-form textarea:hover, #log-text:hover { border-color: var(--red-2); }
#log-form textarea:focus, #log-text:focus, #log-form input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--red-3);
  background: var(--panel-2);
}
#log-form ::placeholder { color: #7d7371; opacity: 1; }
#log-form button[type="submit"], .route__close, .mirror-toggle {
  display: inline-block;
  margin-top: 1rem;
  padding: 11px 22px;
  font: 500 13px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--head);
  background: var(--red-1);
  border: 1px solid var(--red-2);
  border-radius: 0;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
#log-form button[type="submit"]:hover, .route__close:hover, .mirror-toggle:hover { background: var(--red-2); border-color: var(--red-3); color: #fff; }
#log-form button[type="submit"]:active, .route__close:active, .mirror-toggle:active { transform: translateY(1px); }
#form-reply {
  min-height: 1.7em;
  margin: 1.2rem 0 0;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .05em;
  color: var(--head);
}
#form-reply a { color: var(--amber); text-decoration-color: var(--amber); }

/* 15. ROUTES (hidden pages overlay) -------------------------------------- */
.route-layer {
  position: fixed;
  inset: 0;
  z-index: 950;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px var(--gutter);
  background: rgba(3, 2, 3, .92);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.route {
  position: relative;
  max-width: 70ch;
  margin: 0 auto;
  padding: 28px 22px 32px;
  background: var(--panel);
  border: 1px solid var(--red-2);
  box-shadow: 0 0 0 1px var(--void), 0 20px 60px rgba(0, 0, 0, .7);
  opacity: 0;
}
.route.is-open { opacity: 1; animation: route-in .35s ease-out both; }
.route h2, .route h3 { overflow-wrap: anywhere; }
.route > p, .route li { max-width: var(--measure); }
.route__close { margin: 0 0 1.4rem; float: right; margin-left: 1rem; }
.route::after { content: ""; display: block; clear: both; }

/* 16. MIRROR ------------------------------------------------------------- */
.mirror-text {
  transform: scaleX(-1);
  transform-origin: center;
  max-width: var(--measure);
  padding: 16px 18px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  transition: transform .6s ease;
}
.mirror-text.is-flipped { transform: none; }
.mirror-toggle { margin-top: 0; margin-bottom: 1rem; }

/* 17. FOOTER ------------------------------------------------------------- */
.footer {
  margin-top: 40px;
  padding: 48px var(--gutter) 64px;
  border-top: 1px solid var(--rule);
  background: linear-gradient(var(--panel), var(--void));
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--text);
}
.footer p { margin: 0 auto .9rem; max-width: 70ch; }
.footer__clock { text-transform: uppercase; color: var(--head); }
.footer .fiction-note { text-align: left; margin-left: auto; margin-right: auto; }
.signoff {
  margin-top: 1.6rem;
  color: var(--head);
  text-transform: uppercase;
  letter-spacing: .14em;
  opacity: .9;
}

/* 18. ANIMATION ---------------------------------------------------------- */
@keyframes heart {
  0%, 100% { opacity: .55; box-shadow: 0 0 4px 0 rgba(163, 32, 43, .35); }
  50% { opacity: 1; box-shadow: 0 0 12px 3px rgba(163, 32, 43, .65); }
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(110, 17, 24, 0); }
  50% { box-shadow: 0 0 18px 0 rgba(110, 17, 24, .35); }
}
@keyframes flicker {
  0% { opacity: 1; }
  15% { opacity: .55; }
  30% { opacity: 1; }
  50% { opacity: .7; }
  70% { opacity: 1; }
  85% { opacity: .85; }
  100% { opacity: 1; }
}
@keyframes glitch {
  0%, 93%, 100% { text-shadow: none; transform: none; }
  94% { text-shadow: 3px 0 0 rgba(163, 32, 43, .75), -2px 0 0 rgba(110, 17, 24, .7); transform: translateX(1px); }
  97% { text-shadow: -3px 0 0 rgba(163, 32, 43, .75), 2px 0 0 rgba(110, 17, 24, .7); transform: translateX(-1px); }
}
@keyframes route-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes type-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes caret { 0%, 100% { border-right-color: var(--red-3); } 50% { border-right-color: transparent; } }

.flicker-hover:hover, .card:hover .card__title, .sec__title:hover { animation: flicker .2s linear 1; }
.glitch { animation: glitch 10s steps(1, end) infinite; }
.stamp--retracted, #stair-widget, .fiction-note { animation: none; }
#stair-widget { animation: breathe 4s ease-in-out infinite; }

/* JS-gated reveals: without html.js everything is simply visible */
html.js .reveal { opacity: 0; transform: translateY(14px); }
html.js .reveal.in-view { animation: fade-up .8s ease-out forwards; }

/* typewriter: full text in DOM; clip-path reveal in steps with a caret */
html.js .typewriter { clip-path: inset(0 100% 0 0); border-right: 2px solid transparent; }
html.js .typewriter.in-view {
  opacity: 1;
  transform: none;
  animation: type-reveal 2.4s steps(32, end) forwards, caret 1s step-end 5;
}
/* when both .reveal and .typewriter are present, the typewriter owns the motion */
html.js .typewriter.reveal { opacity: 1; transform: none; }
html.js .typewriter.reveal.in-view { animation: type-reveal 2.4s steps(32, end) forwards, caret 1s step-end 5; }
/* glitch and typewriter share the title: glitch runs on pseudo-free text-shadow, safe after reveal */
html.js .typewriter.reveal.in-view.glitch {
  animation: type-reveal 2.4s steps(32, end) forwards, caret 1s step-end 5, glitch 10s steps(1, end) 3s infinite;
}

/* 19. REDUCED MOTION: everything static ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .scan { animation: none !important; top: 0; height: 100%; opacity: .05;
    background: repeating-linear-gradient(0deg, var(--red-2) 0 1px, transparent 1px 4px); box-shadow: none; }
  .heartbeat { opacity: 1; box-shadow: 0 0 8px 2px rgba(163, 32, 43, .55); }
  #stair-widget { box-shadow: 0 0 14px 0 rgba(110, 17, 24, .3); }
  html.js .reveal, html.js .typewriter, html.js .typewriter.reveal { opacity: 1 !important; transform: none !important; clip-path: none !important; border-right-color: transparent !important; }
  .route.is-open { opacity: 1; }
  .glitch { text-shadow: none; transform: none; }
  .card:hover { transform: none; }
}
html.reduce-motion { scroll-behavior: auto; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; }
html.reduce-motion .scan { animation: none !important; top: 0; height: 100%; opacity: .05;
  background: repeating-linear-gradient(0deg, var(--red-2) 0 1px, transparent 1px 4px); box-shadow: none; }
html.reduce-motion .heartbeat { opacity: 1; box-shadow: 0 0 8px 2px rgba(163, 32, 43, .55); }
html.reduce-motion #stair-widget { box-shadow: 0 0 14px 0 rgba(110, 17, 24, .3); }
html.js.reduce-motion .reveal, html.js.reduce-motion .typewriter, html.js.reduce-motion .typewriter.reveal { opacity: 1 !important; transform: none !important; clip-path: none !important; border-right-color: transparent !important; }
html.reduce-motion .route.is-open { opacity: 1; }
html.reduce-motion .glitch { text-shadow: none; transform: none; }
html.reduce-motion .card:hover { transform: none; }

/* 20. RESPONSIVE --------------------------------------------------------- */
@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .sec { padding-top: 88px; padding-bottom: 88px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .route { padding: 36px 36px 40px; }
  .route-layer { padding-top: 64px; padding-bottom: 64px; }
  .doc__head, .doc__body { padding-left: 28px; padding-right: 28px; }
  .doc__sig { margin-left: 28px; margin-right: 28px; }
  .topnav { gap: 8px; }
  .topnav a { font-size: 13px; padding: 6px 12px; }
}
@media (min-width: 960px) {
  :root { --gutter: 32px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .card { padding: 24px; }
  .hero { padding-top: 96px; }
}
@media (max-width: 400px) {
  body { font-size: 17px; }
  .hero__title { letter-spacing: .03em; }
  .article { font-size: 16.5px; }
  .card { padding: 16px; }
}
