/* Cappslock — interactive resume, single-page
   Resume document feel · click-to-expand sections
   ───────────────────────────────────────────── */

:root {
  --bg-0: #0f1218;
  --bg-1: #131418;
  --bg-2: #191b1f;
  --bg-3: #22252b;
  --bg-4: #2c2f36;

  --fg-0: #f6f4ee;
  --fg-1: rgba(246, 244, 238, 0.78);
  --fg-2: rgba(246, 244, 238, 0.52);
  --fg-3: rgba(246, 244, 238, 0.34);
  --fg-4: rgba(246, 244, 238, 0.16);

  --line-0: rgba(246, 244, 238, 0.07);
  --line-1: rgba(246, 244, 238, 0.13);
  --line-2: rgba(246, 244, 238, 0.22);

  --accent: #f0a23e;
  --accent-soft: color-mix(in oklab, var(--accent) 22%, transparent);
  --accent-glow: color-mix(in oklab, var(--accent) 50%, transparent);
  --accent-ink: #0d0e10;

  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-sans: "Space Grotesk", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --f-stretch: "Space Grotesk", system-ui, sans-serif;

  --display-tracking: -0.02em;
  --display-weight: 600;
  --display-style: normal;

  --pad-x: clamp(1px, 4vw, 40px);
  --r-1: 2px;
  --r-2: 6px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-scale: 1;
}

html[data-theme="light"] {
  --bg-0: #f0ece1;
  --bg-1: #e6e1d4;
  --bg-2: #ddd7c8;
  --bg-3: #d1cab8;
  --bg-4: #c5bda8;
  --fg-0: #15171b;
  --fg-1: rgba(21, 23, 27, 0.78);
  --fg-2: rgba(21, 23, 27, 0.55);
  --fg-3: rgba(21, 23, 27, 0.36);
  --fg-4: rgba(21, 23, 27, 0.16);
  --line-0: rgba(21, 23, 27, 0.08);
  --line-1: rgba(21, 23, 27, 0.16);
  --line-2: rgba(21, 23, 27, 0.28);
  --accent-ink: #f0ece1;
}

/* ═══ Type pairings ═══ */
html[data-type="brutalist"] {
  --f-display: "Inter Tight", system-ui, sans-serif;
  --f-sans: "Inter Tight", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --display-tracking: -0.035em; --display-weight: 600;
}
html[data-type="cinematic"] {
  --f-display: "Bricolage Grotesque", system-ui, sans-serif;
  --f-sans: "Inter Tight", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --display-tracking: -0.045em; --display-weight: 700;
}
html[data-type="workshop"] {
  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-sans: "Space Grotesk", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --display-tracking: -0.02em; --display-weight: 600;
}
html[data-type="quirky-pro"] {
  --f-display: "Fraunces", serif;
  --f-sans: "Inter Tight", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --display-tracking: -0.025em; --display-weight: 500;
}
html[data-type="editorial"] {
  --f-display: "Instrument Serif", serif;
  --f-sans: "Inter Tight", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --display-tracking: -0.02em; --display-weight: 400;
}

/* ═══ Base ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg-0); -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--f-sans);
  font-size: calc(15px * var(--font-scale, 1));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(900px 600px at 100% 0%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 55%),
    radial-gradient(900px 600px at 0% 100%, color-mix(in oklab, var(--accent) 5%, transparent), transparent 60%);
}
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='220' height='220' filter='url(%23n)'/></svg>");
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ═══ Primitives ═══ */
.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.65); }
}

main { position: relative; z-index: 2; }

/* ═══ Top bar ═══ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center; gap: 16px;
  padding: 12px var(--pad-x);
  background: transparent;
  transition: background .3s, backdrop-filter .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in oklab, var(--bg-0) 80%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--line-0);
}
.logo {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-1);
  justify-self: start;
}
.logo .mark {
  width: 26px; height: 26px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--f-stretch);
  font-size: 15px; font-weight: 700;
  line-height: 1;
  border-radius: var(--r-1);
  letter-spacing: -0.04em;
}
.logo strong { color: var(--fg-0); font-weight: 600; }
.logo .sep { color: var(--fg-3); }
.nav-meta {
  display: inline-flex; align-items: center; gap: 16px;
  justify-self: end;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-2);
}
.nav-meta .clock {display:none; font-variant-numeric: tabular-nums; }

/* ═══ Resume document ═══ */
.resume {
  width: min(840px, 100%);
  margin: 0 auto;
  padding: clamp(80px, 12vw, 12px) var(--pad-x) clamp(40px, 6vw, 64px);
  position: relative;
}

.resume-head {
  padding-bottom: clamp(4px, 4vw, 36px);
  margin-bottom: clamp(8px, 4vw, 10px);
}
.resume-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.resume-head-top .updated { white-space: nowrap; }
.resume-head h1 {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  font-style: var(--display-style, normal);
  letter-spacing: var(--display-tracking, -0.025em);
  font-size: clamp(44px, 9vw, 88px);
  line-height: 0.95;
  margin-bottom: 12px;
}
.resume-summary {
  font-size: clamp(15px, 1.2vw, 17px);
  color: var(--fg-1;
  line-height: 1.55;)
  max-width: 56ch;
  margin-bottom: 18px;
}
.resume-contacts {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--fg-1);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  line-height: 1.7;
}
.resume-contacts a {
  border-bottom: 1px solid var(--line-1);
  transition: border-color .15s, color .15s;
}
.resume-contacts a:hover { color: var(--accent); border-color: var(--accent); }
.resume-contacts .bullet { color: var(--fg-3); }
.resume-contacts .socials { display: inline-flex; flex-wrap: wrap; gap: 0; }
.resume-contacts .socials a + a { margin-left: 4px; }

