/* =========================================================
   Noah O'Sullivan — Portfolio
   Design system: dark, minimal, high-contrast, gallery-like
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

@font-face {
  font-family: 'Romland';
  src: url('../fonts/Romland.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rijusans Italic';
  src: url('../fonts/RijusansItalic.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000;
  --bg-raised: #121214;
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #f4f4f2;
  --text-dim: rgba(244, 244, 242, 0.62);
  --text-faint: rgba(244, 244, 242, 0.36);
  --accent: #6e8ba3;      /* dark chrome blue — used sparingly */
  --accent-dim: #435a6b;

  --font-display: 'Romland', 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-prose: 'Rijusans Italic', 'Inter', 'Helvetica Neue', Arial, sans-serif;

  --container: 1280px;
  --gutter: clamp(24px, 5vw, 64px);
  --nav-h: 84px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

::selection { background: var(--accent); color: #000; }

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-prose);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* ---------- Nav ---------- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(0, 0, 0,0.85), rgba(0, 0, 0,0));
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease), background 0.4s var(--ease);
}
.site-nav.is-scrolled {
  background: rgba(0, 0, 0, 0.92);
  border-bottom: 1px solid var(--line);
}
.site-nav .wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex;
  gap: clamp(20px, 3vw, 44px);
  list-style: none;
  margin: 0; padding: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  font-family: var(--font-display);
}
.nav-links a {
  position: relative;
  color: var(--text-dim);
  padding: 6px 0;
  transition: color 0.25s var(--ease);
}
.nav-links a:hover, .nav-links a.is-active { color: var(--text); }
.nav-links a.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
  }
  .nav-links.is-open { max-height: 400px; }
  .nav-links li { border-top: 1px solid var(--line-soft); width: 100%; }
  .nav-links a { display: block; padding: 18px var(--gutter); }
  .nav-toggle { display: block; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding-top: var(--nav-h);
}
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.hero-media-fallback {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #16161a, #000 70%);
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0,0.1) 0%, rgba(0, 0, 0,0.8) 78%),
    linear-gradient(to bottom, rgba(0, 0, 0,0.35) 0%, rgba(0, 0, 0,0) 30%, rgba(0, 0, 0,0.1) 60%, var(--bg) 100%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
  padding-bottom: clamp(48px, 8vw, 96px);
}
.hero-kicker {
  margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(30px, 5.2vw, 68px);
  max-width: 16ch;
}
.hero-title em {
  font-style: normal;
  color: var(--accent);
}
.hero-sub {
  margin-top: 24px;
  max-width: 46ch;
  font-size: clamp(15px, 1.6vw, 19px);
  color: var(--text-dim);
  font-family: var(--font-prose);
  font-weight: 300;
}
.hero-meta {
  margin-top: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: center;
}
.scroll-hint {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Fixed scroll rail (right edge) ---------- */
.scroll-rail {
  position: fixed;
  right: clamp(14px, 2.6vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}
.scroll-rail-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  writing-mode: vertical-rl;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  opacity: 1;
  transition: opacity 0.5s var(--ease);
}
.scroll-rail-hint.is-hidden { opacity: 0; }
.scroll-rail-arrow {
  color: var(--accent);
  animation: railBounce 1.8s ease-in-out infinite;
}
@keyframes railBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}
.scroll-rail-track {
  position: relative;
  width: 2px;
  height: 96px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}
.scroll-rail-fill {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.12s linear;
}
@media (max-width: 780px) {
  .scroll-rail { display: none; }
}

@media (max-width: 640px) {
  .hero { min-height: 90svh; }
  .hero-video { object-position: 60% center; }
}

/* ---------- Sections ---------- */
section { position: relative; }
section[id] { scroll-margin-top: var(--nav-h); }
.section {
  padding: clamp(72px, 10vw, 140px) 0;
}
.section-alt { background: var(--bg-raised); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: clamp(36px, 5vw, 64px);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 28px;
}
.section-head h2 {
  font-size: clamp(28px, 4vw, 44px);
}
.section-head .section-note {
  font-size: 14px;
  color: var(--text-faint);
  max-width: 32ch;
  text-align: right;
  font-family: var(--font-prose);
}
@media (max-width: 640px) {
  .section-head { flex-direction: column; align-items: flex-start; }
  .section-head .section-note { text-align: left; }
}

