/* ==========================================================================
   HENRY WU - Design System
   Vintage-Modern Editorial (B&W + Cream + Gold)
   Derived from the design guide: Personal Identity + Nostalgia & Now
   Shape language: Sharp (0px). Inter (dev voice) + Playfair Display (creative).
   ========================================================================== */

:root {
  /* --- Color tokens --- */
  --paper-cream:      #FBFBE2;   /* background base */
  --bg:               #FBFBE2;
  --surface:          #FFFFFF;   /* off-white card lift */
  --ink:              #1b1b1b;   /* primary text (on-surface) */
  --ink-black:        #000000;   /* structural borders / headings */
  --muted:            #4c4546;   /* on-surface-variant */
  --outline:          #7e7576;   /* outline */
  --outline-variant:  #cfc4c5;
  --hairline:         rgba(27,27,27,.16);
  --gold:             #D4AF37;   /* soft gold accent */
  --gold-soft:        #E9C349;   /* secondary-fixed-dim */
  --gold-tint:        #FED65B;   /* secondary-container */
  --surface-low:      #F5F5DC;
  --surface-container:#EFEFD7;
  --fixed-dim:        #E4E4CC;

  /* --- Typography --- */
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, "Courier New", monospace;

  /* --- Spacing scale --- */
  --page-margin: clamp(1.25rem, 5vw, 4rem);
  --gutter: 24px;
  --gap: 24px;
  --section-gap: clamp(3rem, 8vw, 6rem);
  --stack-xs: 4px;
  --stack-sm: 12px;
  --stack-md: 24px;
  --stack-lg: 48px;
  --card-padding: clamp(20px, 2.5vw, 32px);

  --nav-h: 64px;
  --ease: cubic-bezier(.25,.8,.25,1);
}

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--gold); color: #fff; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

main { flex: 1 0 auto; width: 100%; max-width: 1400px; margin: 0 auto; }
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding-left: var(--page-margin); padding-right: var(--page-margin); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --- Typographic voices (clash & complement) --- */
/* Inter - the developer, tight tracking, blocky */
.t-headline-lg {
  font-family: var(--sans); font-weight: 800; font-size: clamp(26px,3.4vw,32px);
  line-height: 1.12; letter-spacing: -0.04em;
}
.t-label-caps {
  font-family: var(--sans); font-weight: 700; font-size: 12px;
  line-height: 16px; letter-spacing: .15em; text-transform: uppercase;
}
.t-body-lg { font-family: var(--sans); font-weight: 400; font-size: clamp(16px,2vw,18px); line-height: 1.55; }
.t-body-md { font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.5; }
/* Playfair - the creative, elegant */
.t-display-xl {
  font-family: var(--serif); font-weight: 700; font-size: clamp(48px,9vw,80px);
  line-height: 1.02; letter-spacing: -0.02em;
}
.t-headline-md { font-family: var(--serif); font-weight: 500; font-size: clamp(24px,3vw,28px); line-height: 1.28; }
.t-caption-serif { font-family: var(--serif); font-weight: 400; font-size: 14px; line-height: 1.45; }
.t-quote {
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: clamp(28px,5vw,44px); line-height: 1.15; letter-spacing: -0.01em;
}
.t-mono { font-family: var(--mono); font-weight: 500; letter-spacing: .04em; }
.muted { color: var(--muted); }

/* --- Film grain overlay (global texture) --- */
.grain-overlay {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  pointer-events: none; z-index: 9998; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 400px 400px;
}

/* --- Page loader (gold progress bar) --- */
.page-loader {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 10000;
  background: var(--gold); transform: scaleX(0); transform-origin: left;
  transition: transform .7s var(--ease), opacity .5s ease 0.3s;
}
.page-loader.done { transform: scaleX(1); }
.page-loader.hide { opacity: 0; }

/* ==========================================================================
   Navigation
   ========================================================================== */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); padding: 0 var(--page-margin);
  border-bottom: 1px solid transparent;
  transition: background-color .35s ease, border-color .35s ease, backdrop-filter .35s ease;
}
.site-nav.is-scrolled, .site-nav.has-bg {
  background: rgba(251,251,226,.82);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom-color: var(--ink-black);
}
.nav-brand {
  font-family: var(--serif); font-weight: 700; font-size: 20px;
  letter-spacing: .02em; color: var(--ink-black);
}
.nav-links { display: flex; align-items: center; gap: var(--stack-md); }
.nav-links a {
  font-weight: 700; font-size: 12px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--muted); transition: color .3s;
  position: relative; padding-bottom: 2px;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink-black); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-burger {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--ink-black);
  background: var(--surface); position: relative; z-index: 1001;
}
.nav-burger span {
  display: block; width: 18px; height: 2px; background: var(--ink-black);
  position: relative; transition: background .2s;
}
.nav-burger span::before, .nav-burger span::after {
  content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink-black);
  transition: transform .3s var(--ease), top .3s var(--ease);
}
.nav-burger span::before { top: -6px; }
.nav-burger span::after { top: 6px; }
.nav-burger.open span { background: transparent; }
.nav-burger.open span::before { top: 0; transform: rotate(45deg); }
.nav-burger.open span::after { top: 0; transform: rotate(-45deg); }