/* ═══ Section ═══ */
.resume-section {
  margin-bottom: clamp(28px, 4vw, 40px);
}
.resume-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-1);
  position: relative;
}
.resume-section-head::before {
  content: ""; position: absolute; bottom: -1px; left: 0;
  width: 44px; height: 2px; background: var(--accent);
}
.resume-section-head h2 {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.resume-tools {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  display: inline-flex; gap: 6px; align-items: baseline;
}
.resume-tools button {
  color: var(--fg-2);
  transition: color .15s;
  border-bottom: 1px dashed transparent;
}
.resume-tools button:hover { color: var(--accent); }
.resume-tools .bullet { color: var(--fg-4); }

.resume-hint {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  padding-left: 14px;
  border-left: 2px solid var(--accent-soft);
}

/* ═══ Jobs (collapsible) ═══ */
.jobs {
  display: flex;
  flex-direction: column;
}

.job {
  border-bottom: 1px solid var(--line-1);
  transition: background .2s;
}
.job:first-child { border-top: 1px solid var(--line-0); }
.job.is-open { background: color-mix(in oklab, var(--accent) 4%, transparent); }

.job-head {
  width: 100%;
  display: grid;
  grid-template-columns: 90px 1fr auto auto;
  gap: 16px;
  align-items: start;
  padding: 16px 4px;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background .2s;
}
.job-head:hover { background: color-mix(in oklab, var(--fg-0) 3%, transparent); }
.job-head .yr-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}
.job-head .yr {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.job.is-open .job-head .yr { color: var(--accent); }
.job-head .job-loc {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--fg-4);
  letter-spacing: 0.04em;
}
.job-head .role-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.job-head .role {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--fg-0);
}
.job-head .role .org {
  display: block;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--accent);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.job-head .job-tagline {
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.45;
  overflow: visible;
  margin-left: 15px;
}
.job-head .tag {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid var(--line-1);
  border-radius: 999px;
  color: var(--fg-2);
  white-space: nowrap;
}
.job.is-open .job-head .tag {
  color: var(--accent);
  border-color: var(--accent);
}
.job-head .chev {
  font-family: var(--f-mono);
  font-size: 22px;
  line-height: 1;
  color: var(--fg-2);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-1);
  border-radius: 50%;
  transition: color .15s, border-color .15s, background .15s, transform .25s var(--ease-out);
}
.job.is-open .job-head .chev {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  transform: rotate(180deg);
}
.job-head:hover .chev { border-color: var(--accent); }

/* Collapsible body via grid-rows trick */
.job-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .4s var(--ease-out);
}
.job.is-open .job-body {
  grid-template-rows: 1fr;
}
.job-body > .job-body-inner {
  overflow: hidden;
  min-height: 0;
}
.job-body-inner {
  padding: 0px 4px 0;
}
.job.is-open .job-body-inner {
  padding-bottom: 24px;
}
.job-brief {
  font-size: 14.5px;
  color: var(--fg-1);
  line-height: 1.6;
  padding-left: 0px;
  margin-bottom: 20px;
  max-width: 75ch;
}

/* ═══ Artifact tiles ═══ */
.cv-artifacts-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.cv-artifacts-label::after {
  content: ""; flex: 1; height: 1px; background: var(--line-1);
}
.cv-artifacts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.cv-artifact {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, transform .25s;
  background: var(--bg-2);
}
.cv-artifact:hover { border-color: var(--accent); transform: translateY(-2px); }
.cv-artifact.is-featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cv-artifact .type-tag {
  position: absolute; top: 8px; left: 8px; z-index: 4;
  font-family: var(--f-mono);
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  display: inline-flex; align-items: center; gap: 6px;
  pointer-events: none;
}
.cv-artifact .type-tag.dim {
  background: rgba(0,0,0,0.55);
  color: var(--fg-1);
  border: 1px solid var(--line-1);
  backdrop-filter: blur(6px);
}
.cv-artifact .type-tag::before {
  content: ""; width: 4px; height: 4px; background: currentColor; border-radius: 50%;
  opacity: .65;
}
.cv-artifact .cap {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.92), transparent);
  font-family: var(--f-mono); font-size: 10px;
  color: var(--fg-1); letter-spacing: 0.04em;
  z-index: 3;
}
.cv-artifact.kind-image .cap,
.cv-artifact.kind-model .cap { display: none; }
.cv-artifact .meta {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--f-mono); font-size: 9px;
  color: var(--fg-2); letter-spacing: 0.12em;
  z-index: 4; pointer-events: none;
}

