/* ==========================================================================
   Lucas Anthony DiMarco — Portfolio
   Two modes: FLIGHT (default, deep-space) and BLUEPRINT (engineering drawing)
   ========================================================================== */

:root {
  --bg: #06080c;
  --bg-2: #0b0f16;
  --panel: #0f141c;
  --panel-2: #141b25;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #e9edf2;
  --muted: #8b95a4;
  --dim: #6f7a8a;
  --accent: #ff5a24;          /* ignition orange */
  --accent-soft: rgba(255, 90, 36, 0.12);
  --accent-2: #6ad4ff;        /* telemetry cyan */
  --ok: #7ef2a0;
  --warn: #ffc24a;
  --grid: rgba(255, 255, 255, 0.035);

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1320px;
  --radius: 4px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}

:root[data-theme="blueprint"] {
  --bg: #0d3469;
  --bg-2: #0f3a74;
  --panel: #11427f;
  --panel-2: #144a8c;
  --line: rgba(220, 235, 255, 0.22);
  --line-strong: rgba(235, 244, 255, 0.5);
  --text: #f1f6ff;
  --muted: #b5cbea;
  --dim: #86a6d2;
  --accent: #ffd54a;          /* drafting pencil yellow */
  --accent-soft: rgba(255, 213, 74, 0.14);
  --accent-2: #ffffff;
  --ok: #bff5cf;
  --grid: rgba(220, 235, 255, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }   /* clip only: older browsers ignore it and keep body's hidden */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; overflow-x: clip;   /* clip: nothing can ever widen the page (iOS zoom-out) */
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
:root[data-theme="blueprint"] body {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(rgba(220,235,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220,235,255,.035) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
::selection { background: var(--accent); color: #000; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Preloader / countdown ---------- */
.launch {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity .6s var(--ease), visibility .6s;
}
.launch.done { opacity: 0; visibility: hidden; }
.launch__inner { text-align: center; }
.launch__count {
  font-family: var(--font-display); font-weight: 700;
  font-size: min(22vw, 240px); line-height: .9; letter-spacing: -.02em;
}
.launch__label { margin-top: 12px; color: var(--muted); }
.launch__bar { width: 220px; height: 2px; background: var(--line); margin: 24px auto 0; overflow: hidden; }
.launch__bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .24s linear; }
.launch__skip { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); color: var(--dim); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav__inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand__mark {
  width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 50%;
  display: grid; place-items: center; position: relative;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .06em;
}
.brand__mark::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px dashed var(--line); animation: spin 24s linear infinite;
}
.brand__mark i { position: absolute; top: -6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); transform-origin: 2.5px 23px; animation: spin 6s linear infinite; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: .12em; text-transform: uppercase; }
.nav__links { display: flex; gap: 26px; }
.nav__links a { color: var(--muted); transition: color .2s; position: relative; }
.nav__links a:hover, .nav__links a.active { color: var(--text); }
.nav__links a.active::before { content: ""; position: absolute; left: -12px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; background: var(--accent); border-radius: 50%; }
.nav__actions { display: flex; align-items: center; gap: 10px; }

.mode-toggle {
  display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; gap: 2px;
}
.mode-toggle button { padding: 5px 11px; border-radius: 999px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; transition: all .25s; }
.mode-toggle button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  transition: background .25s, color .25s, border-color .25s, transform .25s;
}
.btn:hover { border-color: var(--text); }
.btn--solid { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
.btn--solid:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn--sm { padding: 8px 14px; font-size: 11px; }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

.menu-btn { display: none; width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 50%; position: relative; }
.menu-btn span, .menu-btn span::before { position: absolute; left: 12px; right: 12px; height: 1.5px; background: var(--text); content: ""; transition: transform .3s; }
.menu-btn span { top: 16px; }
.menu-btn span::before { left: 0; right: 0; top: 6px; }
.menu-open .menu-btn span { transform: translateY(3px) rotate(45deg); }
.menu-open .menu-btn span::before { transform: translateY(-6px) rotate(-90deg); }

.mobile-menu {
  position: fixed; inset: 68px 0 0 0; z-index: 49; background: var(--bg);
  padding: 32px var(--gutter); display: none; flex-direction: column; gap: 6px;
}
.menu-open .mobile-menu { display: flex; }
.mobile-menu a { font-family: var(--font-display); font-size: 44px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; border-bottom: 1px solid var(--line); padding: 8px 0; }
.mobile-menu .mode-toggle { margin-top: 24px; align-self: flex-start; }

/* ---------- Altitude rail ---------- */
.altimeter {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 40;
  height: min(56vh, 460px); width: 64px; pointer-events: none;
  display: flex; flex-direction: column; align-items: flex-end;
  opacity: 0; transition: opacity .5s;
}
.altimeter.visible { opacity: 1; }
.altimeter__track { position: relative; flex: 1; width: 1px; background: var(--line-strong); margin-right: 8px; }
.altimeter__tick { position: absolute; right: 0; width: 6px; height: 1px; background: var(--line-strong); }
.altimeter__tick.major { width: 12px; }
.altimeter__tick span { position: absolute; right: 16px; top: -7px; font-family: var(--font-mono); font-size: 9px; color: var(--dim); white-space: nowrap; }
.altimeter__craft {
  position: absolute; left: 50%; bottom: 0; width: 10px; height: 22px; margin-left: -5px;
  transition: bottom .15s linear;
}
.altimeter__craft svg { width: 100%; height: 100%; fill: var(--accent); }
.altimeter__readout { margin-top: 12px; text-align: right; font-family: var(--font-mono); font-size: 10px; line-height: 1.5; color: var(--muted); letter-spacing: .08em; white-space: nowrap; }
.altimeter__readout b { display: block; color: var(--text); font-size: 13px; font-weight: 500; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding: 120px 0 56px; overflow: hidden; }
/* the corner readouts occupy the top ~190px; keep the hero text clear of them when the name wraps */
@media (min-width: 761px) { .hero { padding-top: 260px; } }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
/* Keeps the hero text readable over the replay: a fade behind the text column + the edge vignette */
.hero__vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 30%, color-mix(in srgb, var(--bg) 40%, transparent) 50%, transparent 66%),
    linear-gradient(0deg, color-mix(in srgb, var(--bg) 70%, transparent) 0%, transparent 38%),
    radial-gradient(ellipse at 70% 42%, transparent 45%, var(--bg) 100%); }
