/* packaging-studio — the Carte Blanche luxury stage + 3D Packaging Studio.
 * Brand fonts (copied from the child theme into assets/fonts so the studio is self-contained):
 * Glitten (display) + Rubrik (UI).
 * Everything is scoped under .cb-stage so it can drop into the theme later. */

@font-face {
  font-family: 'Glitten';
  src: url('assets/fonts/glitten-regular.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'Rubrik';
  src: url('assets/fonts/rubrik-light.otf') format('opentype');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Rubrik';
  src: url('assets/fonts/rubrik-regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Rubrik';
  src: url('assets/fonts/rubrik-medium.otf') format('opentype');
  font-weight: 500;
  font-display: swap;
}

.cb-stage {
  --red-deep: #5e0508;
  --gold: #e2c27e;
  --gold-soft: #f3dfae;
  --gold-deep: #b8893f;
  --ink: #2a1712;
  --card-line: rgba(226, 194, 126, 0.35);
  --font-display: 'Glitten', 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'Rubrik', -apple-system, 'Segoe UI', sans-serif;

  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  /* poster: the full flat export — shows instantly, and stays if WebGL is unavailable */
  background: var(--red-deep) url('assets/stage/bg-poster-1920.webp') 48% 60% / cover no-repeat;
  isolation: isolate;
}

.cb-stage__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.cb-stage.is-live .cb-stage__canvas { opacity: 1; }

/* ---- gold CB seal, where "LUXURY / BACKGROUND" sat in the original art ---- */
.cb-stage__mark {
  position: absolute;
  left: 50%;
  top: 19%;
  z-index: 1;
  width: clamp(88px, 8.5vw, 150px);
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 12px) scale(0.92);
  animation: cb-stage-rise 1.6s 0.4s cubic-bezier(.2, .7, .2, 1) forwards;
}
/* the shadow and glow follow the round seal itself (an SVG with a transparent outside),
   so no square box can show on any browser */
.cb-stage__mark img {
  display: block; width: 100%; height: 100%;
  filter: drop-shadow(0 6px 18px rgba(60, 0, 4, 0.55)) drop-shadow(0 0 22px rgba(255, 196, 110, 0.28));
}
/* light sweeping across the foil — masked by the seal's own shape, so it never leaves the gold */
.cb-stage__mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 250, 225, 0.85) 50%, transparent 62%) no-repeat;
  background-size: 300% 100%;
  background-position: 130% 0;
  -webkit-mask: url('assets/cb-logo-gold.svg') center / contain no-repeat;
  mask: url('assets/cb-logo-gold.svg') center / contain no-repeat;
  mix-blend-mode: soft-light;
  animation: cb-stage-sweep 6.5s 1.8s ease-in-out infinite;
}