/* placeholders */
.placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.22);
  overflow: hidden;
}
.placeholder.tone-1 { background: linear-gradient(135deg, #0c1418 0%, #1a2d36 50%, #2a4754 100%); }
.placeholder.tone-2 { background: linear-gradient(135deg, #1c1409 0%, #2e2412 50%, #4a3a1f 100%); }
.placeholder.tone-3 { background: linear-gradient(135deg, #0e0c14 0%, #1c1828 50%, #2a263e 100%); }
.placeholder.tone-4 { background: linear-gradient(135deg, #14110a 0%, #2c2614 50%, #4a3e22 100%); }
.placeholder.tone-5 { background: linear-gradient(135deg, #0e1410 0%, #1c2a22 50%, #2c4538 100%); }
.placeholder.tone-6 { background: linear-gradient(135deg, #1a0d0d 0%, #2e1416 50%, #4a2024 100%); }
.placeholder::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 60px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 60px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.2));
}
.placeholder .ph-glyph {
  position: relative;
  font-family: var(--f-display);
  font-size: clamp(40px, 6vw, 88px);
  color: rgba(255,255,255,0.24);
  line-height: 1;
  font-style: italic;
  font-weight: 500;
}

/* text artifact tile */
.text-tile {
  position: absolute; inset: 0;
  padding: 36px 14px 36px 14px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  overflow: hidden;
}
.text-tile::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    180deg, transparent 0 18px, rgba(255,255,255,0.04) 18px 19px
  );
}
.text-tile .preview {
  position: relative;
  font-family: var(--f-mono);
  font-size: 9.5px;
  line-height: 1.65;
  color: var(--fg-2);
  letter-spacing: 0.01em;
  max-height: 100%;
  white-space: pre-wrap;
  mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}
.text-tile .corner {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--f-display);
  font-style: italic;
  color: var(--accent);
  font-size: 22px; line-height: 1;
  opacity: 0.7;
}

/* model viewer */
model-viewer {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  --poster-color: transparent;
}
.cv-artifact model-viewer { position: absolute; inset: 0; }
.model-badge {
  position: absolute; bottom: 10px; left: 10px;
  z-index: 3; pointer-events: none;
  display: inline-flex; gap: 4px; align-items: center;
  font-family: var(--f-mono); font-size: 8.5px;
  color: var(--fg-2); letter-spacing: 0.16em; text-transform: uppercase;
  background: rgba(0,0,0,0.5);
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line-1);
  backdrop-filter: blur(6px);
}
.model-badge::before {
  content: ""; width: 5px; height: 5px;
  background: var(--accent); border-radius: 50%;
  animation: pulse 2.4s ease-in-out infinite;
}

/* ═══ Plain lists (education / recognition) ═══ */
.plain-list { list-style: none; }
.plain-list li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line-0);
  align-items: baseline;
}
.plain-list li:last-child { border-bottom: 0; }
.plain-list .yr {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
}
.plain-list .t {
  font-size: 14px; color: var(--fg-1);
}
.plain-list .t strong { color: var(--fg-0); font-weight: 500; }

.cv-skills { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
.cv-skills span {
  font-family: var(--f-mono);
  font-size: 10px;
  padding: 5px 10px;
  border: 1px solid var(--line-1);
  border-radius: 999px;
  color: var(--fg-1);
  letter-spacing: 0.06em;
}
.cv-skills .skill-linked {
  cursor: pointer;
  border-color: var(--accent);
  color: var(--accent);
  transition: background .15s;
}
.cv-skills .skill-linked:hover {
  background: var(--accent-soft);
}

/* ═══ Lightbox (kind-aware) ═══ */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: color-mix(in oklab, var(--bg-0) 96%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease-out);
}
.lightbox.is-open { opacity: 1; pointer-events: auto; overscroll-behavior: contain; touch-action: none; }
body.lightbox-open { position: fixed; width: 100%; overflow-y: scroll; }
.lightbox-panel {
  width: 100%;
  max-width: 1024px;
  display: grid;
  grid-template-rows: auto 1fr;
}
.lightbox-head {
  padding: 16px var(--pad-x);
}
.lightbox-body {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}
@media (min-width: 860px) {
  .lightbox-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    overflow: hidden;
    border-top: 1px solid var(--line-0);
  }
}
.lightbox-stage {
  display: grid; place-items: center;
  padding: 16px var(--pad-x);
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;  /* trap model-viewer's GPU layer inside the stage */
}
@media (min-width: 860px) {
  .lightbox-stage {
    padding: 24px;
    overflow: hidden;
  }
}
.lightbox-info {
  padding: 24px var(--pad-x) clamp(32px, 6vh, 72px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (min-width: 860px) {
  .lightbox-info {
    border-left: 1px solid var(--line-0);
    overflow-y: auto;
    padding: 28px 24px 32px;
  }
}
.lightbox-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-2);
  gap: 16px;
}
.lightbox-head .breadcrumb { display: inline-flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lightbox-head .breadcrumb span { color: var(--fg-0); }
.lightbox-head .breadcrumb .sep { color: var(--fg-3); }
.lightbox-head button.x {
  width: 38px; height: 38px;
  border: 1px solid var(--line-1);
  border-radius: 50%;
  display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.lightbox-head button.x:hover { border-color: var(--accent); background: var(--accent-soft); }
.lightbox-frame {
  width: min(94vw, 1200px);
  height: min(70vh, 760px);
  position: relative;
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
  overflow: hidden;
  background: var(--bg-1);
}
@media (min-width: 860px) {
  .lightbox-frame {
    width: 100%;
    height: 100%;
    border-radius: var(--r-2);
  }
}
.lightbox-frame.kind-text {
  background: var(--bg-1);
  height: min(70vh, 720px);
  overflow-y: auto;
  padding: clamp(24px, 5vw, 56px);
}
.lightbox-frame.kind-text .doc {
  font-family: var(--f-mono);
  font-size: clamp(13px, 1.05vw, 15px);
  line-height: 1.75;
  color: var(--fg-1);
  white-space: pre-wrap;
  max-width: 70ch;
  margin: 0 auto;
}

/* Article-mode doc (block array body) */
.doc-article {
  font-family: var(--f-sans);
  white-space: normal;
  max-width: 68ch;
  margin: 0 auto;
}
.doc-article .doc-h {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  letter-spacing: var(--display-tracking, -0.02em);
  font-size: clamp(17px, 1.6vw, 21px);
  color: var(--fg-0);
  line-height: 1.2;
  margin-top: 2.2em;
  margin-bottom: 0.55em;
}
.doc-article .doc-h:first-child { margin-top: 0; }
.doc-article .doc-p {
  font-size: clamp(14px, 1.05vw, 15.5px);
  line-height: 1.72;
  color: var(--fg-1);
  margin-bottom: 1.3em;
}
.doc-article .doc-p:last-child { margin-bottom: 0; }

.doc-figure {
  margin: 2.2em 0;
}
.doc-figure-media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-2);
  overflow: hidden;
  background: var(--bg-2);
}
.doc-figure-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.doc-model-embed {
  width: 100%;
  height: min(55vh, 480px);
  border-radius: var(--r-2);
  overflow: hidden;
  background: radial-gradient(ellipse at center, var(--bg-2) 0%, var(--bg-0) 100%);
}
.doc-figure-media video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.doc-video-play-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 18px;
  color: var(--fg-0);
  background: rgba(0,0,0,0.35);
}
.doc-cap {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line-0);
}
.lightbox-frame.kind-text::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--accent);
}
.lightbox-frame.kind-model {
  height: min(74vh, 820px);
}
.lightbox-frame.kind-model model-viewer {
  background: radial-gradient(ellipse at center, var(--bg-2) 0%, var(--bg-0) 100%);
}
.lightbox-frame.kind-model.is-bare {
  background: transparent;
  border-color: transparent;
}
.lightbox-frame.kind-model.is-bare model-viewer {
  background: transparent !important;
}
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: color-mix(in oklab, var(--bg-0) 40%, transparent);
  backdrop-filter: blur(8px);
  color: var(--fg-1);
  font-size: 12px;
  line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.lightbox-arrow:hover { border-color: var(--accent); color: var(--fg-0); }
