/* Packaging concepts (js/studio-row.js, js/studio.js).
   Two parts: the slide in the swipe row (a transparent 3D box on the page's black, with a pink View CAD button),
   and the viewer that opens behind that button. Uses the site's own colours and fonts; every value has a fallback. */

/* ============ the row: same slider as the other Physical Design rows ============ */
[data-packs="concepts"] .swipe-track { --slide: 620px; }
[data-packs="concepts"] .swipe-slide { min-width: 0; }
[data-packs="concepts"] .pack3d { max-width: 100%; min-width: 0; align-self: center; }
[data-packs="concepts"] .p3d-open { font-variant: small-caps; letter-spacing: .02em; }

/* the picture shows at once and while the 3D wakes up; the live 3D then takes its place. No panel, no border: just the box on black. */
.concept-stage { cursor: grab; }
.concept-poster { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - 72px); object-fit: contain; display: block; pointer-events: none; transition: opacity .4s ease; }
.concept-stage.is-live .concept-poster { opacity: 0; }
.concept-tag { position: absolute; top: 2px; left: 0; right: 0; margin: 0; text-align: center; pointer-events: none; font: 600 .7rem/1 var(--text, "Figtree", system-ui, sans-serif); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2, #d8cfe1); opacity: .85; }

.studio-embed-host.studio { position: absolute; inset: 0 0 72px 0; width: auto; max-width: none; margin: 0; display: block; gap: 0; }
.studio-embed .studio-tabs, .studio-embed .studio-bar, .studio-embed .studio-info, .studio-embed .studio-hint, .studio-embed .studio-loading, .studio-embed .studio-flat { display: none; }
.studio-embed .studio-view { position: absolute; inset: 0; display: block; }
.studio-embed .studio-stage { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; background: none; overflow: visible; }
.studio-embed .studio-canvas { opacity: 0; transition: opacity .4s ease; cursor: grab; }
.concept-stage.is-live .studio-embed .studio-canvas { opacity: 1; }
.concept-stage.is-grabbing .studio-embed .studio-canvas { cursor: grabbing; }

/* ============ the viewer ============ */
.studio { --st-ink: var(--ink, #fff7ef); --st-ink2: var(--ink-2, #d8cfe1); --st-line: rgba(255, 247, 239, .16); --st-card: var(--ground-2, #17131f); --st-card2: var(--ground-3, #221c2d); --st-accent: var(--accent, #ff4fa3);
  width: min(100%, 960px); margin-inline: auto; display: grid; gap: 18px; color: var(--st-ink); font-family: var(--text, "Figtree", system-ui, sans-serif); text-align: left; }
.studio, .studio *, .studio *::before, .studio *::after { box-sizing: border-box; }
.studio button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.studio button:focus-visible, .studio input:focus-visible { outline: 3px solid var(--st-accent); outline-offset: 2px; }

.studio-modal .studio-in-modal { display: contents; } /* its view and its notes become the sheet's own columns */
.studio-modal .studio-tabs, .studio-modal .studio-info .studio-kick, .studio-modal .studio-info h3 { display: none; }
.studio-view { display: grid; gap: 14px; justify-items: center; min-width: 0; }
.studio-modal .studio-view { margin: 8px 12px 0; }
.studio-stage { position: relative; width: 100%; height: min(56vh, 480px); border-radius: 18px; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 50% 35%, #2b2338, var(--ground-3, #221c2d) 55%, var(--ground, #0b0a0f) 100%); }
.studio-stage .studio-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.studio-stage .studio-canvas:active { cursor: grabbing; }
.studio-stage .studio-canvas[hidden], .studio-stage .studio-flat[hidden] { display: none; }
.studio-stage .studio-flat { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: clamp(8px, 2.4vw, 18px); display: block; }
.studio-loading { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: var(--st-ink); text-shadow: 0 1px 8px rgba(0, 0, 0, .5); pointer-events: none; z-index: 2; }
.studio-loading[hidden] { display: none; }
.studio-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(11, 10, 15, .72); color: var(--st-ink); font-size: 13px; font-weight: 600; white-space: nowrap; pointer-events: none; transition: opacity .4s; z-index: 2; }
.studio-hint.is-gone, .studio-stage[data-flat="1"] .studio-hint, .studio-stage:not([data-mode="3d"]) .studio-hint { opacity: 0; }

/* controls: a segmented view switch, then the fold slider, both centred */
.studio-bar { width: 100%; display: grid; gap: 12px; justify-items: center; }
.studio-modes { display: inline-grid; grid-template-columns: repeat(4, auto); max-width: 100%; padding: 4px; border-radius: 999px; background: var(--st-card); }
.studio-modes button { min-height: 44px; padding: 0 clamp(10px, 2.6vw, 20px); border: 0; border-radius: 999px; background: transparent; font-size: clamp(12.5px, 3.3vw, 15px); font-weight: 700; white-space: nowrap; transition: background .2s, color .2s; }
.studio-modes button[aria-pressed="true"] { background: var(--st-accent); color: var(--ink-dark, #1a0f1f); }
.studio-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.studio-items[hidden] { display: none; }
.studio-items button { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--st-accent); background: transparent; font-size: clamp(13px, 3.4vw, 15px); font-weight: 700; transition: background .2s, color .2s; }
@media (hover: hover) { .studio-items button:hover { background: var(--st-card2); } }
.studio-fold { width: min(100%, 560px); display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; color: var(--st-ink2); min-height: 48px; }
.studio .studio-play { min-width: 88px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--st-accent); color: var(--ink-dark, #1a0f1f); font-weight: 800; font-size: 15px; }
.studio-fold input[type="range"] { width: 100%; min-width: 0; height: 44px; margin: 0; background: transparent; accent-color: var(--st-accent); cursor: pointer; touch-action: pan-y; }

/* the notes beside it: story, spec, brand, and the four steps */
.studio-info { display: grid; gap: 18px; min-width: 0; padding: 20px 24px 26px; }
.studio-head { display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr); gap: clamp(14px, 3vw, 22px); align-items: center; }
.studio-logo { border-radius: 16px; padding: 12px; aspect-ratio: 5 / 3; display: grid; place-items: center; overflow: hidden; }
.studio-logo svg { width: 100%; height: 100%; display: block; }
.studio-tag { margin: 0; font-size: clamp(16px, 3.6vw, 19px); color: var(--st-ink); font-weight: 600; }
.studio-story { margin: 0; max-width: 62ch; font-size: 15.5px; line-height: 1.55; color: var(--st-ink2); }
.studio-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.studio-cols > div { min-width: 0; }
.studio-info h4, .studio-flow h4 { margin: 0 0 10px; font-family: var(--display, "Fredoka", system-ui, sans-serif); font-size: 1.2rem; font-weight: 600; }
.studio-spec { margin: 0; display: block; }
.studio-spec dt { margin: 12px 0 0; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--st-accent); }
.studio-spec dt:first-child { margin-top: 0; }
.studio-spec dd { margin: 3px 0 0; font-size: 14.5px; line-height: 1.45; color: var(--st-ink); }
.studio-sw { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.studio-sw li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border-radius: 999px; background: var(--st-card2); font-size: 12.5px; color: var(--st-ink2); }
.studio-sw i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .3); flex: none; }
.studio-sw b { color: var(--st-ink); font-weight: 700; }

