/* ATELIER PI: the design layer.
   Digital-couture register: near-black canvas, one light accent, oversized
   grotesk with clipped-line reveals, hairline rails, mono metadata. The
   Fabricant bar: restraint, space, and motion that feels expensive. */

:root {
  --bg: #08080b;
  --bg-2: #0c0d11;
  --panel: #101218;
  --panel-2: #14161d;
  --line: #22242c;
  --line-soft: #1a1c23;
  --ink: #ececef;
  --ink-dim: #a2a5ae;
  --ink-faint: #63666f;
  /* the one accent: a cold spectral lavender-ice */
  --acc: #b7b3ff;
  --acc-deep: #7d78e6;
  --acc-soft: rgba(183, 179, 255, 0.10);
  --live: #63d6a4;
  --hold: #ffb86b;
  --block: #ff7d90;
  --pass: #6fe3b1;
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--acc); color: #0a0a10; }

/* ── ambient field ─────────────────────────────────────────────── */
.field { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.field-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 62% at 50% 0%, rgba(0,0,0,0.55), transparent 68%);
  -webkit-mask-image: radial-gradient(ellipse 90% 62% at 50% 0%, rgba(0,0,0,0.55), transparent 68%);
  opacity: 0.5;
}
.field-haze {
  position: absolute; inset: 0;
  background:
    radial-gradient(52% 38% at 78% -6%, rgba(125, 120, 230, 0.14), transparent 70%),
    radial-gradient(44% 34% at 8% 108%, rgba(125, 120, 230, 0.07), transparent 70%);
}

/* ── chrome ────────────────────────────────────────────────────── */
.chrome {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 40px;
  background: linear-gradient(to bottom, rgba(8,8,11,0.92), rgba(8,8,11,0.72));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.marque {
  font-weight: 600; font-size: 14px; letter-spacing: 0.34em;
  display: flex; align-items: center; gap: 10px;
}
.marque-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 12px var(--acc);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.chrome-sub {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint);
  letter-spacing: 0.08em; margin-top: 4px;
}
.chrome-right { display: flex; align-items: center; gap: 22px; }

.meter {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--line); border-radius: 99px;
  padding: 7px 14px; background: var(--bg-2);
}
.meter-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.meter-dot.low { background: var(--hold); }
.meter-dot.out { background: var(--block); }
.meter-num { color: var(--ink); font-weight: 500; }
.meter-label { color: var(--ink-faint); letter-spacing: 0.06em; }
.meter-usd { color: var(--ink-dim); border-left: 1px solid var(--line); padding-left: 9px; }

.status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
}
.status-led { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); transition: background .3s; }
.status-led.live { background: var(--live); box-shadow: 0 0 10px var(--live); }
.status-led.err { background: var(--block); box-shadow: 0 0 10px var(--block); }
.status-led.busy { background: var(--acc); box-shadow: 0 0 10px var(--acc); animation: pulse 1.1s ease-in-out infinite; }

/* ── progress rail ─────────────────────────────────────────────── */
.rail {
  position: sticky; top: 67px; z-index: 39;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px 40px;
  background: rgba(8,8,11,0.86); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.rail-step {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-mono); cursor: default;
  opacity: 0.38; transition: opacity 0.5s var(--ease-out);
}
.rail-step .rail-n { font-size: 10px; color: var(--acc); letter-spacing: 0.1em; }
.rail-step .rail-t { font-size: 11px; color: var(--ink-dim); letter-spacing: 0.14em; text-transform: uppercase; }
.rail-step.active, .rail-step.done { opacity: 1; }
.rail-step.done .rail-t { color: var(--ink); }
.rail-step.done .rail-n::after { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--live); margin-left: 6px; vertical-align: 2px; }
.rail-line { width: 42px; height: 1px; background: var(--line); }

/* ── shared atoms ──────────────────────────────────────────────── */
main { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 40px 40px; }