.lightbox-arrow-prev { left: 8px; }
.lightbox-arrow-next { right: 8px; }

.lightbox-info h3 {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  letter-spacing: var(--display-tracking, -0.02em);
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.1;
}
.lightbox-desc {
  font-size: clamp(13px, 2vw, 14.5px);
  color: var(--fg-2);
  line-height: 1.6;
}
.lightbox-link {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 1px;
  transition: border-color .15s;
}
.lightbox-link:hover { border-bottom-color: var(--accent); }

/* ── Link-card previews in lightbox info panel ── */
.lightbox-link-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.lightbox-link-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-2);
  border: 1px solid var(--line-1);
  background: var(--bg-2);
  transition: border-color .15s, background .15s;
  text-decoration: none;
}
.lightbox-link-card:hover {
  border-color: var(--accent-soft);
  background: var(--bg-3);
}
.lightbox-link-card-thumb {
  width: fit-content;
  max-width: 100%;
  border-radius: var(--r-1);
  overflow: hidden;
  background: var(--bg-3);
}
.lightbox-link-card-thumb img {
  display: block;
  max-width: 100%;
  height: auto;
}
.lightbox-link-card-footer {
  display: flex;
  align-items: center;
  gap: 5px;
}
.lightbox-link-card-label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-1);
  line-height: 1.35;
}
.lightbox-link-card-arrow {
  font-size: 13px;
  color: var(--accent);
}

.lightbox-info .meta {
  font-family: var(--f-mono); font-size: 10px; color: var(--fg-3);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin-top: auto;
  padding-top: 16px;
}
.lightbox-info .tip {
  font-family: var(--f-mono); font-size: 10px; color: var(--fg-2);
  letter-spacing: 0.1em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.lightbox-info .tip kbd {
  font-family: var(--f-mono); font-size: 9.5px;
  padding: 3px 6px; border: 1px solid var(--line-1);
  border-radius: 4px; background: var(--bg-1);
  color: var(--fg-1);
}

/* Model lightbox play/pause */
.lightbox-model-controls {
  position: absolute;
  bottom: 14px; left: 14px;
  display: flex; gap: 8px; z-index: 10;
  will-change: transform; /* own compositor layer, paints above model-viewer WebGL canvas */
}
.lightbox-model-controls-mobile {
  display: none; /* desktop: hidden, controls float on stage */
}
@media (max-width: 859px) {
  .lightbox-model-controls { display: none; }
  .lightbox-model-controls-mobile {
    display: flex; gap: 8px;
    padding: 10px var(--pad-x);
    border-bottom: 1px solid var(--line-0);
  }
}
.lightbox-model-btn {
  padding: 5px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(10,10,10,0.7);
  color: rgba(255,255,255,0.7);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .15s, color .15s, background .15s;
}
.lightbox-model-btn:hover {
  border-color: rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.95);
  background: rgba(10,10,10,0.9);
}

/* ═══ Footer ═══ */
.footer {
  width: min(840px, 100%);
  margin: 0 auto;
  border-top: 1px solid var(--line-1);
  padding: clamp(40px, 6vw, 64px) var(--pad-x) calc(40px + env(safe-area-inset-bottom));
  display: grid;
  gap: clamp(28px, 4vw, 48px);
}
.footer-cta {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  letter-spacing: var(--display-tracking, -0.025em);
  font-size: clamp(32px, 5.5vw, 64px);
  line-height: 1;
  max-width: 18ch;
}
.footer-cta em { font-style: italic; color: var(--accent); }
.footer-cta a {
  display: inline-block;
  border-bottom: 2px solid var(--line-2);
  transition: border-color .15s;
}
.footer-cta a:hover { border-color: var(--accent); }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line-1);
  font-family: var(--f-mono); font-size: 12px;
  color: var(--fg-1);
}
.footer-grid h5 {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 400;
  margin-bottom: 10px;
}
.footer-grid ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.footer-grid a { transition: color .15s; }
.footer-grid a:hover { color: var(--accent); }
.footer-bottom {
  display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 10px;
  color: var(--fg-3); letter-spacing: 0.12em; text-transform: uppercase;
}

/* ═══ Reveal ═══ */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
.reveal.is-in { opacity: 1; transform: translateY(0); }
.reveal-d-1 { transition-delay: 60ms; }
.reveal-d-2 { transition-delay: 120ms; }
.reveal-d-3 { transition-delay: 180ms; }
.reveal-d-4 { transition-delay: 240ms; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .eyebrow .dot, .model-badge::before { animation: none; }
}

/* ═══ Project page ═══ */
.project {
  width: min(840px, 100%);
  margin: 0 auto;
  padding: clamp(80px, 12vw, 120px) var(--pad-x) clamp(40px, 6vw, 64px);
}

.project-head {
  
}
.project-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.project-back {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--fg-3);
  transition: color .15s;
}
.project-back:hover { color: var(--accent); }

