:root {
  color-scheme: dark;
  --bg: #050506;
  --panel: #0c0c0e;
  --panel-2: #131316;
  --fg: #f1f0ec;
  --muted: #8d8c93;
  --faint: #55545b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #dfe9ff;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

::selection { background: rgba(223, 233, 255, 0.25); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ── Top bar ───────────────────────────────────────────────────────────── */

.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, rgba(5, 5, 6, 0.85), rgba(5, 5, 6, 0));
  pointer-events: none;
}
.bar > * { pointer-events: auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 18px;
}
.brand-mark { width: 22px; height: 22px; }

.bar nav { display: flex; gap: clamp(14px, 3vw, 28px); font-size: 15px; }
.bar nav a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.bar nav a:hover, .bar nav a[aria-current="page"] { color: var(--fg); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg);
  font: 500 15px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--fg); color: #0a0a0b; border-color: var(--fg); }
.btn.primary:hover { background: #fff; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; }

/* ── Landing ───────────────────────────────────────────────────────────── */

.landing #dust {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
.landing #dust.dim { opacity: 0.18; }

.landing main { position: relative; z-index: 1; }

.step {
  position: relative;
  min-height: 115vh;
  display: flex;
  align-items: center;
  padding: 120px clamp(20px, 6vw, 96px);
}

.copy { max-width: 31rem; }

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.eyebrow b { color: var(--fg); font-weight: 600; }

h1, h2 {
  margin: 0;
  font-weight: 640;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 6.4vw, 5.6rem); line-height: 0.98; }
h2 { font-size: clamp(2rem, 4.2vw, 3.6rem); line-height: 1.02; }

.copy p { color: #b9b8be; font-size: clamp(1rem, 1.25vw, 1.15rem); text-wrap: pretty; }
.copy h2 + p { margin-top: 22px; }

.hero { min-height: 100vh; align-items: flex-end; justify-content: center; text-align: center; padding-bottom: clamp(56px, 9vh, 110px); }
.hero .copy { max-width: 46rem; }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 4.6rem); }
.hero .lede { margin: 22px auto 0; max-width: 38rem; }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }

.hint {
  margin-top: 26px;
  color: var(--faint);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.note {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  position: fixed;
  right: clamp(16px, 3vw, 36px);
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.5s;
}
.progress span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  transition: background 0.3s, transform 0.3s;
}
.progress span.on { background: var(--fg); transform: scale(1.5); }
.progress.hidden { opacity: 0; }

/* After the story: normal page content */
.after {
  position: relative;
  z-index: 1;
  padding: 140px clamp(20px, 6vw, 96px) 60px;
  background: linear-gradient(to bottom, rgba(5, 5, 6, 0), var(--bg) 220px);
}
.after section { max-width: 1120px; margin: 0 auto 120px; }
.after h2 { margin-bottom: 20px; }
.after p.lead { color: #b9b8be; max-width: 40rem; margin: 0 0 34px; }

.code {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: #d8d7dc;
  font: 13.5px/1.7 var(--mono);
  tab-size: 2;
}
.code .c { color: var(--faint); }
.code .k { color: #9fb7ff; }
.code .s { color: #c8e3b0; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.gallery a {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #000;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; opacity: 0.82; transition: opacity 0.3s, transform 0.5s; }
.gallery a:hover img { opacity: 1; transform: scale(1.04); }
.gallery span {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 12px;
  color: var(--fg);
  text-shadow: 0 1px 8px #000;
}

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.features div { background: var(--bg); padding: 26px 24px; }
.features h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.features p { margin: 0; color: var(--muted); font-size: 15px; }

footer.site {
  max-width: 1120px;
  margin: 0 auto;
  padding: 30px 0 10px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 859px) {
  .step { align-items: flex-end; padding-bottom: 12vh; }
  .step .copy {
    padding: 26px 22px 24px;
    margin: 0 -6px;
    border-radius: 18px;
    background: linear-gradient(to top, rgba(5, 5, 6, 0.94) 70%, rgba(5, 5, 6, 0.6));
    backdrop-filter: blur(2px);
  }
  .hero .copy { background: none; backdrop-filter: none; padding: 0; }
  .hero { padding-bottom: 7vh; }
  .hero .eyebrow { margin-bottom: 12px; }
  .progress { display: none; }
}

@media (hover: none) {
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ── Configurator ──────────────────────────────────────────────────────── */

.studio-page { overflow: hidden; }
.studio-page .bar { position: static; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: 14px; padding-bottom: 14px; }

.studio {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  height: calc(100vh - 61px);
  height: calc(100dvh - 61px);
}

.panel {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 6px 0 40px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.panel details { border-bottom: 1px solid var(--line); }
.panel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: "+"; font-size: 16px; color: var(--faint); letter-spacing: 0; }
.panel details[open] summary::after { content: "–"; }
.panel details[open] summary { color: var(--fg); }
.group { padding: 0 20px 20px; display: grid; gap: 14px; }

.field { display: grid; gap: 6px; }
.field label, .field .label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #c9c8ce;
}
.field output { color: var(--muted); font: 12px/1.6 var(--mono); }

input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  accent-color: var(--fg);
  cursor: pointer;
}

select, input[type="text"], input[type="color"] {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--fg);
  font: 14px var(--font);
}
input[type="color"] { padding: 3px; cursor: pointer; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row > .btn { flex: 0 0 auto; }

.check, .field label.check { display: flex; justify-content: flex-start; align-items: center; gap: 10px; font-size: 13px; color: #c9c8ce; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--fg); }

.drop {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 96px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop strong { color: var(--fg); font-weight: 600; font-size: 14px; }
.drop:hover, .drop.over { border-color: var(--fg); background: rgba(255, 255, 255, 0.03); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.samples { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.samples button {
  padding: 0;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}
.samples button img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.75; }
.samples button:hover img, .samples button[aria-pressed="true"] img { opacity: 1; }
.samples button[aria-pressed="true"] { border-color: var(--fg); }

.presets { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.presets li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.presets li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presets .empty { color: var(--faint); border-style: dashed; justify-content: center; padding: 10px; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 8px; font: 13px var(--font); }
.icon-btn:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.muted { color: var(--faint); font-size: 12px; margin: 0; }

.stage { position: relative; overflow: hidden; background: #000; }
.stage #dust { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage-ui {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(10px);
}
.stage-ui .btn { border-color: transparent; background: transparent; white-space: nowrap; }
.stage-ui .btn:hover { background: rgba(255, 255, 255, 0.08); }
.stage-ui .btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); }

.inspect {
  position: absolute;
  top: 16px;
  right: 16px;
  width: min(30%, 260px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #000;
  image-rendering: auto;
}
.inspect[hidden] { display: none; }

.toast {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translate(-50%, -8px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--fg);
  color: #0a0a0b;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.stage-drop {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.stage.over .stage-drop { opacity: 1; }

@media (max-width: 799px) {
  .studio-page { overflow: auto; }
  .studio { grid-template-columns: 1fr; grid-template-rows: 58vh auto; height: auto; }
  .stage { order: -1; height: 58vh; position: sticky; top: 0; z-index: 2; }
  .stage-ui { bottom: 10px; gap: 2px; padding: 4px; }
  .stage-ui .btn.small { padding: 0 10px; font-size: 12px; }
  .inspect { width: 34%; top: 10px; right: 10px; }
  .panel { border-right: 0; overflow: visible; }
  .samples { grid-template-columns: repeat(7, 1fr); }
}