.personal-head {
  align-items: center;
  margin-bottom: clamp(16px, 2vw, 28px);
  padding-bottom: 16px;
}
.personal-head-media {
  width: clamp(160px, 26vw, 320px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: #000;
  flex-shrink: 0;
}
.personal-head-video { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 640px) {
  .personal-head-media { width: clamp(140px, 40vw, 220px); }
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), gap 0.25s var(--ease);
}
.link-arrow:hover { color: var(--text); border-color: var(--accent); gap: 12px; }

/* ---------- Project grid ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
@media (max-width: 760px) { .project-grid { grid-template-columns: 1fr; } }

.project-card {
  position: relative;
  background: var(--bg);
  padding: 0;
  display: block;
  overflow: hidden;
}
.project-card .media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #16161a, #000 70%);
}
.project-card .media::after {
  content: attr(data-tag);
  position: absolute;
  top: 18px; left: 18px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0,0.6);
}
.media-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: color 0.35s var(--ease), transform 0.6s var(--ease);
}
.project-card:hover .media-glyph { color: var(--accent); transform: scale(1.08); }
.project-card:hover .media { }
.media-glyph svg { width: 44px; height: 44px; }

.project-card .card-body {
  padding: 22px 24px 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-top: 1px solid var(--line-soft);
}
.project-card h3 {
  font-size: 19px;
  font-weight: 500;
}
.project-card .card-meta {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 8px;
  letter-spacing: 0.02em;
}
.project-card .card-index {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- Project editorial rows (University Projects) ---------- */
.proj-row {
  display: grid;
  grid-template-columns: 55fr 45fr;
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(48px, 6vw, 76px) 0;
  border-top: 1px solid var(--line-soft);
}
.proj-row:last-child { padding-bottom: 0; }
.proj-row:nth-of-type(even) { grid-template-columns: 45fr 55fr; }
.proj-row:nth-of-type(even) .proj-media { order: 2; }
.proj-row:nth-of-type(even) .proj-body { order: 1; }
@media (max-width: 860px) {
  .proj-row,
  .proj-row:nth-of-type(even) { grid-template-columns: 1fr; }
  .proj-row:nth-of-type(even) .proj-media,
  .proj-row:nth-of-type(even) .proj-body { order: initial; }
}

.proj-media {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #16161a, #000 70%);
  display: block;
}
.proj-media video, .proj-media img { width: 100%; height: 100%; object-fit: cover; }
.proj-media .media-glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-faint); transition: color 0.35s var(--ease), transform 0.5s var(--ease); }
.proj-media .media-glyph svg { width: 40px; height: 40px; }
.proj-row:hover .proj-media .media-glyph { color: var(--accent); transform: scale(1.06); }
.proj-media .media-tag {
  position: absolute;
  top: 16px; left: 16px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0,0.65);
}

.proj-body { display: flex; flex-direction: column; }
.proj-kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
  font-family: var(--font-prose);
}
.proj-title {
  font-size: clamp(24px, 3vw, 34px);
  transition: color 0.25s var(--ease);
}
.proj-row a.proj-title-link:hover .proj-title { color: var(--accent); }
.proj-desc {
  margin-top: 16px;
  font-size: 15.5px;
  font-family: var(--font-prose);
  color: var(--text-dim);
  max-width: 60ch;
}
.proj-quote {
  margin: 20px 0 0;
  padding-left: 18px;
  border-left: 2px solid var(--accent);
  font-style: italic;
  font-size: 14.5px;
  color: var(--text-dim);
  max-width: 52ch;
}
.proj-quote cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}
.proj-row .tag-row { margin-top: 22px; }
.proj-row .link-arrow { margin-top: 24px; }

/* ---------- Personal work — 3D panel carousel ---------- */
.personal-gallery {
  position: relative;
  margin-top: 8px;
  width: 100%;
  height: clamp(420px, 46vw, 620px);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #000;
}
.personal-gallery canvas { display: block; width: 100%; height: 100%; }

