/* ============================================================================
   Cardinal Labs — "Inside the Machine" (v7, built from zero 2026-08-26)
   Six pinned chapters over the world-gl `pcb` world. Page owns only tokens,
   layout and chrome; the world modules are configured, never forked.
   ========================================================================= */

@font-face {
  font-family: 'Inter';
  src: url('assets/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'CL Mono';
  src: url('assets/fonts/mono.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  /* the display face — a squared engineering grotesk; headlines only */
  font-family: 'Chakra Petch';
  src: url('assets/fonts/chakra-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --ground:   #0A0A0C;
  --paper:    #EEF2F7;   /* headlines */
  --body:     #C2CBD6;   /* ledes */
  --steel:    #93A3B8;   /* mono labels over PANELS — the world's own key light */
  --hud:      #C2CBD6;   /* mono labels that sit straight on the world */
  --cardinal: #E8323C;   /* the one red — same hex the world's core burns at */
  --hairline: rgba(147, 163, 184, .22);
  --panel:    rgba(10, 10, 12, .66);
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'CL Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  /* world-scroll tokens — tuned ONE place, never veil x scrim stacked dark */
  --world-ground: #0A0A0C;
  --world-veil: linear-gradient(180deg, rgba(10,10,12,.14), rgba(10,10,12,.36));
  --world-scrim: rgba(10, 10, 12, .18);
  --world-scrim-strong: rgba(10, 10, 12, .46);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--cardinal); color: var(--ground); }

.skip {
  position: absolute;
  left: 0; top: 0;
  transform: translateY(-200%);
  z-index: 10;
  padding: .8rem 1.2rem;
  background: var(--cardinal);
  color: var(--ground);
  font-family: var(--mono);
  font-size: .75rem;
  text-decoration: none;
}
.skip:focus { transform: none; }

/* ── HUD chrome ─────────────────────────────────────────────────────────── */

.hud {
  position: fixed;
  left: 0; right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 clamp(1rem, 3vw, 2.2rem);
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .14em;
  color: var(--steel);
  pointer-events: none;
}
.hud a { pointer-events: auto; }

.hud-top {
  top: 0;
  height: 3.4rem;
  border-bottom: 1px solid var(--hairline);
  background: rgba(10, 10, 12, .94);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--paper);
  font-weight: 700;
  letter-spacing: .22em;
  text-decoration: none;
}
.wordmark-mark {
  width: 1.15rem; height: 1.15rem;
  flex: none;
  display: block;
}

.hud-cta {
  color: var(--ground);
  background: var(--cardinal);
  font-weight: 700;
  text-decoration: none;
  padding: .55rem .95rem;
  transition: filter .2s ease;
}
.hud-cta:hover, .hud-cta:focus-visible { filter: brightness(1.12); }

.hud-bottom {
  bottom: 0;
  height: 2.6rem;
  border-top: 1px solid var(--hairline);
  background: rgba(10, 10, 12, .94);
}
#hud-z { display: inline-block; min-width: 5.5em; }

/* ── the progress rail ──────────────────────────────────────────────────── */

.rail {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .14em;
  padding: 1.6rem clamp(2.6rem, 6vw, 4.5rem) 1.6rem clamp(1rem, 3vw, 2.2rem);
  background: linear-gradient(90deg, rgba(10,10,12,.95) 55%, rgba(10,10,12,.55) 78%, rgba(10,10,12,0));
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
}
/* inactive/active is a COLOR change at full opacity — semi-transparent text
   blends toward its background and quietly fails the contrast gate */
.rail a {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  color: #96A3B2;
  text-decoration: none;
  transition: color .25s ease;
}
.rail a::before {
  content: "";
  width: 1.1rem;
  height: 1px;
  background: currentColor;
  align-self: center;
  transition: background .25s ease, width .25s ease;
}
.rail a:hover { color: var(--hud); }
.rail a.is-active { color: var(--paper); }
.rail a.is-active::before {
  background: var(--cardinal);
  width: 1.7rem;
}
.rail-n { font-size: .625rem; }

/* ── chapters ───────────────────────────────────────────────────────────── */

/* Track heights are the score: they place each chapter's hold on the camera
   path so the copy lands beside its landmark (holo -14 / RAM -52 / CPU -140 /
   GPU -218 / core -300 over a 286-unit corridor). Change with intent only.
   vh lines are the fallback for engines without svh. */
.track-boot   { min-height: 100vh; min-height: 100svh; }
.track-signal { min-height: 100vh; min-height: 100svh; }
.track-memory { min-height: 200vh; min-height: 200svh; }
.track-cpu    { min-height: 240vh; min-height: 240svh; }
.track-gpu    { min-height: 240vh; min-height: 240svh; }
.track-output { min-height: 320vh; min-height: 320svh; }

main section { background: var(--world-scrim); }

.ws-pin { padding: 5.5rem clamp(1.25rem, 5vw, 4.5rem) 4rem; }

/* a local panel caps the world's highlights right behind the copy — a flat
   coat with a soft halo edge, so every line in the block gets the same
   protection (a radial decays exactly where the blooms sit: at the edges) */
.chapter {
  position: relative;
  max-width: 44rem;
  padding: 2.4rem 2.6rem;
  background: rgba(10, 10, 12, .58);
  box-shadow: 0 0 42px 26px rgba(10, 10, 12, .58);
  border-radius: 18px;
}
.chapter-left   { margin-right: auto; margin-left: clamp(0rem, 6vw, 5rem); }
.chapter-right  { margin-left: auto;  margin-right: clamp(0rem, 4vw, 3rem); text-align: left; }
.chapter-center { margin-inline: auto; text-align: center; }

.eyebrow {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .18em;
  color: var(--hud);
  margin: 0 0 1.3rem;
}

h1, h2 {
  margin: 0 0 1.15rem;
  font-family: 'Chakra Petch', var(--sans);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.02;
  text-wrap: balance;
}
h1 { font-size: clamp(2.7rem, 6.6vw, 5.5rem); }
h2 { font-size: clamp(2.2rem, 5.6vw, 4.5rem); }

.lede {
  font-size: clamp(1rem, 1.35vw, 1.17rem);
  line-height: 1.62;
  color: var(--body);
  max-width: 36rem;
  margin: 0;
}
.chapter-center .lede { margin-inline: auto; }

.scroll-cue {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .18em;
  color: var(--hud);
  margin: 2.6rem 0 0;
}

/* ── the console ────────────────────────────────────────────────────────── */

.console {
  position: relative;
  margin: 2.6rem auto 0;
  max-width: 34rem;
  padding: 1.6rem 1.5rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-top: 2px solid var(--cardinal); /* the console is fed by the core */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: left;
}
/* instrument corner ticks */
.console::before, .console::after {
  content: "";
  position: absolute;
  width: .85rem; height: .85rem;
  border: 1px solid var(--steel);
  pointer-events: none;
}
.console::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.console::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.console-status {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .16em;
  color: var(--steel);
  margin: 0 0 1.2rem;
}
.console-dot {
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: var(--cardinal);
  flex: none;
  animation: console-pulse 2.4s ease-in-out infinite;
}
@keyframes console-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.port {
  display: block;
  text-decoration: none;
  border: 1px solid var(--hairline);
  padding: .95rem 1.1rem .9rem;
  transition: border-color .2s ease, background .2s ease, filter .2s ease;
}
.port-tag {
  display: block;
  font-family: var(--mono);
  font-size: .625rem;
  letter-spacing: .18em;
  margin-bottom: .35rem;
}
.port-action {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .1em;
}
.port-sub {
  display: block;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .08em;
  margin-top: .3rem;
}

.port-txt {
  background: var(--cardinal);
  border-color: var(--cardinal);
  color: var(--ground);
}
.port-txt .port-tag, .port-txt .port-sub { color: var(--ground); }
.port-txt:hover, .port-txt:focus-visible { filter: brightness(1.1); }

.port-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
  margin-top: .7rem;
}
.port-vox { color: var(--paper); }
.port-vox .port-tag, .port-vox .port-sub { color: var(--steel); }
.port-vox:hover, .port-vox:focus-visible { border-color: var(--steel); background: rgba(147,163,184,.07); }