/* Mobile slide-in panel */
.mobile-nav {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(80vw, 300px); z-index: 1000;
  background: var(--paper-cream); border-right: 1px solid var(--ink-black);
  box-shadow: 4px 0 0 0 var(--ink-black);
  transform: translateX(-100%); transition: transform .3s var(--ease);
  padding: calc(var(--nav-h) + 16px) var(--stack-md) var(--stack-md);
  display: flex; flex-direction: column;
}
.mobile-nav.open { transform: translateX(0); }
.mobile-nav ul { display: flex; flex-direction: column; gap: var(--stack-sm); }
.mobile-nav a {
  display: flex; align-items: center; gap: var(--stack-sm);
  padding: 14px; font-family: var(--serif); font-size: 22px; font-weight: 500;
  color: var(--ink); transition: background .25s, color .25s;
}
.mobile-nav a:hover, .mobile-nav a[aria-current="page"] { background: var(--surface); }
.mobile-nav a svg { width: 20px; height: 20px; }
.nav-overlay {
  position: fixed; inset: 0; z-index: 950; background: rgba(27,27,27,.35);
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
}
.nav-overlay.show { opacity: 1; visibility: visible; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 12px; letter-spacing: .15em; text-transform: uppercase;
  padding: 16px 24px; border: 1px solid var(--ink-black); background: var(--ink-black);
  color: #fff; transition: background-color .4s ease, color .4s ease, transform .1s ease;
  min-height: 48px;
}
.btn:hover { background: var(--gold); color: var(--ink-black); }
.btn:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--ink-black); }
.btn-outline:hover { background: var(--ink-black); color: #fff; }

/* ==========================================================================
   Hairstyles: rules & dividers
   ========================================================================== */
.hairline-b { border-bottom: 1px solid var(--ink-black); }
.hairline-t { border-top: 1px solid var(--ink-black); }
.hairline-l { border-left: 1px solid var(--ink-black); }
.hairline-r { border-right: 1px solid var(--ink-black); }
.rule { height: 1px; background: var(--ink-black); border: 0; margin: 0; }
.halftone-divider {
  height: 6px; width: 100%;
  background-image: radial-gradient(var(--ink-black) 1.1px, transparent 1.1px);
  background-size: 6px 6px; opacity: .28;
}

/* --- Vertical print layout: grid with marginalia --- */
.editorial-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 900px) {
  .editorial-grid { grid-template-columns: repeat(12, 1fr); grid-column-gap: var(--gap); }
  .grid-col-label { grid-column: span 3; }
  .grid-col-body { grid-column: span 9; }
}

/* --- Vertical text (runs) --- */
.vertical-label {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-weight: 700; font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted);
}

/* --- Hero masthead spreads (desktop only) --- */
@media (min-width: 900px) {
  .hero-title { grid-column: 1 / 13; }
  .hero-left  { grid-column: 1 / 6; }
  .hero-right { grid-column: 12 / 13; }
}

/* ==========================================================================
   Reveal on scroll
   ========================================================================== */
.reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity .8s ease, transform .8s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   Cards
   ========================================================================== */
