/* Host-side styling for the showroom page. Not part of the module. */

:root {
  --ink: #f3ece1;
  --muted: rgba(243, 236, 225, 0.62);
  --line: rgba(243, 236, 225, 0.18);
  --amber: #ffb020;
  --panel: rgba(18, 15, 12, 0.82);
}

* { box-sizing: border-box; }

/* Fullscreen, no scrollbar — the interactive view owns the viewport. */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0d0b09;
}

body {
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The module's mount. Fixed to the viewport; the canvas fills it. */
.hall {
  position: fixed;
  inset: 0;
  outline: none;
}
.hall:focus-visible { box-shadow: inset 0 0 0 2px rgba(255, 176, 32, 0.65); }

/* --- overlay -------------------------------------------------------------
   pointer-events:none so drags fall through to the canvas; individual
   controls opt back in. */
/*
 * No safe-area padding here, deliberately.
 *
 * Insetting the whole overlay also insets every background it contains, so on
 * a notched phone in landscape the ribbon's gradient stopped 44px short of the
 * screen edge and left a bare strip with the 3D showing through. The insets
 * belong on each bar's own padding instead: the bar still spans edge to edge,
 * and only its *contents* keep clear of the notch.
 */
.overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.overlay a,
.overlay button,
.overlay .swatches { pointer-events: auto; }

/* --- landing choice ------------------------------------------------------ */

.landing {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 10%, rgba(64, 50, 36, 0.55), transparent 60%),
    #0d0b09;
}
.landing[hidden] { display: none; }

.landing .eyebrow { margin: 0; letter-spacing: 0.42em; }
.landing h1 {
  margin: 0 0 26px;
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.landing-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
  gap: 18px;
  justify-content: center;
}

.landing-card {
  display: grid;
  gap: 10px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.landing-card:hover {
  border-color: var(--amber);
  background: rgba(255, 176, 32, 0.06);
  transform: translateY(-2px);
}
.landing-card strong { font-size: 19px; font-weight: 600; }
.landing-card span { color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* --- room switcher -------------------------------------------------------- */

.env-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 11, 9, 0.5);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.env-switcher[hidden] { display: none; }
.env-switcher button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.env-switcher button:hover { color: var(--ink); }
.env-switcher button[aria-pressed="true"] {
  background: var(--amber);
  color: #14150f;
  font-weight: 600;
}

.cross-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.cross-link:hover { color: var(--ink); }
.cross-link[hidden] { display: none; }

/* --- top ribbon ---------------------------------------------------------- */

.ribbon {
  display: flex;
  align-items: center;
  gap: 24px;
  padding:
    calc(18px + env(safe-area-inset-top))
    calc(28px + env(safe-area-inset-right))
    18px
    calc(28px + env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(13, 11, 9, 0.85), transparent);
}

.wordmark {
  font-weight: 600;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  font-size: 15px;
  /* It is a button, but it should read as the logo, not as a control. */
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
}
.wordmark:hover { opacity: 0.75; }
.wordmark:focus-visible { outline: 1px solid var(--amber); outline-offset: 6px; }

.ribbon-nav { display: flex; gap: 20px; margin-left: auto; }
.ribbon-nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
.ribbon-nav a:hover { color: var(--ink); }

.cart-button {
  border: 1px solid var(--line);
  background: rgba(13, 11, 9, 0.5);
  color: inherit;
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.cart-button:hover { border-color: var(--ink); }

.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--amber);
  color: #14150f;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- product details ----------------------------------------------------- */

.details {
  margin-top: auto;
  padding: 22px calc(28px + env(safe-area-inset-right)) 22px calc(28px + env(safe-area-inset-left));
  max-width: 420px;
  transition: opacity 0.25s ease;
}
/* Stands down while the detail panel is showing the same information. */
.details.is-hidden { opacity: 0; pointer-events: none; }

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--amber);
}

.details h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.06;
}

.tagline { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.price { margin: 0 0 16px; font-variant-numeric: tabular-nums; font-size: 15px; }

.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.swatches { display: flex; gap: 8px; }
.swatch {
  width: 26px; height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #0d0b09, 0 0 0 4px var(--amber);
  transform: scale(1.06);
}

.primary {
  border: 0;
  background: var(--amber);
  color: #14150f;
  border-radius: 10px;
  padding: 11px 22px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.primary:active { transform: translateY(1px); }

/* --- hint ---------------------------------------------------------------- */

/* Bottom centre, 20px off the screen edge.
   Pinned to the viewport rather than left in the overlay's flex flow: it used
   to ride below `.details`, which is display:none whenever nothing is
   selected, and with that sibling gone the `margin-top: auto` that pushed the
   pair down stopped applying and the hint rose up under the ribbon. Fixed
   positioning makes it independent of whether anything is on display. */
.hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(20px + env(safe-area-inset-bottom));
  padding: 0 calc(28px + env(safe-area-inset-right)) 0 calc(28px + env(safe-area-inset-left));
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  transition: opacity 0.6s ease;
}
.hint.faded { opacity: 0; }
.hint-key {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--ink);
}

