/* ==========================================================================
   BARNES PROJECTS — index.css
   Classic / minimalist restyle. A scientific-monograph aesthetic:
   ink on paper, Playfair Display + Inter + JetBrains Mono, a single
   restrained nobel-gold accent. Light is the default theme; body.light
   holds the light palette, the bare body holds the dark palette (toggle
   driven by index.js, key: barnes-lcars-theme).
   ========================================================================== */

/* ---------------- theme tokens ---------------- */

:root {
  /* dark palette (bare <body>) */
  --paper:    #17150F;
  --paper-2:  #201D16;
  --paper-3:  #262219;
  --ink:      #EDE7D8;
  --ink-soft: #A39C89;
  --ink-faint:#6E6858;
  --gold:     #D4B26A;
  --gold-dim: #A08A55;
  --line:     #34301F;
  --line-2:   #423C28;

  --maxw: 1120px;
  /* floor is what every phone gets: 5vw only overtakes it above ~480px */
  --gutter: clamp(28px, 5vw, 64px);

  --f-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

body.light {
  --paper:    #F9F8F4;
  --paper-2:  #F3F1E9;
  --paper-3:  #EDEADF;
  --ink:      #1C1A17;
  --ink-soft: #5A554C;
  --ink-faint:#8B8578;
  --gold:     #B0893A;
  --gold-dim: #9A7E38;
  --line:     #DED9CC;
  --line-2:   #CFC9B8;
}

/* ---------------- reset / base ---------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .5s var(--ease), color .5s var(--ease);
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--gold); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---------------- typography primitives ---------------- */

h1, h2, h3 { font-family: var(--f-display); font-weight: 500; line-height: 1.08; margin: 0; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------------- top bar ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.1) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 14px var(--gutter);
  display: flex; align-items: center; gap: 24px;
  position: relative;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--f-display); font-size: 19px; font-weight: 600;
  letter-spacing: .01em; white-space: nowrap;
}
.brand img { width: 26px; height: 26px; opacity: .95; }
.brand .brand-dot { color: var(--gold); }

.nav { display: flex; gap: 26px; margin-left: auto; }
.nav-link {
  font-family: var(--f-mono);
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--ink); border-bottom-color: var(--gold); }

.theme-toggle {
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 40px;
  padding: 7px 15px;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
  white-space: nowrap;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--gold); }

.nav-toggle {
  display: none;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line-2);
  border-radius: 3px; padding: 7px 12px; cursor: pointer;
}

/* ---------------- section scaffolding ---------------- */

section, .comms { scroll-margin-top: 80px; }

.section { padding-block: clamp(64px, 9vw, 132px); border-top: 1px solid var(--line); }

.section-head { margin-bottom: clamp(32px, 5vw, 56px); max-width: 760px; }
.section-head .eyebrow { margin-bottom: 16px; }
.section-title {
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -.01em;
}
.section-intro { color: var(--ink-soft); margin: 18px 0 0; max-width: 62ch; font-size: 1.02rem; }

.body-copy { margin: 0 0 18px; }
.body-copy.dim { color: var(--ink-soft); }
.body-copy em { font-style: italic; color: var(--ink); }

/* pull quote used across sections */
.pullquote {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink);
  border-left: 2px solid var(--gold);
  padding-left: 22px;
  margin: 30px 0 0;
}
.pullquote cite { display: block; margin-top: 10px; font-family: var(--f-mono); font-style: normal; font-size: 12px; letter-spacing: .1em; color: var(--ink-soft); text-transform: uppercase; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono);
  font-size: 12px; letter-spacing: .13em; text-transform: uppercase;
  padding: 13px 22px;
  border-radius: 2px;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--gold); border-color: var(--gold); color: #1a1508; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

.btn-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }

/* ---------------- hero ---------------- */

/* padding-block only: inline padding is left to .container's gutter, which a
   `padding: … 0 …` shorthand would otherwise reset to 0 and flush text to the edge */
.hero { padding-block: clamp(40px, 6vw, 80px) clamp(40px, 6vw, 72px); border-top: 0; }