.editorial-card {
  background: var(--surface); border: 1px solid var(--ink-black);
  display: flex; flex-direction: column; height: 100%;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.editorial-card:hover { transform: translateY(-3px); box-shadow: 5px 5px 0 0 var(--ink-black); }
.interactive-card {
  background: var(--surface); border: 1px solid var(--ink-black);
  padding: var(--card-padding); display: flex; flex-direction: column; height: 100%;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  position: relative;
}
.interactive-card:hover { transform: translateY(-3px); box-shadow: 5px 5px 0 0 var(--ink-black); }
.interactive-card .card-icon { width: 34px; height: 34px; }
.interactive-card:hover .card-icon { color: var(--gold); }

/* Polaroid */
.polaroid {
  background: var(--surface); border: 1px solid var(--ink-black); padding: 10px;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.polaroid:hover { transform: translateY(-4px) rotate(0deg) !important; box-shadow: 5px 5px 0 0 var(--ink-black); }
.polaroid img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; margin-bottom: 12px;
  filter: grayscale(1) contrast(1.05);
}
.polaroid figcaption {
  font-family: var(--serif); font-size: 14px; text-align: center; color: var(--ink);
  padding-bottom: 8px; letter-spacing: .02em;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  flex-shrink: 0; width: 100%; border-top: 1px solid var(--ink-black);
  padding: var(--stack-lg) var(--page-margin);
  display: flex; flex-direction: column; gap: var(--stack-md);
  align-items: center; justify-content: space-between;
  background: var(--paper-cream);
}
@media (min-width: 760px) { .site-footer { flex-direction: row; } }
.site-footer .brand { font-family: var(--serif); font-weight: 700; letter-spacing: .02em; }
.site-footer .faith { display: inline-flex; align-items: center; gap: 6px; }
.site-footer .faith svg { width: 14px; height: 14px; }
.site-footer .socials { display: flex; flex-wrap: wrap; gap: var(--stack-md); }
.site-footer .socials a {
  font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); transition: color .3s;
}
.site-footer .socials a:hover { color: var(--gold); }

/* ==========================================================================
   Page transitions (snap-fade / vertical slide)
   ========================================================================== */
.fade-page { opacity: 1; transition: opacity .25s ease, transform .25s var(--ease); }
body.is-leaving .fade-page { opacity: 0; transform: translateY(-10px); }

/* ==========================================================================
   Games
   ========================================================================== */