.hero__eyebrow, .hero__tagline, .now, .hud { text-shadow: 0 0 10px var(--bg), 0 0 4px var(--bg), 0 0 2px var(--bg); }
/* Blueprint has no animation behind the text, so the drafting grid stays fully visible */
:root[data-theme="blueprint"] .hero__vignette { display: none; }
:root[data-theme="blueprint"] :is(.hero__eyebrow, .hero__tagline, .now, .hud) { text-shadow: none; }
:root[data-theme="blueprint"] .hero__name .outline { color: transparent; }
.hero .wrap { position: relative; z-index: 2; }
.hero__eyebrow { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; color: var(--text); opacity: .88; margin: 26px 0 0; font-size: 12.5px; }
.status-dot { display: inline-flex; align-items: center; gap: 8px; color: var(--ok); }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
.hero__name {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(56px, 10.4vw, 190px); line-height: .84; letter-spacing: -.01em; margin: 0;
}
.hero__name .line { display: block; overflow: hidden; }
.hero__name .line span { display: inline-block; transform: translateY(105%); transition: transform 1.1s var(--ease); }
.hero__name .line:nth-child(2) span { transition-delay: .08s; }
.ready .hero__name .line span { transform: none; }
.hero__name .outline { color: var(--bg); -webkit-text-stroke: 1.5px var(--text); }  /* solid fill so no line shows through */
.hero__bottom { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: end; margin-top: 26px; }
.hero__tagline { font-size: clamp(17px, 1.6vw, 21px); max-width: 560px; margin: 0; color: var(--text); }
.hero__tagline em { font-style: normal; color: var(--accent); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }

.hud { position: absolute; z-index: 2; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; color: var(--muted); line-height: 1.7; text-transform: uppercase; }
.hud b { color: var(--text); font-weight: 500; }
.hud--tl { top: 96px; left: var(--gutter); }
.hud--tr { top: 96px; right: var(--gutter); text-align: right; }
:root[data-theme="blueprint"] .hud--tr { display: none; }
.hud__event { color: var(--accent); max-width: 300px; margin-left: auto; min-height: 1.7em; }
.hud__bracket { position: absolute; width: 14px; height: 14px; border-color: var(--line-strong); border-style: solid; }
.scroll-cue { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--dim); }
.scroll-cue i { width: 1px; height: 36px; background: linear-gradient(var(--text), transparent); animation: drop 2s var(--ease) infinite; }

.now { display: flex; flex-direction: column; gap: 5px; margin-top: 20px; color: var(--text); opacity: .78; font-size: 11.5px; }
.now span + span::before { content: none !important; }
.now span { position: relative; }
.now span + span::before { content: "·"; position: absolute; left: -11px; color: var(--dim); }
.now .now__label + span::before { content: none; }
.now__label { color: var(--ok); }
.now__label::after { content: " —"; color: var(--dim); }

