/* Meta ads deck: shared scene styles. Tokens come from /assets/tokens.css, runtime from /deck/deck.css.
 * Chapter styles live in ch-*.css and must prefix every selector with their own class prefix. */

/* ---------- extra worlds ---------- */
.theme-adsm { --s-bg: #F0F2F5; --s-fg: #1c1e21; --s-muted: #606770; --s-line: #DADDE1; --s-accent: #0866FF; background: var(--s-bg); 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="adsm"], .deck[data-theme="claude"] { --hud-fg: #111; }
.theme-paper, .theme-white { --s-muted: var(--ink-2, #555); }

/* ---------- layout: every scene is built with shell() ---------- */
.scene .mx { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; row-gap: clamp(16px, 3vh, 36px); align-items: start; }
.mx-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; }
.mx-vis { position: relative; min-width: 0; min-height: 0; }
.mx-side { position: relative; z-index: 2; display: grid; gap: 18px; align-content: start; min-width: 0; }

/* split: side text left, visual right */
.scene .mx--split { grid-template-columns: minmax(0, .36fr) minmax(0, .64fr); grid-template-rows: auto minmax(0, 1fr); column-gap: clamp(28px, 4.5vw, 80px); }
.mx--split .mx-side { grid-column: 1; grid-row: 2; align-self: center; max-width: 25em; }
.mx--split .mx-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 */
.mx--stage .mx-vis { grid-row: 2; align-self: stretch; height: 100%; }
.mx--stage .mx-side { grid-row: 3; grid-auto-flow: column; grid-auto-columns: minmax(0, max-content); gap: clamp(20px, 3vw, 48px); align-items: start; }

/* full and right: the visual is a full-bleed layer behind the text (3D worlds) */
.scene > .mx-vis { position: absolute; inset: 0; z-index: 0; }
.scene .mx--full, .scene .mx--right { pointer-events: none; z-index: 1; }
.mx--full > *, .mx--right > * { pointer-events: auto; }
.mx--full .mx-t, .mx--right .mx-t { max-width: min(100%, 19em); }
.mx--full .mx-side { grid-row: 3; max-width: 27em; }
.scene .mx--right { grid-template-columns: minmax(0, 1fr) minmax(0, 25em); }
.mx--right .mx-t { grid-column: 1 / -1; }
.mx--right .mx-side { grid-column: 2; grid-row: 2 / 4; align-self: center; }

/* soft scrims so text stays readable over 3D (add the class to the scene layer) */
.mx-scrim::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--s-bg) 82%, transparent) 0, transparent 34%), linear-gradient(0deg, color-mix(in srgb, var(--s-bg) 78%, transparent) 0, transparent 32%); }