.game-card-thumb {
  height: 190px; border-bottom: 1px solid var(--ink-black);
  background: var(--surface-container); position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.game-card-thumb .thumb-img {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: grayscale(1) contrast(1.05); opacity: .82; transition: opacity .4s;
}
.game-card:hover .thumb-img { opacity: 1; }
.game-meta { padding: var(--card-padding); display: flex; flex-direction: column; flex: 1; }
.game-tag { margin-bottom: var(--stack-xs); }
.game-card h3 { font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 1.2; margin-bottom: var(--stack-sm); }
.game-card p { color: var(--muted); margin-bottom: var(--stack-md); }
.game-card .card-rule { height: 1px; background: rgba(27,27,27,.16); margin-bottom: var(--stack-md); }

/* --- Fullscreen game overlay --- */
.game-overlay {
  position: fixed; inset: 0; z-index: 1200; background: var(--paper-cream);
  display: flex; flex-direction: column; opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
.game-overlay.open { opacity: 1; visibility: visible; }
.game-overlay-bar {
  flex-shrink: 0; height: var(--nav-h); display: flex; align-items: center;
  justify-content: space-between; padding: 0 var(--page-margin);
  border-bottom: 1px solid var(--ink-black); background: var(--paper-cream);
}
.game-back {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700;
  font-size: 12px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted);
}
.game-back:hover { color: var(--ink-black); }
.game-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 24px; }
.game-stage {
  position: relative; display: flex; flex-direction: column; align-items: center;
  max-width: 100%; gap: 12px;
}
.game-canvas-card {
  background: #111; border: 1px solid var(--ink-black); box-shadow: 8px 8px 0 0 var(--ink-black);
  padding: 12px; line-height: 0;
}
.game-canvas-card canvas { display: block; background: #0e0e0e; max-width: 100%; max-height: min(58vh, 620px); width: auto; height: auto; }
.game-stats {
  width: 100%; display: flex; justify-content: space-between;
  font-family: var(--mono); color: var(--ink); font-size: 15px; letter-spacing: .04em;
}
.game-stats .stat strong { font-weight: 700; }
.game-prompt { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 15px; text-align: center; }

.pixel-btn {
  font-family: var(--mono); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  background: var(--ink-black); color: #fff; border: 1px solid var(--ink-black);
  padding: 12px 22px; transition: background .2s, color .2s;
}
.pixel-btn:hover { background: var(--gold); color: var(--ink-black); }

/* --- Odd Wordle --- */
.wl-cell {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; border: 2px solid var(--outline-variant);
  font-family: var(--mono); font-weight: 700; font-size: clamp(20px, 5vw, 30px);
  background: var(--surface); color: var(--ink); text-transform: uppercase;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.wl-cell.correct { background: var(--ink-black); color: #fff; border-color: var(--ink-black); }
.wl-cell.present { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.wl-cell.absent  { background: var(--surface-container); color: var(--muted); border-color: var(--outline-variant); }
.wl-key {
  flex: 1; min-width: 24px; height: 46px; font-family: var(--mono); font-weight: 700;
  text-transform: uppercase; background: var(--surface); border: 1px solid var(--ink-black);
  transition: background .2s ease, color .2s ease;
}
.wl-key:hover { background: var(--gold-soft); }
.wl-key.spec { flex: 1.7; font-size: 11px; }
.wl-key.correct { background: var(--ink-black); color: #fff; }
.wl-key.present { background: var(--gold); color: var(--ink); }
.wl-key.absent  { background: var(--surface-container); color: var(--muted); }
.wl-row { display: flex; gap: 5px; width: 100%; justify-content: center; }
@keyframes wl-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.wl-cell.shaking { animation: wl-shake .44s ease; }

/* ==========================================================================
   The Procrastinator
   ========================================================================== */
.tv-frame {
  position: relative; background: #0a0a0a; border: 6px solid #2a2a2a;
  box-shadow: 10px 10px 0 0 var(--ink-black); border-radius: 4px;
  max-width: 640px; width: 100%; overflow: hidden;
}
.tv-screen { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #111; }
.tv-screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.045) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
.tv-brand {
  position: absolute; top: 8px; left: 12px; z-index: 4; pointer-events: none;
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: rgba(255,255,255,.55);
}
.tv-ticker {
  background: #111; color: var(--gold); border-top: 2px solid var(--gold);
  padding: 8px 14px; font-family: var(--mono); font-size: 13px; letter-spacing: .06em;
  overflow: hidden; white-space: nowrap;
}
.tv-ticker .ticker-track { display: inline-flex; gap: 60px; animation: ticker 24s linear infinite; }
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.guilt-box {
  width: 100%; max-width: 480px; margin: var(--stack-md) auto 0;
  border: 1px solid var(--ink-black); background: var(--surface);
  padding: var(--stack-md); position: relative;
}
.guilt-box::before {
  content: ""; position: absolute; inset: 0; transform: translate(8px, 8px);
  background: var(--gold); z-index: -1; border: 1px solid var(--ink-black);
}
.guilt-head {
  display: flex; justify-content: space-between; border-bottom: 1px solid var(--ink-black);
  padding-bottom: 10px; margin-bottom: 16px; font-family: var(--serif); font-size: 15px;
}
.guilt-intervention {
  display: none; margin-top: 16px; border: 1px solid var(--ink-black);
  background: var(--ink-black); color: #fff; padding: 20px; text-align: center;
  font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.3;
}
.guilt-intervention.show { display: block; animation: pop .4s var(--ease); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.guilt-intervention span { color: var(--gold); }

/* ==========================================================================
   Tools
   ========================================================================== */
.tool-card-icon { width: 34px; height: 34px; }
.tool-panel {
  background: var(--surface); border: 1px solid var(--ink-black); padding: var(--card-padding);
}
.field {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--stack-md);
}
.field label { font-weight: 700; font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.input-underline {
  font-family: var(--mono); font-size: 16px; width: 100%; padding: 10px 0 8px;
  border: 0; border-bottom: 1px solid var(--ink-black); background: transparent;
  color: var(--ink); outline: none; transition: border-color .25s;
}
.input-underline:focus { border-bottom: 2px solid var(--gold); }
.input-underline::placeholder { color: var(--outline-variant); }
textarea.input-underline { resize: vertical; min-height: 60px; }

.result-box {
  width: 100%; font-family: var(--mono); font-size: 18px; padding: 16px;
  border: 1px dashed var(--outline-variant); background: var(--surface-container);
  word-break: break-all;
}
.result-box.code { font-size: clamp(20px,3vw,26px); letter-spacing: .06em; }

/* Odometer / flip digits */
.odometer { display: inline-flex; gap: 6px; font-family: var(--mono); }
.odometer .digit {
  position: relative; display: inline-block; min-width: .62em; padding: 4px 8px;
  background: var(--surface); border: 1px solid var(--ink-black);
  text-align: center; overflow: hidden;
}
.odometer .digit span { display: block; transition: transform .4s var(--ease); }
.odometer .digit.flip span { transform: translateY(-50%); }
.odometer .digit::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--outline-variant); }

/* Range slider */
input[type="range"] { -webkit-appearance: none; width: 100%; height: 28px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--ink-black); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -10px; background: var(--surface);
  border: 2px solid var(--ink-black); transition: background .2s, transform .2s;
}
input[type="range"]::-webkit-slider-thumb:hover { background: var(--gold); transform: scale(1.15); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--ink-black); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; background: var(--surface); border: 2px solid var(--ink-black); border-radius: 0; }

.toggle-row { display: flex; gap: var(--stack-md); flex-wrap: wrap; margin-bottom: var(--stack-md); }
.toggle {
  display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.toggle input { position: absolute; opacity: 0; }
.toggle .mark {
  width: 18px; height: 18px; border: 1px solid var(--ink-black); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; transition: all .2s;
}
.toggle input:checked + .mark { background: var(--ink-black); }
.toggle input:checked + .mark::after { content: "✕"; color: #fff; font-size: 11px; line-height: 1; }

.palette-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--stack-sm); margin-bottom: var(--stack-md); }
.palette-block { border: 1px solid var(--ink-black); cursor: pointer; transition: transform .2s; }
.palette-block:hover { transform: translateY(-3px); }
.palette-block .swatch { height: 90px; }
.palette-block .label { padding: 8px; font-family: var(--mono); font-size: 12px; background: var(--surface); border-top: 1px solid var(--ink-black); }

/* Decibel meter gauge */
.db-gauge {
  height: 20px; border: 1px solid var(--ink-black); background: var(--surface-container);
  position: relative; overflow: hidden; margin-bottom: var(--stack-md);
}
.db-gauge .fill {
  height: 100%; width: 0%; background: var(--ink-black);
  transition: width .12s linear, background-color .3s ease;
}
.db-gauge .fill.hot { background: var(--gold); }
.db-gauge .tick {
  position: absolute; top: 0; bottom: 0; width: 1px; background: var(--outline-variant);
}
.db-readout { display: flex; align-items: baseline; gap: var(--stack-sm); margin-bottom: var(--stack-md); }
.db-readout .val { font-family: var(--mono); font-weight: 700; font-size: clamp(44px, 9vw, 72px); line-height: 1; }
.db-peak { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--muted); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 14px; }
.data-table th {
  text-align: left; font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--ink-black); padding: 12px 8px;
}
.data-table td { padding: 12px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.data-table tr:hover td { background: var(--surface-container); }
.copy-chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--ink-black); padding: 4px 10px; color: var(--ink); transition: all .2s;
}
.copy-chip:hover { background: var(--gold); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink-black); color: #fff; padding: 14px 22px; z-index: 5000;
  font-size: 14px; letter-spacing: .02em; opacity: 0; transition: all .3s var(--ease);
  pointer-events: none; box-shadow: 4px 4px 0 0 var(--gold);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-carousel {
  width: 100%; max-width: 640px; min-height: 96px; display: flex; align-items: center; justify-content: center;
  border-top: 1px solid var(--ink-black); border-bottom: 1px solid var(--ink-black);
  background: rgba(255,255,255,.4); backdrop-filter: blur(2px);
  position: relative; overflow: hidden;
}
.contact-line {
  font-family: var(--mono); font-size: clamp(18px,3vw,24px); letter-spacing: .04em; color: var(--ink);
  display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
  transition: opacity .35s ease, transform .35s var(--ease);
}
.contact-line.out { opacity: 0; transform: translateY(-14px); }
.contact-line .copy-icon { opacity: .45; width: 18px; height: 18px; transition: opacity .2s, transform .2s; }
.contact-line:hover .copy-icon { opacity: 1; transform: translateY(-1px); }

