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

:root {
  --page-bg:      #070605;
  --still-bg:     #0c0a08;
  --text:         #F3EDE4;
  --text-muted:   #A89F94;
  --text-dim:     #6B635A;
  --accent:       #D45E30;
  --accent-dim:   rgba(212, 94, 48, 0.18);
  --line:         rgba(243, 237, 228, 0.1);
  --line-strong:  rgba(243, 237, 228, 0.22);
  --font-serif:   'Instrument Serif', Georgia, serif;
  --font-sans:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', ui-monospace, monospace;
  --nav-h:        64px;
  --max-w:        1280px;
  --measure:      38rem;
  --pad:          clamp(1.25rem, 4vw, 3.5rem);
  color-scheme:   dark;

  /* Dimmed house map — same contract as index.html, quieter + warm. */
  --contour-rgb:      234 216 192;
  --contour-high-rgb: 212 94 48;
  --contour-alpha:    0.34;
  --shade-rgb:        90 52 28;
  --shade-alpha:      0.07;
  --atmo:
    radial-gradient(ellipse at 22% 12%, rgba(212, 94, 48, 0.07) 0%, transparent 52%),
    radial-gradient(ellipse at 78% 78%, rgba(60, 32, 16, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 40%, rgba(20, 12, 8, 0.25) 0%, transparent 70%);
  --lift: 0 1px 14px rgb(7 6 5 / 0.88);
}

html { scroll-behavior: smooth; }

body {
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

/* ── BACKGROUND LAYERS (dimmed house map) ───── */
#terrain-canvas,
.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.bg-atmosphere { background: var(--atmo); }

/* ── GRAIN ───────────────────────────────────── */
#grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  z-index: 400;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain-shift 0.45s steps(5) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -4%); }
  60%  { transform: translate(-1%, 3%); }
  80%  { transform: translate(3%, -2%); }
  100% { transform: translate(0, 0); }
}

/* ── NAV ─────────────────────────────────────── */
.studio-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  background: linear-gradient(to bottom, rgba(7, 6, 5, 0.92) 0%, rgba(7, 6, 5, 0.55) 55%, transparent 100%);
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.nav-logo em { color: var(--accent); font-style: italic; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}
.nav-links a,
.nav-back {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-back:hover { color: var(--text); }

.nav-links svg {
  width: 13px; height: 13px;
  fill: currentColor;
  margin-right: 0.35rem;
  vertical-align: -2px;
}

/* ── TYPE ────────────────────────────────────── */
.credit {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.credit-accent { color: var(--accent); }

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
}
.live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(212, 94, 48, 0.55);
  animation: live-pulse 2.2s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(212, 94, 48, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(212, 94, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 94, 48, 0); }
}

.display {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.92;
  text-shadow: var(--lift);
}

/* ── STAGE (hub first screen) ────────────────── */
.stage {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-top: var(--nav-h);
}

/* ── HERO (hub) ──────────────────────────────── */
.hero {
  flex: 0 0 auto;
  padding: 1.35rem var(--pad) 1.1rem;
  position: relative;
  z-index: 1;
}

.hero-inner {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr minmax(16rem, 22rem);
  gap: 1rem 3rem;
  align-items: end;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5.2vw, 4.1rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0.3rem 0 0;
  text-shadow: var(--lift);
}
.hero-name em {
  font-style: italic;
  color: var(--accent);
}

.hero-copy { padding-bottom: 0.15rem; }

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.55;
  margin-bottom: 0.85rem;
  text-shadow: var(--lift);
}
.hero-desc strong { color: var(--text); font-weight: 500; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.8rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--text);
  color: var(--page-bg);
  border-color: var(--text);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--line-strong);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ── STILLS ──────────────────────────────────── */
.still {
  position: relative;
  z-index: 1;
  margin: 0;
}
.work-row .still-label,
.work-row .still-title { display: none; }
.still-inner {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--still-bg);
}
@media (min-width: 900px) {
  .still-inner { aspect-ratio: 21 / 9; }
}

