/* ---------- Tokens ---------- */
:root {
  --paper-rgb: 228 233 236;
  --ink-rgb: 16 22 26;
  --paper: rgb(var(--paper-rgb));
  --ink: rgb(var(--ink-rgb));
  --mute: rgb(var(--ink-rgb) / .56);
  --faint: rgb(var(--ink-rgb) / .3);
  --line: rgb(var(--ink-rgb) / .14);
  --elev: #d8dee2;
  --accent: #e0883a;
  --accent-2: #3fa9bd;
  --grain: .05;
  --pad: 20px;
  --gap: 16px;
  --header-h: 60px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
  --display: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper-rgb: 9 12 18;
  --ink-rgb: 232 238 242;
  --elev: #141a24;
  --accent: #ffb347;
  --accent-2: #3fd1c7;
  --grain: .035;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper-rgb: 9 12 18;
    --ink-rgb: 232 238 242;
    --elev: #141a24;
    --accent: #ffb347;
    --accent-2: #3fd1c7;
    --grain: .035;
    color-scheme: dark;
  }
}
@media (min-width: 1024px) {
  :root { --pad: 40px; --gap: 24px; --header-h: 72px; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: var(--grain);
  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='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
::selection { background: var(--accent); color: #fff; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
canvas, svg { display: block; }
p, h1, h2, h3, dl, dd, ol, figure { margin: 0; }
ol { padding: 0; list-style: none; }
h1, h2, h3 { font: inherit; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.005em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.label { font-family: var(--mono); font-size: 12px; line-height: 1.4; letter-spacing: .01em; color: var(--mute); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* underline that draws in from the left */
.u { position: relative; }
.u::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ease);
}
@media (hover: hover) { .u:hover::after { transform: scaleX(1); transform-origin: left; } }

/* ---------- Curtain (intro + page transitions) ---------- */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .95s var(--ease-io);
}
.curtain.is-up { transform: translateY(-100%); pointer-events: none; }
html:not(.js) .curtain, .curtain-failsafe .curtain { transform: translateY(-100%); pointer-events: none; }
.curtain-mark { font-family: var(--display); font-size: 40px; font-weight: 650; letter-spacing: -.05em; }
.curtain-mark i { font-style: normal; color: var(--accent); }
.curtain-count { position: absolute; left: var(--pad); bottom: 24px; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; opacity: .7; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  font-size: 14px;
  border-bottom: 1px solid transparent;
  transition: background-color .35s var(--ease), border-color .35s var(--ease);
}
.site-header.is-solid {
  background: rgb(var(--paper-rgb) / .82);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}
.progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.brand { display: inline-flex; align-items: baseline; gap: 12px; }
.brand-name { font-family: var(--display); font-size: 20px; font-weight: 650; letter-spacing: -.05em; }
.brand-name i, .wordmark i { font-style: normal; color: var(--accent); }
.brand-role { display: none; color: var(--mute); }
.nav { display: none; align-items: center; gap: 28px; }
.nav-link { display: inline-flex; align-items: center; gap: 8px; }
.nav-link::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform .35s var(--ease);
}
.nav-link.is-active::before { transform: scale(1); }
.theme-btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--mute); }
.theme-btn svg { width: 18px; height: 18px; color: var(--ink); }
.theme-btn .half, .theme-btn .full { opacity: 0; transition: opacity .3s; }
.theme-btn[data-mode="auto"] .half, .theme-btn[data-mode="dark"] .full { opacity: 1; }
.theme-label { min-width: 4ch; text-align: left; }
.menu-btn { font-size: 14px; }
@media (min-width: 768px) { .brand-role { display: inline; } }
@media (min-width: 1024px) {
  .nav { display: flex; }
  .menu-btn { display: none; }
}

.menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--header-h) + 40px) var(--pad) 32px;
  background: var(--paper);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s var(--ease), visibility .35s;
}
.menu.is-open { opacity: 1; visibility: visible; }
.menu-nav a { display: flex; align-items: baseline; gap: 14px; padding: 8px 0; font-family: var(--display); font-size: 12vw; font-weight: 550; letter-spacing: -.045em; line-height: 1.05; border-bottom: 1px solid var(--line); }
.menu-foot { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--mute); }
@media (min-width: 1024px) { .menu { display: none; } }

/* ---------- Reveal ---------- */
.js [data-reveal]:not([data-reveal="lines"]) { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform 1.1s var(--ease); transition-delay: var(--d, 0ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.line > span { display: inline-block; }
.js .line > span { transform: translateY(110%); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i, 0) * 80ms + var(--d, 0ms)); }
.js .is-in .line > span { transform: none; }

