/* Zefmatic 3D Lab — presentation shell (P3a.2e)
 *
 * Loaded after the bundle's stylesheet, and scoped to [data-vs="2"] so the
 * flag-off Lab is byte-for-byte what it was. The canvas is never given a
 * radius, a card surface or the application's 1440px container: it owns the
 * viewport and the overlays sit above it.
 */

:root[data-vs="2"] {
  --lab-glass: color-mix(in srgb, var(--canvas, #070808) 72%, transparent);
  --lab-glass-strong: color-mix(in srgb, var(--canvas, #070808) 86%, transparent);
  --lab-dock: 320px;
}

/* ---- the canvas owns the viewport ------------------------------------- */
[data-vs="2"] #stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 0;
  max-width: none;
}

/* ---- top bar: translucent, never an opaque band across the world ------ */
[data-vs="2"] .topbar {
  background: linear-gradient(to bottom, var(--lab-glass), transparent);
  backdrop-filter: blur(10px);
  border-bottom: 0;
  padding: var(--space-4, 16px) var(--space-6, 24px);
  gap: var(--space-4, 16px);
}
[data-vs="2"] .topbar .brand small {
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--text-secondary, #a2a7a0);
}
[data-vs="2"] .topbar .meter span {
  font-size: 13px;
  color: var(--text-secondary, #a2a7a0);
}
[data-vs="2"] .icon-button {
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-control, 12px);
  border: 1px solid var(--border-subtle, rgba(255,255,255,.09));
  background: var(--lab-glass);
  color: var(--text-primary, #f5f6f0);
}
[data-vs="2"] .icon-button:focus-visible,
[data-vs="2"] .preset:focus-visible,
[data-vs="2"] .lab-use:focus-visible,
[data-vs="2"] .control-panel :focus-visible {
  outline: none;
  /* A ring that survives a bright scene as well as a dark one. */
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--signal, #d9ff43);
}

/* ---- scene information ------------------------------------------------ */
/* A gradient behind the text rather than a shadow alone, so the copy stays
   readable over the brightest world as well as the darkest. */
[data-vs="2"] .hud .title-block {
  position: relative;
  padding: var(--space-6, 24px);
  border-radius: var(--radius-card, 16px);
}
[data-vs="2"] .hud .title-block::before {
  content: "";
  position: absolute;
  inset: -8% -12% -20% -12%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 100% at 0% 0%,
    color-mix(in srgb, #000 82%, transparent), transparent 72%);
}
[data-vs="2"] .hud .title-block h1 {
  font-size: clamp(38px, 4.4vw, 64px);
  line-height: .98;
  letter-spacing: -.035em;
  text-wrap: balance;
}
[data-vs="2"] .hud .title-block p#presetDescription {
  max-width: 44ch;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary, #f5f6f0);
  opacity: .92;
}
[data-vs="2"] .hud .eyebrow { font-size: 11px; letter-spacing: .14em; }
[data-vs="2"] .hud .counter { font-size: 13px; }

/* ---- control dock ------------------------------------------------------ */
[data-vs="2"] .control-panel {
  width: var(--lab-dock);
  padding: var(--space-5, 20px);
  border: 1px solid var(--border-subtle, rgba(255,255,255,.09));
  border-radius: var(--radius-card, 16px);
  background: var(--lab-glass-strong);
  backdrop-filter: blur(18px);
  gap: var(--space-4, 16px);
}
[data-vs="2"] .control-panel label,
[data-vs="2"] .control-panel output,
[data-vs="2"] .control-panel select,
[data-vs="2"] .demo-note {
  font-size: 13px;
}
[data-vs="2"] .upload-button,
[data-vs="2"] .play-button,
[data-vs="2"] .caption-picker button,
[data-vs="2"] .control-panel select {
  min-height: 44px;
  border-radius: var(--radius-control, 12px);
}
[data-vs="2"] .caption-picker button { min-width: 44px; }
[data-vs="2"] .demo-note {
  color: var(--text-secondary, #a2a7a0);
  line-height: 1.5;
}

/* ---- use this style ---------------------------------------------------- */
[data-vs="2"] .lab-cta {
  display: grid;
  gap: var(--space-2, 8px);
  padding-top: var(--space-4, 16px);
  border-top: 1px solid var(--border-subtle, rgba(255,255,255,.09));
}
[data-vs="2"] .lab-use {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-4, 16px);
  border-radius: var(--radius-control, 12px);
  background: var(--signal, #d9ff43);
  color: var(--canvas, #070808);
  font: 750 13px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
/* Preview-only is visibly inert: no accent, no pointer, no destination. */
[data-vs="2"] .lab-use.is-disabled {
  background: transparent;
  border: 1px dashed var(--border-strong, rgba(255,255,255,.16));
  color: var(--text-tertiary, #747a74);
  cursor: not-allowed;
}
[data-vs="2"] .lab-cta-note {
  margin: 0;
  color: var(--text-secondary, #a2a7a0);
  font-size: 13px;
  line-height: 1.5;
}

/* ---- carousel ---------------------------------------------------------- */
/* Small enough to leave the world visible, with full names and a selected
   state that is a shape as well as a colour. */
[data-vs="2"] .preset-dock {
  gap: var(--space-2, 8px);
  padding: var(--space-3, 12px) var(--space-6, 24px) var(--space-6, 24px);
  overflow-x: auto;
  scrollbar-width: thin;
  background: linear-gradient(to top, var(--lab-glass), transparent);
}
[data-vs="2"] .preset {
  flex: 0 0 auto;
  min-height: 44px;
  padding: var(--space-2, 8px) var(--space-4, 16px);
  border: 1px solid var(--border-subtle, rgba(255,255,255,.09));
  border-radius: var(--radius-pill, 999px);
  background: var(--lab-glass-strong);
  color: var(--text-secondary, #a2a7a0);
  font-size: 13px;
  white-space: nowrap;
}
[data-vs="2"] .preset span { white-space: nowrap; overflow: visible; }
[data-vs="2"] .preset i { font-size: 11px; opacity: .7; font-style: normal; }
[data-vs="2"] .preset.active {
  border-color: var(--signal, #d9ff43);
  color: var(--text-primary, #f5f6f0);
}
[data-vs="2"] .preset.active::before {
  content: "\2022";
  margin-right: 6px;
  color: var(--signal, #d9ff43);
}
[data-vs="2"] .preset.is-preview-only::after {
  content: "preview";
  margin-left: 8px;
  font-size: 11px;
  color: var(--text-tertiary, #747a74);
}

/* ---- WebGL fallback ---------------------------------------------------- */
[data-vs="2"] .lab-fallback {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: var(--space-8, 32px);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(128,100,255,.10), transparent 60%),
    var(--canvas, #070808);
}
[data-vs="2"] .lab-fallback-inner {
  display: grid;
  gap: var(--space-3, 12px);
  justify-items: center;
  max-width: 720px;
  text-align: center;
}
[data-vs="2"] .lab-fallback-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border: 1px solid var(--border-subtle, rgba(255,255,255,.09));
  border-radius: var(--radius-card, 16px);
  background: #000;
}
[data-vs="2"] .lab-fallback-kicker {
  margin: 0;
  font: 800 11px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--warning, #ffbf4d);
}
[data-vs="2"] .lab-fallback-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 850;
  letter-spacing: -.03em;
}
[data-vs="2"] .lab-fallback-desc,
[data-vs="2"] .lab-fallback-note {
  margin: 0;
  max-width: 56ch;
  color: var(--text-secondary, #a2a7a0);
  font-size: 15px;
  line-height: 1.6;
}
/* The carousel and the dock stay above the fallback and stay usable. */
[data-vs="2"] .lab-no-webgl .preset-dock,
[data-vs="2"] .lab-no-webgl .topbar { z-index: 6; }

/* ---- reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  [data-vs="2"] .grain,
  [data-vs="2"] .vignette { animation: none !important; }
  [data-vs="2"] .meter i { transition: none !important; animation: none !important; }
  [data-vs="2"] .loader { animation: none !important; }
}
[data-vs="2"].lab-reduced-motion .meter i,
[data-vs="2"] .lab-reduced-motion .meter i { animation: none !important; transition: none !important; }

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 1000px) {
  /* The dock becomes a bottom sheet; the carousel sits above it so the two
     never overlap, and fullscreen stays reachable in the top bar. */
  [data-vs="2"] .control-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 46vh;
    overflow-y: auto;
    border-radius: var(--radius-hero, 24px) var(--radius-hero, 24px) 0 0;
    z-index: 7;
  }
  [data-vs="2"] .preset-dock {
    bottom: auto;
    top: auto;
    padding-bottom: 48vh;
  }
  [data-vs="2"] .hud .title-block h1 { font-size: clamp(30px, 8vw, 44px); }
  [data-vs="2"] .hud .title-block p#presetDescription { max-width: 36ch; }
}
@media (max-width: 430px) {
  [data-vs="2"] .topbar .meter { display: none; }
  [data-vs="2"] .hud .title-block { padding: var(--space-4, 16px); }
  [data-vs="2"] .control-panel { max-height: 52vh; }
}

/* ---- text floor -------------------------------------------------------- */
/* The bundle ships several 7-12px labels. Anything carrying meaning is
   raised to the 13px floor; only the two decorative eyebrows keep 11px. */
[data-vs="2"] .counter,
[data-vs="2"] .counter span,
[data-vs="2"] .meter span,
[data-vs="2"] .control-panel output,
[data-vs="2"] .control-panel label,
[data-vs="2"] .caption-picker button,
[data-vs="2"] .upload-button b,
[data-vs="2"] .demo-note,
[data-vs="2"] .toast,
[data-vs="2"] .loader p {
  font-size: 13px !important;
  letter-spacing: .04em;
}
[data-vs="2"] .eyebrow,
[data-vs="2"] .brand small,
[data-vs="2"] .preset i {
  font-size: 11px !important;
}

/* ---- narrow layout: the carousel sits ABOVE the bottom sheet ----------- */
@media (max-width: 1000px) {
  [data-vs="2"] .control-panel { max-height: 44vh; }
  /* Positioned clear of the sheet rather than merely padded, so the two
     cannot overlap however tall the sheet becomes. */
  [data-vs="2"] .preset-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 45vh;
    padding-bottom: var(--space-3, 12px);
    z-index: 6;
  }
}

/* The bundle sizes the carousel label on the inner span (8px), so styling
   .preset alone never reached it — the scene names were a third of the
   required size while still passing a truncation check. */
[data-vs="2"] .preset span {
  font-size: 13px !important;
  letter-spacing: .01em;
  text-transform: none;
}
[data-vs="2"] .upload-button span { font-size: 13px !important; }

/* The legacy footer banner sat over the carousel, hiding scene names 03-06,
   and it now duplicates what the dock states per scene: an exportable style
   says "Use this style", one that cannot says "Preview only". The brand mark
   in the top bar already links back to the studio. */
[data-vs="2"] .lab-legacy-banner { display: none !important; }