/* the stage: the brain sits behind, the copy in front on a paper wash */
.hero-stage { position: relative; min-height: clamp(420px, 62vh, 640px); display: flex; align-items: center; }
.hero-copy {
  position: relative; z-index: 2;
  width: min(100%, 640px); padding-block: 24px;
  background: linear-gradient(90deg, var(--paper) 0%, var(--paper) 62%, transparent 100%);
}
.hero-tagline, .hero-disclaimer { max-width: 34ch; }
.hero-eyebrow { margin-bottom: 22px; }
.hero-title {
  font-size: clamp(52px, 10vw, 108px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: .95;
}
.hero-tagline {
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(19px, 2.3vw, 24px);
  line-height: 1.45;
  color: var(--ink);
  margin: 26px 0 0;
}
.hero-disclaimer {
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: .08em;
  color: var(--ink-soft);
  margin: 22px 0 0;
}

/* hero signature: the animated Barnes logo (video), dimmed, right-aligned, behind the copy.
   The clip is black line-art on white; blend modes drop the white backdrop
   into the page so it reads as engraved line-art in both themes. */
.brain {
  position: absolute;
  right: -4%; top: 50%;
  width: min(58%, 560px);
  /* the clip is square, so half its width centres it vertically; percentages in
     margin-top resolve against the stage width, like the width above */
  margin-top: max(-29%, -280px);
  pointer-events: none;
  /* No `opacity`, `z-index` or `transform` here: each creates a stacking context, which
     isolates the video's mix-blend-mode from the page and shows the clip's backdrop as
     a box. The copy column (z-index: 2) paints above this positioned-but-auto layer.
     Dimming is done with filter: opacity() on the video, applied before blending. */
}
.brain-media { position: relative; display: block; width: 100%; line-height: 0; }
.brain-video {
  width: 100%; height: auto; display: block;
  /* dark theme (bare body) is the default: invert to light lines, screen out the black,
     then dim so the labyrinth reads as a backdrop. */
  filter: invert(1) contrast(1.14) opacity(.6);
  mix-blend-mode: screen;
}
body.light .brain-video {
  /* light theme: keep dark lines, multiply out the white, then dim. */
  filter: brightness(1.07) contrast(1.05) opacity(.55);
  mix-blend-mode: multiply;
}
/* mask the AI watermark in the bottom-right corner with a page-coloured patch */
.brain-media::after {
  content: ""; position: absolute; right: 0; bottom: 0;
  width: 30%; height: 9%; background: var(--paper);
}

/* console head/status: shared with the audio jukebox deck */
.console-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft);
}
.console-status { color: var(--gold); }

/* ---------------- ticker ("now") ---------------- */

.ticker {
  display: flex; align-items: center; gap: 16px;
  padding-block: 12px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em;
  color: var(--ink-soft);
}
.ticker-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: ticker-pulse 2s infinite; }
@keyframes ticker-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }
.ticker-label { flex: none; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.ticker-viewport { flex: 1; min-width: 0; overflow: hidden; display: flex; }
/* two identical tracks scroll together; when the first has fully left, the loop restarts seamlessly */
.ticker-track { flex: none; display: inline-flex; align-items: center; gap: 40px; padding-right: 40px; white-space: nowrap; animation: ticker-scroll 48s linear infinite; }
.ticker-viewport:hover .ticker-track,
.ticker-viewport:focus-within .ticker-track,
.ticker.paused .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll { to { transform: translateX(-100%); } }
.ticker-item { color: var(--ink); transition: color .2s; }
.ticker-item:hover { color: var(--gold); }
.ticker-kind { color: var(--ink-soft); }
.ticker-date { color: var(--ink-faint); margin-left: 8px; }
.ticker-sep { color: var(--line-2); }

@media (prefers-reduced-motion: reduce) {
  .ticker-dot { animation: none; }
  .ticker-track { animation: none; flex-wrap: wrap; white-space: normal; gap: 10px 24px; padding-right: 0; }
  .ticker-track[aria-hidden="true"] { display: none; }
}

/* ---------------- writing / essays ---------------- */

.log-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.log-card {
  background: var(--paper); padding: 28px 26px 26px;
  display: flex; flex-direction: column;
  transition: background .25s var(--ease);
  position: relative;
}
.log-card:hover { background: var(--paper-2); }
.log-card.wide { grid-column: span 2; padding: 36px 34px 32px; }
.log-card.wide .log-title { font-size: clamp(1.6rem, 2.6vw, 2.1rem); max-width: 22ch; }
.log-card.wide .log-desc { font-size: 1.02rem; max-width: 62ch; }
.log-stamp { font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.log-new { display: inline-block; font-family: var(--f-mono); font-size: 10px; letter-spacing: .16em; background: var(--gold); color: var(--paper); padding: 2px 7px 1px; border-radius: 2px; }
.log-title { font-family: var(--f-display); font-size: 1.28rem; line-height: 1.2; margin-bottom: 12px; }
.log-desc { color: var(--ink-soft); font-size: .95rem; margin: 0 0 20px; flex: 1; }
.log-cta { font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); transition: color .2s, letter-spacing .2s; }
.log-card:hover .log-cta { color: var(--gold); letter-spacing: .16em; }
.log-more-row { display: flex; justify-content: center; margin-top: 28px; }

/* ---------------- about ---------------- */

.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 64px); align-items: start; }