.gallery-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 32px 24px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0,0.94) 0%, rgba(0, 0, 0,0.55) 55%, transparent 100%);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  pointer-events: none;
}
.personal-gallery.is-hovering .gallery-caption { opacity: 1; transform: translateY(0); }
.gallery-caption-title { font-size: 16px; font-weight: 500; color: var(--text); }
.gallery-caption-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; }
.gallery-caption-hint {
  margin-top: 9px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.media-note {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.gallery-hint-static {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* No-WebGL fallback: plain clickable thumbnail grid */
.gallery-fallback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}
.gallery-fallback-card {
  position: relative;
  display: block;
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.gallery-fallback-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-fallback-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 12px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0,0.9) 0%, transparent 100%);
}
.gallery-fallback-caption h3 { font-size: 13px; font-weight: 500; color: var(--text); }
.gallery-fallback-caption .card-sub { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

@media (max-width: 640px) {
  .personal-gallery { height: clamp(340px, 82vw, 460px); }
}

/* ---------- About / bio ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
}
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .about-grid { display: flex; flex-direction: column; }
  .about-grid .bio-text { display: contents; }
  .about-grid .bio-text-intro { order: 1; }
  .about-grid .about-media { order: 2; margin: clamp(24px, 5vw, 40px) 0; }
  .about-grid .bio-text-details { order: 3; }
}

.portrait-frame {
  aspect-ratio: 3/4;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #16161a, #000 70%);
  border: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}
.portrait-frame.is-live { padding: 0; overflow: hidden; background: #000; }
.portrait-embed { width: 100%; height: 100%; border: 0; display: block; background: #000; }

.about-media { display: flex; flex-direction: column; gap: clamp(16px, 2.4vw, 28px); }
.typo-loop {
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: #000;
}
.typo-loop-video { width: 100%; height: 100%; object-fit: cover; display: block; }

.grid-showcase {
  margin-top: clamp(56px, 8vw, 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.grid-showcase-media {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: #000;
}
.grid-showcase-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid-showcase-note { width: 100%; max-width: 1100px; }

.laser-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 32px);
}
.laser-item { display: flex; flex-direction: column; }
.laser-media {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: #000;
}
.laser-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.laser-item .media-note { margin-top: 12px; text-align: center; }
@media (max-width: 860px) {
  .laser-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .laser-grid { grid-template-columns: 1fr; max-width: 420px; margin-left: auto; margin-right: auto; }
}

.mirror-row {
  margin: clamp(20px, 3vw, 32px) auto 0;
  max-width: 1100px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2.4vw, 28px);
}
.mirror-item { min-width: 0; }
.mirror-video-box {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: #000;
}
.mirror-video { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 640px) { .mirror-row { grid-template-columns: 1fr; } }

.bio-text p { font-size: 16px; color: var(--text-dim); margin: 0 0 20px; max-width: 62ch; font-family: var(--font-prose); }
.bio-text p:first-child { font-size: 19px; color: var(--text); font-weight: 300; }

.fact-grid {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 32px;
  border-top: 1px solid var(--line-soft);
  padding-top: 32px;
}
.fact-grid dt {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
  font-family: var(--font-prose);
}
.fact-grid dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.6;
  font-family: var(--font-prose);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 40px;
  border-top: 1px solid var(--line-soft);
  padding-top: 28px;
}
.skills-grid dt {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
  font-family: var(--font-prose);
}
.skills-grid dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.6;
  font-family: var(--font-prose);
}
@media (max-width: 480px) { .skills-grid { grid-template-columns: 1fr; } }

.tag-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.tag {
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 7px 13px;
  border-radius: 999px;
}

/* ---------- Case study ---------- */
.cs-hero {
  padding-top: calc(var(--nav-h) + 56px);
  padding-bottom: 40px;
}
.cs-kicker { display: flex; margin-bottom: 22px; }
.cs-title { font-size: clamp(34px, 6vw, 68px); max-width: 20ch; }
.cs-lede { margin-top: 20px; font-size: clamp(15px, 1.5vw, 18px); color: var(--text-dim); max-width: 60ch; font-family: var(--font-prose); }
.cs-statement {
  margin: 16px auto 0;
  max-width: 42ch;
  text-align: center;
  font-weight: 700;
  font-size: clamp(19px, 2.6vw, 29px);
  line-height: 1.45;
  color: var(--text);
  font-family: var(--font-prose);
}
.cs-topic-head {
  margin-top: clamp(40px, 6vw, 64px);
  text-align: center;
}
.cs-topic-label {
  font-family: var(--font-prose);
  font-weight: 700;
  font-size: clamp(17px, 1.8vw, 20px);
  color: var(--text);
}

.cs-meta-bar {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}
@media (max-width: 900px) { .cs-meta-bar { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .cs-meta-bar { grid-template-columns: repeat(2, 1fr); } }
.cs-meta-bar dt { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; font-family: var(--font-prose); }
.cs-meta-bar dd { margin: 0; font-size: 14px; color: var(--text-dim); font-family: var(--font-prose); }

.media-block {
  margin: 0 0 clamp(48px, 6vw, 88px);
  aspect-ratio: 16/9;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #16161a, #000 70%);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-faint);
  text-align: center;
  padding: 24px;
}
.media-block.is-tall { aspect-ratio: 4/5; }
.media-block.is-panorama { aspect-ratio: 21/9; }
.media-block .label { font-size: 12.5px; letter-spacing: 0.04em; max-width: 40ch; }

.triptych-block { margin: 0 0 clamp(24px, 4vw, 40px); }
.triptych {
  display: flex;
  gap: 2px;
  background: #000;
}
.triptych-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.triptych-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  margin-bottom: 10px;
}
.triptych-video {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: #000;
  border: 1px solid var(--line-soft);
}
@media (max-width: 760px) {
  .triptych { flex-direction: column; gap: 24px; }
}
.media-block video, .media-block img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Audio player ---------- */
.audio-bar-player {
  display: flex;
  align-items: center;
  gap: 18px;
}
.audio-bar-btn {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.25s var(--ease);
}
.audio-bar-btn:hover { color: var(--text); }
.audio-bar-btn svg { width: 16px; height: 16px; }
.audio-bar-btn .icon-pause { display: none; }
.audio-bar-player.is-playing .icon-play { display: none; }
.audio-bar-player.is-playing .icon-pause { display: block; }

.audio-bar-time {
  flex: none;
  font-family: var(--font-prose);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
}
.audio-bar-duration { text-align: right; }

.audio-bar-track {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
}
.audio-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 5px;
  transition: width 0.2s ease-out;
}
.audio-bar-player.is-seeking .audio-bar-fill { transition: none; }