.still-card {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background:
    radial-gradient(ellipse at 72% 18%, rgba(212, 94, 48, 0.22), transparent 52%),
    radial-gradient(ellipse at 18% 88%, rgba(40, 24, 12, 0.7), transparent 50%),
    linear-gradient(180deg, #100c0a 0%, #1a1210 100%);
}
.still-card--lodestar {
  background:
    radial-gradient(circle at 78% 38%, rgba(243, 237, 228, 0.16) 0%, transparent 8%),
    radial-gradient(ellipse at 78% 42%, rgba(212, 94, 48, 0.28), transparent 42%),
    linear-gradient(180deg, #08070a 0%, #121018 100%);
}
.still-card--factory {
  background:
    linear-gradient(90deg, transparent 0%, rgba(212, 94, 48, 0.08) 40%, transparent 70%),
    radial-gradient(ellipse at 50% 110%, rgba(180, 70, 30, 0.35), transparent 55%),
    linear-gradient(180deg, #0a0808 0%, #16110e 100%);
}

.still-num {
  position: absolute;
  top: 8%;
  right: 5%;
  font-family: var(--font-serif);
  font-size: clamp(5rem, 14vw, 11rem);
  line-height: 1;
  color: var(--text);
  opacity: 0.05;
  pointer-events: none;
}
.still-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
}
.still-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  max-width: 18ch;
}

.still img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transform: scale(1.045);
  transition: opacity 0.7s ease, transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.still img.is-loaded { opacity: 1; }

.still img.still-device {
  inset: auto;
  width: auto;
  height: 82%;
  max-height: 520px;
  max-width: 72%;
  left: 50%;
  top: 44%;
  object-fit: contain;
  object-position: center;
  z-index: 3;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.55));
}
.study-still img.still-device {
  height: 88%;
  max-height: 560px;
  max-width: 28%;
  top: 50%;
}

.still-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to top, rgba(7, 6, 5, 0.78) 0%, rgba(7, 6, 5, 0.16) 42%, transparent 62%);
}

.work-row:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* ── WORK ROWS (hub) ─────────────────────────── */
#work {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 0 1.1rem;
}

.work-kicker {
  flex: 0 0 auto;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  padding: 0 var(--pad) 0.75rem;
  text-shadow: var(--lift);
  color: var(--text);
}

.work-list {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0 var(--pad);
  min-height: calc(100svh - var(--nav-h) - 12rem);
  align-items: stretch;
}

.work-row {
  display: block;
  text-decoration: none;
  color: inherit;
  min-height: 0;
  height: 100%;
}
.stage .still,
.stage .still-inner {
  height: 100%;
}
.stage .still-inner {
  aspect-ratio: auto;
}

.work-row:hover .still img.still-bg.is-loaded,
.work-row:focus-visible .still img.still-bg.is-loaded {
  transform: scale(1.09);
}
.work-row:hover .still img.still-device.is-loaded,
.work-row:focus-visible .still img.still-device.is-loaded {
  transform: translate(-50%, -50%) scale(1.04);
}

.work-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  padding: 1.15rem 1.2rem;
  pointer-events: none;
}
.work-caption .credit {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}
.work-caption h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 2.5vw, 2.45rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-top: 0.2rem;
  color: var(--text);
}
.work-logline {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.4;
  margin-top: 0.4rem;
  max-width: 42ch;
}
.work-note,
.still-note {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 4;
  margin: 0;
  padding: 0.65rem clamp(1rem, 3vw, 1.5rem);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: rgba(168, 159, 148, 0.42);
  font-weight: 400;
  pointer-events: none;
}

/* ── CREDITS (hub about) ─────────────────────── */
#credits {
  position: relative;
  z-index: 1;
  padding: 7rem var(--pad) 5rem;
}

.credits-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(2.5rem, 6vw, 7rem);
  align-items: start;
}

.about-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-style: italic;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin: 1rem 0 0;
  padding-left: 1.15rem;
  border-left: 1px solid var(--accent);
  text-shadow: var(--lift);
}

