/* Marketing Engineer Academy deck runtime styles (engine by Ryze AI). Brand tokens come from /assets/tokens.css.
 * Satoshi everywhere, no monospace; every HUD text is at least 14 px.
 * Layouts: desktop (at least 960 × 600), compact (short or narrow landscape, down to 640 × 360),
 * phone (portrait and narrower than 760). The engine mirrors them in data-layout on .deck.
 * --hud-top / --hud-bottom: the top bar and bottom zone a deck keeps text out of. */

html, body { margin: 0; height: 100%; overflow: hidden; }
body.deck-page { background: var(--deck-bg, #0E0E0F); }
.scene { font-family: var(--font-sans); }
:where(.scene) :where(h1, h2, h3) { font-weight: 500; margin: 0; text-wrap: balance; }
:where(.scene) :where(p) { margin: 0; }

.deck { position: fixed; inset: 0; color: var(--deck-fg); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; --mx: 0; --my: 0;
  --hud-top: 64px; --hud-bottom: 100px; --hud-x: clamp(16px, 3vw, 36px); }
.deck__stage { position: absolute; inset: 0; overflow: hidden; cursor: default; }

.scene { position: absolute; inset: 0; overflow: hidden; visibility: hidden; contain: layout paint; }
.scene.is-active { visibility: visible; }
.scene.is-receding > .scene__inner { transition: transform 1s cubic-bezier(.7,0,.2,1), filter 1s; transform: scale(.96); filter: brightness(.85); }

/* themes: each sets its own palette for the scene layer and the HUD */
.theme-paper  { --s-bg: #fff; --s-fg: var(--ink, #111); --s-muted: var(--ink-60, #5c5c5c); --s-line: var(--ll-line, #E4E2DD); --s-accent: var(--brand); background: var(--s-bg); color: var(--s-fg); }
.theme-white  { --s-bg: #fff; --s-fg: var(--ink, #111); --s-muted: var(--ink-60, #5c5c5c); --s-line: var(--line, rgba(0,0,0,.1)); --s-accent: var(--brand, #FF7F32); background: var(--s-bg); color: var(--s-fg); }
.theme-ink    { --s-bg: var(--band, #0E0E0F); --s-fg: #f5f3ee; --s-muted: rgba(245,243,238,.6); --s-line: rgba(255,255,255,.12); --s-accent: var(--brand, #FF7F32); background: var(--s-bg); color: var(--s-fg); }
.theme-night  { --s-bg: #050506; --s-fg: #fff; --s-muted: rgba(255,255,255,.6); --s-line: rgba(255,255,255,.1); --s-accent: var(--c-aqua, #9CE7DD); background: var(--s-bg); color: var(--s-fg); }
.theme-brand  { --s-bg: var(--brand, #FF7F32); --s-fg: #fff; --s-muted: rgba(255,255,255,.78); --s-line: rgba(255,255,255,.25); --s-accent: #fff; background: var(--s-bg); color: var(--s-fg); }

.scene__inner { position: absolute; inset: 0; display: grid; padding: clamp(72px, 9vh, 120px) clamp(24px, 6vw, 112px) clamp(88px, 11vh, 132px); box-sizing: border-box; }

/* ---------- HUD: top bar ---------- */
/* left: the lesson name (a link home) · the chapter; right: the Ryze signature. The left side gives way (ellipsis) before anything overlaps. */
.deck__hud { position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: var(--hud-top); box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 var(--hud-x); pointer-events: none;
  color: var(--hud-fg, currentColor); transition: color .6s; font: 500 14px/20px var(--font-sans); letter-spacing: -0.005em; white-space: nowrap; }
.deck__hud > * { pointer-events: auto; }
.hud__left { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; }
.hud__brand { flex: none; display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 500; }
.hud__logo:empty { display: none; }
.hud__logo svg, .hud__logo img { height: 20px; width: auto; display: block; }
.hud__lesson { font-weight: 500; }
.hud__sep { flex: none; padding: 0 .5em; opacity: .4; }
.hud__sep[hidden] { display: none; }
.hud__chapter { min-width: 0; overflow: hidden; text-overflow: ellipsis; opacity: .62; }
.deck .hud__left > .hud__chapter { margin-left: 0; }
/* when space runs out the engine steps the left label down (data-hud-left) instead of clipping it */
.deck[data-hud-left="chapter"] .hud__left > .hud__brand, .deck[data-hud-left="chapter"] .hud__left > .hud__sep,
.deck[data-hud-left="wrap"] .hud__left > .hud__chapter, .deck[data-hud-left="wrap"] .hud__left > .hud__sep { display: none; }
.deck[data-hud-left="wrap"] .hud__brand, .deck[data-hud-left="wrap"] .hud__lesson { white-space: normal; overflow: visible; text-overflow: clip; }
.deck[data-hud-left="wrap"] .hud__lesson { line-height: 18px; }
.deck[data-hud-left="none"] .hud__left { visibility: hidden; }
/* the short label (::after, filled from data-short) hangs from the top of the line, so a zero font-size chapter stays level with the lesson name */
.hud__chapter::after { vertical-align: top; }

.hud__ryze { flex: none; display: flex; align-items: center; gap: 10px; }
/* two lines at every layout: the academy name over "by Ryze AI", the logo spanning both */
.hud__ryze-logo { flex: none; display: grid; width: 30px; height: 30px; }
.hud__ryze-text { display: flex; flex-direction: column; align-items: flex-start; }
.hud__ryze-img { grid-area: 1 / 1; display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity .6s; -webkit-user-drag: none; user-select: none; }
.hud__ryze-img--light, .deck[data-hud-tone="light"] .hud__ryze-img--dark { opacity: 0; }
.deck[data-hud-tone="light"] .hud__ryze-img--light { opacity: 1; }
.hud__ryze-link { font-size: 16px; line-height: 20px; color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 28%, transparent); transition: text-decoration-color .2s; }
a.hud__ryze-link:hover { text-decoration-color: currentColor; }
.hud__ryze-by { font-size: 14px; line-height: 18px; opacity: .62; }
/* a scene with brand: 'hero' shows the large lockup instead, so the small signature steps aside */
.hud__ryze { transition: opacity .4s, visibility 0s; }
.deck[data-brand-hero] .hud__ryze { position: absolute; right: var(--hud-x); opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s linear .4s; }

/* the HUD ink without its colour transition: the engine reads it to pick the black or the white Ryze logo */
.deck__tone { position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; color: var(--hud-fg, currentColor); transition: none !important; }

.deck[data-theme="paper"], .deck[data-theme="white"] { --hud-fg: var(--ink, #111); }
.deck[data-theme="ink"], .deck[data-theme="night"], .deck[data-theme="brand"] { --hud-fg: #fff; }
.deck[data-hud="light"] { --hud-fg: #fff; }
.deck:is([data-theme="ink"], [data-theme="night"], [data-theme="brand"], [data-hud="light"]):not([data-hud="dark"]) .hud__logo img { filter: brightness(0) invert(1); }
.deck[data-hud="dark"] { --hud-fg: var(--ink, #111); }

/* ---------- the large brand lockup (brand: 'hero' on a scene, or brandLockup() placed by a deck) ---------- */
/* --bh: the academy name size; the logo spans the name and "by Ryze AI" lines */
.deck-brand-hero { --bh: clamp(20px, 1.75vw, 30px); --bh-by: max(15px, calc(var(--bh) * .7)); position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: calc(var(--bh) * .55);
  font-family: var(--font-sans); font-weight: 500; letter-spacing: -0.012em; white-space: nowrap; color: inherit; }
.deck-brand-hero__logo { flex: none; display: grid; width: calc(var(--bh) * 1.22 + var(--bh-by) * 1.3); height: calc(var(--bh) * 1.22 + var(--bh-by) * 1.3); }
.deck-brand-hero__img { grid-area: 1 / 1; display: block; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; transition: opacity .6s; }
.deck-brand-hero__text { display: flex; flex-direction: column; align-items: flex-start; }
.deck-brand-hero__name { font-size: var(--bh); line-height: 1.22; color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); transition: text-decoration-color .2s; }
a.deck-brand-hero__name:hover { text-decoration-color: currentColor; }
a.deck-brand-hero__name:focus-visible { outline: 2px solid var(--brand, #FF7F32); outline-offset: 3px; border-radius: 4px; }
.deck-brand-hero__by { font-size: var(--bh-by); line-height: 1.3; opacity: .7; }
/* tone: black logo by default; white on dark slides ('auto' follows the HUD ink) or when forced with --light */
.deck-brand-hero__img--light, .deck[data-hud-tone="light"] .deck-brand-hero:not(.deck-brand-hero--dark) .deck-brand-hero__img--dark, .deck-brand-hero--light .deck-brand-hero__img--dark { opacity: 0; }
.deck[data-hud-tone="light"] .deck-brand-hero:not(.deck-brand-hero--dark) .deck-brand-hero__img--light, .deck-brand-hero--light .deck-brand-hero__img--light { opacity: 1; }
.deck .deck-brand-hero { color: var(--hud-fg, currentColor); }
.deck-brand-hero--light, .deck .deck-brand-hero--light { color: #fff; }
.deck-brand-hero--dark, .deck .deck-brand-hero--dark { color: var(--ink, #111); }
/* engine-placed: in the content box just below the top bar, on a soft scrim of the slide colour so it reads over 3D */
.deck-brand-hero--placed { position: absolute; z-index: 6; top: calc(var(--hud-top) + clamp(6px, 2.2vh, 28px)); }
.deck-brand-hero--top-left, .deck-brand-hero--bottom-left { left: clamp(24px, 6vw, 112px); }
.deck-brand-hero--top-right { right: clamp(24px, 6vw, 112px); }
.deck-brand-hero--bottom-left { top: auto; bottom: calc(var(--hud-bottom) + clamp(6px, 2vh, 24px)); }
.deck-brand-hero--placed::before { content: ""; position: absolute; z-index: -1; inset: -32px -56px; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--s-bg, #fff) 82%, transparent) 40%, transparent); }
.deck-brand-hero--placed .deck-brand-hero__text { text-shadow: 0 0 18px color-mix(in srgb, var(--s-bg, #fff) 70%, transparent); }

/* ---------- HUD: bottom zone ---------- */
.deck__progress { position: fixed; z-index: 20; left: var(--hud-x); right: var(--hud-x); bottom: 20px; display: flex; gap: 4px; color: var(--hud-fg); }
.progress__seg { all: unset; cursor: pointer; flex: 1; height: 14px; display: flex; align-items: center; }
.progress__seg i { display: block; width: 100%; height: 3px; border-radius: 3px; background: color-mix(in srgb, currentColor 18%, transparent); position: relative; overflow: hidden; transition: height .2s; }
.progress__seg i::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--fill, 0)); background: currentColor; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.progress__seg.is-current i::after { background: var(--brand, #FF7F32); }
.progress__seg:hover i { height: 6px; }

/* the nav cluster, bottom right: overview and full screen, then previous, counter and next */
.deck__nav { position: fixed; z-index: 20; right: var(--hud-x); bottom: 44px; display: flex; align-items: center; gap: 8px; color: var(--hud-fg); font-family: var(--font-sans); }
.nav__tools { display: flex; align-items: center; gap: 2px; margin-right: 6px; }
.hud__btn { all: unset; cursor: pointer; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 4px; color: inherit; opacity: .7; transition: opacity .2s, background .2s; }
.hud__btn[hidden] { display: none; }
.hud__btn:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.hud__btn:focus-visible { outline: 2px solid var(--brand, #FF7F32); outline-offset: 2px; opacity: 1; }
.nav__btn { all: unset; cursor: pointer; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 4px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); box-sizing: border-box; transition: background .2s, border-color .2s, opacity .2s; }
.nav__btn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.nav__btn--next { background: #000; border-color: #D6D6D6; color: #fff; }
.nav__btn--next:hover { background: #262626; }
.deck[data-theme="ink"] .nav__btn--next, .deck[data-theme="night"] .nav__btn--next { background: #fff; color: #000; border-color: #fff; }
.deck[data-theme="brand"] .nav__btn--next { background: #000; border-color: #000; }
.nav__btn:disabled { opacity: .3; cursor: default; }
.nav__btn:focus-visible { outline: 2px solid var(--brand, #FF7F32); outline-offset: 3px; }
.nav__count { font: 500 14px/1 var(--font-sans); font-variant-numeric: tabular-nums; letter-spacing: -0.005em; opacity: .66; min-width: 64px; text-align: center; white-space: nowrap; }

/* the first-run hint: centred, level with the nav cluster; narrow frames move it bottom left so the two never meet */
.deck__hint { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: 55px; font: 500 14px/20px var(--font-sans); letter-spacing: -0.005em; color: var(--hud-fg); opacity: .55; transition: opacity .6s; pointer-events: none; white-space: nowrap; }
.deck__hint.is-hidden { opacity: 0; }

/* ---------- overview ---------- */
.deck__overview { position: fixed; inset: 0; z-index: 40; background: rgb(255 255 255 / .94); backdrop-filter: blur(18px); color: var(--ink, #111); opacity: 0; pointer-events: none; transition: opacity .35s; overflow: auto; font-family: var(--font-sans); }
.deck__overview.is-open { opacity: 1; pointer-events: auto; }
/* a closed overview must not take keyboard focus: hide it once its fade has finished */
.deck__overview { visibility: hidden; transition: opacity .35s, visibility 0s linear .35s; }
.deck__overview.is-open { visibility: visible; transition: opacity .35s; }
.progress__seg:focus-visible, .overview__chapter button:focus-visible, .overview__close:focus-visible, .hud__brand:focus-visible, .hud__ryze-link:focus-visible { outline: 2px solid var(--brand, #FF7F32); outline-offset: 2px; border-radius: 4px; }
.overview__inner { max-width: 1100px; margin: 0 auto; padding: 72px 32px; }
.overview__head { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 8px 24px; margin-bottom: 40px; }
.overview__kicker { margin: 0; font-size: 14px; color: var(--brand, #FF7F32); font-weight: 500; grid-column: 1; }
.overview__title { margin: 0; font-family: var(--font-display, inherit); font-size: clamp(32px, 4vw, 52px); letter-spacing: -0.03em; line-height: 1.05; font-weight: 500; grid-column: 1; }
.overview__close { all: unset; cursor: pointer; grid-column: 2; grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; border: 1px solid var(--line, rgba(0,0,0,.12)); }
.overview__chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px; }
.overview__chapter h3 { font-size: 15px; margin: 0 0 12px; font-weight: 500; }
.overview__chapter ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.overview__chapter button { all: unset; cursor: pointer; display: block; padding: 8px 12px; border-radius: 10px; font-size: 15px; color: var(--ink-60, #555); transition: background .2s, color .2s; }
.overview__chapter button:hover { background: #F4F4F4; color: var(--ink, #111); }

/* ---------- fake cursor ---------- */
.fake-cursor { position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none; color: var(--cursor, var(--brand, #FF7F32)); transition: opacity .3s; will-change: transform; filter: drop-shadow(0 4px 10px rgba(0,0,0,.18)); }
.fake-cursor svg { display: block; overflow: visible; }
.fake-cursor__label { position: absolute; left: 16px; top: 19px; padding: 3px 8px; border-radius: 4px; background: var(--cursor, var(--brand, #FF7F32)); color: #fff; font: 700 14px/1.3 var(--font-sans); white-space: nowrap; }
.fake-cursor.is-hidden { opacity: 0; }
.fake-cursor.is-click svg { animation: cursor-click .26s ease-out; }
.fake-cursor.is-click::after { content: ""; position: absolute; left: -10px; top: -10px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--cursor, var(--brand, #FF7F32)); animation: cursor-ring .5s ease-out forwards; }
@keyframes cursor-click { 50% { transform: scale(.82); } }
@keyframes cursor-ring { from { transform: scale(.4); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }

/* typing caret */
.is-typing::after { content: ""; display: inline-block; width: .08em; height: 1em; margin-left: .06em; vertical-align: -0.12em; background: currentColor; animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* word reveals: add .reveal to a container, then .is-in */
.deck-w { display: inline-block; opacity: 0; transform: translateY(.4em); filter: blur(6px); transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1), filter .6s; transition-delay: calc(var(--i) * 40ms); }
.is-in .deck-w, .deck-w.is-in { opacity: 1; transform: none; filter: none; }

/* generic beat-driven visibility helpers: data-show="2" shows from beat 2 on */
[data-show], [data-hide] { opacity: 0; transform: translateY(14px); transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
[data-show].is-on, [data-hide].is-on { opacity: 1; transform: none; }

/* reduced motion shows end states at once: no durations, no delays, no endless loops */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
}

/* ---------- compact: short or narrow landscape (below 960 × 600) ---------- */
@media (max-width: 959px), (max-height: 599px) {
  .deck { --hud-top: 56px; --hud-bottom: 80px; --hud-x: 20px; }
  .deck__hud { gap: 20px; }
  .hud__ryze { gap: 9px; }
  .hud__ryze-logo { width: 28px; height: 28px; }
  .hud__ryze-link { font-size: 15px; line-height: 19px; }
  .deck__progress { bottom: 12px; }
  .deck__nav { bottom: 30px; gap: 6px; }
  .nav__tools { margin-right: 4px; }
  .hud__btn, .nav__btn { width: 36px; height: 36px; }
  .deck__hint { bottom: 38px; }
}
@media (max-width: 899px) { .deck__hint { left: var(--hud-x); transform: none; } }
/* narrow landscape: the short chapter label replaces the long one when the deck provides it */
@media (max-width: 759px) and (orientation: landscape) {
  .deck .hud__chapter[data-short]:not([data-short=""]) { font-size: 0; }
  .deck .hud__chapter[data-short]:not([data-short=""])::after { content: attr(data-short); font-size: 14px; }
  .deck__hud { gap: 16px; }
}

/* ---------- phone: portrait and narrower than 760 ---------- */
/* two quiet lines on each side: lesson over short chapter at left, academy name over "by Ryze AI" at right */
@media (max-width: 759px) and (orientation: portrait) {
  .deck { --hud-top: 56px; --hud-bottom: 96px; --hud-x: 16px; }
  .deck__hud { gap: 12px; line-height: 18px; }
  .hud__left { flex-direction: column; align-items: flex-start; justify-content: center; }
  .hud__left > * { max-width: 100%; }
  .hud__logo, .hud__sep { display: none; }
  .hud__brand { min-width: 0; }
  .hud__lesson { overflow: hidden; text-overflow: ellipsis; }
  .deck .hud__left > .hud__chapter { display: block; font-size: 0; line-height: 18px; }
  .deck .hud__chapter::after { content: attr(data-short); font-size: 14px; }
  .deck__hint { display: none; }
  .deck__progress { bottom: 16px; }
  .deck__nav { bottom: 38px; gap: 6px; }
  .nav__tools { margin-right: 2px; }
  .hud__btn, .nav__btn { width: 42px; height: 42px; }
}
@media (max-width: 759px) and (orientation: portrait) { .deck-brand-hero { --bh: 18px; } .deck-brand-hero--top-left, .deck-brand-hero--top-right { top: calc(var(--hud-top) + 14px); } }
@media (max-height: 420px) { .deck-brand-hero { --bh: 18px; } }
/* the narrowest phones (the 358 px embedded frame): a step smaller so the lesson keeps its room */
@media (max-width: 379px) and (orientation: portrait) {
  .deck { --hud-x: 14px; }
  .deck__hud { gap: 10px; }
  .hud__ryze { gap: 8px; }
  .hud__ryze-logo { width: 26px; height: 26px; }
  .hud__ryze-link { font-size: 14px; line-height: 18px; }
}
/* 320 px phones: a little less padding and a smaller logo, the text stays at 14 px */
@media (max-width: 339px) and (orientation: portrait) {
  .deck { --hud-x: 12px; }
  .deck__hud { gap: 8px; }
  .hud__ryze { gap: 7px; }
  .hud__ryze-logo { width: 22px; height: 22px; }
}