.btn {
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink);
  padding: 13px 20px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 12px;
  transition: transform .18s var(--ease-out), border-color .18s, background .18s, opacity .18s;
}
.btn:hover:not(:disabled) { border-color: var(--acc-deep); transform: translateY(-1px); }
.btn:disabled { opacity: 0.32; cursor: default; }
.btn-primary {
  background: var(--acc); border-color: var(--acc); color: #0b0a14;
  justify-content: space-between; width: 100%;
}
.btn-primary:hover:not(:disabled) { background: #c6c3ff; border-color: #c6c3ff; }
.btn-cost { font-family: var(--font-mono); font-size: 10px; opacity: 0.72; letter-spacing: 0.04em; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(255,125,144,0.4); color: var(--block); background: transparent; }
.btn-danger:hover:not(:disabled) { border-color: var(--block); }
.btn-mini { padding: 8px 12px; font-size: 11.5px; flex: 1; justify-content: center; }
.btn-arrow { font-size: 15px; }
.btn.busy .btn-text::after { content: " ..."; animation: pulse 1s infinite; }

.field-label {
  display: block; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 10px;
}
.prompt {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 12px; padding: 16px 18px;
  font-family: var(--font-sans); font-size: 15px; font-weight: 300;
  line-height: 1.55; resize: vertical; min-height: 88px;
  transition: border-color .2s;
}
.prompt:focus { outline: none; border-color: var(--acc-deep); box-shadow: 0 0 0 3px var(--acc-soft); }
.prompt-sm { font-size: 13px; min-height: 68px; }
.field-row { display: flex; gap: 10px; margin-top: 14px; }
.hint { font-size: 11.5px; color: var(--ink-faint); line-height: 1.55; margin: 12px 0 0; }
code { font-family: var(--font-mono); font-size: 0.86em; background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; color: var(--acc); }

/* ── hero ──────────────────────────────────────────────────────── */
.hero { padding: 96px 0 84px; max-width: 940px; }
.hero-kicker {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--acc); margin: 0 0 34px;
}
.hero-title {
  margin: 0 0 38px; font-weight: 600;
  font-size: clamp(64px, 11vw, 148px);
  line-height: 0.94; letter-spacing: -0.045em; color: var(--ink);
}
.ht-line { display: block; overflow: hidden; }
.ht-word { display: inline-block; transform: translateY(110%); animation: rise 1.1s var(--ease-out) forwards; }
.ht-line:nth-child(1) .ht-word { animation-delay: 0.05s; }
.ht-line:nth-child(2) .ht-word { animation-delay: 0.16s; }
.ht-line:nth-child(3) .ht-word { animation-delay: 0.27s; }
.ht-line:nth-child(4) .ht-word { animation-delay: 0.38s; }
@keyframes rise { to { transform: translateY(0); } }
.ht-em {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--acc);
  font-style: italic; font-weight: 500;
}
.hero-lede { font-size: 17px; color: var(--ink-dim); max-width: 62ch; margin: 0 0 40px; }
.hero-lede strong { color: var(--ink); font-weight: 500; }
.hero-cta { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.hero-note { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); letter-spacing: 0.06em; }

/* ── acts ──────────────────────────────────────────────────────── */
.act {
  border-top: 1px solid var(--line);
  padding: 72px 0 76px;
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.act.revealed { opacity: 1; transform: none; }
.act-head { display: flex; gap: 26px; align-items: flex-start; margin-bottom: 40px; }
.act-num {
  font-family: var(--font-mono); font-size: 12px; color: var(--acc);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px;
  letter-spacing: 0.1em; background: var(--bg-2);
}
.act-title { margin: 0; font-size: clamp(28px, 4vw, 44px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.act-sub { margin: 8px 0 0; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); letter-spacing: 0.05em; }

.act-body { display: grid; grid-template-columns: 380px 1fr; gap: 26px; align-items: start; }
.act-body-vton { grid-template-columns: 1fr 340px; }
.act-body-cw { grid-template-columns: 320px 1fr; }
.act-body-pdp { grid-template-columns: 1.25fr 1fr; }
@media (max-width: 1020px) {
  .act-body, .act-body-vton, .act-body-cw, .act-body-pdp { grid-template-columns: 1fr; }
}

.pane {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px;
}

/* stage (result) panes */
.pane-stage { min-height: 380px; display: flex; flex-direction: column; }
.stage-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; color: var(--ink-faint); font-size: 13.5px; text-align: center; padding: 30px;
}
.stage-empty-ring {
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid var(--line);
  border-top-color: var(--acc);
  animation: idle-spin 7s linear infinite;
}
.stage-empty.working .stage-empty-ring { animation-duration: 0.9s; border-top-color: var(--acc); border-right-color: var(--acc-deep); }
.stage-empty.working p::after { content: " ..."; animation: pulse 1s infinite; }
@keyframes idle-spin { to { transform: rotate(360deg); } }

.stage-figure { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.stage-figure img {
  width: 100%; border-radius: 12px; display: block;
  border: 1px solid var(--line); background: var(--bg-2);
  animation: materialize 0.9s var(--ease-out);
}
@keyframes materialize { from { opacity: 0; transform: scale(0.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.stage-cap {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint);
}
.tag {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--acc);
  border: 1px solid var(--acc-deep); border-radius: 5px; padding: 3px 8px;
  white-space: nowrap;
}
.tag.cached { color: var(--live); border-color: rgba(99,214,164,0.45); }

/* ── VTON act ──────────────────────────────────────────────────── */
.pane-feeds { padding: 18px; }
.feeds { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .feeds { grid-template-columns: 1fr; } }
.feed {
  position: relative; background: #000; border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; aspect-ratio: 3/4;
  display: flex; align-items: center; justify-content: center;
}
.feed video, .feed img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feed-tag {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-dim);
  background: rgba(8,9,11,0.72); padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.feed-out .feed-tag { color: var(--acc); }
.feed-empty { color: var(--ink-faint); font-size: 12px; text-align: center; padding: 18px; z-index: 1; }

.pane-vton-controls { display: flex; flex-direction: column; gap: 4px; }
.vton-garment { margin-bottom: 16px; }
.vton-garment img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.vton-garment .vton-garment-cap { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); margin-top: 8px; }
.vton-stretch { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; margin-top: 16px; }
.stretch-label, .runlog-label {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--hold);
  margin-bottom: 10px;
}
.stretch-row { display: flex; gap: 8px; }
.vton-meta { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); margin-top: 12px; }
.vton-still { margin-top: 22px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.still-figure { margin: 14px 0 0; }
.still-figure img { width: 100%; border-radius: 10px; border: 1px solid var(--line); animation: materialize 0.9s var(--ease-out); }

.runlog {
  margin-top: 20px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px;
}
.runlog ul { margin: 0; padding: 0; list-style: none; }
.runlog li {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
  padding: 5px 0; border-bottom: 1px solid var(--line-soft);
  display: flex; gap: 12px;
}
.runlog li:last-child { border-bottom: none; }
.runlog li .t { color: var(--ink-faint); white-space: nowrap; }
.runlog li.warn { color: var(--hold); }
.runlog li.good { color: var(--live); }

/* ── colorway act ──────────────────────────────────────────────── */
.palette { display: flex; flex-direction: column; gap: 10px; }
.swatch-row {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim);
}
.swatch-chip {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14); flex-shrink: 0;
}
.swatch-row .hex { color: var(--ink-faint); }

