/* Configurator test: questions beside a live 3D model, then the finished build.
   Wide screens: model on the left (it stays in view while the questions
   change), questions on the right. Narrow screens: model on top.
   Everything is scoped to .cfg, in the showcase page's warm colours, so the
   section can drop into that page as it is. */

.cfg {
  --ink: #1f1a14; --ink-soft: #5c5347; --ink-faint: #94897b;
  --cream: #f6f1e7; --sand: #ebe3d5; --card: rgba(255, 252, 246, 0.72); --line: rgba(31, 26, 20, 0.13);
  box-sizing: border-box;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 120px) 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(320px, 0.78fr);
  gap: 56px;
  align-items: start;
  color: var(--ink);
}
.cfg *, .cfg *::before, .cfg *::after { box-sizing: border-box; }

/* The page around the section, when it is shown on its own. */
html:has(.cfg-page), .cfg-page { margin: 0; background: #f6f1e7; }
body:has(.cfg-page) {
  margin: 0;
  font-family: "SF Pro Display", "Inter", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.cfg-page { min-height: 100vh; display: flex; align-items: center; }

/* ── The stage: stays in view while the visitor answers. */
.cfg-stage-wrap { position: sticky; top: 24px; }
.cfg-stage {
  position: relative; width: 100%; aspect-ratio: 5 / 4; overflow: hidden;
  border-radius: 28px; container-type: size; background: #efe5d4; touch-action: pan-y;
}
.cfg-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cfg-status { position: absolute; left: 0; right: 0; top: 46%; margin: 0; text-align: center; font-size: 15px; color: var(--ink-soft); }
.cfg-stage.no3d { background: #fff url("/tools/product-video-assets/phone-front.jpg") center / contain no-repeat; }
.cfg-stage.no3d canvas, .cfg-stage.no3d .cfg-lines { display: none; }

/* The name over the finished phone, at the end. */
.cfg-stage-title {
  position: absolute; left: 6cqw; top: 5.5cqw; margin: 0; max-width: 60cqw;
  font-size: clamp(22px, 4.6cqw, 44px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity 0.9s 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.9s 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cfg-stage-title.in { opacity: 1; transform: none; }

/* The line to the main board, on the storage step. Width must match the script (0.22). */
.cfg-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cfg-lines line { stroke: var(--ink); stroke-width: 1; opacity: 0; }
.cfg-lines circle { fill: var(--ink); opacity: 0; }
.cfg-stage .label { position: absolute; width: 22cqw; opacity: 0; color: var(--ink); pointer-events: none; will-change: opacity, transform; }
.cfg-stage .label strong { display: block; font-size: 2.3cqw; font-weight: 600; letter-spacing: -0.012em; line-height: 1.12; }
.cfg-stage .label span { display: block; margin-top: 0.4cqw; font-size: 1.6cqw; line-height: 1.3; color: var(--ink-soft); }

/* ── The panel. */
.cfg-eyebrow { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.cfg h2 { margin: 0 0 26px; font-size: clamp(34px, 3.6vw, 52px); font-weight: 600; letter-spacing: -0.028em; line-height: 1.05; }

/* The steps, as small buttons: done ones can be revisited. */
.cfg-progress { list-style: none; margin: 0 0 30px; padding: 0; display: flex; gap: 6px; }
.cfg-progress li { flex: 1 1 0; min-width: 0; }
.cfg-progress-step {
  width: 100%; padding: 12px 0 0; border: 0; border-top: 3px solid var(--line); background: none;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--ink-faint); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  transition: border-color 0.4s, color 0.4s;
}
.cfg-progress-step.done { border-top-color: var(--ink); color: var(--ink-soft); }
.cfg-progress-step.current { border-top-color: var(--ink); color: var(--ink); font-weight: 600; }
.cfg-progress-step:disabled { cursor: default; }
.cfg-progress-step:not(:disabled):hover { color: var(--ink); }
.cfg-progress-step:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* A new step slides in. */
.cfg-step-inner { animation: cfg-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes cfg-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cfg-count { margin: 0 0 6px; font-size: 14px; color: var(--ink-faint); }
.cfg-question { margin: 0 0 18px; font-size: clamp(22px, 2vw, 28px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; outline: none; }
.cfg-note { margin: -10px 0 16px; font-size: 15px; color: var(--ink-soft); }

/* The options: cards that fill in when chosen. */
.cfg-options { display: grid; gap: 10px; }
.cfg-option {
  display: flex; align-items: center; gap: 14px; width: 100%; margin: 0; padding: 15px 18px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--card);
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
}
.cfg-option:hover { border-color: rgba(31, 26, 20, 0.3); background: #fffdf8; }
.cfg-option.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #fffdf8; }
.cfg-option:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cfg-option-words { flex: 1; min-width: 0; }
.cfg-option-name { display: block; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.cfg-option-text { display: block; margin-top: 3px; font-size: 14.5px; line-height: 1.4; color: var(--ink-soft); }

/* Finishes: a colour dot before the name. */
.cfg-swatch {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), inset 0 -6px 10px rgba(0, 0, 0, 0.08), inset 0 5px 8px rgba(255, 255, 255, 0.45);
}
.cfg-options-swatches { grid-template-columns: 1fr 1fr; }
.cfg-options-swatches .cfg-option { flex-direction: column; align-items: flex-start; gap: 10px; }

/* Accessories: a tick box on the right. */
.cfg-tick {
  flex: none; width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid rgba(31, 26, 20, 0.3);
  position: relative; transition: background-color 0.2s, border-color 0.2s;
}
.cfg-option.on .cfg-tick { background: var(--ink); border-color: var(--ink); }
.cfg-option.on .cfg-tick::after {
  content: ""; position: absolute; left: 7.5px; top: 3.5px; width: 6px; height: 11px;
  border: solid var(--cream); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Buttons. */
.cfg-nav { display: flex; gap: 10px; margin-top: 22px; }
.cfg-btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 13px 24px; border-radius: 99px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--cream);
  font: inherit; font-size: 16px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color 0.2s, transform 0.2s, opacity 0.2s;
}
.cfg-btn:hover:not(:disabled) { background: #000; transform: translateY(-1px); }
.cfg-btn:disabled { opacity: 0.3; cursor: default; }
.cfg-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.cfg-btn-quiet { background: transparent; color: var(--ink); border-color: rgba(31, 26, 20, 0.22); }
.cfg-btn-quiet:hover:not(:disabled) { background: rgba(255, 252, 246, 0.9); }
.cfg-nav .cfg-btn:last-child { flex: 1; }
.cfg-link {
  padding: 6px 2px; border: 0; background: none; font: inherit; font-size: 15px; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.cfg-link:hover { color: var(--ink); }

/* "Your build", filling in as the visitor goes. */
.cfg-build { margin-top: 28px; }
.cfg-build:empty { display: none; }
.cfg-build-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.cfg-build-list { margin: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 18px; row-gap: 5px; font-size: 14.5px; }
.cfg-build-list dt { color: var(--ink-faint); }
.cfg-build-list dd { margin: 0; color: var(--ink); }

/* ── The finished build. */
.cfg-kicker { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.cfg-model { margin: 0; font-size: clamp(30px, 3vw, 42px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; outline: none; }
.cfg-sub { margin: 8px 0 0; font-size: 17px; color: var(--ink-soft); }
.cfg-why { margin: 16px 0 0; font-size: 16px; line-height: 1.5; }
.cfg-spec {
  margin: 22px 0 0; display: grid; grid-template-columns: auto 1fr;
  border-top: 1px solid var(--line); font-size: 15px;
}
.cfg-spec dt, .cfg-spec dd { padding: 9px 0; border-bottom: 1px solid var(--line); }
.cfg-spec dt { padding-right: 20px; }
.cfg-spec dt { color: var(--ink-faint); }
.cfg-spec dd { margin: 0; font-weight: 500; }
.cfg-ref { margin: 10px 0 0; font-size: 13px; color: var(--ink-faint); }

.cfg-quote { margin-top: 26px; }
.cfg-quote-label { display: block; margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.cfg-quote-row { display: flex; gap: 8px; }
.cfg-input {
  flex: 1; min-width: 0; padding: 13px 18px; border: 1px solid rgba(31, 26, 20, 0.25); border-radius: 99px;
  background: #fffdf8; font: inherit; font-size: 16px; color: var(--ink);
}
.cfg-input:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.cfg-input[aria-invalid="true"] { border-color: #a3402c; }
.cfg-quote-note { margin: 8px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--ink-soft); }
.cfg-quote-note.cfg-error { color: #a3402c; }

.cfg-sent {
  margin-top: 26px; padding: 18px 20px; border-radius: 16px; background: var(--ink); color: var(--cream);
  animation: cfg-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cfg-sent-title { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.cfg-sent-text { margin: 0; font-size: 15px; line-height: 1.45; color: rgba(246, 241, 231, 0.8); }
.cfg-sent-text strong { color: var(--cream); font-weight: 600; }

.cfg-more { margin-top: 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cfg-more .cfg-btn { font-size: 15px; padding: 11px 20px; }

/* ── Narrow screens: model first, then the questions. */
@media (max-width: 860px) {
  .cfg { grid-template-columns: 1fr; gap: 22px; padding: 28px 18px 48px; }
  .cfg-stage-wrap { position: static; }
  .cfg-stage { aspect-ratio: 1 / 1; border-radius: 22px; }
  .cfg-stage .label, .cfg-lines { display: none; }
  .cfg h2 { margin-bottom: 18px; }
  .cfg-progress { margin-bottom: 22px; }
  .cfg-progress-step { font-size: 11px; }
  .cfg-option { padding: 13px 15px; }
  .cfg-quote-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .cfg-step-inner, .cfg-sent { animation: none; }
  .cfg-stage-title, .cfg-progress-step, .cfg-option { transition: none; }
}
.still .cfg-step-inner { animation: none; }
.still .cfg-stage-title { transition: none; }