/* ---------- Sections ---------- */
section { position: relative; }
.section { padding: clamp(80px, 12vw, 150px) 0; }
.section-head { display: grid; grid-template-columns: 200px 1fr; gap: 24px; margin-bottom: clamp(40px, 6vw, 72px); align-items: start; }
.section-head__index { color: var(--accent); padding-top: 12px; }
.section-head__index span { display: block; color: var(--dim); margin-top: 4px; }
.section-title { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: clamp(44px, 7vw, 104px); line-height: .9; margin: 0; letter-spacing: -.005em; }
.section-lede { max-width: 620px; color: var(--muted); font-size: 17px; margin: 18px 0 0; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---------- Stats ---------- */
.stats { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 34px 24px 30px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat__value { font-family: var(--font-display); font-weight: 600; font-size: clamp(40px, 5vw, 68px); line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { margin-top: 10px; color: var(--muted); }

/* ---------- Media + placeholders ---------- */
.media { position: relative; overflow: hidden; background: var(--panel); aspect-ratio: 4 / 3; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.media--contain img { object-fit: contain; }
.placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center; color: var(--dim);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--panel);
}
.placeholder svg { width: 44px; height: 44px; stroke: var(--line-strong); fill: none; stroke-width: 1; }
.placeholder__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.placeholder__path { font-family: var(--font-mono); font-size: 10px; color: var(--dim); word-break: break-all; max-width: 90%; }
.placeholder--cover { gap: 6px; background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(ellipse at 50% 45%, var(--accent-soft), transparent 70%), var(--panel); }
.placeholder--cover svg { position: absolute; inset: 12% 10%; width: 80%; height: 76%; stroke: var(--line-strong); fill: none; stroke-width: .6; }
.placeholder__code { position: relative; font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; color: var(--accent); }
.placeholder__title { position: relative; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: clamp(26px, 3vw, 40px); line-height: .95; color: var(--text); max-width: 80%; }
.placeholder::before, .placeholder::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid var(--line-strong); }
.placeholder::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.placeholder::after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.media--contain img { object-fit: contain; }
.media--figure { background: #fff; }
.media--figure img { object-fit: contain; padding: 4%; }
.media--figure .placeholder { background-color: var(--panel); }

/* Inline SVG drawings (e.g. the Baldwin-1 profile) follow the active theme:
   their fixed Flight-mode colors are remapped to theme variables. */
.svg-live svg { display: block; width: 100%; height: 100%; }
.p-cover .svg-live svg { height: auto; max-height: 78vh; }
.svg-live [fill="#0b0f16"] { fill: var(--bg-2); }
.svg-live [fill="#e9edf2"] { fill: var(--text); }
.svg-live [stroke="#e9edf2"] { stroke: var(--text); }
.svg-live [fill="#8b95a4"] { fill: var(--muted); }
.svg-live [stroke="#8b95a4"] { stroke: var(--muted); }
.svg-live [fill="#ff5a24"] { fill: var(--accent); }
.svg-live [stroke="#ff5a24"] { stroke: var(--accent); }
.svg-live [stop-color="#ff5a24"] { stop-color: var(--accent); }
.svg-live [stroke="#6ad4ff"] { stroke: var(--accent-2); }
.svg-live [stroke="rgba(233,237,242,0.18)"] { stroke: var(--line-strong); }
.svg-live .g-minor { stroke: var(--grid); }
.svg-live .g-major { stroke: var(--line); }
.svg-live svg * { transition: fill .5s var(--ease), stroke .5s var(--ease); }

/* ---------- Trade studies ---------- */
.trades { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.trade { border: 1px solid var(--line); background: var(--panel); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.trade h3 { font-family: var(--font-display); font-weight: 600; font-size: 24px; text-transform: uppercase; line-height: 1; margin: 0; }
.trade header .mono { color: var(--muted); font-size: 10px; margin: 8px 0 0; line-height: 1.5; }
.trade__bars { display: flex; flex-direction: column; gap: 9px; }
.trade__row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.trade__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade__bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.trade__bar i { display: block; height: 100%; background: var(--dim); border-radius: 3px; }
.trade__score { text-align: right; font-size: 11px; white-space: nowrap; min-width: 36px; }
.trade__row.win { color: var(--text); }
.trade__row.win .trade__bar i { background: var(--accent); }
.trade__row.win .trade__score { color: var(--accent); }
.trade__row.win .trade__name::before { content: "✓ "; color: var(--accent); }
.p-section .trade__why { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.55; }

/* ---------- Event sequence ---------- */
.sequence { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); counter-reset: s; }
.p-section .sequence li { padding: 16px 14px 18px; border-top: 0; border-left: 1px solid var(--line); position: relative; font-size: inherit; }
.p-section .sequence li::before { content: none; }
.p-section .sequence li:first-child { border-left: 0; }
.sequence li::after { content: "→"; position: absolute; right: -8px; top: 14px; color: var(--accent); background: var(--bg); font-size: 13px; line-height: 1; z-index: 1; }
.sequence li:last-child::after { display: none; }
.sequence__n { color: var(--accent); font-size: 11px; display: block; margin-bottom: 8px; }
.sequence strong { font-family: var(--font-display); font-weight: 600; font-size: 20px; text-transform: uppercase; display: block; line-height: 1.05; margin-bottom: 6px; }
.p-section .sequence p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }
.spec-table tr.me td { color: var(--accent); }

/* ---------- Featured mission ---------- */
.featured { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(28px, 4vw, 64px); align-items: stretch; margin-bottom: clamp(64px, 8vw, 110px); }
.featured .media { aspect-ratio: auto; min-height: 520px; height: 100%; }
.featured__tag { display: inline-flex; gap: 10px; align-items: center; color: var(--accent); margin-bottom: 18px; }
.featured__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(56px, 7vw, 110px); line-height: .88; text-transform: uppercase; margin: 0; }
.featured__sub { color: var(--muted); font-size: 18px; margin: 12px 0 22px; }
.featured__body { display: flex; flex-direction: column; }
.featured__body p { margin: 0 0 26px; }
.spec-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
.spec-table th, .spec-table td { text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec-table th { font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); width: 44%; padding-right: 16px; }
.spec-table td { font-size: 15px; }
.featured .btn { align-self: flex-start; margin-top: auto; }
/* A drawing (inline SVG) keeps its own proportions instead of stretching to the text column */
.featured > a { display: flex; flex-direction: column; justify-content: center; }
.featured .media.svg-live { min-height: 0; height: auto; aspect-ratio: 1600 / 1000; background: transparent; }
.featured .media.svg-live .card__code { display: none; }  /* the drawing carries its own title block */

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.chip {
  padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip sup { font-size: 9px; margin-left: 4px; opacity: .7; }

/* ---------- Mission cards ---------- */
.missions { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2vw, 28px) clamp(16px, 2vw, 28px); }
.card { display: flex; flex-direction: column; gap: 16px; position: relative; }
.card.hidden { display: none; }
.card .media { aspect-ratio: 4 / 3.2; }
.card .media img { transition: transform .9s var(--ease), opacity .5s var(--ease); }
.card .media .hover-img { position: absolute; inset: 0; opacity: 0; }
.card:hover .media .hover-img.loaded { opacity: 1; }
.card:hover .media img { transform: scale(1.04); }
.card__code {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  padding: 4px 8px; background: color-mix(in srgb, var(--bg) 75%, transparent); backdrop-filter: blur(6px);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; border: 1px solid var(--line);
}
.card__status { position: absolute; top: 12px; right: 12px; z-index: 3; padding: 4px 8px; background: color-mix(in srgb, var(--bg) 75%, transparent); backdrop-filter: blur(6px); font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ok); border: 1px solid var(--line); }
.card__meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.card__title { font-family: var(--font-display); font-weight: 600; font-size: 32px; line-height: 1; text-transform: uppercase; margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__title .arrow { font-family: var(--font-body); font-size: 20px; transition: transform .3s var(--ease), color .3s; color: var(--dim); }
.card:hover .card__title .arrow { transform: translate(4px, -4px); color: var(--accent); }
.card__sub { color: var(--muted); margin: -8px 0 0; font-size: 15px; }
.card__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border: 1px solid var(--line); color: var(--muted); border-radius: 2px; }

