/* Room Designer 3D — the design studio (designer.html, js/studio.js).
   A bar with the steps, the stage (3D room, floor plan or walk-in view) and
   the panel for the current step. Side by side on wide screens; on phones
   the stage stays at the top while the panel scrolls under it. Uses the
   tokens from css/style.css. */

.studio-page {
  --studio-bar-h: 64px;
  --studio-header-h: 0px;
  --studio-ok: #0f9f8c;
  --studio-warn: #b45309;
  --studio-error: #d92d42;
  --studio-select: #3355f0;
  --studio-pipe: #0b74c4; /* the walls the plumbing is in */
  --studio-plan-bg: #f8fafe;
  --studio-plan-ink: #1e2946;
  --studio-plan-line: rgba(51, 85, 240, 0.13);
  --studio-plan-body: #ffffff;
  --studio-plan-wall: #1e2946;
  --studio-stage-bg: #e8eef9;
  /* Labels on the room keep their white text in both themes. */
  --studio-label-warn: #b45309;
  --studio-label-error: #c2283c;
  --studio-white: #ffffff; /* stays white in both themes: a toggle's knob, the backing of product photos */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .studio-page {
    --studio-ok: #2dd4bf;
    --studio-warn: #fbbf24;
    --studio-error: #ff7a8c;
    --studio-select: #8ea6ff;
    --studio-pipe: #5cc4ff;
    --studio-plan-bg: #0d1530;
    --studio-plan-ink: #dbe4ff;
    --studio-plan-line: rgba(142, 166, 255, 0.12);
    --studio-plan-body: #18223d;
    --studio-plan-wall: #c9d3ea;
    --studio-stage-bg: #0d1530;
  }
}

:root[data-theme="dark"] .studio-page {
  --studio-ok: #2dd4bf;
  --studio-warn: #fbbf24;
  --studio-error: #ff7a8c;
  --studio-select: #8ea6ff;
  --studio-pipe: #5cc4ff;
  --studio-plan-bg: #0d1530;
  --studio-plan-ink: #dbe4ff;
  --studio-plan-line: rgba(142, 166, 255, 0.12);
  --studio-plan-body: #18223d;
  --studio-plan-wall: #c9d3ea;
  --studio-stage-bg: #0d1530;
}

.studio-page .icon {
  flex: none;
  display: block;
}

/* The site header scrolls away with the page here instead of floating over
   it (css/style.css fixes it elsewhere), so it never covers the steps or
   the view buttons when the designer scrolls. Its menu still drops from it. */
body:has(main.studio-page) .site-header {
  position: relative;
}

/* ...and keeps one height: the compact one it takes once scrolled, so the
   studio below it never shifts while the page moves. */
body:has(main.studio-page) .site-header .nav {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  transition: none;
}

main.studio-page.solid-header {
  padding-top: 0;
}

/* ---------- The demo ribbon ---------- */
.studio-page .designer-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: none;
  margin: 0;
  padding: var(--space-3) var(--gutter);
  background: var(--color-dark-soft);
  color: var(--color-on-dark-soft);
  border-bottom: 1px solid var(--color-on-dark-line);
}

.designer-intro-text {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.designer-intro-text strong {
  color: var(--color-on-dark);
  margin-right: var(--space-2);
}

.designer-intro-badge {
  display: inline-block;
  margin-right: var(--space-2);
  padding: var(--space-05) var(--space-3);
  border-radius: var(--radius-pill);
  background: rgba(94, 234, 212, 0.16);
  color: var(--color-highlight-on-dark);
  font-weight: 600;
}

.studio-page .designer-intro .btn {
  flex: 0 1 auto;
  max-width: 45%;
  white-space: normal;
  text-align: center;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-sm);
}

.studio-page .designer-intro :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

/* ---------- The studio ---------- */
.studio {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-line);
}

.studio-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--studio-bar-h);
  padding: var(--space-2) var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
}

.studio-brand {
  min-width: 7rem;
  max-width: 16rem;
  flex: 0 1 auto;
}

.studio-biz {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-biz:empty {
  display: none;
}

.studio-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-steps {
  display: flex;
  gap: var(--space-1);
  margin: 0 auto;
  padding: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
}

.studio-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: var(--tap);
  min-height: var(--tap);
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-1);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink-soft);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease);
}

.studio-step-btn:hover {
  color: var(--color-ink);
  background: var(--color-surface);
}

.studio-step-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--color-line-strong);
  background: var(--color-surface);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
}

.studio-step-btn[aria-current="step"] {
  background: var(--color-accent-bright);
  color: var(--color-on-dark);
}

.studio-step-btn[aria-current="step"] .studio-step-num {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-on-dark);
}

.studio-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: none;
}

.studio-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: var(--tap);
  min-height: var(--tap);
  justify-content: center;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-ink-soft);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.studio-action:hover:not(:disabled) {
  background: var(--color-surface-alt);
  color: var(--color-ink);
}

.studio-action:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Undo and redo are icons only; their names are in aria-label and title. */
.studio-action:nth-child(-n + 2) .studio-action-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.studio-total-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-height: var(--tap);
  margin-left: var(--space-2);
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  color: var(--color-ink);
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
}

.studio-total-chip[hidden] {
  display: none;
}

.studio-total-chip-label {
  font-size: var(--fs-2xs);
  color: var(--color-muted);
}

.studio-total-chip strong {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  color: var(--color-accent-text);
}

.studio-total-chip:hover {
  border-color: var(--color-accent-bright);
}

.studio-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  height: calc(100vh - var(--studio-header-h) - var(--studio-bar-h));
  height: calc(100dvh - var(--studio-header-h) - var(--studio-bar-h));
  min-height: 560px;
  max-height: 980px;
}

/* ---------- The stage ---------- */
.studio-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--studio-stage-bg);
}

.studio-room,
.studio-canvas,
.studio-labels,
.studio-plan {
  position: absolute;
  inset: 0;
}

.studio-room[hidden],
.studio-plan[hidden] {
  display: none;
}

/* Until the scripts arrive, both halves say so in words (H1: a slow
   connection used to show a blank grey stage for 30 s and more). */
.studio-canvas:empty::before {
  content: attr(data-loading);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  color: var(--color-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.studio-loading {
  padding: var(--space-6) var(--space-5);
  color: var(--color-ink-soft);
}

.studio-loading-text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-weight: 600;
}

.studio-loading-text::before {
  content: "";
  flex: none;
  width: 1em;
  height: 1em;
  border: 2px solid var(--color-line-strong);
  border-top-color: var(--color-accent-bright);
  border-radius: 50%;
  animation: studio-spin 0.8s linear infinite;
}

/* The "taking longer" line appears on its own after 8 seconds. */
.studio-loading-slow {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-sm);
  color: var(--color-muted);
  opacity: 0;
  animation: studio-appear 0.3s ease 8s forwards;
}

