:root {
  --black: #0a0a0a;
  --white: #f4f3ef;
  --grey: #8a8a86;
  --line: rgba(244, 243, 239, 0.16);
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Inter Tight', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.035em; line-height: 0.92; }
.mono { font: 400 12px/1.4 var(--mono); letter-spacing: 0.02em; text-transform: uppercase; color: var(--grey); }
.eyebrow { font: 400 12px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 24px; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--gutter);
  mix-blend-mode: difference;
}
.nav nav { display: flex; gap: 28px; }
.nav nav a { text-decoration: none; font-size: 14px; }
.nav nav a:hover { text-decoration: underline; }
.wordmark { font-weight: 700; letter-spacing: -0.04em; font-size: 20px; text-decoration: none; }
.wordmark sup { font-size: 0.45em; font-weight: 400; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 16px 28px; border: 1px solid var(--white); border-radius: 999px;
  background: var(--white); color: var(--black);
  font: 500 15px var(--sans); text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s;
}
.btn:hover { background: transparent; color: var(--white); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn--small { padding: 9px 18px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--invert { background: var(--black); color: var(--white); border-color: var(--black); }
.btn--invert:hover { background: transparent; color: var(--black); }

/* ---------- hero: split black | white ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: grid; grid-template-columns: 1fr minmax(0, 560px) 1fr; align-items: center;
  column-gap: clamp(20px, 3vw, 48px); row-gap: 40px;
  padding: 110px var(--gutter) 96px;
  background: linear-gradient(90deg, var(--black) 50%, var(--white) 50%);
}
.hero__word { margin: 0; font-size: clamp(56px, 9vw, 168px); font-weight: 500; letter-spacing: -0.05em; line-height: 0.9; }
.hero__word--l { color: var(--white); text-align: right; }
.hero__word--r { color: var(--black); }
.hero__word--r em { letter-spacing: -0.02em; }
.hero__stage { position: relative; }
.hero__stage canvas { display: block; width: 100%; aspect-ratio: 1; background: #000; box-shadow: 0 0 0 1px rgba(128, 128, 128, 0.35); }
.hero__live {
  position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px;
  color: var(--white); font-size: 10px; mix-blend-mode: difference;
}
.hero__live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.hero__foot {
  grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 48px;
  color: var(--white); mix-blend-mode: difference;
}
.hero__foot .lede { justify-self: end; text-align: right; margin: 0; }
.hero__foot .btn { justify-self: start; }
.btn--diff { background: var(--white); color: var(--black); border-color: var(--white); }
.btn--diff:hover { background: transparent; color: var(--white); }
.lede { max-width: 440px; color: inherit; font-size: 18px; opacity: 0.85; }
.hero__ticker {
  position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden;
  border-top: 1px solid rgba(128, 128, 128, 0.4); padding: 14px 0;
  font: 400 13px var(--mono); letter-spacing: .1em; white-space: nowrap;
  color: var(--white); mix-blend-mode: difference;
}
.hero__ticker div { display: inline-block; animation: tick 30s linear infinite; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
section { padding: clamp(72px, 10vw, 140px) var(--gutter); }
.section-head { display: grid; gap: 20px; margin-bottom: clamp(40px, 6vw, 72px); }
.section-head h2 { font-size: clamp(44px, 6.5vw, 100px); }

/* ---------- studio ---------- */
.studio__grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.stage { position: sticky; top: 80px; }
.stage canvas {
  display: block; width: auto; height: auto; margin-inline: auto;
  max-width: 100%; max-height: calc(100svh - 170px);
  background: #000; border: 1px solid var(--line);
}
.stage__bar { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.stage__bar input { flex: 1; }
.stage__error { color: var(--white); border: 1px solid var(--white); padding: 12px; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: none; color: var(--white); cursor: pointer; font-size: 12px;
}
.icon-btn:hover { border-color: var(--white); }

.panel { border: 1px solid var(--line); padding: 22px; display: grid; gap: 24px; }
.panel__group { display: grid; gap: 12px; }
.panel__label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; }

.frames { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.frames .noface { position: absolute; inset: auto 1px 1px auto; padding: 1px 4px; font: 9px var(--mono); background: var(--white); color: var(--black); text-transform: uppercase; }
.hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--grey); }
.link { border: 0; background: none; padding: 0; color: var(--grey); font: 12px var(--sans); text-decoration: underline; cursor: pointer; }
.link:hover { color: var(--white); }
.is-off { opacity: .35; }
.frames li { position: relative; aspect-ratio: 1; cursor: grab; }
.frames li.dragging { opacity: .35; }
.frames canvas { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1); border: 1px solid var(--line); }
.frames li.active canvas { border-color: var(--white); }
.frames button {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: var(--black); color: var(--white); font-size: 11px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.frames li:hover button, .frames button:focus-visible { opacity: 1; }
.frames .idx { position: absolute; left: 1px; bottom: 1px; padding: 1px 4px; font: 10px var(--mono); background: var(--black); }

.drop {
  display: grid; place-items: center; height: 72px; cursor: pointer;
  border: 1px dashed var(--line); font-size: 13px; color: var(--grey);
  transition: border-color .15s, color .15s;
}
.drop:hover, .drop.over { border-color: var(--white); color: var(--white); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented button {
  border: 0; background: none; color: var(--grey); padding: 8px 2px; border-radius: 999px;
  font: 500 12.5px var(--sans); cursor: pointer; min-width: 0;
}
.segmented button[aria-pressed="true"] { background: var(--white); color: var(--black); }

.slider { display: grid; grid-template-columns: 76px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.slider output { font: 11px var(--mono); color: var(--grey); text-align: right; }

input[type="range"] { -webkit-appearance: none; appearance: none; background: none; height: 20px; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 1px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -6px; border-radius: 50%; background: var(--white); }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--white); }

.toggles { gap: 10px; }
.toggle { display: flex; align-items: center; gap: 12px; font-size: 13px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { width: 32px; height: 18px; border: 1px solid var(--line); border-radius: 999px; position: relative; transition: background .2s; }
.toggle span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--grey); transition: transform .2s, background .2s; }
.toggle input:checked + span { background: var(--white); }
.toggle input:checked + span::after { transform: translateX(14px); background: var(--black); }
.toggle input:focus-visible + span { outline: 2px solid var(--white); outline-offset: 2px; }