/* ---------- CAD Hangar ---------- */
.hangar { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
:root[data-theme="blueprint"] .hangar { background: transparent; }
.hangar__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.cad { grid-column: span 3; position: relative; cursor: zoom-in; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; text-align: left; }
.cad:nth-child(6n+1), .cad:nth-child(6n+2) { grid-column: span 6; }
.cad.hidden { display: none; }
.hangar__grid[data-layout="thirds"] .cad { grid-column: span 4; }
.hangar__grid[data-layout="halves"] .cad { grid-column: span 6; }
.hangar__grid[data-layout] .cad .media { aspect-ratio: 4 / 3; }
.cad .media { aspect-ratio: 4 / 3; }
.cad:nth-child(6n+1) .media, .cad:nth-child(6n+2) .media { aspect-ratio: 16 / 10; }
.cad .media img { transition: transform .8s var(--ease); }
.cad:hover .media img { transform: scale(1.03); }
.cad__info { padding: 14px 16px 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 1px solid var(--line); }
.cad__title { font-family: var(--font-display); font-size: 22px; font-weight: 600; text-transform: uppercase; line-height: 1.05; }
.cad__tool { color: var(--accent); white-space: nowrap; }
.cad__badge { position: absolute; top: 10px; right: 10px; z-index: 3; padding: 3px 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; background: var(--accent); color: #0a0a0a; }
.hangar__foot { margin-top: 28px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); }

.hangar__pos { display: none; }   /* phones only (see the phone block) */

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 150; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); display: none; }
.lightbox.open { display: grid; grid-template-columns: 1fr 360px; }
.lightbox__stage { position: relative; display: grid; place-items: center; padding: 64px 40px; min-height: 0; }
.lightbox__stage img, .lightbox__stage video { max-height: calc(100vh - 128px); width: auto; max-width: 100%; object-fit: contain; }
.lightbox__stage model-viewer { width: 100%; height: calc(100vh - 128px); --poster-color: transparent; background: transparent; }
.lightbox__stage .media { width: min(80%, 900px); }
.lightbox__panel { border-left: 1px solid var(--line); padding: 72px 28px 28px; overflow: auto; background: var(--bg-2); }
.lightbox__panel h3 { font-family: var(--font-display); font-size: 40px; text-transform: uppercase; line-height: .95; margin: 8px 0 16px; }
.lightbox__panel p { color: var(--muted); }
.lightbox__close { position: absolute; top: 18px; right: 18px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 20px; line-height: 1; background: var(--bg); }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--bg); font-size: 18px; }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }
.lightbox__views { display: flex; gap: 6px; margin: 18px 0; }