@keyframes studio-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes studio-appear {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .studio-loading-text::before {
    animation: none;
  }
}

.studio-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

.studio-canvas.can-drag canvas {
  cursor: grab;
}

.studio-canvas.is-dragging canvas {
  cursor: grabbing;
}

.studio-labels {
  pointer-events: none;
  overflow: hidden;
}

.studio-label {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  will-change: transform;
}

.studio-label[hidden] {
  display: none;
}

.studio-label.is-wall {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 16, 36, 0.78);
  color: var(--color-on-dark);
  font-family: var(--font-display);
}

.studio-label.is-name {
  padding: var(--space-15) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--studio-select);
  color: var(--color-on-dark);
  box-shadow: 0 6px 16px -6px rgba(10, 16, 36, 0.5);
}

.studio-label.is-name.is-warn {
  background: var(--studio-label-warn);
}

.studio-label.is-name.is-error {
  background: var(--studio-label-error);
}

.studio-label.is-gap {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-dark);
  box-shadow: 0 2px 8px -2px rgba(10, 16, 36, 0.35);
  font-variant-numeric: tabular-nums;
}

/* The view switch and the "everything fits" status, top left. */
.studio-viewbar {
  position: absolute;
  z-index: 3;
  top: var(--space-3);
  left: var(--space-3);
  right: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.studio-viewbar > * {
  pointer-events: auto;
}

.studio-views {
  display: inline-flex;
  padding: var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-line);
}

.studio-view-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-15);
  min-height: var(--tap);
  min-width: var(--tap);
  justify-content: center;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink-soft);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.studio-view-btn:hover:not(:disabled) {
  color: var(--color-ink);
  background: var(--color-surface-alt);
}

.studio-view-btn[aria-pressed="true"] {
  background: var(--color-dark);
  color: var(--color-on-dark);
}

.studio-view-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.studio-viewbar > .studio-view-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.studio-viewbar > .studio-view-btn[hidden] {
  display: none;
}

.studio-viewbar > .studio-iso-btn {
  padding: 0 var(--space-3);
}

.studio-viewbar > .studio-view-btn[aria-pressed="true"] {
  border-color: var(--color-dark);
  background: var(--color-dark);
  color: var(--color-on-dark);
}

.studio-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-15);
  min-height: 44px;
  margin-left: auto;
  padding: 0 var(--space-4) 0 var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.studio-status.is-ok {
  cursor: default;
}

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

.studio-status.is-warn .icon {
  color: var(--studio-warn);
}

.studio-status.is-error {
  border-color: var(--studio-error);
  color: var(--studio-error);
}

/* The little floor plan, bottom right: a click opens the big one. */
.studio-mini {
  position: absolute;
  z-index: 2;
  right: var(--space-3);
  bottom: var(--space-3);
  width: clamp(120px, 18%, 190px);
  padding: var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: var(--shadow-soft);
  cursor: zoom-in;
}

.studio-mini[hidden] {
  display: none;
}

.studio-mini .plan-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
}

.studio-mini:hover {
  border-color: var(--color-accent-bright);
}

/* The selected fixture while the panel shows another step. */
.studio-selchip {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: var(--space-3);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: calc(100% - 2 * var(--space-3));
  padding: 4px 4px 4px var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-dark);
  color: var(--color-on-dark);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
}

.studio-selchip[hidden] {
  display: none;
}

.studio-selchip-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-selchip .studio-link-btn {
  color: var(--color-highlight-on-dark);
}

.studio-selchip .studio-icon-btn {
  color: var(--color-on-dark);
}

.studio-selchip :focus-visible,
.studio-toast :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

.studio-toast {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(var(--space-3) + 56px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: max-content;
  max-width: calc(100% - 2 * var(--space-4));
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-radius: var(--radius);
  background: var(--color-dark);
  color: var(--color-on-dark);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  line-height: 1.4;
  animation: studio-pop 0.25s var(--ease);
}

.studio-toast[hidden] {
  display: none;
}

.studio-toast-action {
  flex: none;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(94, 234, 212, 0.16);
  color: var(--color-highlight-on-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.studio-toast-action:hover {
  background: rgba(94, 234, 212, 0.28);
}

.studio-toast-close {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-on-dark-soft);
  cursor: pointer;
}

.studio-toast-close .icon {
  width: 18px;
  height: 18px;
}

@keyframes studio-pop {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .studio-toast {
    animation: none;
  }
}

.studio-hint {
  position: absolute;
  z-index: 1;
  left: var(--space-3);
  bottom: var(--space-3);
  max-width: min(440px, calc(100% - 240px));
  margin: 0;
  padding: var(--space-15) var(--space-3);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-surface) 82%, transparent);
  color: var(--color-ink-soft);
  font-size: var(--fs-xs);
  line-height: 1.4;
  pointer-events: none;
}

.studio-stage:has(.studio-selchip:not([hidden])) .studio-hint {
  display: none;
}

/* The 3D room's note about a model that didn't load. */
.studio-room .room-3d-note {
  position: absolute;
  z-index: 2;
  left: var(--space-3);
  top: 64px;
  max-width: 320px;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink-soft);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-soft);
}

.studio-room .room-3d-note[hidden] {
  display: none;
}

/* ---------- The floor plan ---------- */
.studio-plan {
  padding: 64px var(--space-5) var(--space-7);
  background: var(--studio-plan-bg);
}

.studio-plan > .plan-svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.plan-svg {
  overflow: visible;
  font-family: var(--font-display);
}

.plan-floor {
  fill: var(--studio-plan-bg);
}

.plan-grid-line {
  fill: none;
  stroke: var(--studio-plan-line);
  stroke-width: 0.03;
}

.plan-wall {
  fill: var(--studio-plan-wall);
}

/* A window: a pale pane across the wall's thickness. */
.plan-window-frame {
  fill: var(--studio-plan-bg);
  stroke: var(--studio-plan-wall);
  stroke-width: 0.03;
}

.plan-window-pane {
  stroke: var(--studio-select);
  stroke-width: 0.06;
}

.plan-wall-length {
  fill: var(--color-ink);
  text-anchor: middle;
  font-weight: 600;
}

.plan-zone {
  fill: var(--studio-select);
  fill-opacity: 0.1;
  stroke: var(--studio-select);
  stroke-opacity: 0.55;
  stroke-width: 0.03;
  stroke-dasharray: 0.12 0.08;
}

.plan-zone.is-warn {
  fill: var(--studio-warn);
  stroke: var(--studio-warn);
}

.plan-zone.is-error {
  fill: var(--studio-error);
  stroke: var(--studio-error);
}

