/* ============================================================
   3D Box Explorer: the hero's 3D panel (MASTER_PROMPT 6.5).
   Taken from the approved reference build v43 (docs/chapter-1/reference-build/index.html) rule for rule,
   in its original cascade order; only rules for elements the final panel no longer has were left out.
   ============================================================ */
#price iframe.h3d { width: 100%; height: clamp(380px, calc(100vh - 285px), 660px); border: 0; border-radius: 0; background: #F4EADD; display: block; }
/* style tabs are 32px pills (MASTER_PROMPT 6.5.2); the reference reaches 32px through its arrow glyph's line box */
#price .st { min-height: var(--pw-h-tab); }
@media (min-width: 960px) {
  #price { display: flex; flex-direction: column; }
  #price .hstage { position: absolute; inset: 0; }
  #price iframe.h3d { height: 100% !important; }
}
.vsw button:focus-visible { outline:3px solid #EFB13A;outline-offset:2px }
.vsw { display:flex;gap:5px;align-items:center;padding:0 4px;border-left:1px solid #E3DDD3;border-right:1px solid #E3DDD3;padding:0 8px }
.vsw button { width:22px;height:22px;border-radius:50%;border:2px solid #E3DDD3;padding:0;cursor:pointer }
.vsw button[aria-pressed="true"] { border-color:#0F4C3A;box-shadow:inset 0 0 0 2px #FFFFFF }
@media (pointer:coarse) {
  .vsw button { width:28px;height:28px }
}
@media (max-width:560px) {
  .vsw { border-right:0;padding-right:0 }
}
.stabs { display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap }
.stabs-l { display:flex;gap:5px;flex-wrap:wrap }
.stabs-tabs { display:contents } /* the tab group alone (the All Styles link is not a tab); the layout stays as before */
.st { min-height:30px;padding:0 10px;border-radius:999px;border:1.5px solid #E3DDD3;background:#FFFFFF;color:#5C5249;font:inherit;font-size:13px;font-weight:600;cursor:pointer }
.st:hover { border-color:var(--state-border-hover);color:var(--state-text-hover) }
.st.on { background:#0F4C3A;border-color:#0F4C3A;color:#FFFFFF }
.st:focus-visible { outline:3px solid #EFB13A;outline-offset:2px }
.st-all { font-size:13px;font-weight:600;white-space:nowrap }
.hstage { position:relative }
.vsw { display:flex;gap:6px;align-items:center;padding-left:10px!important;border-left:1px solid #E3DDD3;border-right:0!important }
.vsw button { width:22px;height:22px;border-radius:50%;border:2px solid #E3DDD3;padding:0;cursor:pointer }
.vsw button[aria-pressed="true"] { border-color:#0F4C3A;box-shadow:inset 0 0 0 2px #FFFFFF }
.stabs { justify-content:center!important }
.stabs-l { justify-content:center }
.st-all { text-decoration:none;display:inline-flex;align-items:center;color:#0F4C3A!important;border-color:#0F4C3A!important }
.st-all:hover { background:#ECF3EC }
.vrow { display:flex;justify-content:center;align-items:center;gap:10px;flex-wrap:wrap }
#price.static .vrow { visibility:hidden }
.xpanel .stabs { position:absolute;left:0;right:0;top:14px;z-index:3;pointer-events:none }
.xpanel .stabs * { pointer-events:auto }
.xpanel .vrow { position:absolute;left:0;right:0;bottom:14px;z-index:3;pointer-events:none }
.xpanel .vrow>* { pointer-events:auto }
.xpanel .st { box-shadow:0 1px 4px rgba(35,27,21,.08) }
.xpanel .stabs { top:16px!important }
.stabs-l { gap:6px!important }
@media (min-width:960px) and (max-width:1179px) {
  .xpanel .st-all { display:none }
}
#price iframe.h3d[hidden] { display:none!important }
.xpanel .st { box-shadow:none!important }
.vsw button[hidden] { display:none }
.vhint.on { opacity:1;transform:translate(-50%,0) }
.vhint svg { width:16px;height:16px;flex:0 0 auto }
.vhint.on svg { animation:vhand 1.6s ease-in-out infinite }
@media (prefers-reduced-motion: reduce) {
  .vhint.on svg { animation:none }
}
@media (max-width:959px) {
  #price iframe.h3d { height:clamp(480px,74svh,600px)!important }
}
@media (max-width:560px) {
  .xpanel .stabs { top:12px!important }
  .xpanel .stabs-l { flex-wrap:nowrap!important;justify-content:flex-start!important;overflow-x:auto;scrollbar-width:none;padding:0 12px;scroll-padding:12px }
  .xpanel .stabs-l::-webkit-scrollbar { display:none }
  .xpanel .stabs-l .st { flex:0 0 auto }
}
@keyframes vhand { 0%, 100% { transform: translateX(-3px); } 50% { transform: translateX(3px); } }

/* ============================================================
   Control dock (post-launch CHANGES_SPEC 5): one 2 × 2 grid with shared columns, so every edge and the centre gap
   line up. Row 1: Flat · Open · Closed | finish dots + reset. Row 2: Price This Box | Design This Box.
   Cells are 40 px (44 px on touch), labels 14 px. The dock keeps the .vctl class, so the script's insets measure it.
   ============================================================ */
.xpanel .vrow { position:absolute; left:0; right:0; bottom:16px; z-index:3; display:flex; justify-content:center; padding:0 16px; pointer-events:none }
.vdock { box-sizing:border-box; display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:8px; width:min(520px, 100%); padding:8px; border:1px solid #E3DDD3; border-radius:16px; background:rgba(255,255,255,.92); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px); box-shadow:0 8px 24px -8px rgba(35,27,21,.16); pointer-events:auto }
.vstate { box-sizing:border-box; display:grid; grid-template-columns:repeat(3, 1fr); gap:2px; height:40px; padding:4px; border-radius:12px; background:#F4EADD }
.vstate button[data-s] { min-width:0; height:100%; padding:0 4px; border:0; border-radius:8px; background:transparent; color:#231B15; font:600 14px/1 "Public Sans",system-ui,sans-serif; white-space:nowrap; cursor:pointer; transition:background .15s, color .15s }
.vstate button[data-s]:hover { background:var(--state-fill-hover) }
.vstate button[data-s][aria-pressed="true"] { background:#0F4C3A; color:#FFFFFF }
.vtools { box-sizing:border-box; min-width:0; display:flex; align-items:center; justify-content:space-evenly; height:40px; padding:0 4px; border:1px solid #E3DDD3; border-radius:12px; background:#FFFFFF }
.vtools .vsw { display:flex; align-items:center; justify-content:space-evenly; flex:1 1 auto; height:100%; padding:0; border:0; background:none; box-shadow:none }
.vtools .vsw button { position:relative; width:32px; height:32px; padding:0; border:0; border-radius:50%; background-clip:content-box!important; cursor:pointer }
.vtools .vsw button::after { content:""; position:absolute; inset:5px; border-radius:50%; box-shadow:0 0 0 2px #FFFFFF, 0 0 0 3px #E3DDD3; pointer-events:none } /* 22 px dot, 2 px white ring, 1 px line outline */
.vtools .vsw button { padding:5px }
.vtools .vsw button[aria-pressed="true"]::after { box-shadow:0 0 0 2px #FFFFFF, 0 0 0 4px #0F4C3A }
.vtools .vsw button[data-k="kraft"] { background-color:#B07A4C!important }
.vtools .vsw button[data-k="white"] { background-color:#F2EFE8!important }
.vdiv { flex:none; width:1px; height:20px; background:#E3DDD3 }
.vreset { flex:none; display:inline-grid; place-items:center; width:32px; height:32px; margin:0 4px; border:0; border-radius:50%; background:transparent; color:#5C5249; cursor:pointer; transition:background .15s, color .15s }
.vreset:hover { background:var(--state-fill-hover); color:var(--state-text-hover) }
.vreset svg { width:16px; height:16px }
.vprice, .vdz { box-sizing:border-box; display:flex; align-items:center; justify-content:center; height:40px; padding:0 12px; border-radius:12px; font:600 14px/1 "Public Sans",system-ui,sans-serif; text-decoration:none; white-space:nowrap; transition:background .15s, border-color .15s }
.vprice { background:#EFB13A; color:#231B15!important; border:1.5px solid #EFB13A }
.vprice:hover { background:#D6962A; border-color:#D6962A }
.vdz { background:#FFFFFF; color:#0F4C3A!important; border:1.5px solid #0F4C3A }
.vdz:hover { background:var(--state-fill-hover) }
.vstate button:focus-visible, .vtools button:focus-visible, .vprice:focus-visible, .vdz:focus-visible { outline:3px solid #EFB13A; outline-offset:2px }
/* the first-visit hint sits 12 px above the dock, centred (16 + 106 + 12) */
.vhint { position:absolute; left:50%; bottom:134px; z-index:4; transform:translate(-50%,6px); display:inline-flex; align-items:center; gap:8px; height:32px; padding:0 14px 0 12px; border-radius:999px; background:rgba(35,27,21,.86); color:#FFFFFF; font:600 13px/1 "Public Sans",system-ui,sans-serif; white-space:nowrap; pointer-events:none; opacity:0; transition:opacity .35s, transform .35s }
@media (pointer:coarse) {
  .vstate, .vtools, .vprice, .vdz { height:44px }
  .vhint { bottom:142px }
}
@media (max-width:560px) {
  .xpanel .vrow { bottom:12px; padding:0 12px } /* matches the 12 px from the panel top to the tabs on phones */
  .vdock { width:100% }
  .vhint { bottom:138px } /* 12 + 114 + 12 */
}
@media (max-width:400px) { .vstate button[data-s] { font-size:13px } } /* only where 14 px would wrap */


/* Hero 3D loads on top of a poster: nothing half-finished ever paints (FIXES_1_SPEC 4) */
.hstage { position: relative; background: var(--pw-kraft-mist); }
.h3d-poster { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; transition: opacity 250ms ease-out; }
.hstage.is-live .h3d-poster { opacity: 0; }
#price iframe.h3d { position: relative; z-index: 1; opacity: 0; visibility: hidden; transition: opacity 250ms ease-out; }
#price iframe.h3d.is-ready { opacity: 1; visibility: visible; }
#price iframe.h3d.is-incoming { position: absolute; inset: 0; width: 100%; height: 100% !important; z-index: 2; } /* a box that is loading sits on top of the old one, invisible, until it is ready in the chosen colour */
.h3d-tap { position: absolute; z-index: 2; left: 50%; top: 50%; display: none; align-items: center; justify-content: center; min-height: 44px; padding: 0 24px; transform: translate(-50%, -50%); border: 1.5px solid var(--pw-forest); border-radius: 999px; background: var(--pw-white); font: 600 15px/20px var(--font-body); color: var(--pw-forest); cursor: pointer; }
.hstage--tap .h3d-tap { display: inline-flex; }
.h3d-tap:active { transform: translate(-50%, -50%) scale(.98); }
@media (prefers-reduced-motion: reduce) { .h3d-poster, #price iframe.h3d { transition: none; } }