.about-bio {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.8;
}
.about-bio p + p { margin-top: 1.15rem; }
.about-bio strong { color: var(--text); font-weight: 500; }

/* ── CASE STUDY ──────────────────────────────── */
.study-hero {
  position: relative;
  z-index: 1;
  padding-top: var(--nav-h);
}

.study-still { margin: 0; }
.study-still .still-inner {
  max-height: min(72vh, 820px);
}

.study-head {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem var(--pad) 0;
}
.study-head .display {
  font-size: clamp(3rem, 8vw, 6rem);
  margin: 0.7rem 0 1.1rem;
}
.study-logline {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.55;
  max-width: 36rem;
}

.credits-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 2.75rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.credits-item dt {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}
.credits-item dd {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.4;
}

.study-body {
  max-width: calc(var(--measure) + var(--pad) * 2);
  margin: 0 auto;
  padding: 4rem var(--pad) 3rem;
  font-size: 1.08rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.8;
}
.study-body h2 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--text);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 2.6rem 0 0.85rem;
}
.study-body p + p { margin-top: 1rem; }
.study-body strong { color: var(--text); font-weight: 500; }
.study-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--accent-dim);
}
.study-body a:hover { color: var(--text); }
.study-body ul {
  margin: 0.6rem 0 0 1.1rem;
}
.study-body li { margin: 0.35rem 0; }
.study-body li::marker { color: var(--accent); }

.study-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2.75rem;
}

/* optional in-article still */
.still--inline {
  margin: 2.25rem calc(var(--pad) * -0.15);
}
.still--inline .still-inner {
  aspect-ratio: 16 / 9;
  max-height: none;
}

/* ── STUDY PREV / NEXT ───────────────────────── */
.study-nav {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  margin-top: auto;
}
.study-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 2rem var(--pad);
  text-decoration: none;
  transition: background 0.2s;
}
.study-nav a:hover { background: rgba(243, 237, 228, 0.03); }
.study-nav .next { text-align: right; align-items: flex-end; }
.study-nav .dir {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.study-nav .name {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

/* ── FOOTER ──────────────────────────────────── */
.studio-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 2rem var(--pad);
  border-top: 1px solid var(--line);
}
.footer-main {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.footer-copy span { color: var(--accent); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.35rem;
}
.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-dim);
  transition: color 0.18s;
}
.footer-links a:hover { color: var(--text); }

/* ── REVEAL ──────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 800px) {
  .credits-inner { grid-template-columns: 1fr; gap: 2rem; }
  .credits-bar { grid-template-columns: 1fr 1fr; }
  .nav-links { gap: 1.1rem; }
  .hero-inner { grid-template-columns: 1fr; gap: 0.65rem; }
  .hero { padding: 1rem var(--pad) 0.75rem; }
  .hero-name { font-size: clamp(1.85rem, 8vw, 2.6rem); }
  .hero-desc { margin-bottom: 0.55rem; font-size: 0.88rem; }
  .work-list {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    min-height: calc(100svh - var(--nav-h) - 10rem);
  }
  .work-caption { padding: 0.7rem 0.9rem; }
  .work-caption h2 { font-size: 1.35rem; }
  .work-logline { font-size: 0.78rem; max-width: none; }
  .work-kicker { font-size: clamp(1.7rem, 8vw, 2.35rem); padding-bottom: 0.55rem; }
  .still img.still-device {
    height: 78%;
    max-height: 320px;
    max-width: 48%;
    top: 42%;
  }
}

@media (max-width: 560px) {
  .study-nav { grid-template-columns: 1fr; }
  .study-nav .next { text-align: left; align-items: flex-start; border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #grain { animation: none; opacity: 0.035; }
  .live::before { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .still img.still-bg,
  .work-row:hover .still img.still-bg.is-loaded {
    transform: none;
    transition: opacity 0.3s ease;
  }
  .still img.still-device,
  .work-row:hover .still img.still-device.is-loaded {
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
  }
}