.plan-item {
  cursor: grab;
  outline: none;
}

.plan-item:active {
  cursor: grabbing;
}

.plan-body {
  fill: var(--studio-plan-body);
  stroke: var(--studio-plan-ink);
  stroke-width: 0.045;
}

.plan-symbol {
  fill: none;
  stroke: var(--studio-plan-ink);
  stroke-width: 0.035;
  stroke-opacity: 0.75;
}

.plan-symbol.is-faint {
  stroke-opacity: 0.3;
}

.plan-item-label {
  fill: var(--studio-plan-ink);
  text-anchor: middle;
  font-weight: 600;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--studio-plan-body);
  stroke-width: 0.08;
}

.plan-item.is-warn .plan-body {
  stroke: var(--studio-warn);
}

.plan-item.is-error .plan-body {
  fill: color-mix(in srgb, var(--studio-error) 14%, var(--studio-plan-body));
  stroke: var(--studio-error);
}

.plan-item.is-hover .plan-body {
  stroke: var(--studio-select);
}

.plan-item.is-selected .plan-body,
.plan-item:focus-visible .plan-body {
  stroke: var(--studio-select);
  stroke-width: 0.09;
}

.plan-item.is-selected.is-error .plan-body {
  stroke: var(--studio-error);
}

.plan-item:focus-visible .plan-body {
  stroke-dasharray: 0.16 0.08;
}

.plan-door-hit {
  fill: transparent;
}

.plan-door .plan-door-swing {
  fill: var(--studio-plan-ink);
  fill-opacity: 0.05;
  stroke: var(--studio-plan-ink);
  stroke-width: 0.03;
  stroke-dasharray: 0.1 0.07;
}

.plan-door .plan-door-leaf,
.plan-door .plan-door-sill {
  fill: none;
  stroke: var(--studio-plan-ink);
  stroke-width: 0.07;
  stroke-linecap: round;
}

.plan-door .plan-door-sill {
  stroke-dasharray: 0.12 0.1;
}

.plan-door.is-hover .plan-door-leaf,
.plan-door.is-selected .plan-door-leaf,
.plan-door.is-selected .plan-door-sill,
.plan-door:focus-visible .plan-door-leaf {
  stroke: var(--studio-select);
}

.plan-door.is-selected .plan-door-hit,
.plan-door:focus-visible .plan-door-hit {
  fill: var(--studio-select);
  fill-opacity: 0.25;
}

.plan-door.is-error .plan-door-leaf,
.plan-door.is-error .plan-door-swing {
  stroke: var(--studio-error);
}

/* Ink on surface: a dark disc with white letters in light mode, a light
   disc with dark letters in dark mode, so A-D read on the mini plan too. */
.plan-wall-tag circle {
  fill: var(--color-ink);
}

.plan-wall-tag text {
  fill: var(--color-surface);
  text-anchor: middle;
  font-weight: 700;
}

.plan-dim path,
.plan-gap path {
  fill: none;
  stroke: var(--studio-plan-ink);
  stroke-width: 0.025;
  stroke-opacity: 0.7;
}

.plan-dim text,
.plan-gap text {
  fill: var(--studio-plan-ink);
  text-anchor: middle;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-dim-bg {
  fill: var(--studio-plan-bg);
}

.plan-gap path {
  stroke: var(--studio-select);
  stroke-opacity: 1;
}

.plan-gap text {
  fill: var(--studio-select);
}

.plan-gap .plan-dim-bg {
  fill: var(--studio-plan-bg);
  fill-opacity: 0.92;
}

/* Small plans: thumbnails, layout choices and the corner map. */
.plan-svg.is-mini .plan-body {
  stroke-width: 0.07;
}

.plan-svg.is-mini .plan-symbol {
  stroke-width: 0.05;
}

.plan-svg.is-mini .plan-item {
  cursor: inherit;
}

.plan-svg.is-mini .plan-door .plan-door-leaf {
  stroke-width: 0.09;
}

.plan-svg.is-mini .plan-door-hit {
  fill: none;
}

/* ---------- The panel ---------- */
.studio-panel {
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* A field scrolled to (a list still to pick) stays clear of the sticky
     step bar, which grows with its "To go on" note. */
  scroll-padding-bottom: 11rem;
  background: var(--color-surface);
  border-left: 1px solid var(--color-line);
}

.studio-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-5) 0;
}

.studio-step-head h2 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  outline: none;
}

.studio-step-count {
  margin: 0 0 var(--space-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-accent-text);
}

.studio-step-intro {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.studio-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.studio-section > h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-base);
}

.studio-note {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.studio-step-nav {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  margin: auto calc(-1 * var(--space-5)) 0;
  padding: var(--space-3) var(--space-5);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  border-top: 1px solid var(--color-line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* "Step 1 of 6 · Your room": shown in the bar on a phone only, where the
   bar is fixed to the bottom and the step's heading may be off screen. */
.studio-step-nav-title {
  display: none;
  flex: 1 0 100%;
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-accent-text);
}

.studio-step-nav .btn {
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-sm);
}

/* Buttons used in the panel. */
.studio .btn-secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border-color: var(--color-line-strong);
  gap: var(--space-2);
}

.studio .btn-secondary:hover:not(:disabled) {
  border-color: var(--color-accent-bright);
  color: var(--color-accent-text);
}

.studio .btn-sm {
  min-height: 40px;
  padding: var(--space-1) var(--space-4);
  font-size: var(--fs-sm);
}

.studio .btn .icon {
  width: 18px;
  height: 18px;
}

.studio .btn-secondary.is-danger:hover:not(:disabled) {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.studio-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-ink-soft);
  cursor: pointer;
}

.studio-icon-btn:hover:not(:disabled) {
  background: var(--color-surface-alt);
  color: var(--color-ink);
}

.studio-selchip .studio-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-on-dark);
}

.studio-icon-btn .icon {
  width: 20px;
  height: 20px;
}

.studio-link-btn {
  min-height: 36px;
  padding: 0 var(--space-2);
  border: 0;
  background: transparent;
  color: var(--color-accent-text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-15);
}

/* Choice buttons that work like radio buttons. */
.studio-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.studio-choice {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
}

.studio-choice:hover:not(:disabled) {
  border-color: var(--color-accent-bright);
}

.studio-choice[aria-pressed="true"] {
  background: var(--color-selected-bg);
  border-color: var(--color-selected-bg);
  color: var(--color-selected-ink);
  font-weight: 600;
}

.studio-choice:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Switches (checkboxes with role="switch"). */
.studio-toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.studio-toggle input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 46px;
  height: 28px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-line-strong);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.studio-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--studio-white);
  box-shadow: 0 1px 3px rgba(10, 16, 36, 0.35);
  transition: transform 0.2s var(--ease);
}

