/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  --bg: #0d0d0f;
  --surface: #18181c;
  --surface-hover: #222228;
  --border: #2a2a30;
  --text: #f0f0f0;
  --muted: #888;
  --radius: 8px;
  --radius-lg: 12px;
  --nav-h: 64px;
  --ease: 200ms ease;

  /* Vibe tokens — overridden by [data-vibe="code"] below. Art is the default. */
  --accent: #e8650a;
  --accent-hover: #ff7219;
  --accent-text: #fff;              /* readable text on top of --accent */
  --accent-glow: rgba(232, 101, 10, 0.32);
  --accent-wash: rgba(232, 101, 10, 0.06);
  --card-radius: 12px;

  /* One grid for the whole page — change it here and everything follows. */
  --grid-size: 68px;
  --grid-line: rgba(255, 255, 255, 0.024);
}

/* Cooler and squarer — reads "technical" without leaving the palette. */
[data-vibe="code"] {
  --accent: #21b8c9;
  --accent-hover: #35d3e4;
  --accent-text: #06262b;
  --accent-glow: rgba(33, 184, 201, 0.30);
  --accent-wash: rgba(33, 184, 201, 0.06);
  --card-radius: 5px;
}

/* Registering the colours lets them cross-fade in one place instead of needing
   a transition on every element that happens to use them. Unsupported browsers
   just snap, which is fine. */
@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #e8650a;
}
@property --accent-hover {
  syntax: '<color>';
  inherits: true;
  initial-value: #ff7219;
}

:root {
  transition: --accent 450ms ease, --accent-hover 450ms ease;
}

/* ============================================================
   Vibe Backdrop
   Two fixed layers that cross-fade on tab switch. Pure CSS
   gradients — no images, no JS, painted once then composited.
   ============================================================ */
.vibe {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  contain: strict;
}

.vibe::before,
.vibe::after {
  content: '';
  position: absolute;
  inset: 0;
  transition: opacity 700ms ease;
  /* Both layers fade out towards the edges rather than tiling to the corners. */
  -webkit-mask-image: radial-gradient(ellipse 95% 80% at 50% 35%, #000 25%, transparent 100%);
  mask-image: radial-gradient(ellipse 95% 80% at 50% 35%, #000 25%, transparent 100%);
}

/* Art — organic contour rings and soft warm blooms. */
.vibe::before {
  opacity: 1;
  background:
    repeating-radial-gradient(circle at 18% 22%, transparent 0 54px, rgba(255, 255, 255, 0.016) 54px 55px),
    repeating-radial-gradient(circle at 82% 78%, transparent 0 66px, rgba(255, 255, 255, 0.012) 66px 67px),
    radial-gradient(55% 45% at 12% 18%, rgba(232, 101, 10, 0.10), transparent 70%),
    radial-gradient(50% 40% at 88% 70%, rgba(255, 114, 25, 0.07), transparent 70%);
}

/* Code — graph paper and a cool bloom. */
.vibe::after {
  opacity: 0;
  background:
    repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px var(--grid-size)),
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px var(--grid-size)),
    radial-gradient(60% 45% at 78% 16%, rgba(33, 184, 201, 0.10), transparent 70%),
    radial-gradient(45% 40% at 14% 74%, rgba(33, 184, 201, 0.06), transparent 70%);
}

[data-vibe="code"] .vibe::before { opacity: 0; }
[data-vibe="code"] .vibe::after { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  .vibe::before,
  .vibe::after { transition: none; }
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section { padding: 6rem 0; }
.section--alt { background: var(--surface); }
#work { padding-top: 1.5rem; }

/* ============================================================
   Typography
   ============================================================ */
.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
  color: var(--text);
}

.section-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: var(--accent);
  margin-top: 0.6rem;
  border-radius: 2px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}

.btn-accent { background: var(--accent); color: var(--accent-text); }
.btn-accent:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(13, 13, 15, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}

/* Toggled from JS once you scroll past the hero. */
.nav.is-scrolled { background: rgba(13, 13, 15, 0.97); }

.nav-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}



.nav-links {
  display: flex;
  gap: 2.5rem;
  align-items: center;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--ease);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--ease);
  border-radius: 1px;
}

.nav-link:hover,
.nav-link.active { color: var(--text); }
.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

/* Hamburger */
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform var(--ease), opacity var(--ease);
}

