/* ============================================================
   base.css — editorial foundation, shared by every page.
   Type system, colour tokens (light + dark), nav, footer,
   and shared helpers live here. The homepage layout lives in
   home.css; article pages in article.css.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..600;1,9..144,400..500&family=Newsreader:ital,opsz,wght@0,6..72,400..500;1,6..72,400&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* Aged-paper palette — warm, filmic, two-tone (tape-red + faded teal) */
  --paper:  #F3ECDA;
  --paper2: #EBE1CB;   /* faintly deeper — figures, bands, chips */
  --ink:    #262019;
  --ink2:   #5F5644;   /* secondary text */
  --ink3:   #968A70;   /* muted / metadata */
  --line:   #DBD0B5;   /* hairline rules */
  --line2:  #CABD9B;   /* slightly stronger rule */
  --clip:   #FCF8EE;   /* newsprint clipping — brighter than the page */
  --accent: #B23A28;   /* tape / film red — Side A */
  --accent2:#8E2C1E;   /* darker red, hover */
  --teal:   #2F6E62;   /* faded cassette teal — Side B */
  --stamp:  #C57A22;   /* amber date-back stamp */
  --film:   #1E1B14;   /* dark film base */
  /* cassette illustration */
  --shell:      #34302A;
  --shell-edge: #4A443A;
  --shell-hole: #12100B;
  --cass-window:#141009;
  --reel:       #241F16;
  --reel-edge:  #4C4536;
  --reel-spoke: #7A7059;
  --tape:       #4A3620;
  --wood:       #6E4A28;
  --case-back:  #241A10;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body:  'Newsreader', Georgia, serif;
  --mono:  'Space Mono', ui-monospace, 'SF Mono', 'Menlo', monospace;

  --max: 940px;
  --pad: 40px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: var(--paper); }

/* ── Living film grain — shimmers like projected film ── */
body::before {
  content: ""; position: fixed; inset: -60px; z-index: 9999; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05; mix-blend-mode: multiply; animation: grain 0.6s steps(4) infinite;
}
html[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.06; }
@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-28px, 14px); }
  50%  { transform: translate(18px, -22px); }
  75%  { transform: translate(-12px, 26px); }
  100% { transform: translate(22px, 8px); }
}
/* ── Projector vignette — darkens the edges, breathes slowly ── */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  background: radial-gradient(125% 120% at 50% 42%, transparent 56%, rgba(20,13,4,0.20) 100%);
  animation: flicker 7s ease-in-out infinite;
}
html[data-theme="dark"] body::after { background: radial-gradient(125% 120% at 50% 42%, transparent 48%, rgba(0,0,0,0.5) 100%); }
@keyframes flicker { 0%,100% { opacity: 0.9; } 45% { opacity: 1; } 70% { opacity: 0.82; } }

/* ── Shared helpers ── */
.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink3);
}
.eyebrow::before {
  content: "\25CF"; color: var(--accent); font-size: 9px;
  margin-right: 9px; vertical-align: 1.5px;
  animation: rec 2.4s steps(1) infinite;
}
@keyframes rec { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .eyebrow::before { animation: none; } }

/* ── Navigation: a quiet ruled bar ── */
body > nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); height: 62px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-logo { font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink2); transition: color .18s;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.nav-contact { color: var(--ink) !important; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.nav-contact:hover { color: var(--accent) !important; }

.theme-toggle {
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--ink3); display: inline-flex; line-height: 0;
  transition: color .18s;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

/* ── Section headers (shared rhythm) ── */
.sec-head {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; align-items: baseline;
  padding-bottom: 22px; border-bottom: 1px solid var(--line2);
  margin-bottom: 40px;
}
.sec-index {
  font-family: var(--mono); font-weight: 700; font-size: 11px; color: var(--accent);
  letter-spacing: 0.05em; align-self: start; line-height: 1;
  border: 1.5px solid var(--accent); border-radius: 3px; padding: 4px 7px 3px;
}
.sec-title { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; letter-spacing: -0.01em; grid-column: 2; }
.sec-note { grid-column: 2; color: var(--ink2); font-size: 17px; max-width: 52ch; margin-top: 8px; }

/* ── Footer ── */
footer { border-top: 1px solid var(--line2); margin-top: 40px; padding: 72px 0 48px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: start; }
.footer-say { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink3); margin-bottom: 10px; }
.footer-mail { font-family: var(--serif); font-size: clamp(28px, 5vw, 44px); font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.footer-mail:hover { color: var(--accent); }
.footer-desc { color: var(--ink2); font-size: 16px; max-width: 44ch; margin-top: 18px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; text-align: right; }
.footer-links a { font-family: var(--mono); font-size: 13px; color: var(--ink2); transition: color .18s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink3); letter-spacing: 0.04em;
  margin-top: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
/* Camera date-back stamp — glowing amber seven-seg style */
.datestamp {
  font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: 0.12em;
  color: var(--stamp); text-shadow: 0 0 6px color-mix(in srgb, var(--stamp) 45%, transparent);
}
.datestamp::before { content: "\25B8 "; opacity: 0.7; }

/* ── Reveal — items rise and pull into focus as they enter ── */
.reveal { opacity: 0; transform: translateY(22px); filter: blur(5px); transition: opacity .7s ease, transform .8s cubic-bezier(.2,.7,.2,1), filter .7s ease; }
.reveal.visible { opacity: 1; transform: none; filter: none; }

/* ============================================================
   DARK MODE — ink on warm charcoal
   ============================================================ */
html[data-theme="dark"] {
  --paper:  #17150F;
  --paper2: #1F1C15;
  --ink:    #EDE6D6;
  --ink2:   #B8AF9C;
  --ink3:   #837A67;
  --line:   #322C21;
  --line2:  #3D3628;
  --clip:   #221E16;
  --accent: #E0664A;
  --accent2:#EE8266;
  --teal:   #5BA595;
  --stamp:  #E0993F;
  --film:   #0D0C08;
  --shell:      #2B271F;
  --shell-edge: #4E4738;
  --shell-hole: #000000;
  --cass-window:#0A0805;
  --reel:       #17130C;
  --reel-edge:  #423B2C;
  --reel-spoke: #6A6049;
  --tape:       #3A2C18;
  --wood:       #3F2C18;
  --case-back:  #0E0A06;
}
html[data-theme="dark"] ::selection { background: var(--accent); color: var(--paper); }

@media (max-width: 720px) {
  :root { --pad: 22px; }
  .nav-inner { height: 56px; gap: 14px; }
  .nav-links { gap: 15px; overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a, .nav-logo { white-space: nowrap; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { text-align: left; flex-direction: row; flex-wrap: wrap; gap: 18px; }
  .sec-title { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; opacity: 1; transform: none; filter: none; }
  html { scroll-behavior: auto; }
  body::before, body::after,
  .cassette .reel, .vu i, .ticker-row, .pb-reel, .hero-name { animation: none !important; }
  .ticker-row { transform: none; }
}