.studio-toggle input:checked {
  background: var(--color-accent-bright);
}

.studio-toggle input:checked::after {
  transform: translateX(18px);
}

.studio-toggle label {
  display: flex;
  flex-direction: column;
  gap: var(--space-05);
  font-size: var(--fs-base);
  color: var(--color-ink);
  cursor: pointer;
  padding-top: var(--space-1);
}

.studio-toggle small {
  color: var(--color-muted);
  font-size: var(--fs-sm);
}

/* Fields. */
.studio-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-15);
}

.studio-field > label,
.studio-field-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-ink);
}

.studio-field-help {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--color-muted);
}

.studio-field-error {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-danger);
}

.studio-field-error[hidden] {
  display: none;
}

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

.studio-stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  overflow: hidden;
}

.studio-stepper:focus-within {
  border-color: var(--color-accent-bright);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent-bright) 22%, transparent);
}

.studio-stepper button {
  flex: none;
  width: var(--tap);
  border: 0;
  background: var(--color-surface-alt);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-lg);
  line-height: 1;
  cursor: pointer;
}

.studio-stepper button:hover {
  background: var(--color-line);
}

.studio-length {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.studio-length:focus-visible {
  outline: none;
}

.studio-length[aria-invalid="true"] {
  color: var(--color-danger);
}

.studio-select {
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-sm);
}

/* Room templates. */
.studio-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--space-2);
}

.studio-template {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  padding: var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.studio-template:hover {
  border-color: var(--color-accent-bright);
  box-shadow: var(--shadow-soft);
}

.studio-template-thumb {
  display: grid;
  place-items: center;
  height: 74px;
  padding: var(--space-15);
  border-radius: var(--radius-sm);
  background: var(--studio-plan-bg);
}

.studio-template-thumb .plan-svg {
  width: 100%;
  height: 100%;
  max-height: 62px;
}

.studio-template-name {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.studio-template-size {
  font-size: var(--fs-xs);
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* Cards (doors, products). */
.studio-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.studio-card.is-selected {
  border-color: var(--studio-select);
  box-shadow: 0 0 0 1px var(--studio-select);
}

.studio-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: calc(-1 * var(--space-2)) 0;
}

.studio-card-head h3,
.studio-card-head h4 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-base);
}

.studio-card-icon {
  color: var(--color-accent-text);
}

.studio-add-door {
  align-self: flex-start;
}

/* Add a fixture. */
.studio-add-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.studio-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-15);
  min-height: 78px;
  justify-content: center;
  padding: var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.studio-add-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-accent-text);
}

.studio-add:hover:not(:disabled) {
  border-color: var(--color-accent-bright);
}

.studio-add:hover:not(:disabled) .studio-add-icon {
  background: var(--color-accent-bright);
  color: var(--color-on-dark);
}

.studio-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.studio-arrange-btn {
  align-self: flex-start;
}

.studio-arrangements {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  /* Clear of the step buttons when scrolled into view. */
  scroll-margin-bottom: 88px;
}

.studio-arrangement {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--studio-plan-bg);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-xs);
  text-align: left;
  cursor: pointer;
}

.studio-arrangement .plan-svg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.studio-arrangement:hover {
  border-color: var(--color-accent-bright);
  box-shadow: var(--shadow-soft);
}

.studio-arrangement.is-current {
  border-color: var(--studio-select);
}

.studio-arrangement-fit {
  font-weight: 600;
}

.studio-arrangement-fit.is-error {
  color: var(--studio-error);
}

.studio-arrangement-use {
  color: var(--color-accent-text);
  font-weight: 600;
}

/* Problems, in plain words. */
.studio-issues {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.studio-issues li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--studio-warn) 10%, var(--color-surface));
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.studio-issues li.is-error {
  background: color-mix(in srgb, var(--studio-error) 10%, var(--color-surface));
}

.studio-issue-icon {
  flex: none;
  padding-top: 1px;
  color: var(--studio-warn);
}

.studio-issues li.is-error .studio-issue-icon {
  color: var(--studio-error);
}

.studio-issue-text {
  flex: 1;
  min-width: 0;
}

.studio-issues li .studio-link-btn {
  flex: none;
  margin: calc(-1 * var(--space-15)) calc(-1 * var(--space-1)) calc(-1 * var(--space-15)) 0;
}

.studio-issues.is-compact li {
  padding: var(--space-2) var(--space-3);
}

/* The fixtures in the room, each opening its settings. */
.studio-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.studio-item {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.studio-item.is-selected {
  border-color: var(--studio-select);
  box-shadow: 0 0 0 1px var(--studio-select);
}

.studio-item-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.studio-item-btn:hover {
  background: var(--color-surface-alt);
}

.studio-item-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-accent-text);
}

.studio-item-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.studio-item-text strong {
  font-size: var(--fs-sm);
}

.studio-item-text small {
  color: var(--color-muted);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}

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

.studio-item-status.is-warn {
  color: var(--studio-warn);
}

.studio-item-status.is-error {
  color: var(--studio-error);
}

.studio-inspector {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-3) var(--space-4);
}

.studio-card .studio-inspector {
  padding: 0;
}

.studio-slide {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.studio-slide input[type="range"] {
  flex: 1;
  width: auto;
  min-width: 0;
  height: var(--tap);
  margin: 0;
  padding: 0;
  border: 0;
  accent-color: var(--color-accent-bright);
  cursor: pointer;
}

.studio-readout {
  font-size: var(--fs-sm);
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.studio-gaps {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--space-4);
  margin: 0;
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  font-size: var(--fs-sm);
}

.studio-gaps dt {
  color: var(--color-muted);
}

.studio-gaps dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.studio-inspector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Products. */
.studio-product-card .studio-field > label {
  font-weight: 500;
  color: var(--color-ink-soft);
}

/* Finishes. */
.studio-swatch-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.studio-swatch-title {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.studio-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--space-2);
}

.studio-swatch {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-15);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.studio-swatch img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
}

.studio-swatch-name {
  font-size: var(--fs-xs);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.studio-swatch-price {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--color-accent-text);
}

.studio-swatch:hover {
  border-color: var(--color-accent-bright);
}

.studio-swatch[aria-pressed="true"] {
  border-color: var(--studio-select);
  box-shadow: 0 0 0 2px var(--studio-select);
}

/* The estimate. */
.studio-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
}

.studio-banner p {
  flex: 1;
  margin: 0;
}

.studio-banner.is-error {
  background: color-mix(in srgb, var(--studio-error) 12%, var(--color-surface));
  color: var(--color-ink);
}

.studio-banner.is-error > span {
  color: var(--studio-error);
}

.studio-banner.is-warn {
  background: color-mix(in srgb, var(--studio-warn) 12%, var(--color-surface));
  color: var(--color-ink);
}

