/* 42LAB — the void laboratory. Deep space, starlight instruments.
   Token names keep their roles: --fog is the world, --ink is what speaks. */

:root {
  --fog: #0b0c0f;
  --paper: #111318;
  --ink: #e9ebef;
  --ink-70: rgba(233, 235, 239, 0.72);
  --ink-45: rgba(233, 235, 239, 0.45);
  --ink-25: rgba(233, 235, 239, 0.22);
  --line: rgba(233, 235, 239, 0.14);
  --line-soft: rgba(233, 235, 239, 0.08);
  --signal: #46b26f; /* used only for live/boarding status */

  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --u: 1.5rem;
  --sp-section: clamp(7rem, 14vh, 12rem);
  --pad: clamp(1.25rem, 4vw, 4rem);

  --t-hero: clamp(3.4rem, 1rem + 11vw, 11rem);
  --t-h2: clamp(1.9rem, 1.2rem + 2.6vw, 3.4rem);
  --t-body: clamp(0.95rem, 0.9rem + 0.25vw, 1.08rem);
  --t-label: 0.66rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  background: var(--fog);
  color: var(--ink);
  font-family: var(--display);
  font-size: var(--t-body);
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
::selection { background: var(--ink); color: var(--fog); }

.skip { position: fixed; top: -100px; left: var(--pad); z-index: 100; background: var(--ink); color: var(--fog); padding: 0.6rem 1rem; font-family: var(--mono); font-size: 0.75rem; }
.skip:focus { top: 12px; }

/* ---------- the film: grain + vignette over everything ---------- */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 90;
  opacity: 0.16;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' fill='%23ffffff' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ---------- WebGL stage ---------- */
#stage {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100lvh;
}
.no3d #stage { display: none; }
.no3d body, .no3d { background: radial-gradient(120% 90% at 50% 30%, #14171d, var(--fog) 70%); }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 95;
  display: grid; place-items: center;
  background: var(--fog);
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}
#loader.done { opacity: 0; visibility: hidden; }
#loader .pct { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.35em; color: var(--ink-70); }
#loader .pct b { font-weight: 500; color: var(--ink); }

/* ---------- HUD chrome (fixed instruments) ---------- */
.hud { position: fixed; z-index: 40; font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-70); pointer-events: none; }
.hud b { font-weight: 500; color: var(--ink); }
.hud--tl { top: 1.1rem; left: var(--pad); pointer-events: auto; }
.hud--tr { top: 1.1rem; right: var(--pad); text-align: right; }
.hud--bl { bottom: 1.1rem; left: var(--pad); }
.hud--br { bottom: 1.1rem; right: var(--pad); text-align: right; pointer-events: auto; }
.hud a { pointer-events: auto; }
.hud .rule { display: block; width: 34px; border-top: 1px solid var(--ink-25); margin: 0.45rem 0; }
@media (max-width: 640px) { .hud--tr, .hud--bl { display: none; } }

/* wordmark top-left */
.mark { font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: 0.08em; color: var(--ink); }
.mark small { font-family: var(--mono); font-weight: 400; font-size: 0.6rem; letter-spacing: 0.3em; color: var(--ink-45); display: block; margin-top: 0.15rem; }

/* scroll cue */
#cue { transition: opacity 0.5s; }
#cue.gone { opacity: 0; }
.cue-bar { display: inline-block; width: 1px; height: 34px; background: var(--ink-25); position: relative; overflow: hidden; vertical-align: middle; margin-right: 0.8rem; }
.cue-bar::after { content: ""; position: absolute; left: 0; top: -50%; width: 100%; height: 50%; background: var(--ink); animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { to { top: 110%; } }
@media (prefers-reduced-motion: reduce) { .cue-bar::after { animation: none; top: 25%; } }

/* ---------- content column ---------- */
main { position: relative; z-index: 10; }
.chapter { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: var(--sp-section) var(--pad); position: relative; }

/* experiment label above each chapter */
.exp {
  font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--ink-45); display: flex; align-items: center; gap: 1rem; margin-bottom: calc(var(--u) * 1.4);
}
.exp::after { content: ""; flex: 0 0 52px; border-top: 1px solid var(--ink-25); }
.exp b { color: var(--ink); font-weight: 500; }

/* ---------- hero ---------- */
.hero { align-items: flex-start; justify-content: flex-end; padding-bottom: 16vh; }
.hero h1 {
  font-size: var(--t-hero); font-weight: 700; letter-spacing: -0.035em; line-height: 0.92;
  text-transform: uppercase;
}
.hero h1 .lab { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.hero .tag { margin-top: calc(var(--u) * 1.2); max-width: 34ch; font-size: clamp(1.05rem, 1rem + 0.6vw, 1.4rem); line-height: 1.45; color: var(--ink-70); }
.hero .tag b { color: var(--ink); font-weight: 500; }

/* ---------- shared type ---------- */
h2 { font-size: var(--t-h2); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; max-width: 18ch; }
.sub { margin-top: var(--u); max-width: 52ch; color: var(--ink-70); }

/* ---------- specimen list (what we build) ---------- */
.specs { margin-top: calc(var(--u) * 2.5); border-top: 1px solid var(--line); }
.spec {
  display: grid; grid-template-columns: 72px 1fr; gap: 0 2rem;
  padding: calc(var(--u) * 1.3) 0; border-bottom: 1px solid var(--line);
  transition: padding-left 0.45s var(--ease);
}
.spec:hover { padding-left: 0.8rem; }
.spec .no { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.2em; color: var(--ink-45); padding-top: 0.55rem; }
.spec h3 { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.4rem); font-weight: 600; letter-spacing: -0.015em; }
.spec p { margin-top: 0.5rem; max-width: 56ch; color: var(--ink-70); }
.spec .foot { margin-top: 0.8rem; font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-45); }
@media (max-width: 640px) { .spec { grid-template-columns: 1fr; gap: 0.4rem; } }