/* ---------- copy blocks ---------- */
.scene .mx-note { font-size: clamp(16px, 1.32vw, 21px); line-height: 1.5; color: var(--s-muted); max-width: 30em; }
.mx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mx-steps li { position: relative; padding-left: 22px; font-size: clamp(16px, 1.3vw, 20px); line-height: 1.4; color: var(--s-fg); }
.mx-steps li::before { content: ""; position: absolute; left: 2px; top: .52em; width: 8px; height: 8px; border-radius: 50%; background: var(--cta); }
.scene .mx-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; }
.mx-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 .mx-pit, .theme-night .mx-pit { color: var(--c-rose); }
.theme-ink .mx-pit__i, .theme-night .mx-pit__i { background: rgb(225 181 168 / .16); color: var(--c-rose); }
.mx-src { display: inline-block; font-size: 14px; line-height: 1.4; font-weight: 500; color: var(--s-muted); opacity: .82; }
.mx-src--line { display: block; margin-top: 4px; }
.mx-stat { display: grid; gap: 4px; align-content: start; }
.mx-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); }
.mx-stat--sm .mx-stat__v { font-size: clamp(28px, 2.8vw, 46px); }
.mx-stat--xl .mx-stat__v { font-size: clamp(56px, 8vw, 140px); }
.mx-stat--orange .mx-stat__v { color: var(--cta); }
.mx-stat--rose .mx-stat__v { color: var(--c-rose-t); }
.theme-ink .mx-stat--rose .mx-stat__v, .theme-night .mx-stat--rose .mx-stat__v { color: var(--c-rose); }
.mx-stat__l { font-size: clamp(14px, 1.1vw, 17px); line-height: 1.4; color: var(--s-fg); max-width: 26em; }
.mx-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; }
.mx-tag--line { box-shadow: inset 0 0 0 1px var(--s-line); color: var(--s-fg); }
.mx-tag--orange { background: var(--cta); color: #fff; }
.mx-tag--rose { background: var(--c-rose); color: var(--c-rose-t); }
.mx-tag--aqua { background: var(--c-aqua); color: var(--c-aqua-t); }
.mx-tag--ink { background: #111; color: #fff; }

/* ---------- surfaces ---------- */
.mx-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); }
.mx-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) */
.mx-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; }
.mx-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene canvas { display: block; }
.mx-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 */
.mx-ht { position: relative; height: 18px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--s-line); overflow: hidden; --dot: #A9A6A0; }
.mx-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); }
.mx-ht--v { width: 22px; height: auto; }
.mx-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); }
.mx-ht--orange { --dot: var(--cta); }
.mx-ht--rose { --dot: var(--c-rose-d); }
.mx-ht--aqua { --dot: var(--c-aqua-d); }
.mx-ht--lilac { --dot: #A996D8; }
.mx-ht--grey { --dot: #A9A6A0; }
.theme-ink .mx-ht--grey, .theme-night .mx-ht--grey { --dot: rgb(255 255 255 / .42); }

/* departure board */
.flap { display: inline-flex; gap: 2px; font: 500 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; }

/* a blank Meta-style feed ad (adCard) */
.mx-ad { background: #fff; border-radius: 8px; overflow: hidden; color: #1c1e21; font: 13px/1.4 var(--font-sans); box-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 30px 60px -28px rgb(0 0 0 / .35); }
.mx-ad__top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.mx-ad__av { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #111; }
.mx-ad__who { display: grid; gap: 5px; flex: 1; }
.mx-ad__t { padding: 0 12px 10px; }
.mx-ad__img { position: relative; aspect-ratio: 1 / 1; background: #ddd; }
.mx-ad__img canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.mx-ad__foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #F0F2F5; }
.mx-ad__h { flex: 1; display: block; font-weight: 600; font-size: 14px; line-height: 1.3; }
.mx-ad__cta { flex: none; width: 54px; height: 26px; display: grid; place-items: center; background: #E4E6EB; border-radius: 6px; }
.mx-bar { display: block; height: 7px; width: 72%; border-radius: 4px; background: #D9DBDF; }
.mx-bar--s { width: 44%; height: 6px; }

/* typing caret */
.mx-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; }

/* ---------- layout classes (FORMAT section 7; the engine mirrors them in .deck[data-layout]) ----------
 * desktop: landscape, at least 960 x 600 · compact: landscape below that, down to 640 x 360 (and portrait frames 760 px or wider)
 * phone: portrait and narrower than 760 px. A short or narrow landscape frame is compact, never phone. */

/* ---------- compact: tighter paddings and type so the title never reaches the visual ---------- */
@media (orientation: landscape) and (max-width: 959px), (orientation: landscape) and (max-height: 619px), (orientation: portrait) and (min-width: 760px) and (max-width: 959px) {
  .scene .mx { row-gap: clamp(10px, 2.4vh, 20px); }
  .scene .scene__inner.mx { padding: calc(var(--hud-top, 52px) + 6px) clamp(20px, 4vw, 48px) calc(var(--hud-bottom, 80px) + 4px); }
  .mx-t { font-size: clamp(24px, 2.9vw, 30px); line-height: 1.1; letter-spacing: -.022em; }
  .mx--full .mx-t, .mx--right .mx-t { max-width: min(100%, 21em); }
  .scene .mx--split { column-gap: clamp(20px, 3vw, 36px); }
  .mx-side { gap: 10px; }
  .scene .mx-note { font-size: 15px; line-height: 1.42; }
  .mx-steps { gap: 6px; }
  .mx-steps li { font-size: 15px; }
  .scene .mx-pit { font-size: 15px; line-height: 1.4; }
  .mx-pit__i { width: 22px; height: 22px; }
  .mx-stat__v { font-size: clamp(30px, 4.6vw, 48px); }
  .mx-stat--xl .mx-stat__v { font-size: clamp(40px, 7vw, 72px); }
  .mx-stat__l { font-size: 14px; }
}
/* very short frames (640 x 360, 736 x 414): even less vertical air */
@media (orientation: landscape) and (max-height: 459px) {
  .scene .mx { row-gap: 8px; }
  .mx-t { font-size: 24px; }
  .scene .mx-note { font-size: 15px; line-height: 1.36; }
}

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

/* the HUD, its short chapter label ("Lever 4 of 10", from meta.chapterShort in scenes.js) and the 14 px floor come from the engine */

/* short desktop frames (e.g. 1173 x 660): deck.css's 11vh bottom padding is less than the 100 px bottom zone; keep laid-out text clear of it */
.deck[data-layout="desktop"] .scene .scene__inner.mx { padding-bottom: max(clamp(88px, 11vh, 132px), calc(var(--hud-bottom, 100px) + 4px)); padding-top: max(clamp(72px, 9vh, 120px), calc(var(--hud-top, 64px) + 8px)); }

/* stopgap for the shared Ryze hero: ryze.css sets visibility: visible on its .is-on labels, which overrides the hidden
 * inactive scene layer, so the ryze text showed over earlier scenes after a visit. Hide them outside the visible layers. */
.scene:not(.is-active):not(.is-leaving) :is(.rz-hero__p, .rz-hero__name, .rz-node) { visibility: hidden !important; }

/* ---------- round 5 (owner, 27 Nov): supporting text sits directly under the title on every slide ----------
 * reading order: title, explaining sentence, notes or steps, source line; the visual takes the space below or beside */
.scene .mx { grid-template-rows: auto auto minmax(0, 1fr); }
.mx-side { grid-row: 2; align-self: start; }
.scene .mx--split { grid-template-rows: auto minmax(0, 1fr); }
.mx--split .mx-side { grid-column: 1; grid-row: 2; align-self: start; }
.mx--split .mx-vis { grid-column: 2; grid-row: 2; }
.mx--stage .mx-side { grid-row: 2; }
.mx--stage .mx-vis { grid-row: 3; }
.mx--full .mx-side { grid-row: 2; align-self: start; }
.mx--right .mx-side { grid-column: 2; grid-row: 2 / 4; align-self: start; }
@media (max-width: 759px) and (orientation: portrait) {
  .scene .mx--split { grid-template-rows: auto auto minmax(0, 1fr); }
  .mx--split .mx-side { grid-column: 1; grid-row: 2; align-self: start; }
  .mx--split .mx-vis { grid-column: 1; grid-row: 3; }
  .mx--right .mx-side { grid-column: 1; grid-row: 2; align-self: start; }
}