@media (max-width: 560px) {
  .audio-bar-player { flex-wrap: wrap; gap: 12px 18px; }
  .audio-bar-track { order: 3; flex-basis: 100%; }
}

.cs-caption {
  margin: -32px 0 clamp(48px, 6vw, 88px);
  font-size: 13px;
  font-style: italic;
  color: var(--text-faint);
  max-width: 60ch;
}

.cs-quote {
  margin: 0 0 clamp(48px, 6vw, 88px);
  padding: 32px clamp(24px, 4vw, 48px);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(18px, 2.2vw, 24px);
  color: var(--text);
  max-width: 64ch;
}
.cs-quote cite {
  display: block;
  margin-top: 14px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 13px;
  color: var(--text-faint);
}

/* ---------- Personal project module page (lightweight) ---------- */
.module-meta {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.module-meta div dt { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; font-family: var(--font-prose); }
.module-meta div dd { margin: 0; font-size: 14px; color: var(--text-dim); font-family: var(--font-prose); }
.module-media {
  margin: clamp(40px, 6vw, 64px) auto 0;
  max-width: 560px;
  aspect-ratio: 3/4;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #16161a, #000 70%);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-faint);
  text-align: center;
  padding: 24px;
}
.module-media video, .module-media img { width: 100%; height: 100%; object-fit: cover; }
.module-media.is-landscape {
  max-width: 860px;
  aspect-ratio: 16/9;
  padding: 0;
}
.module-media.is-landscape video { object-fit: contain; background: #000; }
.module-media.is-portrait {
  max-width: 420px;
  aspect-ratio: 9/16;
  padding: 0;
}
.module-media.is-portrait video { object-fit: contain; background: #000; }
.module-caption {
  max-width: 56ch;
  margin: 24px auto 0;
  font-size: 14.5px;
  color: var(--text-dim);
  text-align: center;
  font-family: var(--font-prose);
}

.media-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2vw, 28px);
}
@media (max-width: 700px) { .media-pair { grid-template-columns: 1fr; } }

.cs-subhead {
  padding-top: clamp(40px, 6vw, 64px);
  border-top: 1px solid var(--line-soft);
  margin-bottom: 28px;
}
.cs-subhead h3 { font-size: clamp(20px, 2.4vw, 26px); }
.cs-subnote {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--text-faint);
  max-width: 60ch;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(24px, 3vw, 36px);
  margin: 0 0 clamp(48px, 6vw, 88px);
}
.stage-item { display: flex; flex-direction: column; }
.stage-item .media-block { margin-bottom: 0; }
.stage-item:nth-child(1) { grid-column: 1 / 7; }
.stage-item:nth-child(2) { grid-column: 3 / 9; }
.stage-item:nth-child(3) { grid-column: 5 / 11; }
.stage-item:nth-child(4) { grid-column: 7 / 13; }
.stage-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.stage-caption {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  max-width: 44ch;
}
.stage-credit {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}
@media (max-width: 900px) {
  .stage-grid { grid-template-columns: 1fr; }
  .stage-item:nth-child(1),
  .stage-item:nth-child(2),
  .stage-item:nth-child(3),
  .stage-item:nth-child(4) { grid-column: auto; }
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(20px, 3vw, 28px);
  align-items: start;
  margin: 0 0 clamp(48px, 6vw, 88px);
}
.process-grid .media-block { margin-bottom: 0; }
.proc-hero { grid-column: span 6; }
.proc-half { grid-column: span 3; }
.proc-portrait { grid-column: span 2; }
.proc-wide { grid-column: span 4; }
.proc-full { grid-column: span 6; }
@media (max-width: 900px) {
  .process-grid { grid-template-columns: repeat(2, 1fr); }
  .proc-hero, .proc-full { grid-column: span 2; }
  .proc-half, .proc-portrait, .proc-wide { grid-column: span 1; }
}
@media (max-width: 560px) {
  .process-grid { grid-template-columns: 1fr; }
  .proc-hero, .proc-half, .proc-portrait, .proc-wide, .proc-full { grid-column: span 1; }
}
.proc-caption { margin-top: 12px; font-size: 12.5px; color: var(--text-dim); max-width: 60ch; }
.proc-credit { margin: 0 0 8px; font-size: 11px; color: var(--text-faint); }
.proc-caption-link { color: var(--accent-dim); text-decoration: underline; text-underline-offset: 2px; }
.proc-caption-link:hover { color: var(--accent); }