/* ---------- evidence ---------- */
.evidence { margin-top: calc(var(--u) * 2.5); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: clamp(1.2rem, 3vw, 2.5rem); align-items: start; }
.exhibit { border: 1px solid var(--line); background: rgba(17, 19, 24, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.exhibit .shot { overflow: hidden; border-bottom: 1px solid var(--line); position: relative; aspect-ratio: 4 / 5; }
.exhibit .shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; filter: grayscale(1) contrast(1.02); transition: filter 0.6s var(--ease), transform 0.8s var(--ease); }
.exhibit:hover .shot img { filter: grayscale(0); transform: scale(1.015); }
.exhibit .body { padding: 1.1rem 1.2rem 1.3rem; }
.exhibit .body .no { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.25em; text-transform: uppercase; color: var(--ink-45); }
.exhibit .body h3 { margin-top: 0.35rem; font-size: 1.25rem; font-weight: 600; }
.exhibit .body p { margin-top: 0.35rem; font-size: 0.9rem; color: var(--ink-70); }
.exhibit.text-only .body { padding: 1.6rem 1.4rem 1.7rem; }

/* classified client names */
.redact { display: inline-block; min-width: 11ch; height: 0.95em; background: var(--ink); vertical-align: -0.14em; position: relative; cursor: not-allowed; }
.redact.sm { min-width: 8ch; }
.redact::after { content: "NICE TRY"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 0.52rem; letter-spacing: 0.34em; color: var(--fog); opacity: 0; transition: opacity 0.25s; }
.redact:hover::after { opacity: 1; }

/* ---------- terminal teaser board ---------- */
.board { margin-top: calc(var(--u) * 2.5); border: 1px solid var(--line); background: rgba(17, 19, 24, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.brow {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 1.4rem; align-items: baseline;
  padding: 1.05rem 1.3rem; border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  transition: background 0.3s;
}
.brow:last-child { border-bottom: 0; }
.brow:hover { background: rgba(255, 255, 255, 0.05); }
.brow .code { font-size: 0.8rem; letter-spacing: 0.15em; color: var(--ink-45); }
.brow .dest { font-family: var(--display); font-weight: 600; font-size: clamp(1rem, 0.9rem + 0.8vw, 1.35rem); letter-spacing: 0.01em; }
.brow .dest small { display: block; font-family: var(--mono); font-weight: 400; font-size: 0.72rem; letter-spacing: 0.05em; color: var(--ink-70); margin-top: 0.25rem; text-transform: none; }
.brow .status { font-size: 0.66rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--signal); white-space: nowrap; }
.brow .status.soon { color: var(--ink-45); }
.brow .status::before { content: "●"; margin-right: 0.5rem; font-size: 0.5rem; vertical-align: 2px; }
@media (max-width: 640px) { .brow { grid-template-columns: 1fr auto; } .brow .code { display: none; } }

/* ---------- CTA + buttons ---------- */
.cta {
  display: inline-block; margin-top: calc(var(--u) * 1.8);
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase;
  padding: 1rem 1.6rem; border: 1px solid var(--ink);
  transition: background 0.25s, color 0.25s, letter-spacing 0.35s var(--ease);
}
.cta:hover { background: var(--ink); color: var(--fog); letter-spacing: 0.3em; }
.cta.solid { background: var(--ink); color: var(--fog); }
.cta.solid:hover { background: transparent; color: var(--ink); }

/* ---------- contact ---------- */
.contact { text-align: left; }
.contact h2 { max-width: 24ch; }
.contact .mail { display: block; margin-top: var(--u); font-family: var(--mono); font-size: clamp(0.95rem, 0.8rem + 1vw, 1.35rem); letter-spacing: 0.04em; color: var(--ink-70); }
.contact .mail:hover { color: var(--ink); }

/* ---------- footer ---------- */
footer { position: relative; z-index: 10; padding: 2.2rem var(--pad) 2.6rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 1rem 3rem; justify-content: space-between; font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-45); background: var(--fog); }
footer a:hover { color: var(--ink); }

/* ---------- reveals ---------- */
html.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0ms); }
html.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  .spec, .cta, .exhibit .shot img { transition: none; }
}

