/** Studio: two-column layout, sticky preview, numbered steps on the right. */

.studio__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}

/* ── Left column: preview ───────────────────────────────────────── */

.studio__preview {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  align-self: start;
}

/* Two views sharing the one preview slot, swapped by js/studio.js's
   IntersectionObserver on step 5 ("Preview the paint") — single framed
   canvas normally, Framed/Painted side by side while that step is in
   view. Same slot either way, so nothing else in the layout shifts. */
.preview-compare {
  display: none;
}

.studio__preview[data-view="compare"] .preview-single {
  display: none;
}

.studio__preview[data-view="compare"] .preview-compare {
  display: block;
}

.preview-frame {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

#preview {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: grab;
}

#preview.has-photo {
  cursor: grab;
}

.preview-hint {
  margin-top: var(--space-4);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: opacity var(--dur-sm) var(--ease);
}

.preview-hint.is-idle {
  opacity: 0.6;
}

.fit-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: var(--space-4);
}

.fit-row input[type="range"] {
  width: min(260px, 60vw);
}

/* ── Right column: steps ────────────────────────────────────────── */

.studio__steps {
  display: grid;
  gap: var(--space-7);
}

.step {
  padding-bottom: var(--space-7);
  border-bottom: 1px solid var(--line);
}

.step:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.step__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.step__num {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.step h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
}

/* ── Mobile step dots + Back/Next (inert above 900px) ───────────── */

.step-nav {
  display: none;
  gap: var(--space-2);
  justify-content: center;
}

.step-dot {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.step-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-hi);
  transition: background var(--dur-sm) var(--ease), transform var(--dur-sm) var(--ease);
}

.step-dot[aria-selected="true"]::before {
  background: var(--accent);
  transform: scale(1.3);
}

.step-controls {
  display: none;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.step-controls .btn {
  flex: 1;
}

.step-controls .btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Chips: watch model / style — plain <button>s from studio.js's own
   chips() helper, styled structurally via their grid container rather than
   a class studio.js never adds. ─────────────────────────────────────── */

.model-grid,
.style-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
}

.model-grid button,
.style-grid button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font: 600 13px var(--font-body);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--dur-sm) var(--ease),
    background var(--dur-sm) var(--ease),
    transform var(--dur-sm) var(--ease);
}

.model-grid button:hover,
.style-grid button:hover {
  transform: translateY(-2px);
  border-color: var(--line-hi);
  background: var(--surface-hi);
}

.model-grid button[aria-checked="true"],
.style-grid button[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
}

.model-grid button:focus-visible,
.style-grid button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Upload card ─────────────────────────────────────────────────── */

.dropzone {
  display: grid;
  place-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  margin-bottom: var(--space-4);
  border: 1px dashed var(--line-hi);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}

.dropzone__icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.dropzone__hint {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 40ch;
}

.privacy {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: var(--space-2);
}

/* ── Inscription + Art row ──────────────────────────────────────── */

#inscription {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

#inscription:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hi);
}

#art-row {
  margin-top: var(--space-6);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}

#art-row[hidden] {
  display: none;
}

.art-row__check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  cursor: pointer;
}

.art-row__note {
  margin: var(--space-3) 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Step 5: preview the paint (framed vs painted, side by side) ── */

.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.compare-col {
  text-align: center;
}

.compare-col__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 var(--space-2);
}

.art-preview-frame {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

#framed-preview,
#art-preview {
  display: block;
  width: 100%;
  height: auto;
}

#art-preview[hidden] {
  display: none;
}

@media (max-width: 420px) {
  .compare-row {
    gap: var(--space-2);
  }
}

/* ── Order summary: price, buy, photo-later, status ─────────────── */

.studio__summary {
  margin-top: var(--space-2);
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.price {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
  margin-bottom: var(--space-4);
}

#price {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  color: var(--text);
}

#compare {
  color: var(--text-dim);
  text-decoration: line-through;
  font-size: 17px;
}

.ship {
  color: var(--text-dim);
  font-size: 13px;
}

.link-btn {
  display: block;
  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-2) 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}

.status {
  min-height: 1.4em;
  font-size: 14px;
  margin-top: var(--space-3);
  text-align: center;
}

.status.err {
  color: var(--error);
}

.status.ok {
  color: var(--ok);
}

/* ── Mobile sticky buy bar ───────────────────────────────────────── */

.buybar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: var(--space-3) var(--space-4);
  display: none;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.buybar.show {
  display: flex;
}

.buybar .p {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
}

.buybar .btn {
  width: auto;
  padding: 12px 18px;
}

@media (min-width: 900px) {
  .buybar {
    display: none !important;
  }
}

/* ── Breakpoints ─────────────────────────────────────────────────── */

@media (max-width: 900px) {
  #studio.section--flush {
    padding-top: var(--space-4);
  }

  .studio__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }

  .studio__preview {
    position: static;
    max-width: 320px;
    margin: 0 auto;
  }

  .preview-hint {
    margin-top: var(--space-2);
    font-size: 12px;
    letter-spacing: 0.04em;
    line-height: 1.3;
    text-transform: none;
  }

  /* Everything below turns the always-stacked step list into a one-panel-
     at-a-time carousel, so the section fits a single phone screen instead
     of scrolling through all 4 steps. step-carousel.js does the actual
     show/hide; this tightens spacing throughout to make that fit real. */

  #studio .section__head {
    margin-bottom: var(--space-3);
  }

  #studio .section__head .eyebrow,
  #studio .section__head .lead {
    display: none;
  }

  #studio .section__head h2 {
    font-size: 26px;
    margin-bottom: 0;
  }

  .step-nav,
  .step-controls {
    display: flex;
  }

  .studio__steps {
    gap: var(--space-2);
  }

  .step {
    padding-bottom: 0;
    border-bottom: none;
  }

  .step__head {
    margin-bottom: var(--space-2);
  }

  .step h3 {
    font-size: 16px;
  }

  .dropzone {
    padding: var(--space-3);
    gap: var(--space-2);
    margin-bottom: var(--space-2);
  }

  .dropzone__icon {
    width: 22px;
    height: 22px;
  }

  .dropzone__hint {
    line-height: 1.3;
  }

  .privacy {
    margin-top: var(--space-1);
    font-size: 12px;
    line-height: 1.3;
  }

  .studio__summary {
    padding: var(--space-3);
  }

  .price {
    margin-bottom: var(--space-2);
  }

  .studio__summary .btn--block {
    padding-block: 12px;
  }

  .link-btn {
    margin-top: var(--space-2);
  }

  .status {
    margin-top: var(--space-2);
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .model-grid,
  .style-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
