/* ==========================================================================
   CFG.CSS — Shared configurator layout & components
   toilet-cubicle.co.uk — A Paneltech brand (see docs/brand/BRAND.md)

   One layout for every product configurator (wash troughs, IPS, cubicles):
     .cfg-title     compact breadcrumb + H1 + lede
     .cfg           grid: sticky viewer (left) + options panel (right)
     .cfg-stage     the viewer: 3D canvas / SVG drawings / poster image
     .cfg-panel     numbered .cfg-step sections, spec table, actions
     .cfg-bar       mobile-only sticky bar: product code + Add to quote
     .cfg-content   crawlable product content below (sizes, spec, FAQ)

   Step numbers come from a CSS counter, so hiding a step (e.g. the Style
   step while there is only one style) renumbers the rest automatically.
   ========================================================================== */

.cfg-page {
  background-color: var(--color-off-white);
}

/* -------------------------------------------------------------------------
   Title row — compact so the viewer starts high on the page
   ------------------------------------------------------------------------- */

.cfg-title {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding: var(--sp-2) var(--sp-3) var(--sp-2);
}

.cfg-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-grey-600);
}

.cfg-crumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--color-grey-400);
}

.cfg-crumbs a {
  color: var(--color-petrol);
  text-decoration: none;
}

.cfg-crumbs a:hover {
  text-decoration: underline;
}

.cfg-title h1 {
  font-size: clamp(1.5rem, 1.6vw + 1rem, 2.125rem);
  line-height: 1.12;
  color: var(--color-petrol-deep);
  margin-bottom: 4px;
}

.cfg-title__lede {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 72ch;
  margin-bottom: 0;
}

/* -------------------------------------------------------------------------
   Grid
   ------------------------------------------------------------------------- */

.cfg {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding: 0 var(--sp-3) var(--sp-6);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: start;
}

@media (min-width: 900px) {
  .cfg {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    gap: var(--sp-4);
  }

  .cfg-stage-col {
    position: sticky;
    top: calc(var(--header-height) + var(--sp-2));
  }
}

.cfg-stage-col,
.cfg-panel {
  min-width: 0;
}

/* -------------------------------------------------------------------------
   Stage (viewer)
   ------------------------------------------------------------------------- */

.cfg-stage {
  position: relative;
  height: clamp(420px, calc(100vh - var(--header-height) - 170px), 760px);
  height: clamp(420px, calc(100dvh - var(--header-height) - 170px), 760px);
  background-color: #D9E0DE;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
}

.cfg-stage__poster,
.cfg-stage__canvas,
.cfg-stage__drawing {
  position: absolute;
  inset: 0;
}

.cfg-stage__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: opacity 400ms var(--ease-out);
}

.cfg-stage__poster.is-gone {
  opacity: 0;
  pointer-events: none;
}

.cfg-stage__canvas {
  z-index: 2;
  touch-action: none;
  cursor: grab;
}

.cfg-stage__canvas:active {
  cursor: grabbing;
}

.cfg-stage__canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Drawings layer — sits over the 3D layer in "drawings" mode */
.cfg-stage__drawing {
  z-index: 3;
  display: none;
  padding: 64px var(--sp-3) var(--sp-3);
  background-color: var(--color-white);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.cfg-stage__drawing svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cfg-stage[data-mode="drawings"] .cfg-stage__drawing {
  display: block;
}

/* Controls overlaid on the stage: mode switch top-left; camera presets /
   drawing views top-right (bottom-right on phones, so they never wrap over
   the drawing). */
.cfg-stage__modes,
.cfg-stage__views {
  position: absolute;
  top: var(--sp-2);
  z-index: 4;
  display: flex;
  gap: var(--sp-1);
}

.cfg-stage__modes {
  left: var(--sp-2);
}

.cfg-stage__views {
  right: var(--sp-2);
}

.cfg-stage [data-show-in] {
  display: none;
}

.cfg-stage[data-mode="3d"] [data-show-in="3d"],
.cfg-stage[data-mode="drawings"] [data-show-in="drawings"] {
  display: inline-flex;
}

.cfg-stage[data-mode="3d"] p[data-show-in="3d"] {
  display: block;
}

.cfg-stage__hint {
  position: absolute;
  right: var(--sp-2);
  bottom: 12px;
  z-index: 4;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-grey-600);
  pointer-events: none;
}

