/* Xulta Impact configurator.
   Palette from the fixture itself: powder-coat black, the graphite of its price rails, the three header colours,
   and the yellow of a shelf-edge tag for whatever is selected. Type: Archivo, wide and heavy for the name (the
   lettering on the header lightboxes), condensed caps for labels, tabular figures for every dimension. */
@font-face {
  font-family: "Archivo"; src: url("archivo.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
}

:root {
  --ink: #16171a;
  --rail: #2d2f33;
  --muted: #6a6e73;
  --line: #d9dbd9;
  --wash: #eceeec;
  --card: #fbfbfa;
  --studio: #d5d8db;
  --tag: #ffd60a;
  --cig: #c4322c;
  --itp: #3d6db3;
  --otp: #2f8a3c;
  --sheet: 0px;
  --r: 10px;
  --tap: 38px;
  font-family: "Archivo", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px; line-height: 1.35; color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--studio); }
[hidden] { display: none !important; }

button, select, output { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- the 3D view ---------- */
#stage {
  position: fixed; inset: 0 0 var(--sheet) 0;
  background: radial-gradient(ellipse at 58% 42%, #f5f6f6 0%, #e6e8e9 58%, var(--studio) 100%);
}
#view { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
#view.grab { cursor: grab; }
#view.grabbing { cursor: grabbing; }

.tag {            /* the height of the selected shelf, clipped to its rail like a shelf-edge ticket */
  position: absolute; left: 0; top: 0; padding: 3px 7px 2px; border-radius: 3px; pointer-events: none;
  background: var(--tag); color: var(--ink); font-weight: 700; font-stretch: 85%; font-size: 12px; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.18);
  will-change: transform;
}
.tag.stop { background: var(--cig); color: #fff; }

.hint { position: absolute; right: 18px; bottom: 14px; margin: 0; color: var(--muted); font-size: 12px; pointer-events: none; }

/* ---------- top bar: undo / redo, camera ---------- */
.topbar { position: fixed; top: 14px; right: 16px; display: flex; gap: 8px; align-items: center; z-index: 3; }
.history, .views {
  display: flex; padding: 3px; gap: 2px; border-radius: 12px;
  background: rgba(251, 251, 250, 0.86); border: 1px solid rgba(22, 23, 26, 0.10);
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
}
.history button, .views button {
  height: 32px; min-width: 34px; padding: 0 11px; border: 0; border-radius: 9px; background: transparent;
  font-weight: 600; font-stretch: 88%; letter-spacing: 0.01em;
}
.history button { padding: 0; width: 34px; display: grid; place-items: center; }
.history svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.history button:disabled { color: #b4b7b9; }
.views button[aria-pressed="true"] { background: var(--ink); color: #fff; }
@media (hover: hover) {
  .history button:not(:disabled):hover, .views button:not([aria-pressed="true"]):hover { background: rgba(22, 23, 26, 0.08); }
}

/* ---------- the panel ---------- */
.panel {
  position: fixed; left: 16px; top: 14px; width: 328px; max-height: calc(100dvh - 28px); z-index: 4;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid rgba(22, 23, 26, 0.10); border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 18px 40px -18px rgba(22, 23, 26, 0.35), 0 2px 6px rgba(22, 23, 26, 0.06);
}
.grip { display: none; }
.head { padding: 16px 18px 12px; }
.head h1 {
  margin: 0; font-size: 17px; line-height: 1.1; font-weight: 800; font-stretch: 122%; letter-spacing: 0.01em; text-transform: uppercase;
}
.head h1::before {      /* the three header colours, in the order the store sets run */
  content: ""; display: inline-block; width: 21px; height: 9px; margin-right: 9px; vertical-align: 1px;
  background: linear-gradient(90deg, var(--cig) 0 33.4%, var(--itp) 33.4% 66.7%, var(--otp) 66.7%);
}
.sku { margin: 7px 0 0; font-weight: 600; font-stretch: 88%; letter-spacing: 0.01em; }
.dims { margin: 1px 0 0; color: var(--muted); }

.tabs { display: flex; gap: 20px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.tabs button {
  height: 36px; padding: 0; border: 0; background: none; color: var(--muted);
  font-weight: 700; font-stretch: 76%; font-size: 12.5px; letter-spacing: 0.09em; text-transform: uppercase;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.body { padding: 4px 18px 18px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.field { margin-top: 14px; }
.field.row { display: flex; align-items: center; justify-content: space-between; }
.field.row .label { margin: 0; }
.label {
  display: block; margin-bottom: 6px; color: var(--muted);
  font-weight: 650; font-stretch: 76%; font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase;
}

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 11px; background: var(--wash); }
.seg button {
  height: calc(var(--tap) - 6px); padding: 0 6px; border: 0; border-radius: 8px; background: transparent;
  font-weight: 550; font-stretch: 92%; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 650; }
@media (hover: hover) { .seg button:not([aria-pressed="true"]):hover { background: rgba(22, 23, 26, 0.07); } }

.step { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.step button { width: var(--tap); height: calc(var(--tap) - 2px); border: 0; background: none; font-size: 17px; line-height: 1; border-radius: 9px; }
.step button:disabled { color: #c2c5c7; }
.step output { min-width: 50px; text-align: center; font-weight: 600; }
@media (hover: hover) { .step button:not(:disabled):hover { background: var(--wash); } }

select {
  width: 100%; height: var(--tap); padding: 0 32px 0 11px; border: 1px solid var(--line); border-radius: var(--r);
  appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2316171a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1.5 1.5 4.5 4.5 4.5-4.5'/%3E%3C/svg%3E") no-repeat right 11px center;
}

.block { display: grid; grid-template-columns: 5px minmax(0, 1fr) auto var(--tap); gap: 6px; align-items: center; margin-bottom: 6px; }
.block i { align-self: stretch; border-radius: 3px; background: var(--c); }
.block .x { width: var(--tap); height: var(--tap); border: 1px solid var(--line); border-radius: var(--r); background: #fff; font-size: 16px; line-height: 1; }
.block .x:disabled { color: #c2c5c7; }
.block .step button { width: 30px; }
.block .step output { min-width: 34px; }
.block select { padding-left: 9px; padding-right: 26px; background-position: right 9px center; }

.quiet {
  width: 100%; height: var(--tap); border: 1px dashed #c3c6c4; border-radius: var(--r); background: none; font-weight: 600; font-stretch: 92%;
}
.quiet:disabled { color: #b4b7b9; }
.quiet.danger { color: var(--cig); }
.primary { width: 100%; height: 42px; margin-top: 16px; border: 0; border-radius: var(--r); background: var(--ink); color: #fff; font-weight: 650; font-stretch: 92%; }
@media (hover: hover) {
  .quiet:not(:disabled):hover { background: var(--wash); }
  .primary:hover { background: #000; }
  .block .x:not(:disabled):hover { background: var(--wash); }
}

/* ---------- shelves ---------- */
.chips { display: flex; gap: 6px; margin-top: 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; height: 32px; padding: 0 11px 0 9px; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 600; font-stretch: 90%;
}
.chips button::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.shelfgrid { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 14px; margin-top: 12px; align-items: start; }
.elev { width: 124px; height: 264px; display: block; touch-action: none; cursor: default; user-select: none; -webkit-user-select: none; }
.elev text { font-size: 8.5px; font-stretch: 80%; fill: var(--muted); }
.elev .row { cursor: grab; }
.elev.dragging, .elev.dragging .row { cursor: grabbing; }
.inspect { min-width: 0; }
.inspect h2 { margin: 0; font-size: 13px; font-weight: 700; font-stretch: 100%; }
.inspect p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.inspect .field { margin-top: 10px; }
.inspect .step { width: 100%; justify-content: space-between; }
.inspect .step output { flex: 1; }
.inspect .quiet { margin-top: 8px; }
.inspect .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.link { display: block; margin: 10px 0 0; padding: 4px 0; border: 0; background: none; color: var(--ink); font-weight: 600; font-stretch: 92%; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #b9bcbe; }
.link:disabled { color: #b4b7b9; text-decoration: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--sheet) + 22px); z-index: 6; max-width: min(420px, calc(100vw - 32px));
  padding: 9px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 500; text-align: center;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phones: the panel becomes a sheet under the 3D view ---------- */
@media (max-width: 760px) {
  :root { --tap: 44px; font-size: 14px; }
  select { font-size: 16px; }              /* iOS zooms the page on anything smaller */
  .panel {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; height: var(--sheet); max-height: none;
    border-radius: 18px 18px 0 0; border-width: 1px 0 0;
    box-shadow: 0 -10px 30px -12px rgba(22, 23, 26, 0.3);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.snap { transition: height 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .grip { display: block; flex: none; width: 100%; height: 20px; padding: 0; border: 0; background: none; touch-action: none; cursor: grab; }
  .grip i { display: block; width: 38px; height: 4px; margin: 0 auto; border-radius: 2px; background: #c9ccca; }
  .head { padding: 0 16px 8px; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; touch-action: none; }
  .head h1 { font-size: 14px; grid-row: 1 / span 2; align-self: center; white-space: nowrap; }
  .sku { margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dims { text-align: right; font-size: 12px; white-space: nowrap; }
  .tabs { flex: none; padding: 0 16px; }
  .tabs button { height: 40px; flex: 1; }
  .body { flex: 1; padding: 0 16px 20px; }
  .topbar { top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; justify-content: space-between; }
  .history button, .views button { height: 36px; }
  .views button { padding: 0 10px; }
  .hint { display: none; }
  .toast { bottom: calc(var(--sheet) + 14px); }
  .shelfgrid { grid-template-columns: 132px minmax(0, 1fr); margin-top: 10px; }
  .elev { width: 132px; height: 236px; }
  .chips { margin-top: 10px; }
  #stage { bottom: calc(var(--sheet) - 18px); }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .panel.snap { transition: none; }
}
