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

:root {
  --bg: #0e0e0e;
  --surface: #171717;
  --border: #2a2a2a;
  --text: #ececec;
  --text-soft: #b9b9b9;
  --muted: #8a8a8a;
  --accent: #c8ff00;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-display: 'ivypresto-text', serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --radius: 12px;
  --radius-sm: 6px;
}

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

html[data-theme="light"] {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #dcdcd8;
  --text: #161616;
  --text-soft: #3d3d3a;
  --muted: #71716b;
  --accent: #DC343B;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  letter-spacing: 0.015em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

[hidden] { display: none !important; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; }

img, video { max-width: 100%; }

/* ── Navbar ───────────────────────────────────────────────── */
body > header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.navbar {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: var(--font-display);
  white-space: nowrap;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s;
  letter-spacing: 0.04em;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a.active {
  border-bottom-color: var(--accent);
}

/* ── Mobile nav hamburger (hidden until the links get squished) ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 30px;
  padding: 0 7px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--accent);
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text-soft);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── Graph view ───────────────────────────────────────────── */
.graph-view-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-soft);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.graph-view-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.graph-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.graph-overlay canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.graph-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  color: var(--text-soft);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.graph-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.graph-preview {
  position: absolute;
  top: 70px;
  right: 20px;
  width: min(300px, calc(100vw - 40px));
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.graph-preview[hidden] {
  display: block;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-5px);
}

.graph-preview--bottom-left {
  top: auto;
  right: auto;
  bottom: 20px;
  left: 20px;
}

.graph-preview-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  background: var(--bg);
}

.graph-preview iframe {
  width: 1280px;
  height: 800px;
  border: 0;
  transform: scale(0.234375);
  transform-origin: top left;
  pointer-events: none;
}

.graph-preview-label {
  padding: 0.55rem 0.7rem;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  border-top: 1px solid var(--border);
}

@media (max-width: 500px) {
  .graph-preview {
    width: 240px;
  }

  .graph-preview iframe {
    transform: scale(0.1875);
  }
}

.graph-controls {
  position: absolute;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
}

.graph-orbit-btn,
.graph-impulse-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  color: var(--text-soft);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.graph-orbit-btn:hover,
.graph-impulse-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.graph-impulse-btn:active {
  transform: scale(0.94);
}

.graph-orbit-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent);
}

.graph-speed {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.graph-speed input[type="range"] {
  width: 200px;
  accent-color: var(--accent);
}

.graph-speed-value {
  min-width: 2.6em;
  text-align: left;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.graph-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-icon {
  color: var(--muted);
  display: flex;
  align-items: center;
  line-height: 1;
}

.theme-slider-label {
  position: relative;
  display: inline-block;
  width: 2.25rem;
  height: 1.125rem;
  cursor: pointer;
}

.theme-slider-label input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.theme-slider-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 9999px;
  transition: background 0.2s;
}

.theme-slider-track::before {
  content: '';
  position: absolute;
  width: 0.875rem;
  height: 0.875rem;
  left: 0.125rem;
  top: 0.125rem;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s;
}

.theme-slider-label input:checked + .theme-slider-track::before {
  transform: translateX(1.125rem);
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
  flex: 1;
}

footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: #000;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s;
}

.hero .btn {
  font-family: var(--font);
  color: #fff;
}