.port-net {
  color: var(--steel);
  opacity: .5;
  border-style: dashed;
}
.port-net .port-tag, .port-net .port-sub { color: var(--steel); }

.colophon {
  font-family: var(--mono);
  font-size: .625rem;
  letter-spacing: .2em;
  color: var(--hud);
  margin: 2.8rem 0 0;
}

/* ── responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .rail .rail-name { display: none; }
  .rail { gap: .85rem; }
}

/* 767px — the SAME boundary the world config and the module's lite profile
   switch on, so layout and world composition always agree */
@media (max-width: 767px) {
  .rail { display: none; }
  .hud-coords { display: none; }
  .hud-bottom { justify-content: flex-end; }
  .ws-pin { padding: 4.6rem 1.15rem 3.4rem; }
  .chapter { padding: 1.6rem 1.2rem; }
  .chapter-left, .chapter-right { margin-inline: 0; }
  .eyebrow-x { display: none; } /* keeps phone eyebrows to one clean line */
  /* the hologram rides high on phones; the hero copy sits below it */
  .track-boot .ws-pin { align-items: end; }
  h1 { font-size: clamp(2.35rem, 11.5vw, 3.2rem); }
  h2 { font-size: clamp(1.9rem, 9.5vw, 2.6rem); }
  .port-row { grid-template-columns: 1fr; }
  .console { padding: 1.25rem 1.05rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .console-dot { animation: none; }
}