.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 44vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 1rem) 2rem 2.5rem;
  position: relative;
  /* Deliberately no solid background layer: the fixed .vibe backdrop shows
     through, so the hero and the work section share one grid instead of each
     drawing their own and drifting out of alignment. */
  background: radial-gradient(ellipse 80% 55% at 50% 0%, var(--accent-wash) 0%, transparent 65%);
  overflow: hidden;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: var(--text);
  margin-bottom: 1rem;
}

.hero-sub {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 1.75rem;
  letter-spacing: 0.08em;
}


/* ============================================================
   Work — header & tabs
   ============================================================ */
/* The tab switcher is the only thing here now — the section heading and blurb
   were redundant next to the hero, so it sits centred just below it. */
.work-head {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.work-tabs {
  position: relative;
  display: flex;
  gap: 0.25rem;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
}

.work-tabs-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 6px); /* matches one tab: (content - gap) / 2 */
  border-radius: 100px;
  background: var(--accent);
  box-shadow: 0 4px 18px var(--accent-glow);
  transition: transform 320ms cubic-bezier(0.65, 0, 0.35, 1);
}

.work-tabs-thumb.is-code { transform: translateX(calc(100% + 0.25rem)); }

.work-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.4rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  white-space: nowrap;
  transition: color var(--ease);
}

.work-tab:hover { color: var(--text); }
.work-tab.is-active { color: var(--accent-text); }

.work-tab-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.work-tab-count {
  min-width: 20px;
  padding: 0 0.35rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  transition: background var(--ease);
}

.work-tab.is-active .work-tab-count { background: rgba(0, 0, 0, 0.22); }

.work-tab:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
}

/* ── Panels ── */
.work-panel[hidden] { display: none; }

.work-panel.is-active {
  animation: panelIn 400ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
   Project Grid
   ============================================================ */
/* Fits as many ~300px cards as the row allows — four at full width, fewer as
   it narrows, and never a card so small the work stops reading. The min()
   guard stops the track forcing an overflow on very narrow phones. */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1.25rem;
}

.project-card {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  aspect-ratio: 1 / 1;
  transition: transform 300ms ease, box-shadow 300ms ease, border-radius 450ms ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.project-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 450ms ease;
}

.project-card:hover .project-card-img { transform: scale(1.06); }

.project-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.25) 45%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 300ms ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
}

.project-card:hover .project-card-overlay { opacity: 1; }

.project-card-title {
  font-size: 0.975rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.project-card-category {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-card-badge {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  backdrop-filter: blur(6px);
}

/* ============================================================
   Code Cards
   ============================================================ */
.project-grid--code {
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 1.25rem;
}

.project-grid--code.project-grid--empty { grid-template-columns: 1fr; }

.code-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: transform 300ms ease, border-color var(--ease), box-shadow 300ms ease, border-radius 450ms ease;
}

.code-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.code-card-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg);
}



.code-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 450ms ease;
}

.code-card:hover .code-card-media img { transform: scale(1.05); }

.code-card-body {
  flex: 1;
  padding: 1.35rem 1.4rem 1.1rem;
}

.code-card-category {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.code-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 0.55rem;
}

.code-card-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.7;
}

.code-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.code-card-tag {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.code-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.4rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.code-card-year {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.code-card-links {
  display: flex;
  gap: 1rem;
}

.code-card-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  transition: color var(--ease);
}

.code-card-link:hover { color: var(--accent); }
.code-card-link.is-primary { color: var(--text); }
.code-card-link.is-primary:hover { color: var(--accent); }

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 60% 70% at 50% 0%, var(--accent-wash) 0%, transparent 70%),
    var(--surface);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.empty-state-icon svg { width: 24px; height: 24px; }

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.empty-state-sub {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1.75rem;
}

/* ============================================================
   Project Pages
   ============================================================ */
.is-project-page { padding-top: var(--nav-h); }



/* Code pages: narrower than Art, so the article column lands near 800px —
   past that, prose lines get uncomfortable to read. */
.container--mid { max-width: 1280px; }

/* Art pages give the work as much width as the screen allows — the gutters
   only exist so images don't touch the edge. */
.container--wide {
  max-width: 1800px;
  padding-left: clamp(1rem, 2.2vw, 2.25rem);
  padding-right: clamp(1rem, 2.2vw, 2.25rem);
}

.project { padding: 3rem 0 5rem; }
.project--art { padding: 1.5rem 0 3rem; }

.project-head { margin-bottom: 2.5rem; }