.project-title {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  font-style: var(--display-style, normal);
  letter-spacing: var(--display-tracking, -0.025em);
  font-size: clamp(40px, 8vw, 80px);
  line-height: 0.95;
  margin-bottom: 16px;
}
.project-subtitle {
  font-size: clamp(16px, 1.4vw, 20px);
  color: var(--fg-1);
  line-height: 1.5;
  max-width: 52ch;
  margin-bottom: 20px;
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
}
.project-meta .bullet { color: var(--fg-4); }
.project-tag {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid var(--line-1);
  border-radius: 999px;
  color: var(--fg-2);
}

/* Body */
.project-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.proj-lede {
  font-size: clamp(17px, 1.6vw, 21px);
  color: var(--fg-0);
  line-height: 1.55;
  max-width: 54ch;
  margin-bottom: 20px;
}
.proj-h {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  letter-spacing: var(--display-tracking, -0.02em);
  font-size: clamp(20px, 2vw, 26px);
  color: var(--fg-0);
  line-height: 1.15;
  margin-top: 1em;
  margin-bottom: 0.2em;
}
.proj-h:first-child { margin-top: 0; }
.proj-p {
  font-size: clamp(15px, 1.1vw, 16.5px);
  color: var(--fg-1);
  line-height: 1.72;
  margin-bottom: 1.3em;
}
.proj-p:last-child { margin-bottom: 0; }
.proj-p-justify { text-align: justify; text-align-last: left; }
.proj-divider {
  border: 0;
  border-top: 1px solid var(--line-1);
  margin: 1em 0;
}

/* Media */
.proj-figure { margin: 2.4em 0; }
.proj-media {
  position: relative;
  width: 100%;
  border-radius: var(--r-2);
  overflow: hidden;
  background: var(--bg-2);
}
.proj-media img,
.proj-media video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.proj-media-model model-viewer {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}
.proj-media-model .model-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  z-index: 2;
}
.proj-model {
  width: 100%;
  height: min(70vh, 680px);
  border-radius: var(--r-2);
  overflow: hidden;
  background: radial-gradient(ellipse at center, var(--bg-2) 0%, var(--bg-0) 100%);
}
.proj-model.is-bare {
  background: transparent;
  border-radius: 0;
  overflow: visible;
}
.proj-model.is-bare model-viewer {
  background: transparent !important;
}
.proj-model.has-bg-image { background: transparent; }
.proj-model.has-bg-image model-viewer { background: transparent !important; }
.proj-model-bg { z-index: 0; }
.proj-model.has-bg-image model-viewer { z-index: 1; position: relative; }
.proj-overlay {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  max-width: 80%;
}
.proj-overlay.pos-bottom-left  { bottom: 0; left: 0; }
.proj-overlay.pos-bottom-right { bottom: 0; right: 0; text-align: right; }
.proj-overlay.pos-top-left     { top: 0; left: 0; }
.proj-overlay.pos-top-right    { top: 0; right: 0; text-align: right; }
.proj-overlay.pos-center       { top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.proj-overlay.pos-bottom-left,
.proj-overlay.pos-bottom-right {
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
  width: 100%; max-width: 100%; padding-bottom: 20px;
}
.proj-overlay.pos-top-left,
.proj-overlay.pos-top-right {
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 100%);
  width: 100%; max-width: 100%;
}
.proj-overlay-title {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  font-size: clamp(18px, 2.5vw, 28px);
  letter-spacing: var(--display-tracking, -0.02em);
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}
.proj-overlay-sub {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.proj-cap {
  display: block;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-0);
}

/* Gallery */
.proj-gallery {
  display: grid;
  gap: 12px;
  margin: .5em 0;
}
.proj-gallery.cols-2 { grid-template-columns: 1fr 1fr; }
.proj-gallery.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.proj-gallery-item { display: flex; flex-direction: column; }

/* Aside (media + text side by side) */
.proj-aside {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  margin: 2.4em 0;
}
.proj-aside.media-right .proj-aside-media { order: 2; }
.proj-aside.media-right .proj-aside-text  { order: 1; }
.proj-aside .proj-figure { margin: 0; }
.proj-aside .proj-p { max-width: none; }
.proj-aside .proj-h { margin-top: 10px; }
.proj-aside-media[style*="height"] { overflow: hidden; }
.proj-aside-media[style*="height"] .proj-figure,
.proj-aside-media[style*="height"] .proj-media { height: 100%; aspect-ratio: unset; }

/* ── Launcher interactive block — schematic/blueprint style ──────── */
.proj-launcher-wrap { margin-top: .5em; margin-bottom: .2em}