/* --- back button --------------------------------------------------------- */

.back-button {
  border: 1px solid var(--line);
  background: rgba(13, 11, 9, 0.6);
  color: inherit;
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  margin-right: 4px;
}
.back-button:hover { border-color: var(--ink); }
.back-button[hidden] { display: none; }

/* --- product detail panel ------------------------------------------------ */

.panel {
  position: fixed;
  top: 0; right: 0;
  width: min(400px, 94vw);
  height: 100dvh;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  z-index: 25;
}
.panel[hidden] { display: none; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }

.panel-tagline { margin: 0; color: var(--muted); font-size: 14px; }
.panel-description { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.panel-price { margin: 0; font-size: 18px; font-variant-numeric: tabular-nums; }

.panel-section { display: grid; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.panel-section h3 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.panel-section[hidden] { display: none; }
.panel-note { margin: 0; font-size: 12px; color: var(--muted); }

.attachments { display: grid; gap: 8px; }
.attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
}
.attachment:hover { border-color: rgba(243, 236, 225, 0.4); }
.attachment input { accent-color: var(--amber); width: 16px; height: 16px; flex: none; }
.attachment-text { display: grid; flex: 1; }
.attachment-text span { color: var(--muted); font-size: 12px; }
.attachment-price { font-variant-numeric: tabular-nums; color: var(--muted); }

.panel-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.panel-total strong { font-size: 19px; }

.panel-actions { display: grid; gap: 8px; margin-top: auto; padding-top: 8px; }
.panel-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.primary-alt { background: transparent; color: var(--ink); border: 1px solid var(--amber); }
.ghost.wide { width: 100%; text-align: center; }
.ghost.icon { font-size: 13px; }
.ghost.is-on { border-color: var(--amber); color: var(--amber); }

/* --- mock cart ----------------------------------------------------------- */

.cart {
  position: fixed;
  top: 0; right: 0;
  width: min(380px, 92vw);
  height: 100dvh;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 30;
}
.cart[hidden] { display: none; }
.cart-head { display: flex; align-items: center; justify-content: space-between; }
.cart-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.cart-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; }
.cart-line { display: grid; gap: 4px; font-size: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cart-line-main { display: flex; align-items: center; gap: 10px; }
.cart-sub {
  display: flex;
  justify-content: space-between;
  padding-left: 32px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cart-dot { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.cart-line-name { flex: 1; }
.cart-qty, .cart-line-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.cart-empty { color: var(--muted); font-size: 14px; margin: 0; }
.cart-foot { display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.cart-note { margin: 0; color: var(--muted); font-size: 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

/* --- no-WebGL fallback --------------------------------------------------- */

[data-maya-fallback] {
  list-style: none;
  margin: 0;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  align-content: center;
  height: 100%;
}
[data-maya-fallback] li {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 8px;
}
[data-maya-swatch] { width: 44px; height: 44px; border-radius: 12px; display: block; }
[data-maya-fallback] span:last-child { color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
  .details { max-width: none; padding: 18px calc(20px + env(safe-area-inset-right)) 18px calc(20px + env(safe-area-inset-left)); }
  .ribbon { padding: calc(14px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 14px calc(20px + env(safe-area-inset-left)); }
  .hint { padding: 0 calc(20px + env(safe-area-inset-right)) 0 calc(20px + env(safe-area-inset-left)); }
}

/* ==========================================================================
   Mobile — orientation, fullscreen, and rooms as a sheet

   Three problems a phone has that a desktop does not: it is usually held
   portrait, its browser chrome eats a third of a landscape screen, and eight
   room buttons will not fit across it. Each is handled below.
   ========================================================================== */

/* --- the rooms toggle, and the switcher as a sheet ----------------------- */

.rooms-toggle {
  display: none;              /* shown by the media query, and only with rooms */
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 11, 9, 0.5);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.rooms-toggle[hidden] { display: none; }

/* Three bars that become a cross when the sheet is open. */
.rooms-toggle-icon,
.rooms-toggle-icon::before,
.rooms-toggle-icon::after {
  display: block;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  transition: transform .18s ease, opacity .18s ease;
}
.rooms-toggle-icon { position: relative; }
.rooms-toggle-icon::before,
.rooms-toggle-icon::after { content: ''; position: absolute; left: 0; }
.rooms-toggle-icon::before { top: -5px; }
.rooms-toggle-icon::after { top: 5px; }
.rooms-toggle[aria-expanded="true"] .rooms-toggle-icon { transform: rotate(45deg); }
.rooms-toggle[aria-expanded="true"] .rooms-toggle-icon::before { transform: translateY(5px) rotate(-90deg); }
.rooms-toggle[aria-expanded="true"] .rooms-toggle-icon::after { opacity: 0; }

.icon-button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 11, 9, 0.5);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.icon-button[hidden] { display: none; }
.icon-button[aria-pressed="true"] { background: var(--amber); color: #16150f; border-color: transparent; }

@media (max-width: 900px) {
  /* The toggle only exists at this width — `hidden` is still what decides
     whether there are rooms worth toggling. */
  .rooms-toggle:not([hidden]) { display: inline-flex; }

  /* The ribbon keeps only the wordmark and the controls; rooms move into the
     sheet below, which is the only way eight of them fit on a phone. */
  .env-switcher {
    position: fixed;
    top: 56px;
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 6px;
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
    padding: 8px;
    border-radius: 14px;
    background: var(--panel);
    backdrop-filter: blur(14px);
    z-index: 45;
  }
  /* Collapsed unless the toggle says otherwise. `hidden` still wins. */
  .env-switcher:not([data-open="true"]) { display: none; }
  .env-switcher button { padding: 11px 10px; font-size: 13px; border-radius: 9px; }
  .ribbon { gap: 12px; padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 10px calc(14px + env(safe-area-inset-left)); }
  .wordmark { font-size: 13px; letter-spacing: 0.3em; text-indent: 0.3em; }
  .cart-button { margin-left: auto; }
  /* The hint sits under a ribbon that is now shorter. */
  .hint { padding: 0 calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left)); font-size: 11px; }
}

/* --- portrait cover ------------------------------------------------------ */

.rotate-cover {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
  background: #0d0b09;
  color: var(--ink);
}
.rotate-cover[hidden] { display: none; }
.rotate-inner { max-width: 22rem; }
.rotate-cover h2 { margin: 18px 0 8px; font-size: 20px; font-weight: 600; }
.rotate-cover p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* A phone rotating itself, which says the thing faster than the words do. */
.rotate-icon {
  display: inline-block;
  font-size: 46px;
  line-height: 1;
  color: var(--amber);
  animation: rotate-hint 2.4s ease-in-out infinite;
}
@keyframes rotate-hint {
  0%, 40% { transform: rotate(90deg); }
  60%, 100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .rotate-icon { animation: none; transform: rotate(90deg); }
}

/* --- the fullscreen invitation ------------------------------------------ */

/* Sits above the hint, which is also bottom-centre — the two are briefly on
   screen together before the first interaction fades the hint out. */
.fullscreen-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(58px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 24px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}
.fullscreen-prompt[hidden] { display: none; }
.fullscreen-prompt p { margin: 0; font-size: 13px; white-space: nowrap; }
.fullscreen-prompt-actions { display: flex; gap: 8px; }
.fullscreen-prompt button { padding: 7px 12px; font-size: 12.5px; white-space: nowrap; }

@media (max-width: 480px) {
  .fullscreen-prompt { flex-direction: column; gap: 8px; border-radius: 14px; }
  .fullscreen-prompt p { white-space: normal; text-align: center; }
}

/* --- the shop: exit-shopping + checkout screen ---------------------------- */

/* Sits where the Back button does, but for leaving a rack rather than
   returning a piece — the two are never visible at once (Back is placement
   mode, this is rack browsing). */
.exit-shopping {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top, 0px));
  left: calc(18px + env(safe-area-inset-left, 0px));
  pointer-events: auto;
}

.checkout-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: var(--paper, #f4efe6);
  padding: 24px;
}

.checkout-card {
  width: min(520px, 92vw);
  color: #1b1a17;   /* the page theme is light-on-dark; this card is paper */
  background: #fff;
  border: 1px solid rgba(27, 26, 23, 0.12);
  border-radius: 18px;
  padding: 28px 30px;
  box-shadow: 0 24px 60px rgba(27, 26, 23, 0.14);
}

.checkout-card h1 { margin: 4px 0 18px; font-size: 28px; }

.checkout-lines {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.checkout-lines li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(27, 26, 23, 0.14);
}

.checkout-empty { color: rgba(27, 26, 23, 0.55); font-size: 14px; }

.checkout-total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  margin: 12px 0 18px;
}

.checkout-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* --- the shop's rack dropdown --------------------------------------------- */

.rack-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  margin-left: 4px;
}
.rack-nav[hidden] { display: none; }

.rack-nav-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.62;
}

#rack-select {
  font: inherit;
  font-size: 13px;
  color: inherit;
  background: rgba(13, 11, 9, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
#rack-select:hover { border-color: var(--ink); }
/* The popup list is drawn by the OS, which does not inherit the dark ribbon. */
#rack-select option { color: #1b1a17; background: #fff; }