/* ---------- Layout helpers ---------- */
.section { position: relative; z-index: 1; padding: clamp(96px, 13vw, 200px) var(--pad) 0; }
.section-head {
  display: flex;
  gap: var(--gap);
  padding-top: 14px;
  border-top: 1px solid var(--line);
  margin-bottom: clamp(40px, 6vw, 96px);
}
.section-head .label:first-child { min-width: 3.5em; }
.section-head .push { margin-left: auto; }
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100vh;
  height: 100svh;
  min-height: 600px;
  padding: calc(var(--header-h) + 24px) var(--pad) 0;
  overflow: hidden;
}
#bg-gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 28px; padding-bottom: clamp(32px, 5vw, 64px); pointer-events: none; }
.hero-title {
  font-family: var(--display);
  font-size: clamp(46px, 7.6vw, 148px);
  font-weight: 600;
  line-height: .95;
  letter-spacing: -.06em;
  max-width: 14ch;
}
.hero-title em, .contact-title em { letter-spacing: -.02em; padding-right: .04em; }
.hero-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px var(--gap);
  padding: 16px 0 24px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.hero-meta dt { margin-bottom: 4px; }
.scroll-cue { display: none; }
@media (min-width: 1024px) {
  .hero-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-bottom: 32px; }
  .scroll-cue { display: flex; justify-content: flex-end; align-items: flex-end; }
}
.scroll-cue a { display: inline-flex; gap: 8px; align-items: center; }
.scroll-cue .arrow { display: inline-block; animation: nudge 2.4s var(--ease) infinite; }
@keyframes nudge { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(4px); } }

/* ---------- About ---------- */
.about-grid { row-gap: 48px; }
.facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px var(--gap); align-content: start; font-size: 15px; }
.facts dt { margin-bottom: 4px; }
.about-copy { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 32px; }
.about-lead { font-family: var(--display); font-size: clamp(28px, 3.5vw, 60px); line-height: 1.1; letter-spacing: -.035em; font-weight: 450; text-wrap: pretty; }
.about-sub { max-width: 36em; font-size: 18px; line-height: 1.55; color: var(--mute); }
.about-sub a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: .18em; text-decoration-thickness: 1px; transition: text-decoration-color .2s; }
@media (hover: hover) { .about-sub a:hover { text-decoration-color: var(--accent); } }
@media (min-width: 1024px) {
  .facts { grid-column: 1 / span 4; grid-template-columns: 1fr; }
  .about-copy { grid-column: 5 / span 8; }
  .about-sub { font-size: 20px; }
}

/* ---------- Marquee ---------- */
.marquee {
  position: relative;
  z-index: 1;
  margin-top: clamp(96px, 12vw, 180px);
  padding: clamp(14px, 2vw, 28px) 0;
  border-block: 1px solid var(--line);
  overflow: hidden;
  white-space: nowrap;
}
.marquee-track { display: inline-flex; align-items: center; will-change: transform; }
.marquee-track span { font-family: var(--serif); font-style: italic; font-size: clamp(52px, 9vw, 168px); line-height: 1.1; letter-spacing: -.02em; padding: 0 .28em; }
.marquee-track i { font-style: normal; color: var(--accent); font-size: clamp(28px, 4vw, 72px); }

/* ---------- Work index ---------- */
.work-row { border-bottom: 1px solid var(--line); transition: opacity .35s var(--ease); }
.work-row > a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "media media media" "no title year" ". type type";
  column-gap: 14px;
  align-items: baseline;
  padding: 20px 0 22px;
}
.w-media { grid-area: media; display: block; aspect-ratio: 4 / 3; margin-bottom: 16px; border-radius: 6px; overflow: hidden; background: var(--elev); }
.w-media canvas { width: 100%; height: 100%; }
.w-no { grid-area: no; font-family: var(--mono); font-size: 12px; color: var(--mute); transition: color .3s; }
.w-title { grid-area: title; font-family: var(--display); font-size: clamp(24px, 3vw, 46px); font-weight: 550; letter-spacing: -.04em; line-height: 1.1; transition: transform .5s var(--ease); }
.w-type { grid-area: type; font-size: 14px; color: var(--mute); }
.w-year { grid-area: year; font-family: var(--mono); font-size: 12px; color: var(--mute); text-align: right; font-variant-numeric: tabular-nums; }
.w-arrow { display: none; }
@media (min-width: 1024px) {
  .work-row > a {
    grid-template-columns: 5rem minmax(0, 1fr) 16rem 9rem 2rem;
    grid-template-areas: "no title type year arrow";
    align-items: center;
    padding: 26px 0;
  }
  .w-media { display: none; }
  .w-type { font-size: 15px; }
  .w-year { font-size: 13px; }
  .w-arrow { display: block; grid-area: arrow; text-align: right; opacity: 0; transform: translateX(-8px); transition: opacity .35s, transform .45s var(--ease); }
}
@media (hover: hover) and (min-width: 1024px) {
  .work-list:hover .work-row:not(:hover) { opacity: .35; }
  .work-row:hover .w-title { transform: translateX(14px); }
  .work-row:hover .w-no { color: var(--accent); }
  .work-row:hover .w-arrow { opacity: 1; transform: none; }
}