.cs-copy { max-width: 68ch; }
.cs-copy h3 {
  font-size: clamp(20px, 2.4vw, 26px);
  margin-bottom: 18px;
}
.cs-copy p { color: var(--text-dim); font-size: 16px; margin: 0 0 18px; font-family: var(--font-prose); }
.cs-copy ul { color: var(--text-dim); font-size: 16px; padding-left: 20px; margin: 0 0 18px; font-family: var(--font-prose); }
.cs-copy li { margin-bottom: 8px; }

.cs-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(40px, 6vw, 64px) 0;
  border-top: 1px solid var(--line-soft);
}
@media (max-width: 700px) { .cs-row { grid-template-columns: 1fr; gap: 18px; } }

.project-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 28px;
  padding: clamp(40px, 7vw, 80px) 0;
  border-top: 1px solid var(--line);
}
.project-nav-link { display: flex; align-items: center; gap: 20px; }
.project-nav-link .eyebrow { margin-bottom: 14px; }
.project-nav-link h3 { font-size: clamp(22px, 4vw, 36px); }
.project-nav-link .arrow-circle {
  width: 56px; height: 56px; flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.prev-project:hover .arrow-circle { transform: translateX(-6px); border-color: var(--accent); color: var(--accent); }
.next-project:hover .arrow-circle { transform: translateX(6px); border-color: var(--accent); color: var(--accent); }
@media (max-width: 640px) {
  .project-nav { flex-direction: column; align-items: stretch; gap: 28px; }
}

/* Standalone "Next project" link used on the case-study pages (Terraforms, Fractured Eden, Virtual Environment Design) — scoped to .wrap so it never collides with the prev/next pair (.project-nav-link.next-project) on personal project pages */
a.wrap.next-project {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 32px;
  padding: clamp(48px, 8vw, 96px) 0;
  border-top: 1px solid var(--line);
  text-align: right;
}
a.wrap.next-project > div { display: flex; flex-direction: column; align-items: flex-end; }
a.wrap.next-project .eyebrow { margin-bottom: 16px; font-size: 14px; }
a.wrap.next-project h3 { font-size: clamp(30px, 6vw, 64px); }
a.wrap.next-project .arrow-circle {
  width: clamp(64px, 8vw, 96px);
  height: clamp(64px, 8vw, 96px);
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
a.wrap.next-project .arrow-circle svg { width: 28px; height: 28px; }
@media (max-width: 640px) {
  a.wrap.next-project { justify-content: center; text-align: center; }
  a.wrap.next-project > div { align-items: center; }
}

/* ---------- Contact ---------- */
.contact-hero { padding-top: calc(var(--nav-h) + 80px); }
.contact-title { font-size: clamp(36px, 7vw, 88px); max-width: 18ch; }
.contact-links {
  margin-top: 56px;
  border-top: 1px solid var(--line);
}
.contact-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: padding-left 0.3s var(--ease);
}
.contact-link-row:hover { padding-left: 12px; }
.contact-link-row .label { font-size: 13px; color: var(--text-faint); letter-spacing: 0.08em; text-transform: uppercase; }
.contact-link-row .value { font-family: var(--font-display); font-size: clamp(18px, 2.6vw, 28px); }
.contact-link-row .arrow { color: var(--text-faint); transition: transform 0.3s var(--ease), color 0.3s var(--ease); }
.contact-link-row:hover .arrow { color: var(--accent); transform: translateX(6px) translateY(-6px); }

/* ---------- Footer CTA ---------- */
.footer-cta {
  border-top: 1px solid var(--line);
  padding: clamp(64px, 10vw, 120px) 0;
}
.footer-cta a.cta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.footer-cta h2 {
  font-size: clamp(40px, 8vw, 96px);
  transition: color 0.3s var(--ease);
}
.footer-cta .arrow-circle {
  width: clamp(56px, 8vw, 96px);
  height: clamp(56px, 8vw, 96px);
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease), background 0.3s var(--ease);
}
.footer-cta a.cta-row:hover .arrow-circle {
  transform: translateX(8px) translateY(-8px);
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}
.footer-cta a.cta-row:hover h2 { color: var(--accent); }
.footer-cta .eyebrow { margin-bottom: 20px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 40px 0;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; }
.footer-links a { font-size: 13px; color: var(--text-faint); transition: color 0.25s; }
.footer-links a:hover { color: var(--text); }
.footer-note { font-size: 12.5px; color: var(--text-faint); }

/* ---------- Reveal-on-scroll ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  border: 1px solid var(--text);
  font-size: 13.5px;
  letter-spacing: 0.03em;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #000; }

.note-banner {
  background: rgba(56,225,255,0.06);
  border: 1px dashed rgba(56,225,255,0.4);
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 28px;
  line-height: 1.6;
}
.note-banner strong { color: var(--accent); }

/* ---------- Site Preloader ---------- */
.site-preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  transition: opacity 0.6s var(--ease), visibility 0.6s var(--ease);
}
.site-preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.preloader-bar-track {
  width: min(260px, 60vw);
  height: 5px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  overflow: hidden;
}
.preloader-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease-out;
}
.preloader-percent {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
body.is-preloading { overflow: hidden; }
