/* CPro Solutions — story mode (DESIGN.md §7e). Phones only (loaded with media="(max-width: 899px)") and only when
   rx.js turned it on (html.rx-story = scene mode on a screen under 900px wide).
   Every scene is one full-screen card: the 3D (or the visual) owns the top half, a caption sheet sits at the bottom,
   story progress bars run along the top. Nothing on a card may be taller than the screen. */

/* ---------------------------------------------------------------- the frame */
html.rx-story { --sheet-pad: max(18px, env(safe-area-inset-bottom)); --top: calc(var(--header-h) + 18px); }
html.rx-story .hd { background: linear-gradient(rgba(var(--bg-rgb), .85), rgba(var(--bg-rgb), 0)); border-color: transparent !important; backdrop-filter: none; }
html.rx-story .scene { padding-top: var(--top); padding-bottom: var(--sheet-pad); }

/* story bars instead of the side dots: one segment per scene, filled up to the current one */
html.rx-story .sc-nav { left: 16px; right: 16px; top: calc(var(--header-h) + 2px); translate: none; z-index: 111; }
html.rx-story .sc-nav ol { display: flex; flex-direction: row; gap: 4px; }
html.rx-story .sc-nav li { flex: 1; }
html.rx-story .sc-nav button { display: block; width: 100%; height: 14px; padding: 5px 0; }
html.rx-story .sc-nav button .mono { display: none; }
html.rx-story .sc-nav button i { display: block; width: 100%; height: 3px; margin: 0; border-radius: 2px; background: rgba(var(--fg-rgb), .2); box-shadow: none; transform: none; transition: background .3s; }
html.rx-story .sc-nav li:has(~ li button[aria-current]) i, html.rx-story .sc-nav button[aria-current] i { background: var(--fg); }
html.rx-story .sc-hint { bottom: calc(var(--sheet-pad) - 6px); }
html.rx-story .x-bar { display: none; }

/* 3D cards: the copy is a sheet at the bottom; a fade behind it keeps it readable over any model */
html.rx-story .scene.s--clear[data-shot] { display: flex !important; flex-direction: column; justify-content: flex-end; }
html.rx-story .scene.s--clear[data-shot]::after { content: ""; position: absolute; inset: auto 0 0; height: 56%; z-index: 1; pointer-events: none;
  background: linear-gradient(rgba(var(--bg-rgb), 0), rgba(var(--bg-rgb), .86) 38%, rgba(var(--bg-rgb), .96)); }
html.rx-story .scene.s--clear[data-shot] > * { position: relative; z-index: 2; }

