/* ===== DESIGN TOKENS ===== */
:root {
  --bg: #F4F1E8;
  --fg: #2D3A1F;
  --muted: #6B7A60;
  --hairline: #CDD2C9;
  --surface: #E8E2D0;
  --accent: #B8A678;
  --f-display: "Playfair Display", Georgia, serif;
  --f-body: "Inter", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --display-weight: 400;
  --display-italic: italic;
  --tracking-display: -0.02em;
  --tracking-eyebrow: 0.14em;
  --display-size: clamp(40px, 8.3vw, 120px);
  --display-lh: 0.95;
}

html[data-theme="dark"] {
  --bg: #0F1A09;
  --fg: #ECE6D7;
  --muted: #7A8C6A;
  --hairline: #1E2B14;
  --surface: #182310;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s ease, color 0.4s ease;
}
main {
  animation: page-in 0.25s ease both;
}
body.is-leaving main {
  opacity: 0;
  transition: opacity 0.15s ease;
  animation: none;
}
@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { max-width: 100%; display: block; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; }
::selection { background: var(--fg); color: var(--bg); }

/* ===== CUSTOM CURSOR ===== */
.cursor, .cursor-dot {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
  mix-blend-mode: difference;
}
.cursor {
  width: 28px; height: 28px;
  border: 1px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease;
}
.cursor-dot {
  width: 4px; height: 4px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.cursor.is-hover { width: 56px; height: 56px; }

@media (hover: none) {
  .cursor, .cursor-dot { display: none; }
  body { cursor: auto; }
}
@media (hover: hover) {
  body, body * { cursor: none; }
}

/* ===== NAV ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 316px 48px;
  z-index: 100;
  mix-blend-mode: difference;
  color: #fff;
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  background: var(--bg);
  mix-blend-mode: normal;
}
.nav a, .nav button { color: var(--fg); }
.nav .brand {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}
.nav ul {
  display: flex; gap: 32px;
  list-style: none; margin: 0; padding: 0;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nav ul a { color: var(--muted); transition: color 0.2s; }
.nav ul a:hover { color: var(--fg); }
.theme-toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--fg);
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  position: relative;
}
.theme-toggle:hover { background: var(--fg); color: var(--bg); }
.theme-toggle svg { width: 14px; height: 14px; }
.theme-toggle::after {
  content: "Switch to dark mode";
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  white-space: nowrap;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--hairline);
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.theme-toggle:hover::after { opacity: 1; }
[data-theme="dark"] .theme-toggle::after { content: "Switch to light mode"; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* ===== LAYOUT ===== */
.wrap {
  padding-left: 316px;
  padding-right: 316px;
}

section:not(.hero) {
  padding-top: 120px;
  padding-bottom: 80px;
  border-top: 1px solid var(--hairline);
}

/* ===== SHARED LABELS ===== */
.eyebrow {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.section-label {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--muted);
}

/* ===== CTA BUTTON ===== */
button.cta {
  background: none;
  cursor: pointer;
}
.cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background-color 0.3s, color 0.3s;
}
.cta:hover { background: var(--fg); color: var(--bg); }
.cta .arr { transition: transform 0.3s; display: inline-flex; align-items: center; }
.cta:hover .arr { transform: translateX(4px); }
.cta .material-symbols-outlined { font-size: 1em; line-height: 1; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20; }

/* ===== HERO ===== */
.hero {
  position: relative;
  padding-top: 200px;
  padding-bottom: 200px;
  padding-left: 316px;
  padding-right: 316px;
  border-top: 0;
  overflow: hidden;
}
.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.hero-display {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-style: var(--display-italic);
  font-size: var(--display-size);
  line-height: var(--display-lh);
  letter-spacing: var(--tracking-display);
  text-align: center;
  max-width: 808px;
  margin: 0 auto;
}
.hero-display .accent { color: var(--accent); font-style: italic; }
.hero-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  padding-top: 60px;
  border-top: 1px solid var(--hairline);
  margin-top: 80px;
}
.hero-meta .label {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.hero-meta .value { font-size: 14px; }

/* ===== WORK ===== */
.cases {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  max-width: 808px;
  margin-left: auto;
  margin-right: auto;
}
.case-card {
  display: block;
  color: inherit;
  text-decoration: none;
}
.case-card-img {
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--muted) 25%, transparent);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: block;
  width: 100%;
}
.case-card-img video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(.2, .8, .2, 1);
}
.case-card:hover .case-card-img video { transform: scale(1.03); }
.case-card-body {
  padding-top: 14px;
  width: 100%;
}
.case-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.case-card-title {
  font-family: var(--f-display);
  font-style: var(--display-italic);
  font-weight: var(--display-weight);
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: var(--tracking-display);
  color: var(--muted);
}
.case-card-year {
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
  flex-shrink: 0;
  padding-left: 12px;
}
.case-card-desc {
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
}

#work {
  padding-top: 80px;
  padding-bottom: 80px;
}
#work .section-label {
  max-width: 808px;
  margin-left: auto;
  margin-right: auto;
}
#about {
  padding-top: 80px;
  padding-bottom: 80px;
  padding-left: 0;
  padding-right: 0;
  border-top: none;
}

