/* =============================================================
   style.css — all styling for the portfolio.
   Design direction: near-black "ink" background, warm "bone"
   text, a single red "seal" accent, dotted grids, monospace
   labels with wide letter-spacing, pill buttons and bordered
   panels. Colours live in CSS custom properties (variables) so
   the light theme only has to swap the variable values.
   ============================================================= */

/* ---------- 1. Design tokens (CSS variables) ---------- */
:root,
[data-theme="dark"] {
  --bg: #0a0a0b;          /* ink */
  --panel: #111113;
  --raised: #18181b;
  --line: #26262a;
  --text: #eeebe4;        /* bone */
  --muted: #9b9991;
  --dim: #64625d;
  --accent: #ff4b3e;      /* seal red */
  --ok: #3ccf8e;
  --paper: #e6e6e3;
  --paper-ink: #0a0a0b;
  --dot: rgba(238, 235, 228, 0.09);
  --header-bg: rgba(10, 10, 11, 0.72);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 0.5rem;
  --radius-pill: 999px;
  --container: 72rem;
  --header-h: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Light theme: same layout, different variable values */
[data-theme="light"] {
  --bg: #eeebe4;
  --panel: #f6f4ef;
  --raised: #e6e3db;
  --line: #d3cfc5;
  --text: #121214;
  --muted: #55534e;
  --dim: #8a877f;
  --paper: #121214;
  --paper-ink: #eeebe4;
  --dot: rgba(18, 18, 20, 0.10);
  --header-bg: rgba(238, 235, 228, 0.78);
}

/* ---------- 2. Base / reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
img, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; line-height: 1.05; font-weight: 600; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.section { padding: 7rem 0 2rem; scroll-margin-top: var(--header-h); }
.accent { color: var(--accent); }
.underline { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--dim); }
.underline:hover { text-decoration-color: var(--accent); }

/* Monospace uppercase "label" text — a signature of this design */
.label, .eyebrow, .card-tag, .skill-meta, .paper-meta {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.mono-copy { font-family: var(--font-mono); font-size: .82rem; line-height: 1.75; color: var(--muted); }
.section-title { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: .9rem 0 2.5rem; }
.section-title.center { text-align: center; font-family: var(--font-mono); font-weight: 500; font-size: clamp(1.1rem, 2.4vw, 1.5rem); letter-spacing: .14em; }

/* ---------- 3. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .95rem 1.6rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  border: 1px solid transparent;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-solid { background: var(--text); color: var(--bg); }
.btn-ghost { background: var(--raised); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-sm { padding: .65rem 1.1rem; font-size: .68rem; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center;
}
/* The theme icon is drawn with CSS: a moon in dark mode, a sun in light mode */
.theme-icon { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset -5px -3px 0 0 var(--text); transition: .3s; }
[data-theme="light"] .theme-icon { box-shadow: 0 0 0 2px var(--text), 0 0 0 5px transparent; background: var(--text); transform: scale(.65); }

/* ---------- 4. Header & navigation ---------- */
.scroll-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--accent); z-index: 60; }
.site-header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 50;
  transition: background-color .3s, border-color .3s, height .3s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { background: var(--header-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-color: var(--line); height: 60px; }
.header-inner { height: 100%; display: flex; align-items: center; gap: 2rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; letter-spacing: -0.02em; font-size: 1.05rem; }
.brand-mark { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--accent); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.brand-dot { color: var(--accent); }
.main-nav { flex: 1; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.6rem; }
.nav-link { font-size: .88rem; color: var(--muted); position: relative; padding: .3rem 0; transition: color .2s; }
.nav-link:hover, .nav-link.is-active { color: var(--text); }
.nav-link.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--accent); border-radius: 2px; }
.header-actions { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.menu-toggle { display: none; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: 50%; padding: 0; position: relative; }
.menu-toggle span { position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--text); transition: transform .3s var(--ease), opacity .2s; }
.menu-toggle span:nth-child(1) { top: 14px; } .menu-toggle span:nth-child(2) { top: 19px; } .menu-toggle span:nth-child(3) { top: 24px; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---------- 5. Hero ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; padding-top: var(--header-h); overflow: hidden; }
/* Dotted grid made purely with a repeating radial gradient */
.dot-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 14px 14px;
  -webkit-mask-image: radial-gradient(ellipse at 35% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at 35% 40%, #000 30%, transparent 75%);
}
.hero-inner { flex: 1; display: grid; grid-template-columns: 0.9fr 1.2fr; align-items: center; gap: 3rem; position: relative; padding: 3rem 0; }
.hero-art { position: relative; display: grid; place-items: center; }
.dither-canvas { width: min(100%, 440px); height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.terminal {
  position: absolute; left: 0; bottom: -1.5rem; margin: 0;
  font-family: var(--font-mono); font-size: .74rem; line-height: 1.6; color: var(--text);
  white-space: pre-wrap; min-height: 3.4em; max-width: 100%;
}
.caret { color: var(--accent); animation: caret 1s step-end infinite; }
@keyframes caret { 50% { opacity: 0; } }
.hero-title { font-size: clamp(2.4rem, 4.4vw, 3.9rem); letter-spacing: -0.035em; margin: 1.1rem 0 1.4rem; }
.hero-sub { color: var(--muted); max-width: 34rem; font-size: 1.05rem; }
.rotator { color: var(--text); border-bottom: 2px solid var(--accent); display: inline-block; transition: opacity .3s, transform .3s; }
.rotator.is-out { opacity: 0; transform: translateY(6px); }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin: 2rem 0 1.2rem; }
.hero-note { color: var(--muted); font-size: .92rem; }