.cw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.cw-tile {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; animation: materialize 0.8s var(--ease-out) backwards;
}
.cw-tile:nth-child(2) { animation-delay: .08s; }
.cw-tile:nth-child(3) { animation-delay: .16s; }
.cw-tile:nth-child(4) { animation-delay: .24s; }
.cw-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.cw-tile.held { border-color: rgba(255,125,144,0.5); }
.cw-cap { padding: 12px 14px 14px; }
.cw-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cw-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.cw-meta { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); margin-top: 6px; }
.verdict {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  padding: 3px 8px; border-radius: 5px; white-space: nowrap; letter-spacing: 0.06em;
}
.verdict.pass { background: rgba(111,227,177,0.12); color: var(--pass); border: 1px solid rgba(111,227,177,0.35); }
.verdict.hold { background: rgba(255,125,144,0.10); color: var(--block); border: 1px solid rgba(255,125,144,0.4); }

/* ── PDP act ───────────────────────────────────────────────────── */
.pdp-card { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; overflow: hidden; }
@media (max-width: 760px) { .pdp-card { grid-template-columns: 1fr; } }
.pdp-media { position: relative; min-height: 340px; display: flex; }
.pdp-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pdp-media .stage-empty { flex: 1; }
.pdp-info { padding: 30px; display: flex; flex-direction: column; }
.pdp-kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--acc); }
.pdp-title { margin: 12px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.pdp-desc { font-size: 13.5px; color: var(--ink-dim); margin: 14px 0 0; flex: 1; }
.pdp-swatches { display: flex; gap: 8px; margin: 18px 0 4px; flex-wrap: wrap; }
.pdp-swatches .swatch-chip { width: 26px; height: 26px; cursor: default; position: relative; }
.pdp-swatches .swatch-chip.held { opacity: 0.35; }
.pdp-swatches .swatch-chip.pass { outline: 2px solid rgba(111,227,177,0.5); outline-offset: 2px; }
.pdp-buyrow { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.pdp-price { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.btn-pdp { width: auto; flex: 1; justify-content: center; }

.pane-film { display: flex; flex-direction: column; }
.film-frame { margin-top: 18px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); animation: materialize 0.9s var(--ease-out); }
.film-frame video { width: 100%; display: block; background: #000; }

/* ── coda ──────────────────────────────────────────────────────── */
.coda { border-top: 1px solid var(--line); padding: 96px 0 80px; text-align: center; }
.coda-line {
  font-size: clamp(24px, 3.4vw, 40px); font-weight: 600; letter-spacing: -0.025em;
  max-width: 26ch; margin: 0 auto 22px; line-height: 1.18;
}
.coda-sub { color: var(--ink-dim); font-size: 15px; max-width: 52ch; margin: 0 auto; }
.coda-sub strong { color: var(--ink); }
.coda-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); margin-top: 34px; letter-spacing: 0.05em; }

.foot {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 40px 30px; border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint);
  letter-spacing: 0.06em;
}

/* toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 60; background: var(--panel-2); border: 1px solid var(--acc-deep);
  color: var(--ink); border-radius: 12px; padding: 14px 22px;
  font-size: 13px; max-width: min(92vw, 560px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  animation: toast-in 0.35s var(--ease-out);
}
.toast.err { border-color: rgba(255,125,144,0.55); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 760px) {
  .chrome { padding: 14px 18px; }
  .chrome-sub, .meter-label { display: none; }
  .rail { padding: 10px 12px; gap: 8px; top: 61px; }
  .rail-line { width: 14px; }
  main { padding: 0 18px 30px; }
  .hero { padding: 60px 0 56px; }
  .hero-title { font-size: clamp(54px, 17vw, 92px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