.cfg-stage__status {
  position: absolute;
  left: 50%;
  bottom: var(--sp-2);
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  padding: 6px 12px;
  font-size: var(--text-xs);
  color: var(--color-grey-800);
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.cfg-stage__fallback {
  position: absolute;
  left: var(--sp-2);
  right: var(--sp-2);
  bottom: var(--sp-2);
  z-index: 4;
  margin: 0;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--text-sm);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* Readout under the stage */
.cfg-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--sp-2);
  margin: 10px 2px 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-petrol-deep);
}

.cfg-readout span {
  color: var(--color-grey-600);
}

.cfg-caveat {
  margin: 4px 2px 0;
  font-size: var(--text-2xs);
  color: var(--color-grey-600);
}

/* -------------------------------------------------------------------------
   Segmented control (stage modes, camera presets, drawing views, options)
   ------------------------------------------------------------------------- */

.cfg-seg {
  display: inline-flex;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.cfg-seg button {
  min-height: 40px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-grey-800);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--color-grey-200);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.cfg-seg button:last-child {
  border-right: 0;
}

.cfg-seg button:hover:not([aria-pressed="true"]):not(:disabled) {
  background-color: var(--color-grey-100);
}

.cfg-seg button[aria-pressed="true"] {
  color: var(--color-white);
  background-color: var(--color-petrol);
}

.cfg-seg button:focus-visible {
  outline: 2px solid var(--color-petrol);
  outline-offset: -3px;
}

.cfg-seg button:disabled {
  color: var(--color-grey-400);
  cursor: not-allowed;
}

.cfg-seg--mono button {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

/* Full-width option segmented control inside the panel */
.cfg-seg--block {
  display: flex;
  background: var(--color-white);
  box-shadow: none;
}

.cfg-seg--block button {
  flex: 1 1 auto;
}

/* -------------------------------------------------------------------------
   Panel + numbered steps
   ------------------------------------------------------------------------- */

.cfg-panel {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  counter-reset: cfg-step;
}

.cfg-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-petrol-deep);
}

.cfg-panel__head h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  letter-spacing: 0;
  color: var(--color-petrol-deep);
  margin: 0;
}

.cfg-code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-petrol);
  white-space: nowrap;
}

.cfg-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: #6A4A0C;
  background-color: #FBF1DC;
  border-radius: var(--radius);
}

.cfg-step {
  counter-increment: cfg-step;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-grey-200);
}

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

.cfg-step[hidden] {
  display: none;
}

.cfg-step__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  letter-spacing: 0;
  color: var(--color-petrol-deep);
  margin: 0 0 14px;
}

.cfg-step__title::before {
  content: counter(cfg-step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-petrol);
  background-color: var(--color-teal-tint);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.cfg-sub {
  margin-top: var(--sp-2);
}

/* Fieldsets inside a step (IPS / cubicle controls keep their own markup) */
.cfg-panel fieldset {
  border: none;
  padding: 0;
  margin: 0 0 var(--sp-3);
  min-width: 0;
}

.cfg-panel fieldset:last-child {
  margin-bottom: 0;
}

.cfg-panel legend.kicker {
  display: inline-flex;
  width: 100%;
  padding: 0;
  border: none;
}

/* Field label row: label left, range/limit right */
.cfg-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-1);
  margin: 0 0 8px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-grey-900);
}

.cfg-label--gap {
  margin-top: var(--sp-2);
}

.cfg-label__aside {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-regular);
  color: var(--color-grey-600);
}

.cfg-help {
  margin: 10px 0 0;
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  color: var(--color-text-secondary);
}

.cfg-help strong {
  color: var(--color-grey-900);
  font-weight: var(--weight-semibold);
}

/* -------------------------------------------------------------------------
   Range: slider + typeable number field
   ------------------------------------------------------------------------- */

.cfg-range {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cfg-range input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  accent-color: var(--color-petrol);
  cursor: pointer;
}

.cfg-num {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  width: 118px;
  height: 44px;
  background: var(--color-white);
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.cfg-num:focus-within {
  border-color: var(--color-petrol);
  box-shadow: 0 0 0 3px var(--color-petrol-tint);
}

.cfg-num input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 38px 0 10px;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-align: right;
  color: var(--color-grey-900);
  background: transparent;
  border: 0;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.cfg-num input::-webkit-outer-spin-button,
.cfg-num input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cfg-num__unit {
  position: absolute;
  right: 10px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-grey-600);
  pointer-events: none;
}

/* Quick-pick chips (standard sizes) */
.cfg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.cfg-chips button {
  min-height: 36px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-grey-900);
  background: var(--color-white);
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.cfg-chips button:hover {
  border-color: var(--color-petrol);
}

.cfg-chips button[aria-pressed="true"] {
  color: var(--color-petrol-deep);
  background: var(--color-teal-tint);
  border-color: var(--color-petrol);
}