.preview {
  --pw: min(24vw, 420px);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  width: var(--pw);
  aspect-ratio: 4 / 3;
  margin: calc(var(--pw) * -.375) 0 0 calc(var(--pw) * -.5);
  pointer-events: none;
  display: none;
}
@media (hover: hover) and (pointer: fine) and (min-width: 1024px) { .preview { display: block; } }
.preview-inner {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--elev);
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / .35);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .3s var(--ease), transform .55s var(--ease);
}
.preview.is-on .preview-inner { opacity: 1; transform: none; }
.preview-item { position: absolute; inset: 0; opacity: 0; transition: opacity .25s; }
.preview-item.is-active { opacity: 1; }
.preview-item canvas { width: 100%; height: 100%; }

/* ---------- Studio entry ---------- */
.studio-entry { display: block; padding: 8px 0 28px; border-bottom: 1px solid var(--line); }
.studio-entry-title { display: block; max-width: 14ch; font-family: var(--display); font-size: clamp(40px, 6vw, 112px); font-weight: 600; line-height: .96; letter-spacing: -.06em; }
.studio-entry-title em { letter-spacing: -.02em; }
.studio-entry-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px; margin-top: clamp(28px, 4vw, 56px); }
.studio-entry-tags { color: var(--mute); font-family: var(--mono); font-size: 12px; }
.studio-entry-cta { display: inline-flex; align-items: baseline; gap: .4em; font-family: var(--display); font-size: clamp(18px, 1.6vw, 24px); font-weight: 550; letter-spacing: -.02em; }
.studio-entry-cta .arrow { display: inline-block; color: var(--accent); transition: transform .5s var(--ease); }
@media (hover: hover) {
  .studio-entry:hover .studio-entry-cta .arrow { transform: translateX(.3em); }
  .studio-entry:hover .studio-entry-title em { color: var(--accent); }
}