/* ---------- Flight log (timeline) ---------- */
.log { position: relative; }
.log__row {
  display: grid; grid-template-columns: 220px 28px 1fr auto; gap: 20px; align-items: baseline;
  padding: 22px 0; border-bottom: 1px solid var(--line); position: relative; transition: background .3s;
}
.log__row:first-child { border-top: 1px solid var(--line); }
.log__row[href]:hover { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); }
.log__dates { color: var(--muted); }
.log__node { width: 9px; height: 9px; border: 1.5px solid var(--accent); border-radius: 50%; align-self: center; }
.log__row.current .log__node { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.log__title { font-family: var(--font-display); font-weight: 600; font-size: 26px; text-transform: uppercase; line-height: 1.05; }
.log__org { color: var(--text); opacity: .85; font-size: 15px; }
.log__note { color: var(--muted); font-size: 14px; margin-top: 2px; }
.log__go { color: var(--dim); transition: color .2s, transform .3s var(--ease); }
.log__row[href]:hover .log__go { color: var(--accent); transform: translateX(4px); }

/* ---------- Systems (skills) ---------- */
.systems { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.system:nth-child(3n+1) { border-left: 0; }
.system:nth-child(n+4) { border-top: 1px solid var(--line); }
.system { padding: 24px 22px 28px; border-left: 1px solid var(--line); position: relative; }
.system:first-child { border-left: 0; }
.system__code { color: var(--accent); }
.system__name { font-family: var(--font-display); font-weight: 600; font-size: 24px; text-transform: uppercase; line-height: 1.05; margin: 10px 0 18px; min-height: 2.1em; }
.system ul { list-style: none; margin: 0; padding: 0; }
.system li { padding: 7px 0; border-top: 1px dashed var(--line); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.system li::before { content: ""; width: 5px; height: 5px; background: var(--ok); border-radius: 50%; flex: none; }
.system__used { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--dim); font-size: 10px; line-height: 1.9; }
.system__used a { display: block; color: var(--muted); text-transform: none; letter-spacing: .02em; font-size: 12px; transition: color .2s; }
.system__used a::before { content: "→ "; color: var(--accent); }
.system__used a:hover { color: var(--text); }

/* ---------- Recognition marquee ---------- */
.marquee { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 22px 0; }
.marquee__track { display: flex; gap: 56px; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item { font-family: var(--font-display); font-size: clamp(22px, 3vw, 34px); text-transform: uppercase; font-weight: 500; letter-spacing: .02em; color: var(--muted); display: flex; align-items: center; gap: 56px; white-space: nowrap; }
.marquee__item::after { content: "✦"; color: var(--accent); font-size: .6em; }
.marquee__kind { font-style: normal; font-size: 10px; letter-spacing: .12em; color: var(--accent); border: 1px solid var(--line-strong); padding: 3px 7px; margin-right: 14px; vertical-align: middle; position: relative; top: -2px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(32px, 5vw, 80px); align-items: start; }
.about .media { aspect-ratio: 4 / 5; }
.about__body p { font-size: 18px; margin: 0 0 20px; }
.about__body p:first-child { font-size: clamp(22px, 2.3vw, 30px); line-height: 1.35; }
.about__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-top: 32px; }
.fact { padding: 14px 0; border-top: 1px solid var(--line); }
.fact .mono { color: var(--muted); display: block; margin-bottom: 4px; }
.interests { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- Off-nominal hours: drifting film roll ---------- */
.offnom { margin-top: clamp(48px, 7vw, 88px); }
.offnom__head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-bottom: 14px; margin-bottom: 18px; }
.offnom__head .mono:first-child { color: var(--accent); }
.roll { position: relative; overflow: hidden; margin: 0 calc(-1 * var(--gutter)); padding: 26px 0;
  background: #0b0d11; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); contain: paint; }
/* edge fades are overlays, not a mask: a mask re-composites the whole moving strip every frame */
.roll__fade { position: absolute; top: 0; bottom: 0; left: 0; width: 6%; z-index: 3; pointer-events: none; background: linear-gradient(90deg, var(--bg), transparent); }
.roll__fade--r { left: auto; right: 0; transform: scaleX(-1); }
/* sprocket holes along both edges */
.roll::before, .roll::after { content: ""; position: absolute; left: 0; right: 0; height: 10px; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(233,237,242,.16) 14px 26px); }
.roll::before { top: 8px; } .roll::after { bottom: 8px; }
:root[data-theme="blueprint"] .roll { background: rgba(0,0,0,.18); }
.roll__track { display: flex; gap: 22px; width: max-content; padding: 0 11px; animation: roll 70s linear infinite; will-change: transform; }
.roll:hover .roll__track, .roll:focus-within .roll__track, .roll.is-idle .roll__track { animation-play-state: paused; }
@keyframes roll { to { transform: translateX(-50%); } }
.roll__frame { flex: none; width: clamp(200px, 22vw, 290px); background: #f1ede4; padding: 10px 10px 12px; cursor: zoom-in; text-align: left;
  box-shadow: 0 10px 28px rgba(0,0,0,.45); transition: transform .45s var(--ease); transform: rotate(-1.4deg); }
.roll__frame:nth-child(even) { transform: rotate(1.2deg) translateY(6px); }
.roll__frame:nth-child(3n) { transform: rotate(-.4deg) translateY(-4px); }
.roll__frame:hover, .roll__frame:focus-visible { transform: rotate(0) scale(1.04); z-index: 1; }
.roll__frame .media { aspect-ratio: 4 / 5; background: #ddd; }
.roll__frame .media video { width: 100%; height: 100%; object-fit: cover; }
.roll__play { position: absolute; right: 8px; top: 8px; font-size: 10px; color: #fff; background: rgba(0,0,0,.55); padding: 3px 7px; border-radius: 999px; letter-spacing: .1em; }
.roll__cap { display: block; margin-top: 10px; color: #3b3f46; font-size: 10px; letter-spacing: .08em; line-height: 1.5; }
.roll__cap b { color: #d24a1c; font-weight: 500; }   /* ignition orange on the print */
:root[data-theme="blueprint"] .roll__cap b { color: #0d3469; }   /* blueprint blue (yellow would vanish on the cream print) */
.roll__cap em { display: block; font-style: normal; text-transform: none; letter-spacing: .01em; font-family: var(--font-body); font-size: 13px; color: #1d2026; }
@media (prefers-reduced-motion: reduce) {
  .roll { overflow-x: auto; }
  .roll__fade { display: none; }
  .roll__track { animation: none; }
  .roll__frame[aria-hidden="true"] { display: none; }
}
@media (max-width: 760px) { .roll__track { animation-duration: 45s; gap: 14px; } }

/* ---------- Contact ---------- */
.contact { text-align: left; padding-bottom: 60px; }
.contact__title { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: clamp(64px, 12vw, 200px); line-height: .84; margin: 0 0 40px; }
.contact__title .outline { color: transparent; -webkit-text-stroke: 1.5px var(--text); }
.contact__email { display: inline-flex; align-items: center; gap: 16px; font-size: clamp(20px, 3vw, 40px); font-family: var(--font-display); letter-spacing: .02em; border-bottom: 1px solid var(--line-strong); padding-bottom: 6px; transition: border-color .2s, color .2s; }
.contact__email:hover { color: var(--accent); border-color: var(--accent); }
.contact__row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.contact__avail { margin: 22px 0 0; color: var(--ok); }
.copied { color: var(--ok); margin-left: 12px; opacity: 0; transition: opacity .3s; }
.copied.show { opacity: 1; }

.footer { border-top: 1px solid var(--line); padding: 26px 0 84px; color: var(--dim); }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ---------- Project page ---------- */
.p-hero { padding: 130px 0 40px; }
.back { display: inline-flex; gap: 10px; color: var(--muted); margin-bottom: 40px; transition: color .2s; }
.back:hover { color: var(--text); }
.p-hero__code { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); margin-bottom: 18px; }
.p-hero__code .accent { color: var(--accent); }
.p-title { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: clamp(56px, 11vw, 170px); line-height: .86; margin: 0; }
.p-sub { font-size: clamp(18px, 2vw, 24px); color: var(--muted); margin: 18px 0 0; max-width: 820px; }
.p-meta { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 48px; }
.p-meta > div { padding: 18px 18px 18px 0; }
.p-meta > div + div { border-left: 1px solid var(--line); padding-left: 18px; }
.p-meta .mono { color: var(--muted); display: block; margin-bottom: 6px; font-size: 10px; }
.p-meta p { margin: 0; font-size: 15px; }
.p-cover { margin: 40px 0 0; }
.p-cover .media { aspect-ratio: 21 / 9; }
.p-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(32px, 6vw, 96px); padding-top: clamp(56px, 8vw, 100px); padding-bottom: clamp(56px, 8vw, 100px); }
.p-summary { font-size: clamp(21px, 2.2vw, 28px); line-height: 1.4; margin: 0 0 56px; }
.p-section { margin-bottom: 52px; }
.p-section h2 { font-family: var(--font-mono); font-weight: 400; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 16px; display: flex; gap: 12px; align-items: center; }
.p-section h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.p-section p { font-size: 17px; margin: 0 0 16px; color: var(--text); }
.p-section ul { margin: 0; padding: 0; list-style: none; }
.p-section li { padding: 12px 0 12px 28px; border-top: 1px solid var(--line); position: relative; font-size: 16px; }
.p-section li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.p-section.todo { border: 1px dashed var(--warn); padding: 20px; border-radius: var(--radius); }
.p-section.todo h2 { color: var(--warn); }
.p-section.todo h2::before { content: "EDIT ME ·"; }
.p-section.todo p { color: var(--muted); }

.anomaly { border: 1px solid var(--warn); border-radius: var(--radius); margin: 0 0 52px; overflow: hidden; }
.anomaly__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.anomaly__head h2 { margin: 0; font-family: var(--font-display); font-size: 26px; text-transform: uppercase; font-weight: 600; color: var(--text); }
.anomaly dl { margin: 0; display: grid; grid-template-columns: 170px 1fr; }
.anomaly dt, .anomaly dd { padding: 14px 20px; border-top: 1px solid var(--line); margin: 0; }
.anomaly dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.anomaly dd.ok { color: var(--ok); }

.p-aside { position: sticky; top: 100px; align-self: start; }
.p-aside h3 { font-family: var(--font-mono); font-weight: 400; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.p-aside .block { margin-bottom: 36px; }
.outcome { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.outcome::before { content: "✓"; color: var(--ok); }
.tools { display: flex; flex-wrap: wrap; gap: 6px; }

.p-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.p-gallery figure { margin: 0; cursor: zoom-in; }
.p-gallery figure:first-child:nth-last-child(odd) { grid-column: span 2; }
.p-gallery figure:first-child:nth-last-child(odd) .media { aspect-ratio: 16 / 8; }
.p-gallery figcaption, .p-video figcaption { margin-top: 10px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
/* Project pages never crop: covers and gallery images keep their natural shape */
.p-cover .media, .p-gallery .media { aspect-ratio: auto !important; }
.p-cover .media img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
.p-gallery .media img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.p-cover .media:has(.placeholder) { aspect-ratio: 21 / 9 !important; }
.p-gallery .media:has(.placeholder) { aspect-ratio: 4 / 3 !important; }
.p-gallery { align-items: start; }
.p-video .media { aspect-ratio: 16 / 9; }
.p-video .media--vertical { aspect-ratio: 9 / 16; width: min(100%, 360px); background: #000; border: 1px solid var(--line); }
.p-video .media--vertical video { object-fit: contain; }
.p-video .media--vertical + figcaption { max-width: 360px; }
.p-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.p-nav { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.p-nav a { padding: 40px 0; display: block; transition: color .2s; }
.p-nav a + a { text-align: right; border-left: 1px solid var(--line); padding-left: 24px; }
.p-nav .mono { color: var(--muted); }
.p-nav strong { display: block; font-family: var(--font-display); font-size: clamp(30px, 4vw, 56px); text-transform: uppercase; line-height: 1; margin-top: 8px; font-weight: 600; }
.p-nav a:hover strong { color: var(--accent); }

/* ---------- Music toggle (bottom-left, every page) ---------- */
.music {
  position: fixed; left: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg) 90%, transparent);   /* no backdrop blur: it would re-blur the animation every frame */
  color: var(--muted); transition: color .2s, border-color .2s, background .2s;
}
.music:hover { color: var(--text); border-color: var(--text); }
.music { transition: color .2s, border-color .2s, background .2s, transform .35s var(--ease), opacity .35s; }
.music--tucked { transform: translateX(-130%); opacity: 0; }
.music[data-state="on"] { color: var(--text); border-color: var(--accent); }
.music[data-state="armed"] { color: var(--accent); }
.music__label { font-size: 10px; white-space: nowrap; }
.music__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.music__bars i { width: 2px; height: 3px; background: currentColor; border-radius: 1px; transition: height .3s; }
.music[data-state="on"] .music__bars i { background: var(--accent); animation: eq 1.1s ease-in-out infinite; }
.music[data-state="on"] .music__bars i:nth-child(2) { animation-delay: -.4s; animation-duration: .9s; }
.music[data-state="on"] .music__bars i:nth-child(3) { animation-delay: -.7s; animation-duration: 1.3s; }
.music[data-state="on"] .music__bars i:nth-child(4) { animation-delay: -.2s; animation-duration: 1s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 14px; } }
@media (max-width: 760px) {
  .music { left: 12px; bottom: 12px; width: 40px; padding: 0; justify-content: center; }
  .music__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .now { flex-direction: column; gap: 4px; }
  .now span + span::before { content: none; }
  .now__label::after { content: ""; }
}

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes drop { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .hero__name .line span { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .systems { grid-template-columns: repeat(2, 1fr); }
  .system:nth-child(3n+1) { border-left: 1px solid var(--line); }
  .system:nth-child(2n+1) { border-left: 0; }
  .system:nth-child(n+3) { border-top: 1px solid var(--line); }
}
/* The altitude rail lives in the right margin; hide it when the margin is too narrow */
@media (max-width: 1480px) { .altimeter { display: none; } }
@media (max-width: 1000px) {
  .nav__links, .nav__actions .mode-toggle, .nav__actions .btn { display: none; }
  .menu-btn { display: block; }
  .missions { grid-template-columns: repeat(2, 1fr); }
  .featured { grid-template-columns: 1fr; }
  .featured .media { min-height: 0; aspect-ratio: 4 / 3; }
  .cad, .cad:nth-child(6n+1), .cad:nth-child(6n+2) { grid-column: span 6; }
  .cad .media, .cad:nth-child(6n+1) .media, .cad:nth-child(6n+2) .media { aspect-ratio: 4 / 3; }
  .p-body { grid-template-columns: 1fr; }
  .sequence { grid-template-columns: 1fr; }
  .p-section .sequence li { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 34px 1fr; column-gap: 8px; }
  .p-section .sequence li:first-child { border-top: 0; }
  .sequence li::after { display: none; }
  .sequence__n { grid-row: span 2; margin: 3px 0 0; }
  .p-aside { position: static; }
  .p-meta { grid-template-columns: repeat(2, 1fr); }
  .p-meta > div { border-left: 0 !important; padding-left: 0 !important; border-top: 1px solid var(--line); }
  .p-meta > div:nth-child(-n+2) { border-top: 0; }
  .lightbox.open { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .lightbox__panel { border-left: 0; border-top: 1px solid var(--line); padding: 20px; max-height: 38vh; }
  .lightbox__stage { padding: 64px 16px 16px; }
  .lightbox__stage img, .lightbox__stage video { max-height: 52vh; }
  .lightbox__stage model-viewer { height: 52vh; }
}
@media (max-height: 860px), (max-width: 760px) {
  .scroll-cue { display: none; }
}
@media (max-width: 760px) {
  .hud--tr { display: none; }
  .hero__canvas { opacity: .6; }
  .hero__vignette { background:
      linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 80%, transparent) 55%, transparent 78%),
      radial-gradient(ellipse at 70% 20%, transparent 40%, var(--bg) 100%); }
  .hero__bottom { grid-template-columns: 1fr; gap: 28px; }
  .hero__cta { justify-content: flex-start; }
  .section-head { grid-template-columns: 1fr; gap: 8px; }
  .section-head__index { padding-top: 0; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 24px 0 22px 16px; }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .missions { grid-template-columns: 1fr; }
  .cad, .cad:nth-child(6n+1), .cad:nth-child(6n+2), .hangar__grid[data-layout] .cad { grid-column: span 12; }
  .log__row { grid-template-columns: 16px 1fr; gap: 4px 14px; }
  .log__dates { grid-column: 2; order: -1; }
  .log__node { grid-row: 1 / span 2; grid-column: 1; align-self: start; margin-top: 8px; }
  .log__go { display: none; }
  .systems { grid-template-columns: 1fr; }
  .system { border-left: 0 !important; border-top: 1px solid var(--line); }
  .system:first-child { border-top: 0; }
  .system__name { min-height: 0; }
  .about { grid-template-columns: 1fr; }
  .about__facts { grid-template-columns: 1fr; }
  .p-gallery { grid-template-columns: 1fr; }
  .p-gallery figure:first-child:nth-last-child(odd) { grid-column: auto; }
  .p-cover .media { aspect-ratio: 4 / 3; }
  .anomaly dl { grid-template-columns: 1fr; }
  .anomaly dt { padding-bottom: 0; }
  .anomaly dd { border-top: 0; padding-top: 6px; }
  .p-nav { grid-template-columns: 1fr; }
  .p-nav a + a { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; text-align: left; }
}

/* ==========================================================================
   Phones: portrait (≤760px wide) and landscape (short + ≤1000px wide).
   Goals: shorter page, readable small type, nothing overlapping, big tap targets.
   ========================================================================== */
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  :root { --muted: #a2acba; --dim: #8893a3; }
  :root[data-theme="blueprint"] { --muted: #c9daf2; --dim: #a6bee0; }

  /* Small mono labels: larger, less tracking, full contrast */
  .mono { letter-spacing: .05em; }
  .tag, .card__code, .card__status, .chip, .placeholder__label, .marquee__kind,
  .system__used, .p-meta .mono, .spec-table th, .p-aside h3, .p-gallery figcaption, .p-video figcaption,
  .anomaly dt, .trade header .mono, .hud { font-size: 11.5px; letter-spacing: .05em; }
  .roll__cap { font-size: 11px; }
  .now { font-size: 12px; opacity: 1; gap: 6px; }
  .hero__eyebrow { font-size: 12px; opacity: 1; }

  /* Nav: slimmer bar, menu that scrolls if the screen is short */
  .nav__inner { height: 58px; }
  .mobile-menu { inset: 58px 0 0 0; overflow-y: auto; padding-bottom: 40px; }

  /* Hero: the coordinates sit in the text column above the name, so they can never overlap it */
  .hero { padding-top: 96px; }
  .hud--tr { display: none; }
  .hud--tl { position: relative; top: auto; left: auto; z-index: 2; width: 100%; max-width: var(--maxw); margin: 0 auto 18px; padding: 0 var(--gutter); }

  /* Filters: one swipeable row instead of four wrapped rows */
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)) 22px; padding: 2px var(--gutter);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; min-height: 40px; }

  /* Featured mission: keep the three most telling specs */
  .featured { margin-bottom: 48px; gap: 22px; }
  .featured .spec-table tr:nth-child(n+4) { display: none; }
  .featured__sub { font-size: 16px; }

  /* Mission list: compact rows (thumbnail + title) that are quick to scan */
  .missions { grid-template-columns: 1fr; gap: 0; border-top: 1px solid var(--line); }
  .card { display: grid; grid-template-columns: 104px minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 14px; row-gap: 4px;
    align-content: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .card .media { grid-row: 1 / span 3; aspect-ratio: 1 / 1; align-self: center; }
  .card .media .hover-img, .card__status, .card__cats { display: none; }
  .card .card__code { display: none; }
  .card__meta { grid-column: 2; order: -1; font-size: 11px; justify-content: flex-start; }
  .card__meta span:first-child { display: none; }
  .card__title { grid-column: 2; font-size: 22px; line-height: 1.02; }
  .card__title .arrow { font-size: 16px; }
  .card__sub { grid-column: 2; margin: 0; font-size: 14px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .card .placeholder--cover { padding: 8px; }
  .card .placeholder--cover svg, .card .placeholder::before, .card .placeholder::after { display: none; }
  .card .placeholder__code { font-size: 9px; letter-spacing: .1em; }
  .card .placeholder__title { font-size: 17px; max-width: 100%; }

  /* Hangar: a swipeable shelf instead of a 5,000px column */
  .hangar__grid { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 4px; scroll-padding: 0 var(--gutter); overscroll-behavior-x: contain; }
  .hangar__grid::-webkit-scrollbar { display: none; }
  .hangar__grid .cad { flex: 0 0 80%; scroll-snap-align: start; }
  .hangar__grid .cad.hidden { display: none; }
  .hangar__grid .cad.reveal { opacity: 1; transform: none; }
  .hangar__grid .cad .media { aspect-ratio: 4 / 3; }
  .cad__info { padding: 12px 14px 14px; }
  .cad__title { font-size: 19px; }
  .hangar__foot { margin-top: 16px; }
  .hangar__pos { display: inline; color: var(--text); }
  .hangar__hint { display: none; }

  /* Flight log: tighter rows */
  .log__row { padding: 16px 0; }
  .log__title { font-size: 22px; }
  .log__note { font-size: 14px; }

  /* Skills: items as chips, "used on" as one wrapped line */
  .system { padding: 20px 0 22px; }
  .systems { border-left: 0; border-right: 0; }
  .system__name { font-size: 22px; margin: 6px 0 12px; }
  .system ul { display: flex; flex-wrap: wrap; gap: 6px; }
  .system li { padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; line-height: 1.3; }
  .system li::before { display: none; }
  .system__used { margin-top: 12px; padding-top: 0; border-top: 0; line-height: 1.8; }
  .system__used a { display: inline; }
  .system__used a + a::before { content: " · "; color: var(--dim); }
  .system__used a:first-child::before { content: " "; }

  /* About: a smaller portrait so the story starts sooner */
  .about .media { aspect-ratio: 1 / 1; max-width: 260px; }
  .about__body p:first-child { font-size: 21px; }
  .about__body p { font-size: 16px; }

  /* Sections: less dead space between them */
  .section { padding: 64px 0; }
  .section-head { margin-bottom: 28px; }
  .section-title { font-size: clamp(40px, 11vw, 64px); }
  .section-lede { font-size: 16px; margin-top: 12px; }

  /* Contact */
  .contact__title { font-size: clamp(56px, 17vw, 110px); margin-bottom: 28px; }
  .contact__email { font-size: clamp(18px, 5.4vw, 28px); word-break: break-all; }

  /* Project pages */
  .p-hero { padding-top: 92px; }
  .back { margin-bottom: 24px; min-height: 44px; align-items: center; }
  .p-title { font-size: clamp(44px, 13vw, 88px); }
  .p-meta { margin-top: 28px; }
  .p-summary { font-size: 20px; margin-bottom: 36px; }
  .p-section p { font-size: 16px; }
  .p-section li { font-size: 15px; }
  .spec-table td { font-size: 14px; }
  .p-nav a { padding: 26px 0; }

  .music { left: calc(12px + env(safe-area-inset-left)); bottom: calc(12px + env(safe-area-inset-bottom)); width: 40px; padding: 0; justify-content: center; }
  .music__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* Landscape phones: use the width */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  .hero { min-height: 0; padding-top: 84px; padding-bottom: 36px; }
  .hero__name { font-size: clamp(48px, 9vw, 96px); }
  .hero__bottom { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; }
  .hero__cta { justify-content: flex-end; }
  .hero__vignette { background:
      linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 40%, transparent 75%),
      linear-gradient(0deg, color-mix(in srgb, var(--bg) 70%, transparent) 0%, transparent 38%); }
  .mobile-menu a { font-size: 28px; padding: 6px 0; }
  .menu-open .mobile-menu { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; align-content: start; padding-top: 20px; }
  .mobile-menu .mode-toggle { grid-column: 1 / -1; margin-top: 16px; }
  .featured { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .featured .media.svg-live { aspect-ratio: 1600 / 1000; }
  .missions { grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .hangar__grid .cad { flex-basis: 40%; }
  .hangar__grid .cad .media { aspect-ratio: 16 / 10; }
  .stats__grid { grid-template-columns: repeat(4, 1fr); }
  .stat { padding: 18px 0 16px 14px !important; border-top: 0 !important; border-left: 1px solid var(--line) !important; }
  .stat:first-child { border-left: 0 !important; padding-left: 0 !important; }
  .systems { grid-template-columns: 1fr 1fr; column-gap: 28px; }
  .system:nth-child(2) { border-top: 0; }
  .about { grid-template-columns: 220px 1fr; }
  .about .media { max-width: none; }
  .log__row { grid-template-columns: 160px 16px 1fr; }
  .log__dates { grid-column: 1; order: 0; }
  .log__node { grid-row: auto; grid-column: 2; margin-top: 0; align-self: center; }
  .lightbox.open { grid-template-columns: 1fr 40%; grid-template-rows: 1fr; }
  .lightbox__panel { border-top: 0; border-left: 1px solid var(--line); max-height: none; padding: 56px 18px 18px; }
  .lightbox__stage { padding: 16px 56px; }
  .lightbox__stage img, .lightbox__stage video { max-height: calc(100vh - 32px); }
  .p-meta { grid-template-columns: repeat(3, 1fr); }
  .p-gallery { grid-template-columns: 1fr 1fr; }
  .p-cover .media img { max-height: 70vh; }
}
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  #cad-count { display: none; }
}
/* Small landscape phones (e.g. iPhone SE sideways): two mission columns would be too narrow */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 699px) {
  .missions { grid-template-columns: 1fr; }
}
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  .card__title { min-width: 0; overflow-wrap: anywhere; }
}
/* Tablets (iPad portrait, small laptops): three hangar columns instead of two */
@media (min-width: 761px) and (max-width: 1000px) and (min-height: 521px) {
  .cad, .cad:nth-child(6n+1), .cad:nth-child(6n+2), .hangar__grid[data-layout] .cad { grid-column: span 4; }
  .cad__title { font-size: 19px; }
  .cad__info { flex-direction: column; gap: 4px; }
}
/* Large monitors: use more of the screen and scale type up slightly */
@media (min-width: 1800px) {
  :root { --maxw: 1600px; }
  body { font-size: 17px; }
  .section-lede, .p-section p { font-size: 18px; }
  .card__sub { font-size: 16px; }
}
@media (min-width: 2300px) {
  :root { --maxw: 1920px; }
  body { font-size: 18px; }
  .mono { font-size: 13px; }
  .section-lede, .p-section p { font-size: 20px; }
  .card__title { font-size: 38px; }
  .cad__title { font-size: 26px; }
  .log__title { font-size: 30px; }
  .system__name { font-size: 28px; }
  .system li { font-size: 16px; }
}

/* Phones: the top bar hides while scrolling down, returns on scroll up; slimmer when sideways */
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  .nav { transition: background .3s, border-color .3s, transform .35s var(--ease); }
  .nav.nav--away { transform: translateY(-100%); }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  .nav__inner { height: 46px; }
  .brand__mark { width: 30px; height: 30px; font-size: 11px; }
  .brand__mark i { transform-origin: 2.5px 20px; }
  .brand__name { font-size: 16px; }
  .menu-btn { width: 36px; height: 36px; }
  .menu-btn span { top: 14px; left: 10px; right: 10px; }
  .mobile-menu { inset: 46px 0 0 0; }
  .hero { padding-top: 64px; }
  .p-hero { padding-top: 72px; }
}