/* ---------- the journey (index): captions, annotation, runway ---------- */
.journey { cursor: crosshair; }
.journey a, .journey button { cursor: pointer; }
.scrollspace { height: 1150vh; }
.beatmeter { margin-top: 0.9rem; font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.22em; color: var(--ink-45); }
.beatmeter b { font-weight: 500; color: var(--ink); }

.caplayer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.cap { position: absolute; left: var(--pad); bottom: 18vh; max-width: 44ch; opacity: 0; visibility: hidden; will-change: opacity; }
.cap .cta { pointer-events: auto; }
.cap-kick { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-45); margin-bottom: 0.9rem; }
.cap-line { font-size: clamp(1.05rem, 1rem + 0.6vw, 1.4rem); line-height: 1.45; color: var(--ink-70); }
.cap-line b { color: var(--ink); font-weight: 500; }
.cap-big { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.2rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; margin-bottom: 0.55rem; }
.cap-note { margin-top: 1rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.26em; color: var(--ink-25); }
.cap--title h1 { font-size: var(--t-hero); font-weight: 700; letter-spacing: -0.035em; line-height: 0.92; text-transform: uppercase; }
.cap--title h1 .lab { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.cap--title .cap-line { margin-top: 1.2rem; max-width: 34ch; }
.cap .cta { margin-top: 1.4rem; }

.anno { position: fixed; left: 0; top: 0; z-index: 32; pointer-events: none; display: flex; align-items: flex-start; will-change: transform; }
.anno[hidden] { display: none; }
.anno-dot { width: 7px; height: 7px; border: 1px solid var(--ink); transform: rotate(45deg) translate(-2px, -2px); background: transparent; }
.anno-line { width: 56px; border-top: 1px solid var(--ink-25); margin-top: 3px; }
.anno-tag { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.2em; color: var(--ink-70); padding-left: 0.6rem; white-space: nowrap; line-height: 1.9; }
.anno-tag em { font-style: normal; color: var(--ink-45); }

/* clickable annotations invite the file */
.anno[data-dossier] { pointer-events: auto; cursor: pointer; }
.anno[data-dossier]:hover .anno-tag, .anno[data-dossier]:focus-visible .anno-tag { color: var(--ink); }
.anno[data-dossier]:hover .anno-dot { background: var(--ink); }

/* the dossier: a classified file, opened */
#dossier { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--pad); background: rgba(5, 6, 8, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#dossier[hidden] { display: none; }
.dossier-card { position: relative; max-width: 520px; width: 100%; background: var(--paper); border: 1px solid var(--line); padding: 2.1rem 2.3rem 2.3rem; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.dossier-card .kick { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-45); }
.dossier-card h3 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); font-weight: 600; letter-spacing: -0.02em; margin: 0.7rem 0 0.9rem; }
.dossier-card p { color: var(--ink-70); margin-bottom: 0.8rem; font-size: 0.98rem; line-height: 1.6; }
.dossier-card p a { color: var(--ink); border-bottom: 1px solid var(--ink-45); }
.dossier-card .scope { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.22em; color: var(--ink-45); margin: 1.2rem 0 0; border-top: 1px solid var(--line-soft); padding-top: 1rem; }
#dossier-close { position: absolute; top: 0.9rem; right: 1rem; font-size: 1rem; color: var(--ink-45); padding: 0.5rem; transition: color 0.2s, transform 0.3s var(--ease); }
#dossier-close:hover { color: var(--ink); transform: rotate(90deg); }

/* the social dock: orbit our channels */
.socdock { display: inline-flex; align-items: center; gap: 1.4rem; margin-top: 1.6rem; pointer-events: auto; }
.socdock button { font-size: 1.7rem; line-height: 1; color: var(--ink-45); padding: 0.3rem 0.7rem; border: 1px solid var(--line); transition: color 0.2s, border-color 0.2s; }
.socdock button:hover { color: var(--ink); border-color: var(--ink-45); }
.socdock #soc-name { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.34em; min-width: 12ch; text-align: center; color: var(--ink); }
.cap .cta.solid { background: var(--ink); color: var(--fog); }
.cap .cta.solid:hover { background: transparent; color: var(--ink); }

.sr-content { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
html.no3d .sr-content { position: static; width: auto; height: auto; clip-path: none; padding: 20vh var(--pad); max-width: 60ch; }
html.no3d .scrollspace, html.no3d .caplayer, html.no3d #anno { display: none; }

@media (max-width: 640px) {
  .cap { bottom: 14vh; right: var(--pad); }
  .beatmeter { display: none; }
}

/* ---------- terminal42 page specifics ---------- */
.t42 .hero h1 { font-size: clamp(2.6rem, 1rem + 8.5vw, 8.5rem); }
.t42-board .brow { padding: 1.35rem 1.3rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: clamp(2rem, 5vw, 5rem); margin-top: calc(var(--u) * 2.5); }
.split .cell h3 { font-size: 1.3rem; font-weight: 600; }
.split .cell p { margin-top: 0.5rem; color: var(--ink-70); max-width: 44ch; }
.split .cell .no { font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.25em; color: var(--ink-45); display: block; margin-bottom: 0.6rem; }