.proj-launcher-label {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--fg-4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.proj-launcher {
  --sl: rgba(72, 138, 196, 0.68);   /* schematic line */
  --sd: rgba(72, 138, 196, 0.28);   /* schematic dim */
  --sg: rgba(40,  90, 150, 0.10);   /* grid */
  --sb: #070c12;                    /* bg */

  position: relative;
  width: 100%;
  height: 220px;
  background-color: var(--sb);
  background-image:
    linear-gradient(var(--sg) 1px, transparent 1px),
    linear-gradient(90deg, var(--sg) 1px, transparent 1px);
  background-size: 22px 22px;
  border-radius: var(--r-2);
  border: 1px solid rgba(40, 90, 150, 0.22);
  overflow: hidden;
  user-select: none;
}

/* annotation label */
.proj-schem-title {
  position: absolute;
  top: 9px; left: 13px;
  font-family: var(--f-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(72, 138, 196, 0.35);
  pointer-events: none;
}

/* hint */
.proj-launcher-hint {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: 9px;
  color: rgba(72, 138, 196, 0.38);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

/* ── turret (both cylinders + gap tick + dart, rotates with aim angle) ── */
.proj-turret {
  position: absolute;
  left: 50%; top: 66px;   /* NIP_Y */
  width: 124px;           /* 56 + 12gap + 56 */
  height: 56px;
  overflow: visible;      /* dart extends below the cylinder row */
  /* transform set inline — includes rotate(aimAngle) */
  transition: transform 0.05s linear;
  pointer-events: none;
}

/* ── cylinders (engineering section view, 56px) ── */
.proj-cyl {
  position: absolute;
  top: 0;
  width: 56px; height: 56px;
  border-radius: 50%;
}
.proj-cyl-left  { left: 0; }
.proj-cyl-right { left: 68px; }   /* 56px + 12px gap */

/* hatched fill — rotates to simulate spin */
.proj-cyl-hatch {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: repeating-linear-gradient(
    45deg,
    rgba(50, 105, 165, 0.20) 0px,
    rgba(50, 105, 165, 0.20) 1px,
    transparent 1px,
    transparent 9px
  );
  animation: cyl-spin var(--spin-dur, 2.2s) linear infinite;
}
.proj-cyl-hatch-rev { animation-direction: reverse; }
.proj-launcher.is-caught .proj-cyl-hatch { animation-duration: 0.22s !important; }

/* outer ring + inner detail ring */
.proj-cyl-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 4px var(--sb), 0 0 10px rgba(50, 105, 165, 0.16);
}
.proj-cyl-ring::after {
  content: '';
  position: absolute; inset: 8px;
  border-radius: 50%;
  border: 1px solid var(--sd);
}

/* center crosshair */
.proj-cyl-cross { position: absolute; inset: 0; pointer-events: none; }
.proj-cyl-cross::before,
.proj-cyl-cross::after { content: ''; position: absolute; background: var(--sd); }
.proj-cyl-cross::before { left: 50%; top: 18%; bottom: 18%; width: 1px; transform: translateX(-50%); }
.proj-cyl-cross::after  { top: 50%; left: 18%; right: 18%; height: 1px; transform: translateY(-50%); }

/* gap tick — inside turret, so it rotates with it */
.proj-cyl-gap-tick {
  position: absolute;
  top: 50%; left: 56px;   /* right edge of left cyl */
  width: 12px; height: 1px;
  border-top: 1px dashed rgba(72, 138, 196, 0.22);
  transform: translateY(-50%);
  pointer-events: none;
}
.proj-cyl-gap-tick::before,
.proj-cyl-gap-tick::after {
  content: ''; position: absolute;
  top: -4px; width: 1px; height: 8px;
  background: rgba(72, 138, 196, 0.28);
}
.proj-cyl-gap-tick::before { left: 0; }
.proj-cyl-gap-tick::after  { right: 0; }

@keyframes cyl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── exit arrow ── */
.proj-aim-arrow {
  position: absolute;
  left: 50%; top: 66px;   /* NIP_Y */
  width: 1px; height: 1px;
  overflow: visible;
  pointer-events: none;
  transition: transform 0.05s linear;
}
.proj-aim-arrow line    { stroke: var(--sl); stroke-width: 1; }
.proj-aim-arrow polygon { fill:   var(--sl); }

/* ── force slider (vertical, right side) ── */
.proj-force-col {
  position: absolute;
  right: 14px; top: 24px; bottom: 44px;
  width: 20px;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  pointer-events: none;
}
.proj-force-track {
  position: relative;
  flex: 1; width: 1px;
  background: var(--sd);
  pointer-events: auto;
}
.proj-force-handle {
  position: absolute;
  left: 50%; transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--sl);
  background: var(--sb);
  cursor: ns-resize;
  pointer-events: auto;
  touch-action: none;
  transition: border-color 0.12s, background 0.12s;
}
.proj-force-handle:hover {
  border-color: rgba(120, 180, 235, 0.95);
  background: rgba(72, 138, 196, 0.15);
}
.proj-force-label {
  font-family: var(--f-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  color: rgba(72, 138, 196, 0.35);
  text-transform: uppercase;
  line-height: 1;
  pointer-events: none;
}

/* ── hit counter (lower-left of launcher) ── */
.proj-hit-counter {
  position: absolute;
  bottom: 44px;   /* sits just above the aim row */
  left: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  pointer-events: none;
}
.proj-hit-count {
  font-family: var(--f-mono);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--sl);
  transition: color 0.15s;
}
.proj-hit-label {
  font-family: var(--f-mono);
  font-size: 7px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(72, 138, 196, 0.32);
}

/* ── aim control strip at bottom ── */
.proj-aim-row {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 36px;
  border-top: 1px solid rgba(40, 90, 150, 0.2);
  background: rgba(7, 12, 18, 0.7);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
.proj-aim-meta {
  font-family: var(--f-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: rgba(72, 138, 196, 0.4);
  text-transform: uppercase;
  flex-shrink: 0;
}
.proj-aim-track {
  position: relative;
  flex: 1;
  height: 1px;
  background: rgba(72, 138, 196, 0.25);
}
.proj-aim-handle {
  position: absolute;
  top: 50%; transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--sl);
  background: var(--sb);
  cursor: ew-resize;
  touch-action: none;
  transition: border-color 0.12s, background 0.12s;
}
.proj-aim-handle:hover {
  border-color: rgba(120, 180, 235, 0.95);
  background: rgba(72, 138, 196, 0.15);
}
.proj-aim-readout {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--sl);
  letter-spacing: 0.06em;
  min-width: 34px;
  text-align: right;
  flex-shrink: 0;
}

/* ── draggable dart ── */
/* dart is a child of .proj-turret (pointer-events:none), so re-enable here */
.proj-launch-rect {
  position: absolute;
  pointer-events: auto;
  width: 11px; height: 36px;
  background: color-mix(in oklab, rgba(72,138,196,1) 10%, transparent);
  border: 1.5px solid rgba(72, 138, 196, 0.85);
  border-top: none;
  border-radius: 0 0 3px 3px;
  cursor: grab;
  touch-action: none;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 3px;
  transition: background 0.12s, box-shadow 0.12s;
  z-index: 4;
}
/* orange dome outline — open at the base so it reads as one dart */
.proj-launch-rect::before {
  content: '';
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 11px; height: 8px;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}
.proj-launch-rect:hover {
  background: color-mix(in oklab, rgba(72,138,196,1) 18%, transparent);
}

.proj-dart-label {
  font-family: var(--f-mono);
  font-size: 5.5px;
  letter-spacing: 0.1em;
  color: var(--sd);
  pointer-events: none;
  user-select: none;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin-top: 2px;
}

.proj-launch-rect.is-pulling {
  cursor: grabbing;
  background: color-mix(in oklab, rgba(72,138,196,1) 24%, transparent);
  box-shadow: 0 0 10px rgba(72, 138, 196, 0.5);
}
.proj-launch-rect.is-caught {
  background: color-mix(in oklab, rgba(72,138,196,1) 30%, transparent);
  box-shadow: 0 0 14px rgba(72, 138, 196, 0.55);
}

/* ── flying dart (position:fixed, appended to body on launch) ── */
.proj-dart-fly {
  position: fixed;
  left: 0; top: 0;
  pointer-events: none;
  z-index: 9999;
  width: 11px; height: 38px;
  background: color-mix(in oklab, rgba(72,138,196,1) 10%, transparent);
  border: 1.5px solid rgba(72, 138, 196, 0.85);
  border-top: none;
  border-radius: 0 0 3px 3px;
  will-change: transform;
}
/* orange dome outline on the flying dart */
.proj-dart-fly::before {
  content: '';
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 11px; height: 8px;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

/* ── target bullseye — fixed so it floats over page content with no layout impact ── */
.proj-target {
  position: fixed;
  z-index: 200;   /* above page content, below lightbox (1000) */
  /* top + left set via inline style, computed from launcher viewport position */
  width: 8px; height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  background: rgba(72, 138, 196, 0.55);
  box-shadow:
    0 0 0 8px  rgba(72, 138, 196, 0.12),
    0 0 0 16px rgba(72, 138, 196, 0.07),
    0 0 0 22px rgba(72, 138, 196, 0.04);
  pointer-events: none;
  opacity: 1;
  /* position changes are instant (target is hidden while it moves);
     only scale + opacity animate for the pop-in / pop-out */
  transition: transform 0.32s var(--ease-out), opacity 0.28s ease-out,
              top 0s, left 0s;
  animation: target-pulse 3.2s ease-in-out infinite;
}
/* hide + shrink state (applied briefly while repositioning) */
.proj-target.is-hidden {
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.18s ease-in, opacity 0.14s ease-in,
              top 0s, left 0s;
  animation: none;
}
/* horizontal crosshair */
.proj-target::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 54px; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, rgba(72,138,196,0.25) 25%,
    rgba(72,138,196,0.25) 75%, transparent 100%);
}
/* vertical crosshair */
.proj-target::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 1px; height: 54px;
  background: linear-gradient(180deg,
    transparent 0%, rgba(72,138,196,0.25) 25%,
    rgba(72,138,196,0.25) 75%, transparent 100%);
}
@keyframes target-pulse {
  0%, 100% { opacity: 0.65; }
  50%       { opacity: 1;    }
}