/* ---------- Contact ---------- */
.contact { overflow: hidden; }
.contact-grid { row-gap: 40px; }
.contact-title { grid-column: 1 / -1; font-family: var(--display); font-size: clamp(44px, 6.6vw, 128px); font-weight: 600; line-height: .95; letter-spacing: -.06em; }
.contact-mail { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 24px; }
.mail-link { font-family: var(--display); font-size: clamp(22px, 3vw, 52px); font-weight: 500; letter-spacing: -.04em; line-height: 1.2; overflow-wrap: anywhere; }
.mail-link::after { height: 2px; bottom: -4px; transform: scaleX(1); background: var(--line); transition: background-color .3s; }
@media (hover: hover) { .mail-link:hover::after { background: var(--accent); } }
.copy-btn { font-family: var(--mono); font-size: 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--mute); transition: border-color .2s, color .2s; }
@media (hover: hover) { .copy-btn:hover { border-color: var(--ink); color: var(--ink); } }
@media (min-width: 1024px) {
  .contact-title, .contact-mail { grid-column: 1 / span 10; }
}
.contact-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px var(--gap);
  margin-top: clamp(80px, 10vw, 160px);
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.contact-info dt { margin-bottom: 4px; }
.socials { display: flex; flex-wrap: wrap; gap: 4px 16px; }
@media (min-width: 1024px) {
  .contact-info { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .to-top-wrap { display: flex; justify-content: flex-end; align-items: flex-end; }
}
.wordmark {
  display: flex;
  justify-content: space-between;
  margin: clamp(48px, 6vw, 96px) 0 0;
  padding-bottom: 3vw;
  font-family: var(--display);
  font-size: 36vw;
  font-weight: 650;
  line-height: .8;
  letter-spacing: -.07em;
  user-select: none;
}
.wordmark span { display: inline-block; }
.js .wordmark span { transform: translateY(30%); opacity: 0; transition: transform 1.2s var(--ease), opacity .8s var(--ease); transition-delay: calc(var(--i) * 70ms); }
.js .wordmark.is-in span { transform: none; opacity: 1; }
@media (hover: hover) {
  .js .wordmark.is-in span { transition: transform .6s var(--ease), opacity .8s var(--ease); }
  .js .wordmark.is-in span:hover { transform: translateY(-6%); }
}

/* ---------- Media ---------- */
.media { position: relative; overflow: hidden; border-radius: 6px; background: var(--elev); }
.media canvas { width: 100%; height: 100%; transition: transform 1.6s var(--ease); }
.js [data-reveal] .media canvas { transform: scale(1.08); }
.js [data-reveal].is-in .media canvas { transform: none; }

/* ---------- Project page ---------- */
.p-head { padding: calc(var(--header-h) + clamp(40px, 7vw, 110px)) var(--pad) clamp(40px, 5vw, 72px); }
.p-crumbs { display: flex; justify-content: space-between; margin-bottom: clamp(32px, 5vw, 64px); }
.p-crumbs a { color: var(--ink); }
.p-title { font-family: var(--display); font-size: clamp(48px, 9vw, 168px); font-weight: 600; line-height: .95; letter-spacing: -.06em; }
.p-summary { max-width: 30em; margin-top: 28px; font-family: var(--display); font-size: clamp(20px, 2vw, 30px); font-weight: 450; line-height: 1.3; letter-spacing: -.02em; color: var(--mute); }
.p-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px var(--gap); margin-top: clamp(40px, 5vw, 72px); padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.p-meta dt { margin-bottom: 4px; }
@media (min-width: 1024px) { .p-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.p-cover { padding: 0 var(--pad); }
.p-cover .media { aspect-ratio: 4 / 3; }
@media (min-width: 768px) { .p-cover .media { aspect-ratio: 16 / 9; } }
.p-demo .media { aspect-ratio: auto; height: clamp(560px, 82svh, 720px); background: #1c1915; }
.p-demo canvas { position: absolute; inset: 0; transition: opacity .8s var(--ease), transform 1.6s var(--ease); }
.p-demo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .8s var(--ease) .1s; }
.p-demo .is-live iframe { opacity: 1; }
.p-demo .is-live canvas { opacity: 0; }
.p-demo-start { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 8px; padding: clamp(20px, 3vw, 40px); text-align: left; color: #f1e9d8; background: linear-gradient(to top, rgb(0 0 0 / .45), transparent 45%); transition: opacity .5s var(--ease); }
.p-demo-start .label { color: rgb(241 233 216 / .7); }
.p-demo-cta { font-family: var(--display); font-size: clamp(28px, 4vw, 56px); font-weight: 600; letter-spacing: -.05em; line-height: 1; }
.p-demo-cta .arrow { display: inline-block; color: var(--accent); transition: transform .5s var(--ease); }
@media (hover: hover) { .p-demo-start:hover .p-demo-cta .arrow { transform: translateX(.2em); } }
.p-demo .is-loading .p-demo-start { opacity: 0; pointer-events: none; }
.p-demo .is-loading canvas { animation: demo-wait 1.4s var(--ease-io) infinite alternate; }
.p-demo .is-live canvas { animation: none; }
@keyframes demo-wait { to { filter: brightness(.7); } }
.p-demo-bar { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; }
.p-body .grid12 { row-gap: 24px; }
.p-text { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 24px; font-size: 19px; line-height: 1.6; max-width: 40em; }
@media (min-width: 1024px) { .p-text { grid-column: 5 / span 7; font-size: 21px; } }
.p-gallery { display: grid; grid-template-columns: 1fr; gap: var(--gap); padding: clamp(64px, 8vw, 120px) var(--pad) 0; }
.p-gallery .media { aspect-ratio: 1; }
@media (min-width: 768px) { .p-gallery { grid-template-columns: 1fr 1fr; } }
.p-next { display: block; margin: clamp(96px, 12vw, 180px) var(--pad) 0; padding: 16px 0 clamp(64px, 8vw, 120px); border-top: 1px solid var(--line); }
.p-next-title { display: flex; align-items: baseline; gap: .25em; margin-top: 20px; font-family: var(--display); font-size: clamp(40px, 6.6vw, 120px); font-weight: 600; letter-spacing: -.06em; line-height: 1; }
.p-next-title .arrow { display: inline-block; color: var(--accent); transition: transform .5s var(--ease); }
@media (hover: hover) { .p-next:hover .p-next-title .arrow { transform: translateX(.2em); } }
.mini-footer { display: flex; justify-content: space-between; gap: 16px; padding: 20px var(--pad) 28px; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
}