.dossier-name { font-size: clamp(24px, 3vw, 34px); margin-bottom: 20px; }
.dossier-facts { border-top: 1px solid var(--line); margin: 0 0 24px; }
.dossier-row {
  display: grid; grid-template-columns: 150px 1fr; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.dossier-row span { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); padding-top: 2px; }
.dossier-row strong { font-weight: 500; }
.dossier-note { color: var(--ink-soft); margin: 0 0 16px; }
.dossier-motto { font-family: var(--f-display); font-style: italic; font-size: 1.1rem; color: var(--ink); margin: 0; }

.timeline-head { font-family: var(--f-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 20px; }
.timeline { list-style: none; margin: 0 0 28px; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 62px 1fr; gap: 18px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.timeline .t-year { font-family: var(--f-mono); font-size: 14px; color: var(--gold); }
.timeline .t-event { color: var(--ink-soft); font-size: .96rem; }
.timeline li.mark .t-event { color: var(--ink); font-weight: 500; }
.timeline li.mark .t-year { font-weight: 700; }

.about-links { display: flex; gap: 22px; }
.about-links a { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.about-links a:hover { color: var(--gold); border-color: var(--gold); }

/* ---------------- projects ---------------- */

.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 4vw, 48px); }
.project-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 32px 30px;
  background: var(--paper-2);
  display: flex; flex-direction: column;
}
.project-mark { width: 64px; height: 64px; color: var(--gold); margin-bottom: 18px; }
.project-tag { font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 16px; }
.project-card .btn-row { margin-top: 8px; }
.project-card h3 { font-family: var(--f-display); font-size: 1.7rem; margin-bottom: 14px; }
.project-card .btn { align-self: flex-start; margin-top: 8px; }
.archive-list { list-style: none; margin: 4px 0 20px; padding: 0; }
.archive-list li { border-bottom: 1px solid var(--line); }
.archive-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; font-size: .95rem; transition: color .18s; }
.archive-list a:hover { color: var(--gold); }
.pdf-badge { font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; color: var(--ink-soft); border: 1px solid var(--line-2); border-radius: 2px; padding: 2px 6px; }
.archive-rfc { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); transition: color .2s; }
.archive-rfc:hover { color: var(--gold); }

/* ---------------- media (tabs) ---------------- */

.deck-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.deck-tab {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-soft);
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 16px; cursor: pointer; margin-bottom: -1px;
  transition: color .2s, border-color .2s;
}
.deck-tab:hover { color: var(--ink); }
.deck-tab.active { color: var(--ink); border-bottom-color: var(--gold); }

/* ---------------- audio jukebox ---------------- */

.holodeck-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(24px, 4vw, 44px); align-items: start; }

.audio-console { border: 1px solid var(--line); border-radius: 4px; background: var(--paper-2); overflow: hidden; }

.audio-src-tabs { display: flex; gap: 2px; padding: 10px 12px 0; }
.audio-src-tabs button {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line); border-bottom: none;
  border-radius: 3px 3px 0 0; padding: 8px 14px; cursor: pointer; transition: color .2s, background .2s;
}
.audio-src-tabs button.active { color: var(--ink); background: var(--paper); }

.audio-viewbar { display: flex; gap: 6px; padding: 12px 14px 0; }
.audio-viewbar button {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line-2); border-radius: 40px;
  padding: 5px 12px; cursor: pointer; transition: color .2s, border-color .2s;
}
.audio-viewbar button:hover { color: var(--ink); }
.audio-viewbar button.active { color: var(--gold); border-color: var(--gold); }