/* ── explosion (position:fixed, appended to body on hit) ── */
.proj-explosion {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}
/* center flash */
.proj-explosion::before {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  top: 0; left: 0;
  transform: translate(-50%, -50%) scale(0);
  animation: expl-flash 0.38s ease-out forwards;
}
/* first ring */
.proj-explosion::after {
  content: '';
  position: absolute;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  top: 0; left: 0;
  transform: translate(-50%, -50%) scale(0);
  animation: expl-ring 0.52s ease-out forwards;
}
/* second, larger ring */
.proj-expl-ring {
  position: absolute;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--accent) 50%, transparent);
  top: 0; left: 0;
  transform: translate(-50%, -50%) scale(0);
  animation: expl-ring 0.68s ease-out 0.07s forwards;
}
/* scatter particles */
.proj-expl-particle {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  top: 0; left: 0;
  animation: expl-particle 0.56s ease-out forwards;
}
@keyframes expl-flash {
  0%   { transform: translate(-50%,-50%) scale(0);   opacity: 1; }
  40%  { transform: translate(-50%,-50%) scale(2.2); opacity: 0.9; }
  100% { transform: translate(-50%,-50%) scale(1.4); opacity: 0; }
}
@keyframes expl-ring {
  0%   { transform: translate(-50%,-50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1); opacity: 0; }
}
@keyframes expl-particle {
  0%   { transform: translate(-50%,-50%) rotate(var(--a)) translateY(0px)    scale(1); opacity: 1; }
  100% { transform: translate(-50%,-50%) rotate(var(--a)) translateY(-30px) scale(0); opacity: 0; }
}

/* Artifact tile href link */
a.cv-artifact { text-decoration: none; display: block; }
.cv-artifact .link-badge {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  font-size: 14px; color: var(--fg-1);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--line-1);
  border-radius: 50%;
  backdrop-filter: blur(6px);
}