.studio-banner.is-warn > span {
  color: var(--studio-warn);
}

.studio-estimate {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
    linear-gradient(135deg, var(--color-accent-bright), var(--color-accent)) border-box;
  border-top: 4px solid transparent;
}

.studio-estimate-head .eyebrow {
  margin: 0;
}

.studio-estimate-head h3 {
  margin: 0 0 var(--space-1);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}

.studio-lines {
  display: flex;
  flex-direction: column;
}

.studio-lines-title {
  margin: var(--space-2) 0 var(--space-1);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.studio-line {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-line);
  font-size: var(--fs-sm);
}

.studio-line-thumb {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-surface-alt);
}

.studio-line-label {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.studio-line-label small {
  color: var(--color-muted);
  font-size: var(--fs-xs);
}

.studio-line-amount {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.studio-line.is-subtotal {
  border-bottom: 0;
  font-weight: 600;
}

.studio-line.is-muted {
  color: var(--color-muted);
}

.studio-line.is-muted .studio-line-amount {
  font-weight: 500;
}

.studio-lines.is-excluded {
  margin-top: var(--space-1);
}

.studio-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-2) calc(-1 * var(--space-5));
  padding: var(--space-4) var(--space-5);
  background: var(--color-dark);
  color: var(--color-on-dark-soft);
  font-size: var(--fs-sm);
}

.studio-total strong {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--color-highlight-on-dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.studio-products ul {
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.studio-products li {
  margin-bottom: var(--space-2);
}

.studio-products small {
  color: var(--color-muted);
}

.studio-ext-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-accent-text);
  font-weight: 600;
}

.studio-ext-link .icon {
  width: 15px;
  height: 15px;
}

.studio-details summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  color: var(--color-accent-text);
}

.studio-details ul {
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--fs-sm);
  color: var(--color-ink-soft);
  line-height: 1.55;
}

.studio-details li {
  margin-bottom: var(--space-2);
}

.studio-disclaimer {
  margin: 0;
  font-size: var(--fs-xs);
  line-height: 1.55;
  color: var(--color-muted);
}

.studio-design-lines {
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.studio-est-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.studio-pdf-status {
  margin: 0;
  font-size: var(--fs-sm);
}

.studio-pdf-status.is-error {
  color: var(--color-danger);
}

.studio-pdf-status[hidden] {
  display: none;
}

/* The demo's last step: what a business gets, and the sign-up button. */
.studio-demo-end .btn {
  margin-top: var(--space-2);
}

.studio-disclosure {
  margin: 0;
  padding: var(--space-3) var(--gutter);
  font-size: var(--fs-xs);
  color: var(--color-muted);
  text-align: center;
}

/* The share-link dialog, when the browser won't copy. */
.studio-dialog {
  width: min(520px, calc(100% - 2 * var(--space-4)));
  padding: var(--space-6);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow);
}

.studio-dialog::backdrop {
  background: rgba(10, 16, 36, 0.55);
}

.studio-dialog h2 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}

.studio-dialog p {
  margin: 0 0 var(--space-4);
  color: var(--color-ink-soft);
  font-size: var(--fs-sm);
}

.studio-dialog input {
  width: 100%;
  min-height: var(--tap);
  margin-bottom: var(--space-4);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-sm);
}

/* Show examples: a product's listing photos as a slideshow. */
.studio-examples-btn {
  align-self: flex-start;
  margin-top: var(--space-05);
  padding: 0;
}

.studio-examples-btn .icon {
  width: 18px;
  height: 18px;
}

.studio-dialog.studio-photos {
  width: min(860px, calc(100% - 2 * var(--space-4)));
  max-height: calc(100dvh - 2 * var(--space-4));
  padding: var(--space-5);
  overflow-y: auto;
}

.studio-photos-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.studio-dialog .studio-photos-head h2 {
  margin: 0;
  font-size: var(--fs-md, 1.125rem);
}

.studio-dialog .studio-photos-model {
  margin: var(--space-05) 0 0;
  color: var(--color-muted);
  font-size: var(--fs-xs);
}

.studio-photos-stage {
  position: relative;
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface-alt);
}

.studio-photos-stage img {
  display: block;
  width: 100%;
  height: min(62vh, 560px);
  object-fit: contain;
  background: var(--studio-white);
}

.studio-photos-nav {
  position: absolute;
  inset: 50% var(--space-2) auto;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
  pointer-events: none;
}

.studio-photos-arrow {
  display: inline-grid;
  place-items: center;
  width: var(--tap, 44px);
  height: var(--tap, 44px);
  border: 0;
  border-radius: 999px;
  background: rgba(10, 16, 36, 0.72);
  color: var(--color-on-dark);
  cursor: pointer;
  pointer-events: auto;
}

.studio-photos-arrow:hover {
  background: rgba(10, 16, 36, 0.9);
}

.studio-photos-arrow:focus-visible {
  outline: 3px solid var(--color-focus-on-dark);
  outline-offset: 2px;
}

.studio-photos-count {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  padding: var(--space-05) var(--space-3);
  border-radius: 999px;
  background: rgba(10, 16, 36, 0.78);
  color: var(--color-on-dark);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.studio-photos-strip {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-bottom: var(--space-1);
  overflow-x: auto;
}

.studio-photos-thumb {
  flex: none;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--studio-white);
  cursor: pointer;
  opacity: 0.7;
}

.studio-photos-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-photos-thumb:hover,
.studio-photos-thumb[aria-current="true"] {
  opacity: 1;
}

.studio-photos-thumb[aria-current="true"] {
  border-color: var(--color-accent);
}

.studio-dialog .studio-photos-note {
  margin: var(--space-3) 0 0;
}

.studio-photos-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
}

.studio-photos-credit {
  color: var(--color-muted);
}

@media (max-width: 600px) {
  .studio-dialog.studio-photos {
    padding: var(--space-4);
  }

  .studio-photos-stage img {
    height: auto;
    aspect-ratio: 1;
    max-height: 52vh;
  }
}

/* ---------- Narrower screens ---------- */
/* Below this the action names fold away and the steps' names get smaller
   (the business and title give up room first), so every step is named on
   a laptop too. */
