:root {
  color-scheme: light;
  font-family: Onest, system-ui, sans-serif;
  color: #1c1e22;
  background: #fff;
  --facade-ruby: #9b111e;
  --facade-border: #e1e3e5;
  --facade-muted: #5a6067;
  --facade-gutter: clamp(16px, 3vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }

.facade-experience {
  display: grid;
  grid-template-rows: auto minmax(340px, 1fr);
  height: calc(100svh - 44px);
  min-height: 510px;
  border-bottom: 1px solid var(--facade-border);
  background: #f4f5f6;
}

.facade-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 4px var(--facade-gutter) 12px;
  border-bottom: 1px solid var(--facade-border);
}

.facade-back {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 44px;
  color: #3a3f44;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.facade-back:hover { text-decoration: underline; }

.facade-header h1 {
  grid-area: 2 / 1 / 3 / -1;
  margin: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.3px;
  line-height: 1.2;
}

.facade-header p {
  margin: 0;
  color: var(--facade-muted);
  font-size: 13px;
}

.facade-view {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}
.facade-stage {
  position: relative;
  grid-area: 1 / 1 / -1 / -1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.facade-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.facade-stage canvas:active { cursor: grabbing; }
.facade-stage canvas:focus-visible { outline-offset: -3px; }

/* Leave room to scroll alongside the canvas while OrbitControls handles its gestures. */
.facade-stage::before, .facade-stage::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset-block: 0;
  width: clamp(24px, 4vw, 48px);
}
.facade-stage::before { inset-inline-start: 0; }
.facade-stage::after { inset-inline-end: 0; }

.facade-status, .facade-selection, .facade-option-status {
  margin: 0;
  color: var(--facade-muted);
  font-size: 13px;
  line-height: 1.5;
}

.facade-status {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(100%, 480px);
  padding: 16px var(--facade-gutter);
  transform: translate(-50%, -50%);
  color: #1c1e22;
  font-size: 14px;
  text-align: center;
}

.facade-tools {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: var(--facade-gutter);
  left: var(--facade-gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.facade-tool { position: relative; justify-self: start; min-width: 0; pointer-events: auto; }
.facade-tool-right { justify-self: end; }

.facade-zoom {
  display: grid;
  grid-template-columns: 44px minmax(46px, auto) 44px;
  align-items: center;
}

.facade-zoom button {
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #1c1e22;
  font: inherit;
  font-size: 29px;
  line-height: 1;
  cursor: pointer;
}

.facade-zoom button:not(:disabled):is(:focus-visible, :active) { color: var(--facade-ruby); }
@media (hover: hover) {
  .facade-zoom button:hover:not(:disabled) { color: var(--facade-ruby); }
}
.facade-zoom button:disabled { color: #8a9096; cursor: default; }
.facade-zoom output {
  padding: 6px 2px;
  color: #1c1e22;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.facade-control {
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--facade-border);
  border-radius: 13px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.facade-primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  inline-size: clamp(104px, 13vw, 120px);
  min-height: 90px;
  padding: 10px 4px 4px;
  border: 0;
  background: transparent;
  color: #1c1e22;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
}

.facade-primary svg {
  flex: none;
  width: 36px;
  height: 36px;
}

.facade-primary span { text-wrap: balance; }
.facade-primary:is(:focus-visible, :active) { color: var(--facade-ruby); }
@media (hover: hover) {
  .facade-primary:hover { color: var(--facade-ruby); }
}

.facade-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-inline: 14px;
  border: 0;
  color: #fff;
  background: var(--facade-ruby);
}

.facade-apply svg { flex: none; }
.facade-apply:not(:disabled):is(:hover, :focus-visible) { background: #720d16; }

.facade-popover {
  position: absolute;
  z-index: 1;
  top: calc(100% + 8px);
  left: 0;
  max-width: calc(100vw - 2 * var(--facade-gutter));
  max-height: min(430px, calc(100svh - 160px));
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--facade-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 28px rgb(28 30 34 / 9%);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #be6f77 transparent;
}

.facade-tool-right .facade-popover { left: auto; right: 0; }
.facade-options-panel, .facade-views-panel { width: 280px; }

.facade-menu-list { margin: 0; padding: 0; list-style: none; }
.facade-menu-list li + li { border-top: 1px solid rgb(155 17 30 / 20%); }
.facade-menu-button, .facade-category-back {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1c1e22;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.facade-menu-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
}

.facade-options-panel .facade-menu-button::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(-45deg);
}

.facade-category-back { padding: 6px 10px; }
.facade-category-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.facade-category-close {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--facade-ruby);
  cursor: pointer;
}

.facade-category-close:is(:hover, :focus-visible) { background: #f9edef; }
.facade-menu-button:is(:hover, :focus-visible), .facade-category-back:is(:hover, :focus-visible),
.facade-menu-button[aria-pressed="true"] {
  color: var(--facade-ruby);
}

.facade-menu-button[aria-pressed="true"] { background: #f9edef; }

.facade-category-title { margin: 4px 0; font-size: 16px; font-weight: 600; }
.facade-selection { min-height: 20px; }

.facade-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.facade-swatch {
  display: flex;
  gap: 2px;
  padding: 3px;
  min-height: 48px;
  border: 1px solid var(--facade-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.facade-swatch[aria-pressed="true"] {
  border-color: var(--facade-ruby);
  box-shadow: inset 0 0 0 1px var(--facade-ruby);
}

.facade-swatch img, .facade-quote-sample img {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
}

.facade-option-status:not(:empty) { margin-top: 10px; }
.facade-apply:disabled { opacity: .6; cursor: wait; }

.facade-quote-action, .facade-quantities {
  width: min(860px, calc(100% - 2 * var(--facade-gutter)));
  margin: 0 auto;
}

.facade-quote-action {
  z-index: 1;
  grid-area: 2 / 1;
  display: grid;
  gap: 10px 18px;
  align-items: center;
  margin-bottom: 14px;
  pointer-events: none;
}

.facade-quote-swatch, .facade-quote-submit { pointer-events: auto; }

.facade-quote-swatches {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.facade-quote-swatch {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 3px;
  border: 1px solid var(--facade-border);
  border-radius: 10px;
  background: #fff;
  color: #3a3f44;
  font: inherit;
  cursor: pointer;
}

.facade-quote-swatch:hover { border-color: var(--facade-ruby); }
.facade-quote-sample { display: flex; width: 100%; gap: 2px; }
.facade-quote-sample img { height: 34px; border-radius: 6px; }
.facade-quote-caption {
  margin: 4px -2px 0;
  font-size: 11px;
  line-height: 1.2;
}

.facade-quote-action p {
  margin: 0;
  color: var(--facade-muted);
  font-size: 13px;
  line-height: 1.4;
}

#facade-quote-status:not(:empty) { margin-top: 6px; color: var(--facade-ruby); }
.facade-quote-submit { position: relative; justify-self: center; }
.facade-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.facade-quote-notice {
  position: absolute;
  z-index: 3;
  bottom: calc(100% + 9px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  padding: 8px 12px;
  border: 1px solid var(--facade-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 16px rgb(28 30 34 / 12%);
  color: #1c1e22;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.facade-quote-notice span { color: #34745b; }

.facade-quantities {
  padding: 18px 0 36px;
}

.facade-quantities h2 {
  margin: 0 0 14px;
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 600;
  letter-spacing: -.3px;
}

.facade-quantities dl { margin: 0; }
.facade-quantities dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--facade-border);
  font-size: 14px;
}

.facade-quantities dt { font-weight: 600; }
.facade-quantities dt span {
  display: block;
  margin-top: 2px;
  color: var(--facade-muted);
  font-weight: 400;
}

.facade-quantities dd { margin: 0; font-variant-numeric: tabular-nums; }
.facade-quantities p {
  margin: 10px 0 0;
  color: var(--facade-muted);
  font-size: 13px;
  line-height: 1.5;
}

:where(a, button, select, canvas):focus-visible {
  outline: 2px solid var(--facade-ruby);
  outline-offset: 2px;
}

@media (max-width: 459px) {
  .facade-quote-swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (width < 760px) {
  .facade-experience {
    grid-template-rows: auto auto;
    height: auto;
    min-height: 0;
  }
  .facade-header {
    gap: 12px;
    padding: 16px clamp(24px, 6vw, 36px) 12px;
  }
  .facade-header h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .facade-header p { text-align: right; }
  .facade-view { grid-template-rows: max(260px, calc(100svh - 160px)) auto; }
  .facade-tools { top: 6px; }
  .facade-zoom { grid-template-columns: clamp(32px, 9vw, 44px) minmax(40px, auto) clamp(32px, 9vw, 44px); }
  .facade-zoom button { min-height: 44px; font-size: 24px; }
  .facade-zoom output { font-size: 14px; }
  .facade-primary {
    inline-size: clamp(68px, 24vw, 96px);
    min-height: 54px;
    justify-content: center;
    gap: 2px;
    padding: 3px;
    font-size: 11px;
    line-height: 1.15;
  }
  .facade-primary svg { width: 24px; height: 24px; }
}

@media (max-width: 319px) {
  .facade-tools { inset-inline: 10px; gap: 4px; }
  .facade-zoom { grid-template-columns: 29px minmax(36px, auto) 29px; }
  .facade-zoom output { font-size: 13px; }
}

@media (min-width: 760px) {
  /* Let the wheel scroll the page across the finish row while the scene remains visible behind it. */
  .facade-view::before {
    content: '';
    z-index: 1;
    grid-area: 2 / 1;
  }

  .facade-header {
    grid-template-columns: 1fr auto 1fr;
    padding-block: 10px;
  }

  .facade-header h1 { grid-area: auto; font-size: 23px; }
  .facade-header p { justify-self: end; }
  .facade-tools { top: 24px; }
  .facade-zoom { grid-template-columns: 54px minmax(58px, auto) 54px; }
  .facade-zoom button { min-height: 58px; }
  .facade-zoom output { font-size: 18px; }
  .facade-quote-action {
    width: min(700px, calc(100% - 2 * var(--facade-gutter)));
    grid-template-columns: minmax(0, 1fr) max-content;
  }
  .facade-quote-swatches { gap: 6px; }
}