.audio-pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 0; }
.audio-pill {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line-2); border-radius: 40px;
  padding: 5px 11px; cursor: pointer; transition: color .2s, border-color .2s, background .2s;
}
.audio-pill:hover { color: var(--ink); }
.audio-pill.active { color: var(--paper); background: var(--ink); border-color: var(--ink); }

.audio-now { display: flex; align-items: center; gap: 16px; padding: 18px 16px 8px; }
.audio-disc { width: 54px; height: 54px; color: var(--gold); flex: none; }
.audio-disc svg { width: 100%; height: 100%; }
.audio-disc.spinning { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .audio-disc.spinning { animation: none; } }
.audio-meta { min-width: 0; flex: 1; }
.audio-title { font-family: var(--f-display); font-size: 1.15rem; line-height: 1.25; }
.audio-time { font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.audio-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.audio-badge-genre { font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.audio-badge-e { font-family: var(--f-mono); font-size: 10px; font-weight: 700; color: var(--paper); background: var(--gold); border-radius: 2px; padding: 1px 5px; }
.audio-lyr { font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid transparent; }
.audio-lyr:hover { border-color: var(--gold); }

.audio-progress { height: 4px; background: var(--line); margin: 6px 16px 0; border-radius: 3px; cursor: pointer; }
.audio-progress-fill { height: 100%; width: 0; background: var(--gold); border-radius: 3px; }
.audio-controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; }
.audio-controls button {
  font-family: var(--f-mono); font-size: 13px; color: var(--ink);
  background: transparent; border: 1px solid var(--line-2); border-radius: 40px;
  width: 40px; height: 40px; cursor: pointer; transition: color .2s, border-color .2s, background .2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.audio-controls button:hover { border-color: var(--gold); color: var(--gold); }
#audio-play { width: 50px; height: 50px; background: var(--ink); color: var(--paper); border-color: var(--ink); font-size: 15px; }
#audio-play:hover { background: var(--gold); border-color: var(--gold); color: #1a1508; }

.audio-list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; border-top: 1px solid var(--line); }
.audio-list button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 3px; cursor: pointer;
  padding: 9px 11px; color: var(--ink); transition: background .16s;
}
.audio-list button:hover { background: var(--paper-3); }
.audio-list button.active { background: var(--ink); color: var(--paper); }
.audio-list button.active .audio-idx, .audio-list button.active .audio-genre { color: var(--gold); }
.audio-idx { font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); min-width: 22px; }
.audio-row-title { flex: 1; font-size: .92rem; min-width: 0; }
.audio-genre { font-family: var(--f-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }

/* media side counters */
.holodeck-side { display: flex; flex-direction: column; gap: 14px; }
.holo-card { border: 1px solid var(--line); border-radius: 4px; padding: 18px 20px; background: var(--paper-2); }
.holo-num { font-family: var(--f-display); font-size: 2.2rem; line-height: 1; color: var(--gold); }
.holo-label { font-size: .86rem; color: var(--ink-soft); margin-top: 6px; }
.holo-quote { font-family: var(--f-display); font-style: italic; font-size: 1.02rem; color: var(--ink); border-left: 2px solid var(--gold); padding-left: 16px; margin: 6px 0 0; }
.holo-quote cite { display: block; font-family: var(--f-mono); font-style: normal; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-top: 8px; }

/* ---------------- image gallery ---------------- */

.img-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.img-filter {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line-2); border-radius: 40px;
  padding: 6px 14px; cursor: pointer; transition: color .2s, border-color .2s;
}
.img-filter:hover { color: var(--ink); }
.img-filter.active { color: var(--gold); border-color: var(--gold); }

.img-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.img-cell {
  position: relative; aspect-ratio: 1; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); border-radius: 3px; background: var(--paper-2);
}
.img-cell img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease), filter .3s; filter: grayscale(.15); }
.img-cell:hover img { transform: scale(1.05); filter: grayscale(0); }
.img-cell-cat { position: absolute; top: 8px; left: 8px; font-family: var(--f-mono); font-size: 9px; letter-spacing: .08em; color: var(--paper); background: color-mix(in srgb, var(--ink) 78%, transparent); padding: 3px 7px; border-radius: 2px; }
.img-cell-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; font-family: var(--f-mono); font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.72)); opacity: 0; transition: opacity .25s; }
.img-cell:hover .img-cell-label { opacity: 1; }
/* touch devices never hover, so the caption would otherwise be unreachable */
@media (hover: none) {
  .img-cell-label { opacity: 1; }
  .img-cell img { filter: grayscale(0); }
}