@media (max-width: 1600px) {
  .studio-brand {
    flex: 0 4 auto;
    min-width: 0;
    max-width: 16rem;
  }

  .studio-steps {
    flex: 0 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .studio-steps::-webkit-scrollbar {
    display: none;
  }

  .studio-step-btn {
    flex: none;
    gap: var(--space-15);
    padding-right: var(--space-3);
    font-size: var(--fs-xs);
  }

  .studio-step-num {
    width: 26px;
    height: 26px;
    font-size: var(--fs-xs);
  }

  .studio-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

/* Smaller still (tablets, phones): only the current step's name shows. */
@media (max-width: 1180px) {
  .studio-step-label {
    display: none;
  }

  .studio-step-btn {
    padding-right: var(--space-1);
  }

  .studio-step-btn[aria-current="step"] {
    padding-right: var(--space-4);
  }

  .studio-step-btn[aria-current="step"] .studio-step-label {
    display: inline;
  }
}

/* Desktops still have room for the names of Share and Start over (undo and
   redo stay icons, their names in the tooltip). */
@media (min-width: 1200px) and (max-width: 1600px) {
  .studio-action:nth-child(n + 3) .studio-action-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }
}

/* Phones and small tablets: the stage on top, the panel under it. */
@media (max-width: 900px) {
  .studio-page .designer-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  .studio-bar {
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
  }

  .studio-brand {
    flex: 1 1 auto;
  }

  .studio-steps {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    justify-content: space-between;
    margin: 0;
    /* Six steps and the current one's name can outgrow a phone's width (the
       Portuguese names are the longest): they scroll inside the bar, never
       the page sideways. */
    overflow-x: auto;
    scrollbar-width: none;
  }

  .studio-steps::-webkit-scrollbar {
    display: none;
  }

  .studio-step-btn {
    flex: 0 0 auto;
  }

  .studio-body {
    display: block;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  /* The stage stacks: the view buttons and the fit check in a row of their
     own, then the room under them, so no control ever covers the wall
     letters or a fixture on a phone. */
  .studio-stage {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    height: auto;
    border-bottom: 1px solid var(--color-line);
  }

  .studio-viewbar {
    position: static;
    flex: none;
    padding: var(--space-2) var(--space-3);
  }

  .studio-room,
  .studio-plan {
    position: relative;
    inset: auto;
    flex: none;
    height: 38vh;
    height: 38svh;
    min-height: 250px;
  }

  /* While filling in the request, the room steps aside. */
  .studio[data-step="estimate"] .studio-stage {
    position: relative;
    top: auto;
  }

  .studio-panel {
    overflow: visible;
    border-left: 0;
  }

  /* Room at the bottom for the step bar, which is fixed there (below). */
  .studio-step {
    padding: var(--space-5) var(--space-4) calc(var(--tap) + 3 * var(--space-5) + 2 * var(--space-2));
  }

  /* The step bar: the step's name, what it still needs and Next, fixed to
     the bottom of the screen, so how to go on is always in reach however
     long the step's panel is. */
  .studio-step-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    margin: 0;
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface);
    box-shadow: var(--shadow);
  }

  .studio-step-nav-title {
    display: block;
  }

  /* The last step has no Next: its bar scrolls with it as on a desktop. */
  .studio[data-step="estimate"] .studio-step {
    padding-bottom: 0;
  }

  .studio[data-step="estimate"] .studio-step-nav {
    position: sticky;
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    box-shadow: none;
  }

  .studio-total {
    margin-left: calc(-1 * var(--space-5));
    margin-right: calc(-1 * var(--space-5));
  }

  .studio-view-btn > span:not(:first-child) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .studio-view-btn {
    padding: 0 var(--space-2);
  }

  .studio-status {
    padding: 0 var(--space-3);
  }

  .studio-action {
    min-height: var(--tap);
  }

  .studio-hint {
    display: none;
  }

  .studio-mini {
    width: 104px;
    padding: var(--space-1);
  }

  .studio-toast {
    bottom: var(--space-3);
  }

  .studio-stage:has(.studio-selchip:not([hidden])) .studio-toast {
    bottom: calc(var(--space-3) + 52px);
  }

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

@media (max-width: 640px) {
  .studio-page .designer-intro {
    flex-direction: row;
    align-items: center;
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }

  /* One line on phones: the badge, the title and a short button. The long
     description and the free-week line say what the button already says. */
  .designer-intro-text > span:not(.designer-intro-badge),
  .designer-intro-text > strong[data-nav-signed-out] {
    display: none;
  }

  .designer-intro-text strong {
    display: block;
    margin: var(--space-1) 0 0;
  }
}

@media (max-width: 480px) {
  .studio-add-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-arrangements {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-total-chip {
    padding: var(--space-1) var(--space-3);
  }

  .studio-title {
    font-size: var(--fs-base);
  }
}

/* Framed by our own project page (designer.html?embed=1): a read-only view
   of the saved design. No product header, no steps or panel, no Riley; the
   stage fills the frame, with the view buttons and "Open in designer". */
html[data-embed="1"] .studio-steps,
html[data-embed="1"] .studio-panel,
html[data-embed="1"] .studio-hint,
html[data-embed="1"] .studio-riley {
  display: none;
}

html[data-embed="1"] .studio-body {
  grid-template-columns: minmax(0, 1fr);
}

html[data-embed="1"] .studio-room,
html[data-embed="1"] .studio-plan {
  cursor: default;
}

@media (max-width: 900px) {
  html[data-embed="1"] .studio-body {
    height: calc(100vh - var(--studio-bar-h));
    height: calc(100dvh - var(--studio-bar-h));
  }

  html[data-embed="1"] .studio-stage {
    position: relative;
    top: 0;
    height: 100%;
    max-height: none;
  }
}

/* On a touch screen every control is a finger's width. */
@media (pointer: coarse) {
  .riley-mute,
  .riley-tool,
  .riley-action,
  .riley-voice-play,
  .riley-voice-pick {
    min-width: var(--tap);
    min-height: var(--tap);
  }
}

/* ---------- The plumbing wall and the electrical, on the plan ---------- */
.plan-stack rect {
  fill: var(--studio-pipe);
  fill-opacity: 0.18;
  stroke: var(--studio-pipe);
  stroke-opacity: 0.55;
  stroke-width: 0.035;
  stroke-dasharray: 0.3 0.14;
}

.plan-stack line {
  stroke: var(--studio-pipe);
  stroke-width: 0.09;
  stroke-linecap: round;
}

.plan-point {
  cursor: grab;
  outline: none;
}

.plan-point[tabindex]:active {
  cursor: grabbing;
}

.plan-point-dot {
  fill: var(--studio-plan-body);
  stroke: var(--studio-plan-ink);
  stroke-width: 0.04;
}

.plan-point-mark {
  fill: var(--studio-plan-ink);
  text-anchor: middle;
  font-weight: 700;
  pointer-events: none;
}

.plan-point.is-light .plan-point-dot,
.plan-point.is-fan .plan-point-dot {
  fill: color-mix(in srgb, var(--studio-warn) 22%, var(--studio-plan-body));
}

.plan-point.is-warn .plan-point-dot {
  stroke: var(--studio-warn);
  stroke-width: 0.07;
}

.plan-point.is-error .plan-point-dot {
  stroke: var(--studio-error);
  stroke-width: 0.08;
}

.plan-point.is-hover .plan-point-dot,
.plan-point.is-selected .plan-point-dot,
.plan-point:focus-visible .plan-point-dot {
  stroke: var(--studio-select);
  stroke-width: 0.09;
}

/* A point's glyph where an icon would otherwise go. */
.studio-add-icon.is-point,
.studio-item-icon.is-point,
.studio-selchip-icon.is-point {
  font-size: var(--fs-base);
  font-weight: 700;
  line-height: 1;
}

.studio-selchip-icon.is-point {
  display: grid;
  place-items: center;
  width: 22px;
}

/* ---------- Riley ---------- */
.studio-riley {
  position: absolute;
  z-index: 4;
  left: var(--space-3);
  bottom: var(--space-3);
  max-width: min(420px, calc(100% - 2 * var(--space-3)));
  pointer-events: none;
}

/* On a phone or tablet (js/studio.js placeRiley) she sits under the room. */
.studio-riley.is-under {
  position: static;
  max-width: none;
  margin: var(--space-2) var(--space-3) 0;
}

.studio-stage:has(.riley:not([hidden])) .studio-hint {
  display: none;
}

/* Riley has the bottom of the stage, so a toast goes under the view
   buttons instead of over her. */
.studio-stage:has(.riley:not([hidden])) .studio-toast {
  top: calc(var(--space-3) + 56px);
  bottom: auto;
}

.riley {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-left: 3px solid var(--studio-ok);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  box-shadow: var(--shadow-soft);
  pointer-events: auto;
}

.riley[data-tone="warn"] {
  border-left-color: var(--studio-warn);
}

.riley[data-tone="error"] {
  border-left-color: var(--studio-error);
}

.riley-avatar {
  flex: none;
  color: var(--color-accent-bright);
  line-height: 0;
}

.riley-body {
  min-width: 0;
}

.riley-name {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.riley-text {
  margin: var(--space-05) 0 0;
  color: var(--color-ink);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.riley-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.riley-actions:empty {
  display: none;
}

.riley-action {
  min-height: 32px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}

.riley-action:first-child {
  border-color: transparent;
  background: var(--color-dark);
  color: var(--color-on-dark);
}

.riley-action:hover {
  filter: brightness(1.08);
}

.riley-mute,
.riley-tool {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-ink-soft);
  cursor: pointer;
}

.riley-mute:hover,
.riley-tool:hover {
  background: var(--color-surface-alt);
  color: var(--color-ink);
}

.riley-tools {
  display: flex;
  flex-direction: column;
  flex: none;
}

.riley-voice-btn[aria-expanded="true"] {
  background: var(--color-surface-alt);
  color: var(--color-ink);
}

.riley-voices {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-line);
}

.riley-voice-help {
  margin: 2px 0 var(--space-2);
  color: var(--color-ink-soft);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

.riley-voice-list {
  display: grid;
  gap: var(--space-1);
  max-height: 220px;
  margin: 0 0 var(--space-2);
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.riley-voice {
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
}

.riley-voice-pick {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 36px;
  padding: 4px var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-xs);
  text-align: left;
  cursor: pointer;
}

.riley-voice.is-on .riley-voice-pick {
  border-color: var(--color-accent-bright);
  box-shadow: inset 3px 0 0 var(--color-accent-bright);
  font-weight: 700;
}

.riley-voice-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.riley-voice-note {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--fs-2xs);
  font-weight: 400;
}

.riley-voice-play {
  flex: none;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-2xs);
  font-weight: 600;
  cursor: pointer;
}

.riley-voice-pick:hover,
.riley-voice-play:hover {
  filter: brightness(1.06);
}

.riley-mute[aria-pressed="false"] {
  color: var(--studio-warn);
}

@media (max-width: 900px) {
  .studio-riley {
    left: var(--space-2);
    right: var(--space-2);
    bottom: var(--space-2);
    max-width: none;
  }

  .riley-text {
    font-size: var(--fs-xs);
  }
}

/* ---------- What a step still needs before moving on ---------- */
.studio-step-need {
  flex: 1 0 100%;
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--color-muted);
}