@media (max-width: 640px) {
  .project { padding-top: 80px; }
  .project-title { font-size: clamp(36px, 11vw, 60px); }
  .project-head-top { flex-direction: column; align-items: flex-start; gap: 10px; }
  .proj-gallery.cols-2,
  .proj-gallery.cols-3 { grid-template-columns: 1fr; }

  /* Hide nav eyebrow so it doesn't overflow and widen the layout viewport */
  .nav-meta { display: none; }

  /* Asides: stack vertically, media always on top.
     !important needed because gridTemplateColumns is set as an inline style. */
  .proj-aside {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  .proj-aside.media-right .proj-aside-media { order: 0; }
  .proj-aside.media-right .proj-aside-text  { order: 0; }

  /* Prevent hardcoded modelWidth from overflowing viewport */
  .proj-model { width: 100% !important; }

  /* Constrain kind-model lightbox frame to match the general 56vh mobile cap */
  .lightbox-frame.kind-model { height: min(56vh, 560px); }
}

/* ═══ Mobile (phone vertical) ═══ */
@media (max-width: 640px) {
  :root { --pad-x: 16px; }

  .nav { padding: 10px var(--pad-x); grid-template-columns: 2fr 1fr; }
  .nav-meta .clock { display: none; }

  .resume { padding-top: 80px; }

  .resume-head h1 { font-size: clamp(36px, 11vw, 60px); }

  .resume-head-top { display: none; column; align-items: flex-start; gap: 6px; }

  .resume-contacts {
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    line-height: 12px;
  }
  .resume-contacts .bullet { display: none; }
  .resume-contacts .socials { gap: 6px; }

  .resume-section-head { flex-direction: column; align-items: flex-start; gap: 4px; }

  .job-head {
    grid-template-columns: 1fr 28px;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    padding: 14px 2px;
  }
  .job-head .yr-col {
    grid-column: 1; grid-row: 1;
  }
  .job-head .yr { font-size: 10px; letter-spacing: 0.1em; }
  .job.is-open .job-head .yr { color: var(--accent); }
  .job-head .role-col {
    grid-column: 1; grid-row: 2;
  }
  .job-head .role { font-size: 15px; line-height: 1.3; }
  .job-head .tag {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    margin-top: 6px;
    font-size: 8.5px;
    padding: 3px 8px;
  }
  .job-head .chev {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }

  .job-body-inner { padding: 0; }
  .job.is-open .job-body-inner { padding-bottom: 20px; }

  .job-head .job-tagline {
    margin-left: 0;
    margin-top: 4px;
  }
  .job-brief { font-size: 14px; }

  .cv-artifacts {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .cv-artifact .cap { font-size: 9.5px; padding: 7px 9px; }

  .plain-list li {
    grid-template-columns: 70px 1fr;
    gap: 12px;
    padding: 8px 2px;
  }

  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
  .footer-bottom { flex-direction: column; gap: 6px; }

  .lightbox-frame { height: 56vh; }
  .lightbox-frame.kind-text { padding: 20px; }

}

@media (max-width: 480px) {
  .cv-artifacts { grid-template-columns: 1fr 1fr; }
  .cv-artifact { aspect-ratio: 4/3; }
}

/* Below 860px: hide detail panel (prevents JS/CSS resize flash) and
   use compact link-card thumbnails since the lightbox stacks vertically */
@media (max-width: 859px) {
  .detail-panel { display: none; }

  /* Allow the lightbox body (stage + info) to scroll by touch on mobile.
     touch-action: none on .lightbox.is-open blocks the page from scrolling;
     pan-y here lets the lightbox body itself be swiped. */
  .lightbox-body { touch-action: pan-y; }
  /* Prevent the model stage from being squeezed by flex layout */
  .lightbox-stage { flex-shrink: 0; }

  .lightbox-link-card {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
  }
  .lightbox-link-card-thumb {
    flex-shrink: 0;
    width: 100px;
    height: 80px;
    overflow: hidden;
  }
  .lightbox-link-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .lightbox-link-card-footer {
    flex: 1;
    min-width: 0;
  }
  .lightbox-link-card-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  .lightbox-desc {
    max-height: 9.6em; /* 6 lines × 1.6 line-height */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
}

/* ═══ Desktop split panel (≥ 860px) ═══ */
@media (min-width: 860px) {
  .resume { width: min(1320px, 100%); }

  .jobs-layout {
    display: grid;
    grid-template-columns: 520px 1fr;
    align-items: start;
  }

  /* Left: sticky scrollable job list */
  .jobs-list {
    border-right: 1px solid var(--line-1);
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
  }

  /* Compact 3-col header (no chev) */
  .jobs-list .job-head {
    grid-template-columns: 72px 1fr auto;
    gap: 10px;
    padding: 10px 16px 25px 3px;
  }
  .jobs-list .job-head .tag {
    max-width: 80px;
    overflow: hidden;
    white-space: nowrap;
  }
  .jobs-list .job-head .tag .tag-track {
    display: inline-block;
    white-space: nowrap;
    animation: tag-marquee 7s linear infinite;
  }
  @keyframes tag-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
  }

  /* Selection state replaces is-open tint */
  .jobs-list .job.is-selected {
    background: color-mix(in oklab, var(--accent) 6%, transparent);
    box-shadow: inset 2px 0 0 var(--accent);
  }
  .jobs-list .job.is-selected .job-head .yr { color: var(--accent); }
  .jobs-list .job.is-selected .job-head .tag {
    color: var(--accent);
    border-color: var(--accent);
  }
  /* Suppress open-state styles in left list on desktop */
  .jobs-list .job.is-open { background: none; box-shadow: none; }
  .jobs-list .job.is-open .job-head .yr { color: var(--fg-3); }
  .jobs-list .job.is-open .job-head .tag { color: var(--fg-2); border-color: var(--line-1); }

  /* Right: detail panel */
  .detail-panel {
    padding: 0 0 32px 32px;
    min-height: 300px;
  }

  .detail-panel-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    color: var(--accent);
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .detail-panel-content {
    animation: detail-in .22s var(--ease-out);
  }
  @keyframes detail-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .detail-panel-head {
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line-1);
  }
  .detail-yr {
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.06em;
    margin-bottom: 6px;
  }
  .detail-role {
    font-size: 18px;
    font-weight: 500;
    color: var(--fg-0);
    line-height: 1.25;
  }
  .detail-role .org {
    display: block;
    font-family: var(--f-mono);
    font-weight: 400;
    font-size: 12px;
    color: var(--accent);
    margin-top: 3px;
    letter-spacing: 0.02em;
  }
  .detail-panel-head .tag {
    display: inline-block;
    margin-top: 10px;
    font-family: var(--f-mono);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 4px 9px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
  }

  /* Remove year-column indent in detail panel */
  .detail-panel .job-brief { padding-left: 0; max-width: 62ch; }
  .detail-panel .job-body-inner { padding: 0; }
  .detail-panel .cv-artifacts {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