@keyframes cb-stage-rise {
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes cb-stage-sweep {
  0% { background-position: 130% 0; }
  35%, 100% { background-position: -30% 0; }
}

/* =============================================================================
 * Packaging Studio (src/studio.js)
 * ========================================================================== */
.ps-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; touch-action: pan-y; }
.ps-specs { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.ps-spec-labels, .ps-style-labels { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.cb-stage__mark { z-index: 2; transition: opacity .6s ease; }
.cb-stage.ps-mode-config .cb-stage__mark { opacity: 0 !important; }

/* spec lines, drawn like a technical drawing: thin solid lines, 45° ticks, ring markers */
.ps-specs polyline, .ps-specs line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ps-dim  { stroke: rgba(243, 223, 174, .95); stroke-width: 1; }
.ps-ext  { stroke: rgba(243, 223, 174, .42); stroke-width: 1; }
.ps-tick { stroke: #fff3d6; stroke-width: 1.5; }
.ps-call { stroke: rgba(243, 223, 174, .8); stroke-width: 1; }
.ps-ring { fill: rgba(36, 5, 7, .35); stroke: #fff3d6; stroke-width: 1.2; }
.ps-dot  { fill: #fff3d6; }

.ps-spec-label {
  position: absolute; left: 0; top: 0;
  font-family: var(--font-ui); color: #fff6e4; white-space: nowrap;
  opacity: 0; transition: opacity .35s ease;
}
/* a measurement sits on its line: letter, figure, unit */
.ps-spec-label.is-dim {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 7px; border-radius: 3px;
  background: rgba(28, 4, 6, .86); font: 500 12.5px/1.2 var(--font-ui); font-variant-numeric: tabular-nums;
  letter-spacing: .02em; color: #fff3e0;
}
.ps-spec-label.is-dim i { font-style: normal; font-size: 9.5px; letter-spacing: .14em; color: var(--gold); }
.ps-spec-label.is-dim small { font-size: 10px; color: rgba(255, 243, 224, .62); }
/* call-outs: no boxes, a small-caps title over a plain line of detail */
.ps-spec-label.is-left, .ps-spec-label.is-right {
  display: flex; flex-direction: column; gap: 3px; padding: 0;
  text-shadow: 0 1px 12px rgba(30, 0, 2, .75), 0 0 2px rgba(30, 0, 2, .5);
}
.ps-spec-label.is-left { text-align: right; align-items: flex-end; }
.ps-spec-label span { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-soft); font-weight: 500; }
.ps-spec-label em { font-style: normal; font-size: 13px; line-height: 1.35; color: #fff3e0; font-weight: 300; }

/* style names under the line-up */
.ps-style-label {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer;
  padding: 6px 14px !important; border-radius: 999px !important; border: 1px solid var(--card-line) !important;
  background: rgba(36, 5, 7, .55) !important; color: var(--gold-soft) !important;
  font: 500 11px/1.25 var(--font-ui) !important; letter-spacing: .12em; text-transform: uppercase !important;
  max-width: 150px; text-align: center;
  opacity: 0; transition: opacity .4s ease, background .2s ease, color .2s ease;
  backdrop-filter: blur(4px);
}
.ps-style-label:hover { background: var(--gold) !important; color: var(--ink) !important; }

/* HUD: intro text, back / open buttons, category bar */
.ps-hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; font-family: var(--font-ui); }
.ps-hud button { pointer-events: auto; font-family: var(--font-ui); }
/* theme isolation (see note above .ps-back): no kit shadows, transforms or min sizes on our buttons */
.cb-stage button { box-shadow: none; text-shadow: none; min-height: 0; min-width: 0; margin: 0; }
.ps-intro {
  position: absolute; left: 0; right: 0; bottom: 92px; text-align: center; padding: 0 16px;
  transition: opacity .5s ease, transform .5s ease;
}
.cb-stage.ps-mode-config .ps-intro { opacity: 0; transform: translateY(10px); }
/* hero + line-up: the title sits between the seal and the boxes */
.cb-stage.ps-mode-hero .ps-intro, .cb-stage.ps-mode-styles .ps-intro { bottom: auto; top: 39%; }
.cb-stage.ps-mode-styles .ps-eyebrow { display: none; }
.ps-eyebrow { margin: 0 0 6px; font: 500 11px/1 var(--font-ui); letter-spacing: .32em; text-transform: uppercase; color: var(--gold); }
.ps-title {
  margin: 0; font: 400 clamp(26px, 3.2vw, 44px)/1.1 var(--font-display); letter-spacing: .04em;
  color: var(--gold-soft); text-shadow: 0 2px 14px rgba(60, 0, 4, .6);
}
.ps-blurb { margin: 8px auto 0; max-width: 520px; font-weight: 300; font-size: 14px; color: rgba(255, 240, 220, .82); }
.ps-hint { display: inline-flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 12px; letter-spacing: .08em; color: rgba(255, 236, 205, .78); }
.ps-hint-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(226, 194, 126, .7); animation: ps-pulse 1.8s ease-out infinite; }
@keyframes ps-pulse { to { box-shadow: 0 0 0 10px rgba(226, 194, 126, 0); } }

.ps-back, .ps-open {
  position: absolute; border: 1px solid var(--card-line) !important; border-radius: 999px !important; cursor: pointer;
  background: rgba(36, 5, 7, .6) !important; color: var(--gold-soft) !important; backdrop-filter: blur(6px);
  font-size: 12px !important; letter-spacing: .14em; text-transform: uppercase !important; font-weight: 500 !important;
  transition: background .2s ease, color .2s ease;
}
.ps-back { top: 20px; left: 20px; padding: 10px 16px !important; }
.ps-open { left: calc((100% - var(--ps-panel-w, 0px)) / 2); bottom: 28px; transform: translateX(-50%); padding: 12px 22px !important; }
.ps-back:hover, .ps-open:hover { background: var(--gold) !important; color: var(--ink) !important; }
.ps-back[hidden], .ps-open[hidden] { display: none; }

/* full screen: top-right, clear of the quote panel on desktop */
.ps-fs {
  position: absolute; top: 20px; right: calc(var(--ps-panel-w, 0px) + 20px); width: 42px; height: 42px;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--card-line) !important; border-radius: 999px !important; padding: 0 !important;
  background: rgba(36, 5, 7, .6) !important; color: var(--gold-soft) !important; backdrop-filter: blur(6px);
  transition: background .2s ease, color .2s ease, right .45s ease;
}
.ps-fs:hover, .ps-fs:focus-visible { background: var(--gold) !important; color: var(--ink) !important; }
.ps-fs svg { display: block; }
/* phones and iPhone Safari (no element full screen): the stage covers the page instead */
.cb-stage.ps-pseudo-fs { position: fixed !important; inset: 0 !important; z-index: 2147483000; width: 100% !important; height: 100% !important; min-height: 0; margin: 0 !important; border-radius: 0 !important; }
html.ps-lock, html.ps-lock body { overflow: hidden !important; }
.cb-stage:fullscreen { width: 100%; height: 100%; }
/* phone carousel arrows (styles mode, portrait only) */
.ps-nav {
  position: absolute; top: 62%; width: 40px; height: 40px; border-radius: 50% !important; display: none; cursor: pointer;
  border: 1px solid var(--card-line) !important; background: rgba(36, 5, 7, .6) !important; color: var(--gold-soft) !important;
  font-size: 22px !important; line-height: 1 !important; backdrop-filter: blur(6px);
}
.ps-nav-prev { left: 10px; } .ps-nav-next { right: 10px; }

.ps-cats {
  position: absolute; left: 0; right: 0; bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 8px; padding: 2px 16px !important;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity;
  pointer-events: auto; touch-action: pan-x; cursor: grab;
  /* fade the ends so it reads as scrollable */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  transition: opacity .4s ease;
}
/* spacers centre the chips when they fit; when they overflow they collapse, so the
   first chip is never cut off (justify-content: center would clip the left end) */
.ps-cats::before, .ps-cats::after { content: ''; flex: 1 0 0; }
.ps-cats.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.ps-cats::-webkit-scrollbar { display: none; }
.cb-stage.ps-mode-config .ps-cats { opacity: 0; pointer-events: none; }
.cb-stage.ps-mode-config .ps-cats button { pointer-events: none; }
.ps-cat {
  flex: 0 0 auto; scroll-snap-align: center; padding: 8px 14px !important; border-radius: 999px !important; border: 1px solid rgba(226, 194, 126, .28) !important;
  background: rgba(36, 5, 7, .45) !important; color: rgba(255, 236, 205, .85) !important; cursor: pointer;
  font-size: 11.5px !important; letter-spacing: .08em; backdrop-filter: blur(4px);
}
.ps-cat.is-on { background: var(--gold) !important; color: var(--ink) !important; border-color: var(--gold) !important; }
.ps-cat.is-soon { opacity: .55; cursor: default; }
.ps-cat small { margin-left: 4px; font-size: 9px !important; letter-spacing: .12em; text-transform: uppercase !important; color: var(--gold) !important; }

/* quote panel — right-hand card on desktop, bottom sheet on phones */
.cb-stage.ps-mode-config { --ps-panel-w: min(420px, 38vw); }
.ps-panel {
  position: absolute; z-index: 5; top: 16px; right: 16px; bottom: 16px; width: calc(var(--ps-panel-w) - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(34, 6, 8, .9), rgba(22, 3, 5, .92));
  border: 1px solid var(--card-line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(20, 0, 2, .55);
  color: #fff3e2; font-family: var(--font-ui); font-weight: 300;
  animation: ps-panel-in .55s cubic-bezier(.2, .8, .2, 1);
  backdrop-filter: blur(10px);
}
.ps-panel[hidden] { display: none; }
@keyframes ps-panel-in { from { opacity: 0; transform: translateX(24px); } }
.ps-sheet-handle { display: none; }
.ps-sheet-toggle { display: none; }
.ps-form, .ps-thanks { padding: 24px 24px 28px; }
.ps-panel-title { margin: 0 0 14px; font: 400 30px/1.1 var(--font-display); color: var(--gold-soft); letter-spacing: .03em; }
.ps-form fieldset { margin: 0; padding: 14px 0; border: 0; border-top: 1px solid rgba(226, 194, 126, .16); }
.ps-form legend { padding: 0 0 10px; font-size: 10.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.ps-form legend small { letter-spacing: .06em; text-transform: none; color: rgba(255, 236, 205, .6); font-weight: 300; }
.ps-dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ps-form label span { display: block; margin-bottom: 5px; font-size: 11.5px; color: rgba(255, 236, 205, .7); }
.ps-form input, .ps-form textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(226, 194, 126, .28); background: rgba(255, 245, 230, .06);
  color: #fff6e8; font: 400 16px/1.3 var(--font-ui); outline: none; transition: border-color .2s ease, background .2s ease;
}
.ps-form input:focus, .ps-form textarea:focus { border-color: var(--gold); background: rgba(255, 245, 230, .1); }
.ps-qty { display: flex; align-items: center; gap: 12px; }
.ps-qty input { width: 120px; flex: 0 0 auto; }
.ps-qty span { margin: 0 !important; font-size: 12px !important; }
.ps-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-chip {
  padding: 8px 13px !important; border-radius: 999px !important; border: 1px solid rgba(226, 194, 126, .3) !important; cursor: pointer;
  background: transparent !important; color: rgba(255, 238, 210, .9) !important; font: 400 13px/1 var(--font-ui) !important;
}
.ps-chip.is-on { background: var(--gold) !important; border-color: var(--gold) !important; color: var(--ink) !important; font-weight: 500 !important; }
.ps-swatches { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ps-swatch {
  width: 28px; height: 28px; border-radius: 50% !important; cursor: pointer; padding: 0 !important;
  background: var(--sw) !important; border: 2px solid rgba(255, 240, 215, .25) !important; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25) !important;
}
.ps-swatch.is-on { border-color: var(--gold) !important; box-shadow: 0 0 0 3px rgba(226, 194, 126, .3) !important; }
.ps-swatch-name { margin-left: 4px; font-size: 12.5px !important; color: rgba(255, 236, 205, .78) !important; }
.ps-comp { display: flex; align-items: flex-end; gap: 10px; }
.ps-comp label { width: 84px; }
.ps-times { padding-bottom: 11px; color: var(--gold); }
.ps-pieces { padding-bottom: 11px; margin-left: auto; font-size: 12.5px; color: rgba(255, 236, 205, .8); }
.ps-sub { margin: 14px 0 8px; font-size: 11.5px; color: rgba(255, 236, 205, .7); }
.ps-foil { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: rgba(255, 236, 205, .7); }
.ps-foil[hidden] { display: none; }
.ps-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ps-contact .ps-wide { grid-column: 1 / -1; }
.ps-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.ps-turnstile:not(:empty) { margin-top: 12px; }
.ps-error { margin: 6px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 90, 80, .14); color: #ffd6cf; font-size: 13px; }
.ps-error[hidden] { display: none; }
.ps-submit {
  width: 100%; margin-top: 16px; padding: 15px 18px !important; border: 0 !important; border-radius: 12px !important; cursor: pointer;
  background: linear-gradient(100deg, #b8893f, #f3dfae 45%, #d9b46a 60%, #b8893f) !important;
  color: var(--ink) !important; font: 500 13px/1 var(--font-ui) !important; letter-spacing: .2em; text-transform: uppercase !important;
  box-shadow: 0 10px 26px rgba(184, 137, 63, .35) !important;
}
.ps-submit:disabled { opacity: .6; cursor: progress; }
.ps-thanks p { color: rgba(255, 238, 215, .85); line-height: 1.55; }

/* ---- mobile ---------------------------------------------------------------- */
@media (max-width: 700px) {
  .cb-stage { background-position: 48% 70%; }
  .cb-stage__mark { top: 16%; }
}

/* portrait: the quote panel becomes a bottom sheet (studio.js reserves 50% height) */
@media (max-aspect-ratio: 9/10) {
  .cb-stage.ps-mode-config { --ps-panel-w: 0px; }
  .cb-stage { --ps-sheet: 40%; }
  .cb-stage.ps-sheet-full { --ps-sheet: 86%; }
  .ps-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--ps-sheet);
    border-radius: 20px 20px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation-name: ps-sheet-in;
    transition: height .45s cubic-bezier(.2, .8, .2, 1);
  }
  /* the grab bar: tap or swipe it to switch between the model and the form */
  .ps-sheet-toggle {
    display: block; position: sticky; top: 0; z-index: 2; width: 100%; height: 30px; padding: 0 !important; border: 0 !important; cursor: pointer;
    background: linear-gradient(180deg, rgba(34, 6, 8, .98), rgba(34, 6, 8, .85)) !important; touch-action: none;
  }
  .ps-sheet-toggle::before { content: ''; display: block; width: 44px; height: 4px; margin: 0 auto; border-radius: 4px !important; background: rgba(226, 194, 126, .55) !important; }
  .ps-form, .ps-thanks { padding: 4px 18px 24px; }
  .ps-panel-title { font-size: 24px; }
  .ps-open { bottom: calc(var(--ps-sheet) + 14px); padding: 11px 18px !important; font-size: 11px !important; transition: bottom .45s cubic-bezier(.2, .8, .2, 1); }
  .cb-stage.ps-sheet-full .ps-open { opacity: 0; pointer-events: none; }
  /* with the form open the model is small: its spec lines would only crowd it */
  .cb-stage.ps-sheet-full :is(.ps-specs, .ps-spec-labels) { opacity: 0; transition: opacity .3s ease; }
  .ps-back { top: 12px; left: 12px; padding: 11px 14px !important; font-size: 11px !important; }
  .ps-intro { bottom: 74px; }
  .ps-blurb { font-size: 13px; }
  .ps-cats { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .ps-cat { padding: 10px 14px !important; }
  .ps-contact { grid-template-columns: 1fr; }
  .ps-swatch { width: 32px; height: 32px; }
  .ps-spec-label em { font-size: 11.5px; }
  .ps-spec-label span { font-size: 9.5px; }
  .cb-stage.ps-mode-styles .ps-nav { display: block; }
}
@keyframes ps-sheet-in { from { opacity: 0; transform: translateY(30px); } }

@media (prefers-reduced-motion: reduce) {
  .ps-hint-dot, .ps-panel { animation: none; }
  .cb-stage__mark { animation: none; opacity: 1; transform: translate(-50%, 0); }
  .cb-stage__mark::after { animation: none; display: none; }
}