.studio-step-need.is-missing {
  color: var(--color-danger);
  font-weight: 600;
}

.studio-step-btn.is-locked {
  opacity: 0.55;
}

.studio-field.is-missing,
.studio-swatch-group.is-missing,
.studio-pick.is-missing {
  border-radius: var(--radius-sm);
  outline: 2px solid var(--color-danger);
  outline-offset: 4px;
}

.studio-pick.is-missing {
  border-radius: var(--radius);
  outline-offset: 2px;
}

/* ---------- The simple studio ---------- */
/* The "All options" switch, beside "Step n of 6" at the top of each step. */
.studio-step-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-1);
}

.studio-step-topline .studio-step-count {
  margin: 0;
}

.studio-mode {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0;
  padding: 0 var(--space-2);
  border-radius: var(--radius);
  color: var(--color-ink-soft);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.studio-mode:hover {
  background: var(--color-surface-alt);
  color: var(--color-ink);
}

.studio-mode input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-line-strong);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.studio-mode input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--studio-white);
  box-shadow: 0 1px 3px rgba(10, 16, 36, 0.35);
  transition: transform 0.2s var(--ease);
}

.studio-mode input:checked {
  background: var(--color-accent-bright);
}

.studio-mode input:checked::after {
  transform: translateX(14px);
}

/* A step behind the current one with its questions answered: a check in
   place of its number. */
.studio-step-check,
.studio-step-btn:not(.is-done) .studio-step-donetext {
  display: none;
}

.studio-step-check .icon {
  width: 16px;
  height: 16px;
}

.studio-step-btn.is-done .studio-step-n {
  display: none;
}

.studio-step-btn.is-done .studio-step-check {
  display: inline-grid;
  place-items: center;
}

.studio-step-btn.is-done .studio-step-num {
  border-color: var(--studio-ok);
  background: color-mix(in srgb, var(--studio-ok) 16%, var(--color-surface));
  color: var(--studio-ok);
}

/* "More options": the rest of a step's settings, folded away. */
.studio-more {
  border: 1px dashed var(--color-line-strong);
  border-radius: var(--radius-lg);
}

.studio-more > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: var(--space-2) var(--space-4);
  list-style: none;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-accent-text);
  cursor: pointer;
}

.studio-more > summary::-webkit-details-marker {
  display: none;
}

.studio-more > summary .icon {
  transition: transform 0.2s var(--ease);
}

.studio-more[open] > summary .icon {
  transform: rotate(90deg);
}

.studio-more-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: 0 var(--space-4) var(--space-4);
}

.studio-more-open {
  display: contents;
}