/* ===== ABOUT ===== */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  max-width: 808px;
  margin-left: auto;
  margin-right: auto;
}
.about-collage {
  display: block;
  width: 100%;
  height: auto;
}
.about h2 {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-style: var(--display-italic);
  font-size: clamp(28px, 3.6vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 20px;
  margin-bottom: 40px;
  max-width: 20ch;
}
.about .bio {
  font-size: 16px;
  line-height: 1.6;
  max-width: 56ch;
  margin-top: 20px;
}
.about .bio p + p { margin-top: 18px; }
.about .bio em { color: var(--accent); font-style: italic; }

.toolkit {
  margin-top: 40px;
  max-width: 808px;
  margin-left: auto;
  margin-right: auto;
}
.toolkit .section-label { margin-bottom: 16px; }
.toolkit-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.toolkit-logos img {
  display: inline-block;
  height: 60px;
  width: 60px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--muted) 25%, transparent);
}

.about-meta {
  margin-top: 60px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--hairline);
}
.about-meta .col .k {
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.about-meta .col .v { font-size: 14px; line-height: 1.5; }

/* ===== PROCESS ===== */
.process-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  padding-bottom: 60px;
}
.process-head h2 {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-style: var(--display-italic);
  font-size: clamp(36px, 5vw, 72px);
  line-height: 1;
  letter-spacing: var(--tracking-display);
  margin-top: 16px;
}
.process-head p {
  color: var(--muted);
  font-size: 15px;
  max-width: 42ch;
  margin-top: 16px;
}
.process-grid {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 1px;
  max-width: 808px;
  margin-left: auto;
  margin-right: auto;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow: hidden;
}
.process-step {
  background: var(--bg);
  padding: 24px;
  display: grid;
  align-content: start;
}
.process-step h3 {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-style: var(--display-italic);
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  align-self: start;
}
.process-step p {
  color: var(--fg);
  font-size: 17px;
  line-height: 1.6;
}

/* ===== FOOTER ===== */
footer {
  padding: 40px 316px;
}
.footer-copy {
  display: block;
  max-width: 808px;
  margin: 0 auto;
  color: var(--muted);
}

/* ===== DEBUG GRID ===== */
[data-debug] * {
  outline: 1px solid rgba(255, 0, 80, 0.2);
}
[data-debug] nav,
[data-debug] section,
[data-debug] footer,
[data-debug] .case-section,
[data-debug] .case-hero-header,
[data-debug] .case-meta-strip,
[data-debug] .case-back-nav {
  outline: 2px solid rgba(0, 100, 255, 0.5);
  background: rgba(0, 100, 255, 0.03) !important;
}
[data-debug] .section-grid,
[data-debug] .about,
[data-debug] .process-grid,
[data-debug] .case-metrics,
[data-debug] .context-frames,
[data-debug] .fulfillment-diagram {
  outline: 2px solid rgba(255, 140, 0, 0.6);
  background: rgba(255, 140, 0, 0.03) !important;
}
[data-debug] .prose,
[data-debug] .case-lede,
[data-debug] .bio {
  outline: 2px solid rgba(0, 180, 100, 0.6);
  background: rgba(0, 180, 100, 0.04) !important;
}
[data-debug] [data-fs]::after {
  content: attr(data-fs);
  display: inline-block;
  margin-left: 4px;
  padding: 1px 4px;
  background: rgba(255, 0, 80, 0.12);
  color: rgba(255, 0, 80, 0.9);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  font-style: normal;
  border-radius: 2px;
  vertical-align: middle;
  pointer-events: none;
}
[data-debug]::before {
  content: "DEBUG · G to toggle";
  position: fixed;
  bottom: 16px;
  right: 16px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 0, 80, 0.8);
  background: var(--bg);
  padding: 6px 10px;
  border: 1px solid rgba(255, 0, 80, 0.3);
  z-index: 99999;
  pointer-events: none;
}

/* ===== SCROLL REVEAL ===== */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(.2, .8, .2, 1);
}
.fade-up.in {
  opacity: 1;
  transform: translateY(0);
}

/* ===== HERO TOOL ICONS ===== */
.hero-tools {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.hero-tool {
  position: absolute;
  pointer-events: all;
  opacity: 0;
  color: var(--muted);
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform-origin: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1260px) {
  .wrap { padding-left: 60px; padding-right: 60px; }
  .nav { padding: 22px 60px 48px; }
  .hero { padding-left: 60px; padding-right: 60px; }
  footer { padding-left: 60px; padding-right: 60px; }
  .about { padding-left: 60px; padding-right: 60px; max-width: 928px; }
  .toolkit { padding-left: 60px; padding-right: 60px; max-width: 928px; }
}

@media (max-width: 900px) {
  .nav ul { display: none; }
}

@media (max-width: 760px) {
  .nav { padding: 18px 20px; }
  .nav ul { gap: 18px; }
  .wrap { padding-left: 20px; padding-right: 20px; }
  .hero-tools { display: none; }

  .hero {
    padding-top: 140px;
    padding-bottom: 60px;
    padding-left: 20px;
    padding-right: 20px;
  }
  .hero-bottom { grid-template-columns: 1fr; gap: 24px; }

  .cases { grid-template-columns: 1fr; }

  .about { grid-template-columns: 1fr; gap: 40px; padding-left: 20px; padding-right: 20px; }
  .toolkit { padding-left: 20px; padding-right: 20px; }
  .about .bio { max-width: none; }
  .about .portrait { aspect-ratio: 4/5; max-width: 320px; }
  .about-meta { grid-template-columns: 1fr 1fr; gap: 28px; }

  .process-head { grid-template-columns: 1fr; }

  footer { padding: 40px 20px; }
}

/* ===== INLINE PROSE LINKS ===== */
p a, .prose a, .bio-link {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
p a:hover, .prose a:hover, .bio-link:hover { color: var(--muted); }
.bio-link {
  cursor: pointer;
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

/* ===== TOAST ===== */
#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9000;
  white-space: nowrap;
}
#toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
