/* X growth deck: shared scene styles. Tokens come from /assets/tokens.css, runtime from /deck/deck.css,
 * X interface pieces from xui.css. Chapter styles live in ch-*.css and prefix every selector with their own class.
 * Layout classes (FORMAT section 7): desktop = at least 960 x 600; compact = landscape below that, down to 640 x 360
 * (rules under @media (max-width: 959px), (max-height: 599px)); phone = portrait and narrower than 760
 * (@media (max-width: 759px) and (orientation: portrait)). The engine also sets .deck[data-layout]. */

/* ---------- extra worlds ---------- */
.theme-xlight { --s-bg: #F2F4F5; --s-fg: #0F1419; --s-muted: #536471; --s-line: #DFE5E8; --s-accent: #1D9BF0; background: radial-gradient(120% 90% at 70% 40%, #FFFFFF 0%, #F2F4F5 62%, #E9EDEF 100%), #F2F4F5; color: var(--s-fg); }
.theme-xdark { --s-bg: #000; --s-fg: #E7E9EA; --s-muted: #8B9096; --s-line: #2F3336; --s-accent: #1D9BF0; background: radial-gradient(110% 90% at 70% 40%, #0B0D10 0%, #000 70%), #000; color: var(--s-fg); }
.theme-claude { --s-bg: #F5F4EE; --s-fg: #1f1e1d; --s-muted: #6b6a66; --s-line: #E3E0D6; --s-accent: #D97757; background: var(--s-bg); color: var(--s-fg); }
.deck[data-theme="xlight"], .deck[data-theme="claude"] { --hud-fg: #111; }
.deck[data-theme="xdark"] { --hud-fg: #fff; }
.deck[data-theme="xdark"] .nav__btn--next { background: #fff; color: #000; border-color: #fff; }
.theme-paper, .theme-white { --s-muted: var(--ink-2, #555); }
.theme-night .xg-src, .theme-xdark .xg-src, .theme-ryze .xg-src { opacity: .9; }

/* ---------- the reserved HUD zones: content padding follows the engine's --hud-top / --hud-bottom ---------- */
.scene .scene__inner.xg { padding: calc(var(--hud-top, 64px) + clamp(8px, 2.2vh, 28px)) clamp(24px, 6vw, 112px) calc(var(--hud-bottom, 100px) + clamp(4px, 1.4vh, 18px)); }

/* ---------- layout: every scene is built with shell() ---------- */
.scene .xg { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; row-gap: clamp(14px, 2.8vh, 34px); align-items: start; }
.xg-t { grid-column: 1 / -1; grid-row: 1; max-width: min(100%, 23em); font-size: clamp(28px, 3.05vw, 50px); line-height: 1.08; letter-spacing: -.028em; font-weight: 500; color: var(--s-fg); text-wrap: balance; position: relative; z-index: 2; }
.xg-vis { position: relative; min-width: 0; min-height: 0; }
.xg-side { position: relative; z-index: 2; display: grid; gap: 16px; align-content: start; min-width: 0; }

/* split: side text left, visual right */
.scene .xg--split { grid-template-columns: minmax(0, .36fr) minmax(0, .64fr); grid-template-rows: auto minmax(0, 1fr); column-gap: clamp(28px, 4.5vw, 80px); }
.xg--split .xg-side { grid-column: 1; grid-row: 2; align-self: center; max-width: 25em; }
.xg--split .xg-vis { grid-column: 2; grid-row: 2; align-self: stretch; height: 100%; }

/* stage: visual full width under the title, side text in one row under it */
.xg--stage .xg-vis { grid-row: 2; align-self: stretch; height: 100%; }
.xg--stage .xg-side { grid-row: 3; grid-auto-flow: column; grid-auto-columns: minmax(0, max-content); gap: clamp(20px, 3vw, 48px); align-items: start; max-width: calc(100% - 280px); }

/* full and right: the visual is a full-bleed layer behind the grid (3D worlds) */
.scene > .xg-vis { position: absolute; inset: 0; z-index: 0; }
.scene .xg--full, .scene .xg--right { pointer-events: none; z-index: 1; }
.xg--full > *, .xg--right > * { pointer-events: auto; }
.xg--full .xg-t, .xg--right .xg-t { max-width: min(100%, 19em); }
/* bottom-left side text ends before the nav cluster at the bottom right (about 260 px wide) */
.xg--full .xg-side { grid-row: 3; max-width: min(27em, calc(100% - 290px)); }
.scene .xg--right { grid-template-columns: minmax(0, 1fr) minmax(0, 24em); }
.xg--right .xg-t { grid-column: 1 / -1; }
.xg--right .xg-side { grid-column: 2; grid-row: 2 / 4; align-self: center; }

/* scrims inside a 3D host (scrimIn) and on the layer (class xg-scrimmed on the scene) */
.xg-scrim { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.xg-scrim--top { background: linear-gradient(180deg, color-mix(in srgb, var(--s-bg) 86%, transparent) 0, color-mix(in srgb, var(--s-bg) 40%, transparent) 22%, transparent 36%); }
.xg-scrim--bottom { background: linear-gradient(0deg, color-mix(in srgb, var(--s-bg) 86%, transparent) 0, color-mix(in srgb, var(--s-bg) 30%, transparent) 26%, transparent 40%); }
.xg-scrim--top.xg-scrim--bottom { background: linear-gradient(180deg, color-mix(in srgb, var(--s-bg) 86%, transparent) 0, transparent 34%), linear-gradient(0deg, color-mix(in srgb, var(--s-bg) 86%, transparent) 0, transparent 36%); }
.xg-scrim--right { background: linear-gradient(270deg, color-mix(in srgb, var(--s-bg) 88%, transparent) 0, color-mix(in srgb, var(--s-bg) 40%, transparent) 30%, transparent 46%); }
.xg-scrim--left { background: linear-gradient(90deg, color-mix(in srgb, var(--s-bg) 88%, transparent) 0, color-mix(in srgb, var(--s-bg) 40%, transparent) 30%, transparent 46%); }

/* a DOM label pinned to a 3D point (place() positions it); keep it readable on any 3D background */
.xg-label { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; white-space: nowrap; font-size: 15px; font-weight: 500; line-height: 1.25; will-change: transform; color: var(--s-fg); text-shadow: 0 1px 12px rgb(0 0 0 / .65); }
.theme-paper .xg-label, .theme-xlight .xg-label { text-shadow: 0 1px 10px rgb(255 255 255 / .9); }
.xg-label--chip { padding: 5px 10px; border-radius: 4px; background: color-mix(in srgb, var(--s-bg) 72%, transparent); backdrop-filter: blur(6px); box-shadow: inset 0 0 0 1px var(--s-line); text-shadow: none; }

/* an orange annotation bracket for product mocks: <div class="xg-ann" style="--side:right">text</div> */
.xg-ann { position: absolute; z-index: 4; display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; line-height: 1.25; color: var(--s-fg); white-space: nowrap; pointer-events: none; }
.xg-ann::before { content: ""; flex: none; width: 10px; height: var(--ah, 28px); border: 2px solid var(--cta); border-right: 0; border-radius: 4px 0 0 4px; }
.xg-ann--left { flex-direction: row-reverse; }
.xg-ann--left::before { border: 2px solid var(--cta); border-left: 0; border-radius: 0 4px 4px 0; }
.xg-ann--rose::before { border-color: var(--c-rose-d); }

/* ---------- copy blocks ---------- */
.scene .xg-note { font-size: clamp(16px, 1.32vw, 21px); line-height: 1.5; color: var(--s-muted); max-width: 30em; }
.xg-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.xg-steps li { position: relative; padding-left: 22px; font-size: clamp(16px, 1.3vw, 20px); line-height: 1.4; color: var(--s-fg); }
.xg-steps li::before { content: ""; position: absolute; left: 2px; top: .52em; width: 8px; height: 8px; border-radius: 50%; background: var(--cta); }
.scene .xg-pit { display: flex; gap: 10px; align-items: flex-start; font-size: clamp(15px, 1.2vw, 18px); line-height: 1.45; color: var(--c-rose-t); max-width: 30em; }
.xg-pit__i { flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-top: -1px; border-radius: 4px; background: color-mix(in srgb, var(--c-rose) 45%, transparent); color: var(--c-rose-t); }
.theme-ink .xg-pit, .theme-night .xg-pit { color: var(--c-rose); }
.theme-ink .xg-pit__i, .theme-night .xg-pit__i { background: rgb(225 181 168 / .16); color: var(--c-rose); }
.xg-src { display: inline-block; font-size: 14px; line-height: 1.4; font-weight: 500; color: var(--s-muted); opacity: .82; }
.xg-src--line { display: block; margin-top: 4px; }
.xg-stat { display: grid; gap: 4px; align-content: start; }
.xg-stat__v { font-size: clamp(38px, 4.6vw, 80px); line-height: 1; letter-spacing: -.035em; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--s-fg); }
.xg-stat--sm .xg-stat__v { font-size: clamp(28px, 2.8vw, 46px); }
.xg-stat--xl .xg-stat__v { font-size: clamp(56px, 8vw, 140px); }
.xg-stat--orange .xg-stat__v { color: var(--cta); }
.xg-stat--rose .xg-stat__v { color: var(--c-rose-t); }
.theme-ink .xg-stat--rose .xg-stat__v, .theme-night .xg-stat--rose .xg-stat__v { color: var(--c-rose); }
.xg-stat__l { font-size: clamp(14px, 1.1vw, 17px); line-height: 1.4; color: var(--s-fg); max-width: 26em; }
.xg-tag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 4px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.xg-tag--line { box-shadow: inset 0 0 0 1px var(--s-line); color: var(--s-fg); }
.xg-tag--orange { background: var(--cta); color: #fff; }
.xg-tag--rose { background: var(--c-rose); color: var(--c-rose-t); }
.xg-tag--aqua { background: var(--c-aqua); color: var(--c-aqua-t); }
.xg-tag--ink { background: #111; color: #fff; }

/* ---------- surfaces ---------- */
.xg-card { position: relative; background: #fff; border-radius: 8px; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ll-line), 0 1px 2px rgba(17,17,17,.04), 0 8px 22px -14px rgba(17,17,17,.12); }
.xg-dark { position: relative; background: #111; color: #fff; border-radius: 8px; box-shadow: 0 18px 40px -26px rgba(28,106,96,.4); }
/* the accent stroke: a gradient ring that starts orange top-left and melts (hero objects only) */
.xg-stroke::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none; background: var(--accent-stroke);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }
.xg-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene canvas { display: block; }
.xg-label { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; white-space: nowrap; font-size: 14px; font-weight: 500; line-height: 1.2; will-change: transform; }

/* halftone bars: --v from 0 to 1 */
.xg-ht { position: relative; height: 18px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--s-line); overflow: hidden; --dot: #A9A6A0; }
.xg-ht i { position: absolute; left: 3px; top: 3px; bottom: 3px; width: calc(100% - 6px); background: radial-gradient(circle, var(--dot) 1.5px, transparent 1.9px) 0 0 / 5px 5px; clip-path: inset(0 calc((1 - var(--v, 0)) * 100%) 0 0); transition: clip-path 1.2s var(--ease); }
.xg-ht--v { width: 22px; height: auto; }
.xg-ht--v i { left: 3px; right: 3px; top: 3px; bottom: 3px; width: auto; clip-path: inset(calc((1 - var(--v, 0)) * 100%) 0 0 0); }
.xg-ht--orange { --dot: var(--cta); }
.xg-ht--rose { --dot: var(--c-rose-d); }
.xg-ht--aqua { --dot: var(--c-aqua-d); }
.xg-ht--lilac { --dot: #A996D8; }
.xg-ht--grey { --dot: #A9A6A0; }
.theme-ink .xg-ht--grey, .theme-night .xg-ht--grey { --dot: rgb(255 255 255 / .42); }

/* departure board */
.flap { display: inline-flex; gap: 2px; font: 600 clamp(16px, 1.6vw, 24px)/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.flap__c { position: relative; display: inline-block; width: .8em; height: 1.32em; overflow: hidden; background: #0a0a0b; color: #fff; border-radius: 2px; text-align: center; box-shadow: inset 0 -1px 0 rgb(255 255 255 / .05); }
.flap__c::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgb(0 0 0 / .7); }
.flap__s { display: flex; flex-direction: column; transition: transform 1.3s cubic-bezier(.2, .8, .2, 1); }
.flap__s span { display: block; height: 1.32em; line-height: 1.32em; }

/* typing caret */
.xg-typing::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -0.12em; background: currentColor; animation: rz-blink 1s steps(1) infinite; }

/* sliders */
.scene input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; --trk: rgb(0 0 0 / .16); }
.theme-ink input[type="range"], .theme-night input[type="range"] { --trk: rgb(255 255 255 / .3); }
.scene input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--trk); }
.scene input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--trk); }
.scene input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--cta), 0 4px 10px rgb(0 0 0 / .25); }
.scene input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--cta), 0 4px 10px rgb(0 0 0 / .25); }
.scene input[type="range"]:focus-visible { outline: 2px solid var(--cta); outline-offset: 4px; border-radius: 4px; }

.scene [data-show]:not(.is-on), .scene [data-hide]:not(.is-on) { pointer-events: none; }


/* ---------- compact: landscape below 960 x 600 (titles 24 px, body 15 px, nothing below 14 px) ---------- */
@media (max-width: 959px), (max-height: 599px) {
  .scene .scene__inner.xg { padding-left: clamp(20px, 4vw, 48px); padding-right: clamp(20px, 4vw, 48px); padding-top: calc(var(--hud-top, 52px) + 6px); padding-bottom: calc(var(--hud-bottom, 80px) + 4px); }
  .scene .xg { row-gap: 12px; }
  .xg-t { font-size: clamp(24px, 3.3vw, 32px); line-height: 1.12; letter-spacing: -.022em; }
  .scene .xg--split { column-gap: 28px; }
  .xg-side { gap: 10px; }
  .scene .xg-note { font-size: 15px; line-height: 1.42; }
  .xg-steps { gap: 8px; }
  .xg-steps li { font-size: 15px; }
  .scene .xg-pit { font-size: 14px; }
  .xg-stat__v { font-size: clamp(30px, 4.4vw, 48px); }
  .xg-stat__l { font-size: 14px; }
  .xg-label, .xg-ann { font-size: 14px; }
  .xg--full .xg-side { max-width: min(24em, calc(100% - 250px)); }
  .xg--stage .xg-side { max-width: calc(100% - 250px); }
}
@media (max-height: 439px) {
  .xg-t { font-size: 24px; }
  .scene .xg-note { font-size: 14px; }
}

/* ---------- phone: portrait and narrower than 760 ---------- */
@media (max-width: 759px) and (orientation: portrait) {
  .scene .scene__inner.xg { padding: calc(var(--hud-top, 56px) + 8px) 16px calc(var(--hud-bottom, 96px) + 6px); }
  .xg-t { font-size: clamp(22px, 6.4vw, 28px); line-height: 1.15; letter-spacing: -.02em; max-width: 100%; }
  .scene .xg--split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; row-gap: 14px; }
  .xg--split .xg-vis { grid-column: 1; grid-row: 2; }
  .xg--split .xg-side { grid-column: 1; grid-row: 3; align-self: end; max-width: none; }
  .xg--stage .xg-side { grid-auto-flow: row; gap: 10px; max-width: none; }
  .scene .xg--right { grid-template-columns: minmax(0, 1fr); }
  .xg--right .xg-side { grid-column: 1; grid-row: 3; align-self: end; }
  .xg--full .xg-side, .xg--right .xg-side { max-width: none; }
  .xg-side { gap: 10px; }
  .scene .xg-note { font-size: 15px; }
  .xg-steps { gap: 8px; }
  .xg-steps li { font-size: 15px; padding-left: 18px; }
  .xg-steps li::before { width: 7px; height: 7px; }
  .scene .xg-pit { font-size: 14px; }
  .xg-pit__i { width: 22px; height: 22px; }
  .xg-src { font-size: 14px; }
  .xg-stat__l { font-size: 14px; }
  .flap { font-size: 14px; }
  .xg-label, .xg-ann { font-size: 14px; }
}

/* an inactive scene shows nothing: some "is-on" rules (here and in /deck/ryze.css) set visibility: visible, which would
 * otherwise beat the engine's .scene { visibility: hidden } and leave their text over other slides */
.scene:not(.is-active), .scene:not(.is-active) * { visibility: hidden !important; }
/* a delayed visibility transition would otherwise keep fading text visible for up to 0.8 s after the scene has left */
.scene:not(.is-active) * { transition: none !important; }

/* no one-word last lines in body copy */
.scene .xg-note, .scene .xg-pit, .scene .xg-stat__l { text-wrap: pretty; }

/* ---------- round 5 (owner): the supporting text sits directly under the title on every slide ----------
 * Reading order in every layout class: title, explaining sentence and notes, source line, then the visual. */
.scene .xg { grid-template-rows: auto auto minmax(0, 1fr); }
.xg-side { align-self: start; }
.scene .xg--split { grid-template-rows: auto minmax(0, 1fr); }
.xg--split .xg-side { grid-row: 2; align-self: start; padding-top: 2px; }
.xg--stage .xg-side { grid-row: 2; }
.xg--stage .xg-vis { grid-row: 3; }
.xg--full .xg-side { grid-row: 2; align-self: start; max-width: min(34em, 100%); }
.scene .xg--right { grid-template-columns: minmax(0, 1fr); }
.xg--right .xg-side { grid-column: 1; grid-row: 2; align-self: start; max-width: min(34em, 100%); }
.scene .xg--full, .scene .xg--right { row-gap: clamp(10px, 1.8vh, 20px); }
@media (max-width: 759px) and (orientation: portrait) {
  .scene .xg--split { grid-template-rows: auto auto minmax(0, 1fr); }
  .xg--split .xg-side { grid-row: 2; align-self: start; }
  .xg--split .xg-vis { grid-row: 3; }
  .xg--right .xg-side, .xg--full .xg-side { grid-row: 2; align-self: start; }
}
/* chapter styles stacked their beat layers from the bottom up and centred some side columns: in round 5 they all start
 * at the top, right under the title */
.scene .xg-side { align-self: start !important; }
.scene .xg-side .xa-stack__i, .scene .xg-side .xo-stack, .scene .xg-side .xo-swap, .scene .xg-side .xb-layer, .scene .xg-side .xc-layer { align-content: start !important; }

/* round 5, compact frames (landscape below 960 x 600): a thin 3D strip under the text would be unreadable, so on 3D slides
 * with supporting text, title and text form a left column and the 3D layer takes the right part of the frame */
@media (max-width: 959px), (max-height: 599px) {
  @media not all and (max-width: 759px) and (orientation: portrait) {
    .scene.xg-scene--full:has(> .scene__inner > .xg-side > *) > .xg-vis, .scene.xg-scene--right:has(> .scene__inner > .xg-side > *) > .xg-vis { left: 46%; top: var(--hud-top, 56px); bottom: var(--hud-bottom, 80px); }
    .scene .xg--full:has(> .xg-side > *), .scene .xg--right:has(> .xg-side > *) { grid-template-columns: minmax(0, .4fr) minmax(0, .6fr) !important; }
    .scene .xg--full:has(> .xg-side > *) > .xg-t, .scene .xg--right:has(> .xg-side > *) > .xg-t { grid-column: 1 !important; max-width: 100% !important; font-size: clamp(24px, 3vw, 28px); }
    .scene .xg--full > .xg-side, .scene .xg--right > .xg-side { grid-column: 1 !important; grid-row: 2 !important; max-width: 100% !important; }
    /* the text no longer sits over the 3D, so the 3D layer needs no scrims here */
    .scene.xg-scene--full:has(> .scene__inner > .xg-side > *) > .xg-vis > [class*='scrim'], .scene.xg-scene--right:has(> .scene__inner > .xg-side > *) > .xg-vis > [class*='scrim'] { display: none !important; }
  }
}
.scene .xg-side .xa-stack > *, .scene .xg-side .xo-swap > * { align-self: start !important; }
