/* ============================================================
   NIGHT PRESS — base.css
   Design tokens, reset, typography, shared components.
   A noir film typeset like a serious book.
   ============================================================ */

:root {
  /* Color — night world */
  --night: #0B0A08;        /* page background */
  --coal: #151210;         /* alternate section panel */
  --ivory: #E9E3D4;        /* primary type */
  --smoke: #9C9486;        /* secondary type */
  --dim: #5E574B;          /* annotations, captions */
  --copper: #B87333;       /* the only light */
  --copper-bright: #D08A3E;
  --hair: #2B261D;         /* hairline rules */
  --hair-strong: #473F33;  /* interactive borders */

  /* Type families */
  --font-display: 'League Gothic', 'Arial Narrow', sans-serif;
  --font-lyric: 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'Archivo', Helvetica, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* Scale */
  --text-display-xl: clamp(72px, 16vw, 240px);  /* masthead */
  --text-display: clamp(44px, 7vw, 96px);       /* section titles */
  --text-lyric-lg: clamp(22px, 2.6vw, 31px);    /* taglines, pull quotes */
  --text-lyric: clamp(18px, 2vw, 22px);
  --text-body: 16px;
  --text-mono: 12px;
  --text-micro: 10.5px;

  /* Rhythm */
  --pad-x: clamp(20px, 5vw, 72px);
  --pad-section: clamp(72px, 11vw, 140px);
  --measure: 64ch;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--night);
  color: var(--ivory);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
image-slot { display: block; max-width: 100%; min-width: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; color: inherit; cursor: pointer; padding: 0; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--copper); color: var(--night); }

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

/* ---------- Film grain (fixed overlay, behind nothing, above all) ---------- */
.grain {
  position: fixed; inset: -100px;
  pointer-events: none;
  z-index: 90;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27160%27%20height%3D%27160%27%3E%3Cfilter%20id%3D%27n%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.9%27%20numOctaves%3D%272%27%20stitchTiles%3D%27stitch%27%2F%3E%3CfeColorMatrix%20type%3D%27saturate%27%20values%3D%270%27%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%27100%25%27%20height%3D%27100%25%27%20filter%3D%27url%28%23n%29%27%2F%3E%3C%2Fsvg%3E");
  background-size: 160px 160px;
}
@media (prefers-reduced-motion: no-preference) {
  .grain { animation: grain-shift 1.2s steps(4) infinite; }
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-32px, 18px); }
  50% { transform: translate(22px, -26px); }
  75% { transform: translate(-14px, -12px); }
  100% { transform: translate(0, 0); }
}

/* ---------- Print rules ---------- */
.rule { border: none; border-top: 1px solid var(--hair); margin: 0; }
.rule--ivory { border-color: rgba(233, 227, 212, 0.85); }
.rule-double { display: block; }
.rule-double::before, .rule-double::after { content: ""; display: block; }
.rule-double::before { border-top: 2px solid var(--ivory); }
.rule-double::after { border-top: 1px solid var(--hair-strong); margin-top: 3px; }

/* Rules that draw in on scroll (motion.js sets transform) */
.rule-draw { transform-origin: left center; }

/* ---------- Type voices ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.lyric {
  font-family: var(--font-lyric);
  font-style: italic;
  font-weight: 500;
  line-height: 1.5;
}
.mono {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.mono--micro { font-size: var(--text-micro); letter-spacing: 0.14em; }
.eyebrow { color: var(--copper); letter-spacing: 0.24em; font-weight: 400; }
.annot { color: var(--dim); }

/* Honest demo-content tag */
.demo-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--dim);
  padding: 2px 7px;
  white-space: nowrap;
  align-self: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 17px 28px;
  min-height: 50px;
  border: 1px solid var(--hair-strong);
  color: var(--ivory);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  text-align: center;
}
.btn:hover { border-color: var(--ivory); }
.btn--copper { background: var(--copper); border-color: var(--copper); color: var(--night); }
.btn--copper:hover { background: var(--copper-bright); border-color: var(--copper-bright); }
.btn--copperline { border-color: var(--copper); color: var(--copper); }
.btn--copperline:hover { background: var(--copper); color: var(--night); }
.btn.is-done { background: transparent; border-color: var(--copper); color: var(--copper); pointer-events: none; }

/* Mono link with drawing underline */
.linkline {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--smoke);
  padding-bottom: 5px;
  cursor: pointer;
}
.linkline::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s ease;
}
.linkline:hover { color: var(--ivory); }
.linkline:hover::after { transform: scaleX(1); }

/* ---------- Section scaffolding ---------- */
.section { padding: var(--pad-section) var(--pad-x); position: relative; }
.section--coal { background: var(--coal); }
.wrap { max-width: 1440px; margin: 0 auto; }

.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.sec-title {
  font-size: var(--text-display);
  margin: 26px 0 0;
}
.sec-rule { margin-bottom: clamp(32px, 5vw, 56px); }

/* ---------- Smoke atmosphere ---------- */
.smoke { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.smoke--warm {
  background:
    radial-gradient(1100px 460px at 18% 108%, rgba(184, 115, 51, 0.12), transparent 62%),
    radial-gradient(900px 540px at 86% -12%, rgba(233, 227, 212, 0.045), transparent 58%);
}
.smoke--faint {
  background:
    radial-gradient(900px 420px at 80% 110%, rgba(184, 115, 51, 0.07), transparent 60%),
    radial-gradient(700px 380px at 10% -10%, rgba(233, 227, 212, 0.03), transparent 55%);
}
.section > .wrap { position: relative; z-index: 1; }

/* ---------- Waveform ---------- */
.waveform { display: flex; align-items: center; gap: 3px; height: 36px; max-width: 100%; min-width: 0; overflow: hidden; }
.waveform span {
  width: 3px;
  background: var(--copper);
  min-height: 3px;
}
@media (prefers-reduced-motion: no-preference) {
  .waveform.is-playing span { animation: wave-pulse 1.1s ease-in-out infinite alternate; }
}
@keyframes wave-pulse {
  from { transform: scaleY(1); }
  to { transform: scaleY(0.45); }
}

/* ---------- Reveal targets (motion.js) ---------- */
.reveal { will-change: transform, opacity; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
}