/* ---------------- video reel ---------------- */

.video-deck { display: grid; grid-template-columns: 1.7fr 1fr; gap: clamp(20px, 3vw, 36px); align-items: start; }
.video-stage { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #000; }
.video-frame { aspect-ratio: 16/9; background: #000; }
.video-frame video, .video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-yt-fallback { position: relative; display: block; width: 100%; height: 100%; }
.video-yt-fallback img { width: 100%; height: 100%; object-fit: cover; }
.video-yt-play { position: absolute; inset: 0; margin: auto; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; background: rgba(0,0,0,.55); border-radius: 50%; }
.video-yt-note { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; color: #eee; }
.video-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--paper-2); }
.video-caption #video-title { font-family: var(--f-display); font-size: 1.05rem; color: var(--ink); }
.video-type { font-family: var(--f-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.video-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.video-list li + li { border-top: 1px solid var(--line); }
.video-list button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer; padding: 13px 16px; color: var(--ink); font-size: .92rem; transition: background .16s; }
.video-list button:hover { background: var(--paper-2); }
.video-list button.active { background: var(--ink); color: var(--paper); }
.video-list button.active .video-idx { color: var(--gold); }
.video-idx { font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); min-width: 22px; }

/* ---------------- lightbox ---------------- */

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(10,9,6,.9); display: flex; align-items: center; justify-content: center; padding: 40px; }
.lightbox[hidden] { display: none; }
.lightbox-fig { margin: 0; max-width: 92vw; max-height: 88vh; text-align: center; }
.lightbox-fig img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 3px; }
.lightbox-fig figcaption { font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; color: #ddd; margin-top: 14px; }
.lightbox-close { position: absolute; top: 20px; right: 26px; font-size: 30px; line-height: 1; color: #fff; background: transparent; border: 0; cursor: pointer; }

/* ---------------- footer ---------------- */

.comms { border-top: 1px solid var(--line); padding-block: clamp(48px, 6vw, 80px) 40px; }
.comms-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; }
.comms-title { font-family: var(--f-display); font-size: 1.5rem; margin-bottom: 10px; }
.comms-sub { color: var(--ink-soft); max-width: 46ch; margin: 0; }
.comms-links { display: flex; flex-direction: column; gap: 10px; }
.comms-links a { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); transition: color .2s; }
.comms-links a:hover { color: var(--gold); }
.comms-foot { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; color: var(--ink-faint); }

/* ---------------- scroll reveal ---------------- */

.reveal-a { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal-a.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal-a { opacity: 1; transform: none; transition: none; }
}

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  body { font-size: 16px; }
  .about-grid, .projects-grid, .holodeck-grid, .video-deck, .comms-grid { grid-template-columns: 1fr; }
  /* mobile: copy first, the brain below it at full width, no overlap */
  .hero-stage { flex-direction: column; align-items: stretch; min-height: 0; }
  .hero-copy { width: 100%; background: none; padding-block: 0; }
  .hero-tagline, .hero-disclaimer { max-width: none; }
  .hero-copy { order: -1; }
  .brain { position: static; width: min(100%, 420px); margin: 28px auto 0; }
  .log-grid { grid-template-columns: 1fr 1fr; }
  .log-card.wide { grid-column: span 2; }
  .img-grid { grid-template-columns: repeat(3, 1fr); }
  .nav { display: none; }
  .nav.open { display: flex; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px; z-index: 45; margin: 0; }
  .nav.open .nav-link { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .nav-toggle { display: inline-flex; margin-left: auto; }
}
@media (max-width: 560px) {
  .log-grid { grid-template-columns: 1fr; }
  .log-card.wide { grid-column: auto; }
  .img-grid { grid-template-columns: repeat(2, 1fr); }
  .dossier-row { grid-template-columns: 1fr; gap: 2px; }
  .brand .brand-full { display: none; }
  /* 40px each side ate a quarter of the screen, so the image never reached its 92vw cap */
  .lightbox { padding: 16px; }
  .lightbox-fig { max-width: 100%; }
  .lightbox-close { top: 10px; right: 12px; }
  /* the topbar's 24px gap is more than a phone can spare between three controls */
  .topbar-inner { gap: 12px; }
}