.cfg-chips button:focus-visible {
  outline: 2px solid var(--color-petrol);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   Stepper: − / value / +
   ------------------------------------------------------------------------- */

.cfg-stepper-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.cfg-stepper-row .cfg-help {
  margin: 0;
}

.cfg-stepper {
  flex: 0 0 auto;
  display: inline-flex;
  height: 44px;
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-white);
}

.cfg-stepper button {
  width: 44px;
  display: grid;
  place-items: center;
  color: var(--color-petrol);
  background: var(--color-grey-50);
  border: 0;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.cfg-stepper button:hover:not(:disabled) {
  background: var(--color-petrol-tint);
}

.cfg-stepper button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cfg-stepper button:focus-visible {
  outline: 2px solid var(--color-petrol);
  outline-offset: -3px;
}

.cfg-stepper output,
.cfg-stepper input {
  width: 56px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-align: center;
  color: var(--color-grey-900);
  border: 0;
  border-left: 1px solid var(--color-grey-200);
  border-right: 1px solid var(--color-grey-200);
}

/* -------------------------------------------------------------------------
   Picture cards (radio-backed)
   ------------------------------------------------------------------------- */

.cfg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.cfg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
  margin: 0;
  background: var(--color-white);
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.cfg-card:hover {
  border-color: var(--color-petrol);
}

.cfg-card input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.cfg-card:has(input:checked) {
  background: #F3FAF9;
  border-color: var(--color-petrol);
  box-shadow: 0 0 0 1px var(--color-petrol);
}

.cfg-card:has(input:focus-visible) {
  outline: 2px solid var(--color-petrol);
  outline-offset: 2px;
}

.cfg-card__art {
  display: block;
  width: 100%;
  height: 64px;
  margin-bottom: 4px;
}

.cfg-card__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-grey-900);
}

.cfg-card__detail {
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  color: var(--color-text-secondary);
}

/* A fixed (non-editable) value presented as a row, not a control */
.cfg-fixed {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cfg-fixed__chip {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--color-grey-300);
  box-shadow: 0 0 0 2px var(--color-white), 0 0 0 3.5px var(--color-petrol);
}

.cfg-fixed__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.cfg-fixed .cfg-help {
  margin: 2px 0 0;
}

/* Swatch label under the grid: "Grey · 1203" */
.cfg-swatch-name {
  margin: 8px 0 0;
  font-size: var(--text-xs);
  color: var(--color-grey-800);
}

/* -------------------------------------------------------------------------
   Spec table + actions
   ------------------------------------------------------------------------- */

.cfg-spec {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr;
  margin: 0;
  font-size: var(--text-sm);
}

.cfg-spec dt,
.cfg-spec dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--color-grey-100);
}

.cfg-spec dt {
  padding-right: var(--sp-2);
  color: var(--color-text-secondary);
}

.cfg-spec dd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  color: var(--color-grey-900);
}

.cfg-actions {
  display: grid;
  gap: var(--sp-1);
  margin-top: var(--sp-3);
}

.cfg-actions__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--sp-1);
}

.cfg-actions .btn {
  text-transform: none;
  letter-spacing: 0;
}

.cfg-actions__row .btn {
  min-height: 40px;
  padding-inline: 10px;
  font-size: var(--text-sm);
}

.cfg-actions__status {
  min-height: 1.2em;
  margin: 2px 0 0;
  font-size: var(--text-xs);
  color: var(--color-grey-800);
}

.cfg-actions__status--error {
  color: var(--color-error);
  font-weight: var(--weight-medium);
}

.cfg-bespoke {
  margin: var(--sp-2) 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.cfg-bespoke a {
  font-weight: var(--weight-semibold);
}

/* -------------------------------------------------------------------------
   Mobile sticky bar
   ------------------------------------------------------------------------- */

.cfg-bar {
  display: none;
}

/* -------------------------------------------------------------------------
   Content below the configurator (crawlable product information)
   ------------------------------------------------------------------------- */

.cfg-content {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
}

.cfg-content__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: var(--sp-8) var(--sp-3);
}

.cfg-content__intro {
  max-width: 72ch;
  margin-bottom: var(--sp-6);
}

.cfg-content__intro p {
  color: var(--color-grey-800);
}

.cfg-content__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-6) var(--sp-8);
}

@media (min-width: 900px) {
  .cfg-content__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.cfg-content h2 {
  color: var(--color-petrol-deep);
}

.cfg-content h3 {
  font-size: var(--text-lg);
  color: var(--color-petrol-deep);
  margin-bottom: var(--sp-1);
}

.cfg-content p,
.cfg-content li {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-grey-800);
}