/* type scale for cards */
html.rx-story .poster { font-size: clamp(2.6rem, 1.4rem + 6vw, 3.6rem); }
html.rx-story .display { font-size: clamp(2.3rem, 1.3rem + 5vw, 3.1rem); }
html.rx-story .lead { font-size: 1rem; line-height: 1.45; }
html.rx-story .b-row { gap: .6rem; }
html.rx-story .b-row .b { min-height: 44px; padding: .6rem 1rem; font-size: .9rem; }
html.rx-story .clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- home */
/* hero: the EDC in the top half; the headline, one line and two buttons in the sheet */
html.rx-story .x-hero { padding: 0 0 var(--sheet-pad); }
html.rx-story .x-hero__in { padding: 0 !important; align-self: auto; }
html.rx-story .x-hero__in > .mono { font-size: .62rem; }
html.rx-story .x-hero__t { margin-top: .8rem; }
html.rx-story .x-hero__lead { margin-top: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
html.rx-story .x-hero__btns { margin-top: 1.1rem; }
html.rx-story .x-hero__foot { display: none; }

/* engine: one layer at a time in the sheet */
html.rx-story .x-engine__stage { display: flex; flex-direction: column; justify-content: flex-end; padding: 0 0 var(--sheet-pad) !important; height: 100%; }
html.rx-story .x-engine__in { position: relative; z-index: 2; }
html.rx-story .x-engine__t { font-size: 2rem !important; margin-top: .6rem; }
html.rx-story .x-steps { margin-top: 1rem !important; }
html.rx-story .x-steps li:not(.on) { display: none; }
html.rx-story .x-steps button { padding: .5rem 0 !important; }
html.rx-story .x-steps p { padding-left: 3.2rem; }
html.rx-story .x-engine__note { display: none; }

/* Orijin City: the town in the top half; each step's caption in the sheet */
html.rx-story .x-prod__stage { height: 100%; }
html.rx-story .x-prod__in { position: absolute; left: 0; right: 0; bottom: var(--sheet-pad); top: auto; height: min(44vh, 360px); display: block; z-index: 2; }
html.rx-story .x-prod__k { display: none; }   /* the story bars already show where you are */
html.rx-story .x-prod__item { top: auto !important; bottom: 0; left: var(--gutter); right: var(--gutter); translate: 0 14px !important; max-width: none !important; }
html.rx-story .x-prod__item.on { translate: 0 0 !important; }
html.rx-story .x-prod__item .display { margin-top: .6rem; }
html.rx-story .x-prod__item .lead { margin-top: .7rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
html.rx-story .x-prod__item .arrow-link { margin-top: .9rem; }
html.rx-story .x-play { margin-top: 1rem; }
html.rx-story .x-city .x-prod__stage::before { display: none !important; }   /* the older top fade: the sheet fade replaces it */
html.rx-story.rx-gaming .scene.s--clear[data-shot]::after { opacity: 0; }

/* the figure, the proof rows and the closing card all fit one screen */
html.rx-story .x-fig { align-content: center; }
html.rx-story .x-fig__n { font-size: clamp(3.6rem, 1rem + 17vw, 5.6rem); }
html.rx-story .x-fig__row { margin-top: 1.6rem; padding-top: 1.2rem; gap: 1rem; }
html.rx-story .x-fig__row .stat__n { font-size: 2.2rem; }
html.rx-story .x-fig__src { margin-top: 1.2rem; font-size: .58rem; }
html.rx-story .x-proof__t { font-size: 2.2rem; margin-top: .6rem; }
html.rx-story .x-proof .rows { margin-top: 1.2rem; }
html.rx-story .x-proof .rows > a { padding: .8rem 0; }
html.rx-story .x-proof .rows > a:nth-child(n + 4) { display: none; }   /* three rows; "All case studies" has the rest */
html.rx-story .x-proof .row__t { font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html.rx-story .x-proof__all { margin-top: 1.2rem; }
html.rx-story .rx-cta__t { margin-top: .8rem; }
html.rx-story .rx-cta__routes { margin-top: 1.4rem; gap: .55rem; }
html.rx-story .rx-cta .card { padding: .9rem 1rem; }
html.rx-story .rx-cta .card h3 { font-size: 1.05rem; margin-top: .3rem; }
html.rx-story .rx-cta .card p { margin-top: .5rem; font-size: .9rem; }

/* ---------------------------------------------------------------- products */
html.rx-story .px-hero { padding: 0 0 var(--sheet-pad); }
html.rx-story .px-hero__in { padding: 0 !important; }
html.rx-story .px-hero .crumbs { display: none; }
html.rx-story .px-hero__t { margin-top: 0; }
html.rx-story .px-hero__lead { margin-top: .8rem; }
html.rx-story .px-index { flex-wrap: nowrap; overflow-x: auto; margin: 1.1rem calc(var(--gutter) * -1) 0; padding: 0 var(--gutter) 4px; scroll-snap-type: x proximity; scrollbar-width: none; max-width: none !important; }
html.rx-story .px-index::-webkit-scrollbar { display: none; }
html.rx-story .px-index li { flex: none; scroll-snap-align: start; }
html.rx-story .px-drag { display: none !important; }

/* product cards: 3D ones keep the sheet; flat ones put their visual in the top half */
html.rx-story .px-p { padding-bottom: var(--sheet-pad); }
html.rx-story .px-p__in { padding-bottom: 0 !important; gap: 1.2rem; }
html.rx-story .px-p__t { font-size: clamp(2.3rem, 1.3rem + 5vw, 3.1rem); margin-top: .6rem; }
html.rx-story .px-p__t::after { margin-top: .8rem; width: 56px; height: 3px; }
html.rx-story .px-p__lead { margin-top: .8rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
html.rx-story .px-feat { display: none; }
html.rx-story .px-p__btns { margin-top: 1rem; }
html.rx-story .px-p--flat { display: grid !important; align-content: stretch; }
html.rx-story .px-p--flat .px-p__in { height: 100%; grid-template-rows: 1fr auto; align-items: stretch; }
html.rx-story .px-p--flat .px-p__vis { order: -1; display: grid; place-items: center; min-height: 0; }
html.rx-story .px-fan { height: 100%; max-height: 40vh; width: 100%; }
html.rx-story .px-fan__ph { width: min(30vw, 130px); padding: 5px; border-radius: 20px; }
html.rx-story .px-fan__ph img { border-radius: 15px; }
html.rx-story .px-recon { width: 100%; }
html.rx-story .px-wallets { padding: 0; }
html.rx-story .px-wallet { width: min(28vw, 120px); padding: 10px; border-radius: 18px; margin-inline: -10px; gap: 6px; }
html.rx-story .px-wallet i { width: 20px; height: 20px; border-radius: 6px; }
html.rx-story .px-wallet .num { font-size: .95rem; }
html.rx-story .px-wallet em:last-child { height: 22px; }
html.rx-story .px-wallets__cap { font-size: .58rem; margin-top: .6rem; }

/* needs: the filter and the needs themselves become sideways carousels */
html.rx-story .px-needs__head { display: block; margin-bottom: 1rem; }
html.rx-story .px-needs .h2 { font-size: 2.2rem; margin-top: .5rem; }
html.rx-story .px-filter { flex-wrap: nowrap; overflow-x: auto; margin: 1rem calc(var(--gutter) * -1) 0; padding: 0 var(--gutter) 2px; scrollbar-width: none; }
html.rx-story .px-filter::-webkit-scrollbar, html.rx-story .px-needs__list::-webkit-scrollbar { display: none; }
html.rx-story .px-filter button { flex: none; min-height: 36px; }
html.rx-story .px-needs__list { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 6px; background: none; border: 0; border-radius: 0; scrollbar-width: none; }
html.rx-story .px-need { flex: 0 0 82%; scroll-snap-align: center; border: 1px solid var(--line-2); border-radius: var(--r-2); min-height: 15rem; }
html.rx-story .px-need > .mono { display: block !important; }
html.rx-story .px-need.is-off { display: none; }
html.rx-story .px-needs__swipe { display: block; margin-top: .8rem; color: var(--fg-3); font-size: .6rem; }

/* one engine */
html.rx-story .pl-engine .h2 { font-size: 2.2rem; }
html.rx-story .pl-engine .lead { margin-bottom: 1.4rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
html.rx-story .pl-engine__facts { gap: 1rem; }
html.rx-story .pl-engine__facts .stat__n { font-size: 2rem; }
html.rx-story .pl-engine__comp { margin-top: 1.2rem; font-size: .58rem; }
html.rx-story .pl-engine__btns { margin-top: 1.2rem; }

/* ---------------------------------------------------------------- fixes found on a 375 × 812 phone */
/* grid/flex children must not grow to fit a sideways strip's full content */
html.rx-story .scene { grid-template-columns: minmax(0, 1fr); }
html.rx-story .scene > *, html.rx-story .px-p__in > * { min-width: 0; }
/* the no-3D fallback images are hidden by visibility; on a card they must not take up space either */
html.rx-story.rx-3d .still { display: none !important; }
/* Orijin School: a smaller fan so the phones stay above the title */
html.rx-story .px-fan__ph { width: min(25vw, 104px); }
html.rx-story .px-fan { max-height: 34vh; }
/* one engine: drop the compliance line on phones */
html.rx-story .pl-engine__comp { display: none; }
html.rx-story .pl-engine .lead { -webkit-line-clamp: 3; }
html.rx-story .px-fan { max-height: 30vh; }
html.rx-story .px-fan__ph { width: min(23vw, 94px); }
html.rx-story .px-p--flat .px-p__vis { padding-bottom: .6rem; }
html.rx-story .px-hero { overflow: hidden; }
html.rx-story .scene.px-p--flat { align-content: stretch; grid-template-rows: minmax(0, 1fr); }