.studio-inspector .studio-more > summary {
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
}

.studio-inspector .studio-more-body {
  gap: var(--space-3);
  padding: 0 var(--space-3) var(--space-3);
}

/* Width and length side by side. */
.studio-size-grid.is-pair {
  grid-template-columns: 1fr 1fr;
}

/* The one "real products" offer of the simple studio's Products step. */
.studio-real-all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}

.studio-real-all .studio-note {
  margin: 0;
  flex: 1 1 14rem;
}

/* Which wall the plumbing (or the door) is in: the plan and a button per
   wall saying what stands on it. */
.studio-wall-picker {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.studio-wall-plan {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: var(--space-15);
  border-radius: var(--radius-sm);
  background: var(--studio-plan-bg);
}

.studio-wall-plan .plan-svg {
  width: 100%;
  height: 100%;
}

.studio-wall-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.studio-wall-pick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap);
  padding: var(--space-15) var(--space-3);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}

.studio-wall-pick:hover {
  border-color: var(--color-accent-bright);
}

.studio-wall-pick[aria-pressed="true"] {
  background: var(--color-selected-bg);
  border-color: var(--color-selected-bg);
  color: var(--color-selected-ink);
  font-weight: 600;
}

.studio-wall-letter {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-on-dark);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.studio-wall-pick[aria-pressed="true"] .studio-wall-letter {
  background: var(--color-selected-ink);
  color: var(--color-selected-bg);
}

.studio-wall-what {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A wall picked for the plumbing: a pipe-blue edge and a "Pipes" tag. */
.studio-wall-pick.has-pipes {
  border-color: var(--studio-pipe);
  box-shadow: inset 4px 0 0 var(--studio-pipe);
}

.studio-wall-pipes {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex: none;
  margin-left: auto;
  padding: 2px var(--space-2);
  border-radius: 999px;
  background: var(--studio-white);
  color: #0b74c4; /* on the white tag in both themes */
  font-size: var(--fs-xs);
  font-weight: 700;
}

.studio-wall-pipes .icon {
  width: 16px;
  height: 16px;
}

/* One question at a time: "Question 2 of 3" over the question. */
.studio-q-count {
  margin: 0 0 var(--space-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-accent-text);
}

.studio-q-title:focus {
  outline: none;
}

.studio-product-card .studio-q-count {
  margin-bottom: var(--space-2);
}

/* "Done for you: 2 outlets, …" on the Electrical step. */
.studio-done {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--studio-ok) 12%, var(--color-surface));
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.studio-done .icon {
  margin-top: 1px;
  color: var(--studio-ok);
}

.studio-done.is-empty {
  background: var(--color-surface-alt);
}

.studio-done.is-empty .icon {
  color: var(--color-muted);
}

/* "3 of 9 picked" on the Products step. */
.studio-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-15);
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-accent-text);
}

.studio-progress-bar {
  display: block;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-alt);
  overflow: hidden;
}

.studio-progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-accent-bright);
  transition: width 0.3s var(--ease);
}

.studio-progress.is-done {
  color: var(--studio-ok);
}

.studio-progress.is-done .studio-progress-bar > span {
  background: var(--studio-ok);
}

/* A product list: the photo and name of what's showing, Keep and Change. */
.studio-pick {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.studio-pick.is-picked {
  border-color: color-mix(in srgb, var(--studio-ok) 45%, var(--color-line));
}

.studio-pick-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
}

.studio-pick-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.studio-pick-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.studio-pick-name {
  font-size: var(--fs-sm);
  line-height: 1.3;
}

.studio-pick-state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-xs);
  color: var(--color-muted);
}

.studio-pick-state .icon {
  width: 14px;
  height: 14px;
}

.studio-pick.is-picked .studio-pick-state {
  color: var(--studio-ok);
  font-weight: 600;
}

.studio-pick-text .studio-examples-btn {
  align-self: flex-start;
  min-height: 32px;
  padding: 0;
}

.studio-pick-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.studio-pick-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
}

.studio-pick.is-picked .studio-pick-actions {
  justify-content: flex-end;
}

.studio-pick.is-picked .studio-pick-actions .btn {
  flex: 0 1 auto;
}

.studio-thumb {
  display: block;
  width: 64px;
  height: 64px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--studio-white);
  object-fit: contain;
}

.studio-thumb.is-blank {
  display: grid;
  place-items: center;
  background: var(--color-surface-alt);
  color: var(--color-muted);
}

/* The choices for a list, as pictures. */
.studio-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-line);
}

.studio-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-15);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.studio-option .studio-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.studio-option-name {
  font-size: var(--fs-xs);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.studio-option-why {
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--color-danger);
}

.studio-option:hover:not(:disabled) {
  border-color: var(--color-accent-bright);
}

.studio-option[aria-pressed="true"] {
  border-color: var(--studio-select);
  box-shadow: 0 0 0 2px var(--studio-select);
}

.studio-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .studio-size-grid.is-pair {
    grid-template-columns: 1fr;
  }

  .studio-wall-picker {
    grid-template-columns: 1fr;
  }

  .studio-wall-plan {
    max-width: 160px;
  }
}

/* ---------- Phones: the question is on the first screen ---------- */
/* At 390x844 the room is a strip (not 38% of the screen), the demo ribbon is
   one line, Riley's question shows in full, and the banner's button drops
   under its text instead of wrapping into a narrow column, so the step, its
   question and Next are all in view. */
@media (max-width: 600px) {
  .studio-room,
  .studio-plan {
    height: 20svh;
    min-height: 150px;
  }

  .studio-step {
    gap: var(--space-3);
    padding-top: var(--space-3);
  }

  /* Riley already says what the Room step asks, so its intro waits for
     larger screens and the size question itself is in view. */
  .studio-step.is-room .studio-step-intro {
    display: none;
  }

  /* The fixed bar already names the step ("Step 1 of 6 · Your room"), so its
     heading stays for screen readers only. */
  .studio-step-head h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .studio-riley.is-under {
    margin-top: var(--space-1);
  }

  /* The button keeps to one line where it fits and two at most (longer in
     Spanish and Portuguese), never wider than the screen. */
  .designer-intro-text {
    min-width: 0;
  }

  .studio-page .designer-intro .btn {
    flex: 0 1 auto;
    max-width: 62%;
    text-wrap: balance;
    padding-inline: var(--space-4);
  }

  /* The fixed step bar is one row: "Step 1 of 6 · Your room" beside the
     buttons, not over them. */
  .studio-step-nav {
    align-items: center;
  }

  .studio-step-nav-title {
    flex: 1 1 8rem;
  }

  .studio-banner {
    flex-wrap: wrap;
  }

  .studio-banner .btn {
    flex: 1 0 100%;
    white-space: normal;
  }
}