.cfg-content ul {
  padding-left: 1.2em;
  margin-bottom: var(--sp-2);
}

.cfg-table-wrap {
  overflow-x: auto;
  margin-bottom: var(--sp-1);
}

.cfg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--color-white);
  border: 1px solid var(--color-border);
}

.cfg-table caption {
  text-align: left;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding-bottom: var(--sp-1);
}

.cfg-table th,
.cfg-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.cfg-table thead th {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-grey-600);
  background: var(--color-grey-50);
}

.cfg-table tbody th {
  font-weight: var(--weight-semibold);
  color: var(--color-grey-900);
}

.cfg-table .num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.cfg-table a {
  font-weight: var(--weight-semibold);
}

.cfg-faq details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--sp-2);
  margin-bottom: var(--sp-1);
  background: var(--color-white);
}

.cfg-faq summary {
  position: relative;
  cursor: pointer;
  padding: 14px 32px 14px 0;
  font-weight: var(--weight-semibold);
  color: var(--color-petrol-deep);
  list-style: none;
}

/* Hide the browser's marker (it sat outside the box) and draw a chevron
   inside it, on the right, that turns when the answer is open. */
.cfg-faq summary::-webkit-details-marker {
  display: none;
}

.cfg-faq summary::marker {
  content: "";
}

.cfg-faq summary::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -7px;
  border-right: 2px solid var(--color-petrol);
  border-bottom: 2px solid var(--color-petrol);
  transform: rotate(45deg);
  transition: transform var(--transition-fast), margin-top var(--transition-fast);
}

.cfg-faq details[open] > summary::after {
  margin-top: -2px;
  transform: rotate(-135deg);
}

@media (prefers-reduced-motion: reduce) {
  .cfg-faq summary::after {
    transition: none;
  }
}

.cfg-faq summary:focus-visible {
  outline: 2px solid var(--color-petrol);
  outline-offset: 2px;
}

.cfg-faq details p {
  margin: 0 0 var(--sp-2);
}

.cfg-photo {
  margin: 0;
}

.cfg-photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.cfg-photo figcaption {
  margin-top: var(--sp-1);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* -------------------------------------------------------------------------
   Mobile / tablet — below 900px
   The viewer sticks under the header so every change stays visible while
   the options scroll beneath it; a bar at the bottom keeps the code and
   "Add to quote" in reach.
   ------------------------------------------------------------------------- */

@media (max-width: 899px) {
  .cfg-title {
    padding: var(--sp-2) var(--sp-2) 12px;
  }

  .cfg {
    padding: 0 0 var(--sp-4);
    gap: 0;
  }

  .cfg-stage-col {
    position: sticky;
    top: var(--header-height);
    z-index: 5;
    padding-bottom: 8px;
    background-color: var(--color-off-white);
    box-shadow: 0 6px 10px -8px rgba(14, 46, 52, 0.35);
  }

  .cfg-stage {
    height: 42vh;
    height: 42svh;
    min-height: 240px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .cfg-stage__drawing {
    padding: 52px 8px 52px;
  }

  .cfg-stage__modes {
    top: 8px;
    left: 8px;
  }

  .cfg-stage__views {
    top: auto;
    bottom: 8px;
    right: 8px;
  }

  .cfg-seg button {
    min-height: 36px;
    padding: 0 10px;
  }

  .cfg-stage[data-mode] p.cfg-stage__hint {
    display: none;
  }

  /* Drawings need more height than the 3D view to stay legible */
  .cfg-stage[data-mode="drawings"] {
    height: 58vh;
    height: 58svh;
  }

  .cfg-readout {
    padding: 0 var(--sp-2);
    margin-top: 6px;
  }

  /* Keep the sticky block short: size only (the detail is in the spec) */
  .cfg-readout span {
    display: none;
  }

  .cfg-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: var(--sp-1) var(--sp-2) var(--sp-2);
  }

  .cfg-content__inner {
    padding: var(--sp-6) var(--sp-2) calc(var(--sp-8) + 64px);
  }

  .cfg-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: 10px var(--sp-2);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    color: var(--color-white);
    background-color: var(--color-petrol-deep);
  }

  .cfg-bar__code {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
  }

  .cfg-bar .btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding-inline: var(--sp-2);
    text-transform: none;
    letter-spacing: 0;
  }

  /* Leave room for the bar at the end of the page */
  .cfg-page ~ .site-footer {
    padding-bottom: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cfg-stage__poster {
    transition: none;
  }
}