.project-back {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1.5rem;
  transition: color var(--ease);
}

.project-back:hover { color: var(--accent); }

.project-category {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.project-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}





/* ── Art layout: gallery + pinned details column ── */
.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 2rem;
  /* NOT align-items: start — that collapses the details column to its content
     height, leaving the sticky child no room to travel, so it scrolls away
     with the page instead of staying put. */
  align-items: stretch;
}

.project-gallery {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.project-details { min-width: 0; }

.detail-sticky {
  position: sticky;
  top: var(--nav-h);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  /* Long details scroll inside the pinned column rather than pushing it. */
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.75rem 0.25rem 1.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.detail-sticky::-webkit-scrollbar { width: 6px; }
.detail-sticky::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.project--art .project-back { margin-bottom: 0; }
.project--art .project-category { margin-bottom: 0.35rem; }

.project--art .project-title {
  font-size: clamp(1.5rem, 2vw, 2rem);
  margin-bottom: 0.25rem;
}

/* ── Prev / next inside the details column ── */
.detail-pager {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.detail-pager-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface);
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}

.detail-pager-btn.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.detail-pager-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.detail-pager-btn.is-next { flex-direction: row-reverse; text-align: right; }

.detail-pager-glyph {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 0.95rem;
  line-height: 1;
}

.detail-pager-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail-pager-text em {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-pager-text strong {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-intro p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

.detail-intro p + p { margin-top: 0.75rem; }

.spec-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}

.spec-row:last-child { border-bottom: none; }

.spec-row dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.spec-row dd {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.detail-tags .skill-tag { font-size: 0.75rem; padding: 0.3rem 0.8rem; }

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.detail-links .btn {
  padding: 0.6rem 1.2rem;
  font-size: 0.82rem;
}

/* ── Shots ── */
.shot { position: relative; }

.shot-btn {
  display: block;
  width: 100%;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  padding: 0;
}

.shot-btn img,
.shot video {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

.shot video { background: #000; }

.shot-zoom {
  position: absolute;
  bottom: 0.875rem;
  right: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--ease), transform var(--ease), background var(--ease);
  pointer-events: none;
}

.shot-zoom svg { width: 13px; height: 13px; }

.shot-btn:hover .shot-zoom,
.shot-btn:focus-visible .shot-zoom {
  opacity: 1;
  transform: translateY(0);
}

.shot-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Before/after comparison ── */
.compare {
  position: relative;
  overflow: hidden;
  border-radius: var(--card-radius);
  background: var(--surface);
  isolation: isolate;
}

.compare-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Everything left of the divider is image A; B is clipped away up to it. */
.compare-b { clip-path: inset(0 0 0 var(--pos)); }

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  pointer-events: none;
  z-index: 2;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}

.compare-handle svg { width: 20px; height: 20px; }

.compare-label {
  position: absolute;
  top: 0.75rem;
  z-index: 2;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  pointer-events: none;
}

.compare-label.is-a { left: 0.75rem; }
.compare-label.is-b { right: 0.75rem; }

/* Invisible, but it's the real control — gives keyboard and touch for free. */
.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 3;
  touch-action: pan-y;
}

.compare-range:focus-visible + .compare-zoom,
.compare-range:focus-visible ~ .compare-divider .compare-handle {
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
}

.compare-zoom {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 4;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  opacity: 0;
  transition: opacity var(--ease), background var(--ease);
}

.compare-zoom svg { width: 15px; height: 15px; }

.compare:hover .compare-zoom,
.compare-zoom:focus-visible { opacity: 1; }
.compare-zoom:hover { background: var(--accent); color: var(--accent-text); }

@media (prefers-reduced-motion: reduce) {
  .compare-zoom { transition: none; }
}

.shot figcaption {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Code page ── */
.project--code .project-hero { margin-bottom: 2.5rem; }
.project--code .project-head { margin-bottom: 2rem; }
.project-main { min-width: 0; }
.project-gallery--code { margin-top: 3rem; }

/* ── Drag-to-install (Blender 4.2+) ──
   Blender accepts any absolute http(s) .zip URL dropped onto its window, and
   an <a> already carries its href on the drag payload — so this is styling,
   not behaviour. Clicking still just downloads the file. */
.blender-install {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.blender-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  cursor: grab;
  transition: background var(--ease), border-color var(--ease);
}

.blender-drop svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.blender-drop:hover {
  background: var(--surface-hover);
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}

.blender-drop:active { cursor: grabbing; }

/* Sits right under the button, because it qualifies that action specifically. */
.blender-install-hint {
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  opacity: 0.85;
}

.blender-install-alt {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.55;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
  margin-top: 0.15rem;
}

.blender-install-alt a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blender-install-alt a:hover { color: var(--accent); }
.blender-install-alt b { color: var(--muted); font-weight: 600; }

/* ── Pager ── */












/* ============================================================
   Markdown Article
   ============================================================ */
.md { color: var(--muted); line-height: 1.85; }

.article { font-size: 1rem; }

.md h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 2.5rem 0 0.875rem;
}

.md h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 2rem 0 0.75rem;
}

.md h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
}