/* "From sketch to factory floor": four short steps */
.studio-flow { display: grid; gap: 2px; }
.studio-flow ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: step; }
.studio-flow li { counter-increment: step; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; align-items: start; }
.studio-flow li::before { content: counter(step); grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--st-accent); color: var(--ink-dark, #1a0f1f); font-weight: 800; font-size: 14px; }
.studio-flow li b { font-family: var(--display, "Fredoka", system-ui, sans-serif); font-size: 1.02rem; font-weight: 600; }
.studio-flow li span { font-size: 14px; line-height: 1.45; color: var(--st-ink2); }
.studio-note { margin: 12px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--st-ink2); }
.studio-fail { margin: 0; padding: 28px; text-align: center; color: var(--ink-2, #d8cfe1); font-size: 15px; }

@media (min-width: 900px) {
  .studio-modal .studio-view { margin: 8px 0 20px 20px; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
  .studio-modal .studio-stage { height: 100%; min-height: 0; }
  .studio-info { overflow: auto; overscroll-behavior: contain; padding-top: 8px; min-height: 0; }
}
@media (max-width: 560px) {
  .studio-head { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .studio-logo { width: min(100%, 220px); }
  .studio-info { padding: 18px 18px 24px; }
  .studio-modes { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 26px; }
  .studio-modes button { padding: 0 8px; }
  .studio-fold { grid-template-columns: auto minmax(0, 1fr); row-gap: 0; }
  .studio-fold > span { display: none; }
  .studio-fold input[type="range"] { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { .studio *, .concept-poster { transition: none !important; } }
/* the real mouse comes back inside the viewer (the site swaps it for a watering can) */
html.can-on .studio-modal .studio-canvas { cursor: grab !important; }
html.can-on .studio-modal .studio-canvas:active { cursor: grabbing !important; }