.download { text-align: center; font: 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- melt showcase ---------- */
.melt { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: clamp(24px, 4vw, 56px); align-items: end; margin-bottom: 40px; }
.melt__video { width: 100%; aspect-ratio: 1; object-fit: cover; filter: grayscale(1) contrast(1.1); display: block; }
.melt__caption { margin: 0; max-width: 34ch; font: italic clamp(24px, 2.6vw, 36px)/1.15 var(--serif); }

/* ---------- how ---------- */
.how, .styles { border-top: 1px solid var(--line); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.steps li { padding: 32px 28px 8px 0; border-right: 1px solid var(--line); }
.steps li + li { padding-left: 28px; }
.steps li:last-child { border-right: 0; }
.steps__n { font: italic 40px var(--serif); color: var(--grey); }
.steps h3 { font-size: 32px; margin: 18px 0 12px; }
.steps p { color: #bdbcb7; max-width: 32ch; }

/* ---------- styles ---------- */
.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.style-grid article { background: var(--black); padding: 28px; min-height: 240px; display: flex; flex-direction: column; justify-content: space-between; transition: background .25s, color .25s; }
.style-grid article:hover { background: var(--white); color: var(--black); }
.style-grid h3 { font: italic 44px var(--serif); letter-spacing: -0.01em; }
.style-grid p { margin: 0; font-size: 14px; opacity: .75; }

/* ---------- closer / footer ---------- */
.closer { background: var(--white); color: var(--black); text-align: center; display: grid; justify-items: center; gap: 44px; }
.closer h2 { font-size: clamp(64px, 12vw, 200px); }
.footer a { color: inherit; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 28px var(--gutter); border-top: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .hero {
    grid-template-columns: 1fr; justify-items: center; text-align: center; row-gap: 24px; padding-top: 96px;
    background: linear-gradient(180deg, var(--black) 50%, var(--white) 50%);
  }
  .hero__word--l, .hero__word--r { text-align: center; }
  .hero__stage { width: min(100%, 520px); }
  .hero__foot { grid-template-columns: 1fr; gap: 20px; justify-items: center; }
  .hero__foot .lede { justify-self: center; text-align: center; }
  .hero__foot .btn { justify-self: center; }
  .melt { grid-template-columns: 1fr; }
  .studio__grid { grid-template-columns: 1fr; }
  .stage { position: static; }
  .style-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .nav nav { display: none; }
  .steps { grid-template-columns: 1fr; }
  .steps li, .steps li + li { padding: 28px 0 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .style-grid { grid-template-columns: 1fr; }
  .style-grid article { min-height: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__ticker div { animation: none; }
  html { scroll-behavior: auto; }
}