.md > :first-child { margin-top: 0; }

.md p { margin-bottom: 1.1rem; }
.md strong { color: var(--text); font-weight: 600; }

.md a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.md a:hover { color: var(--accent-hover); }

.md-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.md-list li {
  position: relative;
  padding-left: 1.35rem;
  margin-bottom: 0.5rem;
}

ul.md-list li::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

ol.md-list { counter-reset: md-counter; }

ol.md-list li::before {
  counter-increment: md-counter;
  content: counter(md-counter) ".";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85em;
}

.md code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  color: var(--text);
}

.md-code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  position: relative;
}

.md-code code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre;
}

.md-code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.md blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.1rem;
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-style: italic;
}

.md img,
.md video {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
}

.md video { background: #000; display: block; }

.md hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ============================================================
   Lightbox — fullscreen
   ============================================================ */
:root { } /* bottom bar total height */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: #000;
}

.lightbox-inner {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Close button ── */
.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  transition: background var(--ease), color var(--ease);
}

.lightbox-close:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Media — fills everything above the bar ── */
.lightbox-media {
  flex: 1;
  min-height: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media img,
.lightbox-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ── Arrow nav — floats over the image ── */
.lightbox-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* Clears the caption bar. Was var(--lb-bar), a token that stopped matching
     the bar's real height once it became auto — kept at the same pixel value
     so nothing moves, but it's a magic number worth re-measuring. */
  bottom: 116px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 10;
}

.lightbox-prev,
.lightbox-next {
  pointer-events: all;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.75);
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  flex-shrink: 0;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
  opacity: 0;
  pointer-events: none;
}

/* ── Bottom bar: caption on the left, counter on the right ── */
.lightbox-bar {
  flex-shrink: 0;
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
}

.lightbox-header {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
}

.lightbox-counter {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  align-self: center;
}











/* ============================================================
   About
   ============================================================ */
/* Capped independently of .container — prose past ~90 characters a line gets
   hard to read, and the wider container would push this to about 140. */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 5rem;
  align-items: start;
  max-width: 1180px;
}

.about-text p {
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.85;
  font-size: 1rem;
}

.about-text p:last-child { margin-bottom: 0; }

.about-accent {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.about-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color var(--ease);
}

.about-card:hover { border-color: var(--accent); }

.about-card-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.about-card-value {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text);
}

/* ============================================================
   Skills
   ============================================================ */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.skill-tag {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.45rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}

.skill-tag:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   Contact
   ============================================================ */
.contact-center {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.contact-sub {
  color: var(--muted);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.75;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ============================================================
   Fade-in Animation
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 550ms ease, transform 550ms ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1280px) {
  .project-layout { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 1024px) {
  .nav-links { gap: 1.6rem; } /* five links now — keep them on one row */

  .project-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Details move above the gallery so they're read first on narrow screens,
     and stop pinning — a stuck panel would eat most of a short viewport. */
  .project-details { order: -1; }

  .detail-sticky {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .detail-pager { margin-top: 0.5rem; }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .about-accent {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .about-card { flex: 1; min-width: 150px; }
}

@media (max-width: 640px) {
  /* Column count is handled by auto-fill above, not pinned here. */
  .section { padding: 4rem 0; }

  .work-tabs { width: 100%; }
  .work-tab { padding: 0.55rem 0.75rem; }
  .empty-state { padding: 3rem 1.5rem; }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(13, 13, 15, 0.98);
    backdrop-filter: blur(14px);
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open { display: flex; }
  .nav-burger { display: flex; }

  .hero-title { font-size: clamp(3.5rem, 18vw, 6rem); }

  .lightbox-prev,
  .lightbox-next { width: 44px; height: 44px; }
}