html[data-theme="light"] .hero .btn { color: #000; }
html[data-theme="light"] .hero .btn-outline { color: #000; }

html:not([data-theme="light"]) .btn:not(.btn-outline) { color: #000; }

.btn:hover { opacity: 0.85; }

html[data-theme="light"] .btn { color: #fff; }
html[data-theme="light"] .btn-outline { color: var(--text); }
html[data-theme="light"] .btn-outline:hover { color: var(--text); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover { border-color: var(--text); }

/* ── Hero (Home) ──────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 60px - 8rem);
  position: relative;
}

.landing-hero {
  width: 100vw;
  min-height: calc(100vh - 60px);
  margin: -4rem calc(50% - 50vw) 0;
  padding: 4rem max(2rem, calc((100vw - 1200px) / 2 + 2rem));
  overflow: hidden;
  background: #000;
}

.landing-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 24% 48%, rgba(0, 0, 0, 0.74) 0%, rgba(0, 0, 0, 0.58) 32%, rgba(0, 0, 0, 0.24) 58%, rgba(0, 0, 0, 0.38) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.56) 0%, rgba(0, 0, 0, 0.22) 52%, rgba(0, 0, 0, 0.38) 100%);
  pointer-events: none;
}

.landing-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.landing-hero-video.is-visible { opacity: 1; }

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.landing-hero .hero-inner,
.landing-hero .hero-scroll,
.landing-hero .landing-hero-credit {
  z-index: 2;
}

.hero-eyebrow {
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero .subtitle {
  font-family: var(--font);
  font-size: 1.125rem;
  color: #fff;
  letter-spacing: 0.02em;
  max-width: 34rem;
  line-height: 1.7;
}

html[data-theme="light"] .hero .subtitle { color: #000; }

.hero-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.hero-links .btn {
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, opacity 0.15s;
}

.hero-links .btn:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border-color: var(--muted);
  opacity: 1;
  z-index: 1;
}

.hero-scroll {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 0.2s;
  cursor: pointer;
}

.hero-scroll:hover { color: var(--text); }

.hero-scroll svg { animation: scroll-bounce 2s ease-in-out infinite; }

.landing-hero-credit {
  position: absolute;
  right: max(2rem, calc((100vw - 1200px) / 2 + 2rem));
  bottom: 1.5rem;
  max-width: min(18rem, calc(50vw - 3rem));
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-align: right;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
  transition: color 0.2s;
}

.landing-hero-credit:hover {
  color: #fff;
}

.landing-hero,
.landing-hero .hero-eyebrow,
.landing-hero .subtitle,
.landing-hero .hero-scroll,
html[data-theme="light"] .landing-hero .subtitle {
  color: #fff;
}

.landing-hero .hero-eyebrow,
.landing-hero .hero-scroll {
  color: rgba(255, 255, 255, 0.78);
}

.landing-hero .btn-outline,
html[data-theme="light"] .landing-hero .btn-outline {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.62);
  background: rgba(0, 0, 0, 0.16);
}

.landing-hero .btn-outline:hover,
html[data-theme="light"] .landing-hero .btn-outline:hover {
  color: #fff;
  border-color: #fff;
}

html[data-theme="light"] .landing-hero .btn:not(.btn-outline) { color: #fff; }

/* Every home-page visit: fade the copy in first, then reveal its actions. */
.landing-first-visit .landing-hero .hero-inner {
  animation: none;
}

.landing-first-visit .landing-hero .hero-eyebrow,
.landing-first-visit .landing-hero h1,
.landing-first-visit .landing-hero .subtitle {
  animation: landing-copy-enter 0.8s ease both;
}

.landing-first-visit .landing-hero h1 { animation-delay: 0.12s; }
.landing-first-visit .landing-hero .subtitle { animation-delay: 0.24s; }

.landing-first-visit .landing-hero .hero-links .btn {
  animation: landing-actions-enter 0.65s ease 0.85s both;
}

.landing-first-visit .landing-hero .hero-links .btn:nth-child(2) { animation-delay: 0.95s; }
.landing-first-visit .landing-hero .hero-links .btn:nth-child(3) { animation-delay: 1.05s; }

@keyframes landing-copy-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes landing-actions-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ── Home sections ────────────────────────────────────────── */
.home-section { padding: 5rem 0 1rem; }

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.section-heading h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  letter-spacing: -0.01em;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--accent);
}

.section-heading p {
  color: var(--muted);
  font-size: 0.9rem;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.highlight-card {
  position: relative;
  display: block;
  aspect-ratio: 16/10;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.highlight-card-wide {
  grid-column: span 2;
  aspect-ratio: 21/9;
}

.highlight-card img,
.highlight-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.highlight-card-wide video {
  object-position: center 15%;
}

.highlight-card:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  border-color: var(--muted);
  z-index: 1;
}

.highlight-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.3rem;
  padding: 1.75rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.25) 55%, transparent 100%);
}

.highlight-kicker {
  font-family: var(--font);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.highlight-overlay h3 {
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 1px 16px rgba(0,0,0,0.55);
}

.highlight-overlay p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
  max-width: 34rem;
  text-shadow: 0 1px 10px rgba(0,0,0,0.45);
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.explore-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.explore-card:hover {
  transform: translateY(-4px);
  border-color: var(--muted);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.explore-card h3 { font-size: 1.35rem; }

.explore-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.explore-cta {
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.home-contact {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-bottom: 3rem;
}

.home-contact h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }

.home-contact p {
  color: var(--muted);
  max-width: 32rem;
  line-height: 1.7;
}

.home-contact .hero-links { justify-content: center; }

/* ── Page header ──────────────────────────────────────────── */
.page-header { margin-bottom: 3rem; }

.not-found { padding: 6rem 0; text-align: center; }
.not-found .btn { display: inline-block; margin-top: 2rem; }

.page-header h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.page-header-main h1 { font-weight: 500; }

.page-header p { color: var(--muted); max-width: 44rem; }

.page-header a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.page-header a:hover { border-color: var(--accent); }

/* ── Placeholder thumb ────────────────────────────────────── */
.placeholder-thumb {
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ── Project list ─────────────────────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-row {
  display: grid;
  grid-template-columns: 360px 1fr;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-row:hover {
  transform: scale(1.015);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  border-color: var(--muted);
  z-index: 1;
  position: relative;
}

.project-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  height: 100%;
  object-fit: cover;
}

.project-info {
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.project-title { font-size: 1.75rem; }

.project-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--muted);
}

/* ── Gallery grid (CG & Photography) ─────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  padding: 0 clamp(2rem, 8vw, 10rem);
}

@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

.gallery-item {
  display: block;
  aspect-ratio: 4/3;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border-color: var(--muted);
  z-index: 1;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gallery-item:hover .gallery-overlay { opacity: 1; }

/* Touch devices can't hover — keep titles visible */
@media (hover: none) {
  .gallery-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 45%);
  }
}

.gallery-title {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.25rem;
}

.gallery-desc {
  font-size: 0.775rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
}

/* ── Video (Demo Reel) ────────────────────────────────────── */
.video-section {
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  padding: 0 clamp(2rem, 8vw, 10rem);
}

.video-wrapper {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  background: #000;
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-caption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ── About ────────────────────────────────────────────────── */
.about-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 4rem;
  align-items: start;
}

.about-photo {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

.about-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1.05rem;
  line-height: 1.75;
}

.about-text a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.about-text a:hover { border-color: var(--accent); }
.about-text .btn { color: #000; border-bottom: 0; }
html[data-theme="light"] .about-text .btn { color: #fff; }

.about-contact {
  margin-top: 4rem;
  padding: 3rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.about-contact h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.about-contact p {
  color: var(--text-soft);
  line-height: 1.7;
  max-width: 36rem;
  font-size: 1rem;
  margin: 0;
}

.contact-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ── Detail pages ─────────────────────────────────────────── */
.back-btn {
  position: sticky;
  top: 76px;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: -2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  z-index: 90;
  transition: border-color 0.15s, transform 0.15s;
}

.back-btn:hover {
  border-color: var(--text);
  transform: translateX(-2px);
}

.detail-page {
  max-width: 860px;
  margin: 0 auto;
}

.detail-hero { margin-bottom: 3.5rem; }

.detail-tag {
  display: inline-block;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  margin-bottom: 1.25rem;
}

.detail-hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}

.detail-title-link {
  color: inherit;
  border-bottom: 0.06em solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.detail-title-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.detail-subtitle {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 38rem;
  line-height: 1.65;
  font-weight: 300;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  margin-top: 1.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.detail-meta span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.detail-section { margin: 3rem 0; }

.detail-section h2 {
  font-size: 1.75rem;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.detail-section p {
  color: var(--text-soft);
  margin-bottom: 1rem;
}

.detail-section p:last-child { margin-bottom: 0; }

.detail-section p.muted { color: var(--muted); font-size: 0.95rem; }

.detail-section a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.detail-section a:hover { border-color: var(--accent); }

.ascension-course-thumbnail {
  display: block;
  width: min(100%, 44rem);
  margin: 0 auto 1rem;
  overflow: hidden;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm);
}

.ascension-course-thumbnail:hover {
  border-color: var(--accent) !important;
}

.ascension-course-thumbnail img {
  display: block;
  width: 100%;
  transition: transform 0.35s ease;
}

.ascension-course-thumbnail:hover img {
  transform: scale(1.02);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* Pipeline steps */
.pipeline {
  display: block;
  counter-reset: pipeline-step;
  margin: 2rem 0 2.2rem;
  max-width: 52rem;
}

.pipeline > :is(.pipeline-card, .pipeline-step) {
  position: relative;
  min-height: 6.2rem;
  padding: 0.05rem 0 2.15rem 5.4rem;
  counter-increment: pipeline-step;
}

.pipeline > :is(.pipeline-card, .pipeline-step):not(:last-child)::before {
  content: '';
  position: absolute;
  left: 1.36rem;
  top: 2.75rem;
  bottom: -0.15rem;
  width: 0.2rem;
  background: var(--text);
  border-radius: 999px;
}

.pipeline > :is(.pipeline-card, .pipeline-step)::after {
  content: counter(pipeline-step, decimal-leading-zero);
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  width: 3.1rem;
  height: 3.1rem;
  display: grid;
  place-items: center;
  border: 0.2rem solid var(--text);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.pipeline > :is(.pipeline-card, .pipeline-step) .step-num {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.pipeline > :is(.pipeline-card, .pipeline-step) h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.pipeline > :is(.pipeline-card, .pipeline-step) p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* Equation blocks */
.equation-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  margin: 1.5rem 0;
  letter-spacing: 0;
  line-height: 1.6;
  color: var(--text);
  overflow-x: auto;
}

.equation-block .label {
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.equation-block .math-display {
  min-width: max-content;
}

.equation-block .katex {
  color: var(--text);
  font-size: 1.08rem;
}

.equation-block .katex-display {
  margin: 0;
  text-align: left;
}

/* Highlight box */
.highlight-box {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.1rem 1.4rem;
  margin: 1.5rem 0;
}

.highlight-box p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.feature-item {
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feature-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.feature-item p {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* Tech chips */
.tech-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Detail media */
.detail-media {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin: 1.75rem 0;
}

.detail-media figure {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.detail-media img,
.detail-media video {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  display: block;
  border: 1px solid var(--border);
  background: var(--surface);
}

.detail-media img { cursor: zoom-in; }

.detail-media figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.detail-media video.vertical-video {
  max-height: 78vh;
  width: auto;
  max-width: 100%;
  margin-inline: auto;
}

.media-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.media-pair img,
.detail-media .media-pair img {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: 4/3;
  object-fit: contain;
}

.style-transfer-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: center;
}

.style-transfer-pair img,
.style-transfer-pair video,
.detail-media .style-transfer-pair img,
.detail-media .style-transfer-pair video {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: none;
  object-fit: contain;
}

.media-heading {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  margin: 2rem 0 0.25rem;
}

/* ── Media gallery (slideshow) ────────────────────────────── */
.media-gallery {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #050505;
}

.media-gallery-track {
  display: flex;
  transition: transform 0.25s ease;
}

.media-gallery-slide {
  flex: 0 0 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16/9;
}

.media-gallery .media-gallery-slide img,
.media-gallery .media-gallery-slide video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  display: block;
  border: 0;
  border-radius: 0;
  background: none;
  cursor: zoom-in;
}

.media-gallery-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.72);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 1;
  transition: border-color 0.15s;
}

.media-gallery-control:hover { border-color: #fff; }

.media-gallery-prev { left: 0.75rem; }
.media-gallery-next { right: 0.75rem; }

.media-gallery-counter {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: rgba(10, 10, 10, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.8);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* ── Image comparison slider ──────────────────────────────── */
.image-comparison {
  --comparison-position: 50%;
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #050505;
}

.image-comparison > img,
.image-comparison > video,
.detail-media .image-comparison > img,
.detail-media .image-comparison > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  display: block;
  border: 0;
  border-radius: 0;
  background: none;
  cursor: ew-resize;
  user-select: none;
  pointer-events: none;
}

.image-comparison-after {
  clip-path: inset(0 0 0 var(--comparison-position));
}

.image-comparison-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--comparison-position);
  width: 2px;
  background: #fff;
  transform: translateX(-1px);
  pointer-events: none;
  z-index: 2;
}

.image-comparison-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.8);
  transform: translate(-50%, -50%);
}

.image-comparison-handle::before,
.image-comparison-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
}

.image-comparison-handle::before {
  left: 0.6rem;
  transform: translateY(-50%) rotate(-45deg);
}

.image-comparison-handle::after {
  right: 0.6rem;
  transform: translateY(-50%) rotate(135deg);
}

.image-comparison-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 3;
}

.image-comparison:focus-within { border-color: var(--muted); }

.image-comparison-label {
  position: absolute;
  top: 0.75rem;
  padding: 0.2rem 0.55rem;
  background: rgba(10, 10, 10, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  pointer-events: none;
  z-index: 2;
}

.image-comparison-label-before { left: 0.75rem; }
.image-comparison-label-after { right: 0.75rem; }

/* ── Full-screen image zoom ───────────────────────────────── */
.image-zoom-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.94);
  cursor: zoom-out;
}

.image-zoom-backdrop.open { display: flex; }

.image-zoom-backdrop img {
  max-width: calc(100vw - 4rem);
  max-height: calc(100vh - 4rem);
  object-fit: contain;
  display: block;
}

/* ── Tools ────────────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--muted);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.tool-card-icon pre {
  display: inline-block;
  min-width: 4.5em;
  min-height: 2.4em;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--accent);
  margin-bottom: 0.25rem;
  white-space: pre;
}

.tool-card h3 { font-size: 1.35rem; }

.tool-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.tool-card .tech-strip { margin: 0; }

.tool-page {
  max-width: 1100px;
  margin: 0 auto;
}

.tool-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  align-items: stretch;
}

.tool-controls {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* The preview locks to the viewport while the (taller) settings column
   scrolls; exported results flow below it in the document */
.tool-sticky {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  z-index: 5;
  background: var(--bg);
  padding-bottom: 0.5rem;
}

.tool-sticky.is-sticky {
  position: sticky;
  top: 76px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.control-group > label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.control-value {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-soft);
}

.control-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.control-upload { text-align: center; cursor: pointer; }

.tool-controls select,
.tool-controls .control-text {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tool-controls select:focus,
.tool-controls .control-text:focus {
  outline: none;
  border-color: var(--muted);
}

.tool-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.control-row input[type="color"] {
  width: 3rem;
  height: 1.75rem;
  padding: 0.15rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.control-toggle {
  width: 100%;
  padding: 0.55rem 1rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.control-toggle:hover { border-color: var(--text); }

.control-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

html[data-theme="light"] .control-toggle[aria-pressed="true"] { color: #fff; }

.control-checkbox {
  cursor: pointer;
  user-select: none;
}

.control-checkbox input {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.control-label-strong {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.control-select-sm {
  max-width: 7rem;
}

.tool-controls input[type="range"]:disabled {
  opacity: 0.35;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}

.video-result {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.video-result video {
  width: 100%;
  border: 1px solid var(--border);
  background: #000;
}

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

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 5rem 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.dropzone p { max-width: 26rem; font-size: 0.9rem; }

.tool-result {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1; /* fill the output column so the sticky preview stays pinned
              for the entire length of the settings column */
}

.sdf-canvas-wrap {
  position: relative;
  align-self: flex-start;
  max-width: 100%;
  line-height: 0;
}

#sdf-canvas {
  display: block;
  max-width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
}

#sdf-selection-overlay {
  position: absolute;
  inset: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.22s ease;
}

#sdf-selection-overlay.is-empty {
  opacity: 0;
}

#ascii-canvas {
  display: block;
  max-width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Checkerboard behind the canvas when transparent background is on */
#ascii-canvas.checker {
  background: repeating-conic-gradient(#3a3a3a 0% 25%, #565656 0% 50%) 0 0 / 16px 16px;
}

html[data-theme="light"] #ascii-canvas.checker {
  background: repeating-conic-gradient(#d8d8d8 0% 25%, #f2f2f2 0% 50%) 0 0 / 16px 16px;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tool-actions .btn { cursor: pointer; border: 0; font-family: var(--font); }

/* ── Inline SVG diagrams (detail pages) ───────────────────── */
.arap-diagram {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 0.75rem;
}

.arap-diagram text { font-family: var(--font); }

/* ── Deep-dive dropdowns (detail pages) ───────────────────── */
.deep-dive {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 0.75rem;
}

.deep-dive summary {
  cursor: pointer;
  padding: 0.95rem 1.15rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: color 0.15s;
}

.deep-dive summary::-webkit-details-marker { display: none; }

.deep-dive summary::after {
  content: '+';
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.deep-dive[open] summary::after { transform: rotate(45deg); }

.deep-dive summary:hover { color: var(--text); }

.deep-dive-body {
  padding: 0.15rem 1.15rem 1.15rem;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.deep-dive-body p { margin-bottom: 0.85rem; }
.deep-dive-body p:last-child { margin-bottom: 0; }
.deep-dive-body .equation-block { margin: 1rem 0; }

.ascii-text-details summary {
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.ascii-text-details summary:hover { color: var(--text); }

.ascii-text-details pre {
  margin-top: 0.75rem;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 60vh;
}

/* ── Scroll reveal ────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ── Page-open animations ─────────────────────────────────── */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@keyframes hero-scroll-enter {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.page-header,
.detail-hero,
.hero-inner,
.tool-layout,
.about-layout,
.video-section {
  animation: page-enter 0.55s ease both;
}

.hero-scroll { animation: hero-scroll-enter 0.55s ease 0.35s both; }

/* Grids stagger in: the first rows cascade, the rest (below the fold)
   share one delay so they're ready by the time they're scrolled to */
.gallery-grid .gallery-item,
.project-list .project-row,
.tools-grid .tool-card {
  animation: page-enter 0.5s ease 0.3s both;
}

.gallery-grid .gallery-item:nth-child(1),
.project-list .project-row:nth-child(1),
.tools-grid .tool-card:nth-child(1) { animation-delay: 0.05s; }
.gallery-grid .gallery-item:nth-child(2),
.project-list .project-row:nth-child(2),
.tools-grid .tool-card:nth-child(2) { animation-delay: 0.1s; }
.gallery-grid .gallery-item:nth-child(3),
.project-list .project-row:nth-child(3),
.tools-grid .tool-card:nth-child(3) { animation-delay: 0.15s; }
.gallery-grid .gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-grid .gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-grid .gallery-item:nth-child(6) { animation-delay: 0.3s; }

.detail-page > .detail-media:first-of-type,
.detail-page > .detail-section:first-of-type {
  animation: page-enter 0.55s ease 0.15s both;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .landing-hero-video { transition: none; }
  .hero-scroll svg { animation: none; }
  html { scroll-behavior: auto; }
  .page-header, .detail-hero, .hero-inner, .tool-layout, .about-layout,
  .video-section, .hero-scroll,
  .gallery-grid .gallery-item, .project-list .project-row,
  .tools-grid .tool-card,
  .detail-page > .detail-media:first-of-type,
  .detail-page > .detail-section:first-of-type {
    animation: none;
  }

  .landing-first-visit .landing-hero .hero-eyebrow,
  .landing-first-visit .landing-hero h1,
  .landing-first-visit .landing-hero .subtitle,
  .landing-first-visit .landing-hero .hero-links .btn {
    animation: none;
  }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .back-btn { margin-bottom: 1.5rem; }
}

/* The tool page is wider than article pages, so the floating back
   button would overlap its hero — keep it in flow there instead */
.back-btn:has(+ .tool-page) { margin-bottom: 1.5rem; }

@media (max-width: 900px) {
  .feature-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-layout { grid-template-columns: 1fr; }
  .tool-sticky { position: static; }

  /* Collapse the page links into a hamburger dropdown */
  .nav-toggle { display: flex; }
  .nav-right { gap: 0.6rem; }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 2rem;
    flex-direction: column;
    gap: 0;
    min-width: 190px;
    padding: 0.4rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  }

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

  .nav-links li { width: 100%; }

  .nav-links a {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    border-bottom: none;
  }

  .nav-links a:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--text) 8%, transparent);
  }

  .nav-links a.active {
    color: var(--accent);
    border-bottom: none;
  }
}

@media (max-width: 700px) {
  .about-layout { grid-template-columns: 1fr; gap: 2rem; }
  .about-photo { max-width: 240px; }
  .project-row { grid-template-columns: 1fr; }
  .project-thumb { aspect-ratio: 16/9; height: auto; }
  .highlight-grid { grid-template-columns: 1fr; }
  .highlight-card,
  .highlight-card-wide { grid-column: span 1; aspect-ratio: 16/10; }
  .explore-grid { grid-template-columns: 1fr; }
  .home-section { padding-top: 3.5rem; }
  .section-heading { flex-direction: column; gap: 0.5rem; }
  .pipeline { max-width: 100%; }
  .pipeline > :is(.pipeline-card, .pipeline-step) {
    min-height: 5.6rem;
    padding-left: 4.25rem;
  }
  .pipeline > :is(.pipeline-card, .pipeline-step):not(:last-child)::before {
    left: 1.12rem;
    top: 2.35rem;
    width: 0.34rem;
  }
  .pipeline > :is(.pipeline-card, .pipeline-step)::after {
    width: 2.6rem;
    height: 2.6rem;
    border-width: 0.2rem;
    font-size: 0.38rem;
  }
  .media-pair,
  .style-transfer-pair { grid-template-columns: 1fr; }
  .detail-hero { margin-bottom: 2.5rem; }
  .detail-section { margin: 2.25rem 0; }
  .divider { margin: 2.25rem 0; }
  .container { padding: 2.5rem 1.25rem; }
  .landing-hero {
    margin-top: -2.5rem;
    padding: 2.5rem 1.25rem;
  }
  .landing-hero-credit {
    right: 1.25rem;
    bottom: 1.25rem;
    max-width: calc(50vw - 2rem);
  }
}

@media (max-width: 480px) {
  .image-zoom-backdrop { padding: 1rem; }
  .image-zoom-backdrop img {
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
  }
}