.halftone-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--ink-black) 1px, transparent 1px);
  background-size: 16px 16px; opacity: .05;
}

/* Typewriter cursor */
.typewriter-cursor {
  display: inline-block; width: 2px; height: 1em; background: var(--ink);
  animation: blink 1s step-end infinite; vertical-align: text-bottom; margin-left: 4px;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Marginalia block (contact page, desktop only) */
.marg-block { display: none; }
@media (min-width: 900px) { .marg-block { display: block; } }

/* ==========================================================================
   Micro/utility
   ========================================================================== */
.hard-shadow { box-shadow: 4px 4px 0 0 var(--ink-black); }
.gold-cta { background: var(--gold-soft); color: var(--ink); }
.stack-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 760px) { .stack-grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .stack-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .stack-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
/* Homepage photo grid: two columns on mobile too, but with a wide bleed and
   tight gutters so each polaroid renders much larger than before. */
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 0 -18px; }
.photo-grid .polaroid { padding: 6px; }
@media (min-width: 760px) {
  .photo-grid { gap: var(--stack-lg); margin: 0; }
  .photo-grid .polaroid { padding: 10px; }
}
.center { text-align: center; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 899px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
}
@media (min-width: 900px) {
  .mobile-nav, .nav-overlay { display: none !important; }
}