/* Ticker: two copies of the items slide left by 50% forever */
.ticker { border-top: 1px solid var(--line); overflow: hidden; position: relative; }
.ticker-rail { display: flex; width: max-content; animation: ticker 40s linear infinite; }
.ticker:hover .ticker-rail { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }
.tick { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .12em; color: var(--muted); padding: .95rem 1.6rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .6rem; }
.tick b { color: var(--text); font-weight: 500; }
.tick i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.tick:nth-child(2n) i { background: var(--dim); }

/* ---------- 6. Cards (about, skills) ---------- */
.about-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2.5rem; color: var(--muted); font-size: 1.02rem; }
.about-intro strong { color: var(--text); }
.card-grid { display: grid; gap: 1rem; }
.card-grid.two { grid-template-columns: repeat(2, 1fr); }
.card-grid.four { grid-template-columns: repeat(4, 1fr); }
.feature-card, .skill-card, .project-card, .media-card, .stepper-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .25s, transform .25s var(--ease);
}
.feature-card { position: relative; min-height: 240px; padding: 1.6rem; overflow: hidden; display: flex; flex-direction: column; }
.feature-card:hover, .skill-card:hover, .project-card:hover { border-color: var(--dim); }
.feature-text { max-width: 62%; position: relative; z-index: 1; }
.feature-card h3 { font-size: 1.2rem; margin-bottom: .7rem; }
.card-tag { margin-top: auto; padding-top: 1.5rem; font-size: .62rem; position: relative; z-index: 1; }
/* Decorative "dithered" art built only with gradients (no images) */
.feature-art { position: absolute; right: 1.5rem; bottom: 1.2rem; width: 150px; height: 150px; opacity: .9; }
.feature-art::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--muted) 1px, transparent 1.4px); background-size: 5px 5px; }
.art-rings::before { -webkit-mask: radial-gradient(circle, transparent 28%, #000 29% 40%, transparent 41% 55%, #000 56% 68%, transparent 69%); mask: radial-gradient(circle, transparent 28%, #000 29% 40%, transparent 41% 55%, #000 56% 68%, transparent 69%); }
.art-rings::after { content: ""; position: absolute; inset: 42%; border-radius: 50%; background: var(--accent); }
.art-stack::before { -webkit-mask: repeating-linear-gradient(180deg, #000 0 18px, transparent 18px 28px); mask: repeating-linear-gradient(180deg, #000 0 18px, transparent 18px 28px); }
.art-list::before { -webkit-mask: repeating-linear-gradient(180deg, #000 0 10px, transparent 10px 26px), linear-gradient(90deg, #000 20%, transparent 20% 30%, #000 30%); mask: repeating-linear-gradient(180deg, #000 0 10px, transparent 10px 26px); }
.art-list::after { content: ""; position: absolute; left: 0; top: 0; width: 14px; height: 10px; background: var(--accent); }
.art-orbit::before { -webkit-mask: radial-gradient(circle at 50% 50%, #000 22%, transparent 23%), radial-gradient(circle at 12% 15%, #000 9%, transparent 10%), radial-gradient(circle at 88% 20%, #000 9%, transparent 10%), radial-gradient(circle at 80% 88%, #000 9%, transparent 10%); mask: radial-gradient(circle at 50% 50%, #000 22%, transparent 23%), radial-gradient(circle at 12% 15%, #000 9%, transparent 10%), radial-gradient(circle at 88% 20%, #000 9%, transparent 10%), radial-gradient(circle at 80% 88%, #000 9%, transparent 10%); }
.art-orbit::after { content: ""; position: absolute; inset: 38%; border-radius: 50%; background: var(--accent); opacity: .85; }

.skill-card { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.skill-card h3 { font-size: 1.1rem; }
.chev-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }
.chev-list li { padding-left: 1.2rem; position: relative; }
.chev-list li::before { content: ">"; position: absolute; left: 0; color: var(--accent); }
.skill-meta { margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .62rem; }

/* ---------- 7. Projects ---------- */
.project-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.filter-btn { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; padding: .6rem 1rem; border-radius: var(--radius-pill); border: 1px solid var(--line); background: transparent; color: var(--muted); transition: .2s; }
.filter-btn:hover { color: var(--text); border-color: var(--muted); }
.filter-btn.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.search input { font-family: var(--font-mono); font-size: .8rem; padding: .65rem 1rem; width: 240px; max-width: 100%; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.project-count { margin-bottom: 1rem; font-size: .72rem; }
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.project-card { padding: 1.5rem; display: flex; flex-direction: column; gap: .9rem; animation: cardIn .45s var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } }
.project-card .card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.project-card h3 { font-size: 1.2rem; }
.project-role { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.project-card p { color: var(--muted); font-size: .92rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.chips li { font-family: var(--font-mono); font-size: .64rem; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--muted); }
.project-links { margin-top: auto; display: flex; gap: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.project-links a { text-decoration: underline; text-underline-offset: 4px; }
.project-links a:hover { color: var(--accent); }
.project-links .private { color: var(--dim); }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 3rem; border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- 8. Experience stepper ---------- */
.stepper { max-width: 56rem; margin: 0 auto; }
.stepper-track { display: flex; justify-content: space-between; position: relative; margin-bottom: 1.2rem; overflow-x: auto; padding-bottom: .4rem; }
.stepper-track::before { content: ""; position: absolute; left: 6px; right: 6px; top: 6px; height: 1px; background: var(--line); }
.step-btn { background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: .9rem; position: relative; min-width: 84px; }
.step-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--dim); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--dim); transition: .25s; }
.step-name { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.step-btn.is-active .step-dot { background: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 14px var(--accent); }
.step-btn.is-active .step-name, .step-btn:hover .step-name { color: var(--text); }
.stepper-panel { padding: 1.5rem 1.6rem; display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; min-height: 170px; }
.panel-index { font-family: var(--font-mono); font-size: .62rem; border: 1px solid var(--line); padding: .1rem .4rem; border-radius: 4px; color: var(--muted); margin-right: .6rem; }
.panel-role { font-family: var(--font-mono); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; }
.panel-points { margin: .9rem 0 0; padding: 0; list-style: none; display: grid; gap: .5rem; color: var(--muted); font-size: .9rem; }
.panel-points li::before { content: "> "; color: var(--accent); font-family: var(--font-mono); }
.panel-meta dt { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .16em; color: var(--dim); text-transform: uppercase; }
.panel-meta dd { margin: .25rem 0 1rem; font-family: var(--font-mono); font-size: .78rem; }
.stepper-panel.is-switching { animation: panelIn .35s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 9. Media ---------- */
.media-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1rem; align-items: start; }
.media-card { padding: 1.2rem; display: grid; gap: 1.2rem; }
.media-card:first-child { grid-template-columns: minmax(200px, 300px) 1fr; align-items: center; }
.media-text h3, .audio-head h3 { font-size: 1.25rem; margin-bottom: .6rem; }
.credit { margin-top: .8rem; font-size: .72rem; color: var(--dim); font-family: var(--font-mono); }
kbd { font-family: var(--font-mono); font-size: .7rem; padding: .05rem .35rem; border: 1px solid var(--line); border-radius: 4px; color: var(--text); }
.video-shell { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 9 / 16; border: 1px solid var(--line); }
.video-shell video { width: 100%; height: 100%; object-fit: cover; }
.big-play { position: absolute; inset: 76% auto auto 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 1.3rem; box-shadow: 0 0 0 8px rgba(255, 75, 62, .25); transition: .25s; }
.video-shell.is-playing .big-play { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.8); }
.video-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: .5rem; padding: .6rem; background: linear-gradient(transparent, rgba(0,0,0,.85)); color: #eeebe4; }
.ctrl { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 6px; width: 30px; height: 30px; font-size: .75rem; display: grid; place-items: center; color: #eeebe4; padding: 0; }
.progress { flex: 1; height: 6px; background: rgba(255,255,255,.18); border-radius: 3px; cursor: pointer; position: relative; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.video-controls .time { font-size: .62rem; color: #eeebe4; white-space: nowrap; }
.audio-card { gap: 1rem; }
.visualiser { width: 100%; height: 140px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.audio-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.volume { display: inline-flex; align-items: center; gap: .5rem; font-size: .66rem; letter-spacing: .14em; }
.volume input { accent-color: var(--accent); width: 110px; }

/* ---------- 10. Contact ---------- */
.paper-card { background: var(--paper); color: var(--paper-ink); border-radius: var(--radius); padding: 1.6rem; min-height: 250px; display: flex; flex-direction: column; justify-content: space-between; }
.paper-card h3 { font-size: 1.7rem; margin-bottom: .9rem; }
.paper-card .mono-copy { color: inherit; opacity: .75; max-width: 26rem; }
.paper-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; border-top: 1px solid rgba(128,128,128,.35); padding-top: 1rem; }
.paper-title { font-weight: 600; word-break: break-all; }
.paper-meta { color: inherit; opacity: .6; margin-top: .2rem; font-size: .6rem; }
.square-btn { width: 36px; height: 36px; border-radius: 6px; border: 0; background: var(--paper-ink); color: var(--paper); display: grid; place-items: center; flex-shrink: 0; }
.contact-form { margin-top: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; display: grid; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field label { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .45rem; }
.field input, .field textarea { width: 100%; padding: .8rem 1rem; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: .95rem; resize: vertical; transition: border-color .2s; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--muted); }
.field.has-error input, .field.has-error textarea { border-color: var(--accent); }
.field.is-valid input, .field.is-valid textarea { border-color: var(--ok); }
.error { min-height: 1.1em; margin-top: .35rem; color: var(--accent); font-family: var(--font-mono); font-size: .72rem; }
.counter { letter-spacing: 0; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.form-status { font-size: .74rem; }
.form-status.is-ok { color: var(--ok); }

/* ---------- 11. Footer & back to top ---------- */
.site-footer { margin-top: 6rem; border-top: 1px solid var(--line); padding: 2rem 0 2.5rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.4rem; font-size: .88rem; color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-note { margin-top: 1.2rem; font-size: .7rem; }
.back-to-top { position: fixed; right: 1.2rem; bottom: 1.2rem; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--text); color: var(--bg); font-size: 1.1rem; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .3s var(--ease); z-index: 40; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }

/* ---------- 12. Scroll-reveal animation ---------- */
/* Elements start slightly lower and transparent; JS adds .is-visible when they enter the viewport */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 13. Responsive breakpoints ---------- */
@media (max-width: 1024px) {
  .card-grid.four { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .media-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .menu-toggle { display: inline-block; }
  .hide-mobile { display: none; }
  /* The nav becomes a full-width drop-down panel that JS opens/closes */
  .main-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-110%); opacity: 0; visibility: hidden;
    transition: transform .35s var(--ease), opacity .25s, visibility .35s;
  }
  .site-header.is-scrolled .main-nav { top: 60px; }
  .main-nav.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav-list { flex-direction: column; gap: 0; padding: .5rem 1.25rem 1.25rem; }
  .nav-link { display: block; padding: 1rem 0; font-size: 1.1rem; border-bottom: 1px solid var(--line); }
  .nav-link.is-active::after { display: none; }
  .nav-link.is-active { color: var(--accent); }
  .hero-inner { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1.5rem; }
  .hero-art { order: -1; }
  .dither-canvas { width: min(78%, 330px); }
  .terminal { position: static; justify-self: start; font-size: .68rem; }
  .about-intro, .card-grid.two, .form-row, .stepper-panel { grid-template-columns: 1fr; }
  .feature-text { max-width: 100%; }
  .feature-art { width: 96px; height: 96px; opacity: .45; }
}
@media (max-width: 600px) {
  .section { padding-top: 5rem; }
  .card-grid.four, .project-grid { grid-template-columns: 1fr; }
  .media-card:first-child { grid-template-columns: 1fr; }
  .video-shell { max-width: 320px; margin: 0 auto; width: 100%; }
  .search, .search input { width: 100%; }
  .stepper-track { justify-content: flex-start; gap: .5rem; }
}

/* ---------- 14. Multi-page layout (inner pages + 404) ---------- */
/* Inner pages have no full-viewport hero, so the first section
   needs extra top padding to clear the fixed header. */
.section.page-start { padding-top: calc(var(--header-h) + 4.5rem); }
.page-lede { max-width: 40rem; color: var(--muted); font-size: 1.05rem; margin: -1.4rem 0 2.2rem; }
.page-lede code { font-family: var(--font-mono); font-size: .84em; color: var(--text); }
.page-jump { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: -1.6rem 0 2.4rem; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.page-jump a:hover { color: var(--text); }
.highlights-foot { margin-top: 2rem; }
.not-found { min-height: calc(100svh - 12rem); }

@media (max-width: 600px) {
  .section.page-start { padding-top: calc(var(--header-h) + 3rem); }
}

/* Respect users who ask the OS for less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* Icon swaps driven by classes that JavaScript toggles */
.ctrl .ico-muted, .ctrl.is-muted .ico-sound { display: none; }
.ctrl.is-muted .ico-muted { display: block; }
.square-btn.is-copied { background: var(--ok); color: #0a0a0b; }
