/* =====================================================================
   CINEMA — home page stylesheet

   Three modes, chosen before first paint by the boot script:
     html.cx-3d          live WebGL stage, acts pinned while the scene plays
     html.cx-3d.cx-reduced  same stage, no pinning, no motion (cuts only)
     anything else       flat layout: all content, a rendered poster
                         of the model, no WebGL — also the no-JS layout

   Composed for Persian first: text on the right, where the eye starts;
   the object on the left. English mirrors that deliberately.
   ===================================================================== */

:root { --cx-ease: cubic-bezier(.22, .61, .36, 1); }

body.home-cinema { background: #06070a; }
.cx { position: relative; isolation: isolate; }

/* ---------- the world behind everything ---------- */
.cx-atmos {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(70vw 60vh at 28% 48%, rgba(150, 12, 22, .26), transparent 62%),
    radial-gradient(60vw 50vh at 78% 108%, rgba(255, 201, 40, .05), transparent 60%),
    radial-gradient(50vw 40vh at 50% -8%, rgba(120, 140, 200, .06), transparent 70%),
    linear-gradient(180deg, #040507 0%, #0a0b10 55%, #06070a 100%);
}
/* Film grain + vignette: the difference between "dark website" and "dark scene". */
.cx-atmos::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, .55) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .5; mix-blend-mode: overlay;
}
.cx-canvas { position: fixed; inset: 0 0 auto 0; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none; }
/* 100lvh: the canvas already covers the screen when the address bar hides, so it never has to resize mid-scroll. */
.cx-canvas canvas { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s var(--cx-ease); }
.cx-live .cx-canvas canvas { opacity: 1; }

/* The footer and header must sit above the fixed stage. */
body.home-cinema .footer { position: relative; z-index: 3; background: #06070a; }

/* ---------- header: transparent at first, a quiet dark layer on scroll ---------- */
/* The header floats over the stage instead of pushing it down, so the
   first act is a true full-bleed frame. */
body.home-cinema .topbar {
  position: fixed; top: 0; left: 0; right: 0;
  background: transparent; border-bottom-color: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  transition: background .4s ease, border-color .4s ease;
}
body.home-cinema.scrolled .topbar {
  background: rgba(7, 8, 11, .78); border-bottom-color: rgba(255, 255, 255, .06);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

/* ---------- journey progress + chapter rail ---------- */
.cx-journey { position: fixed; top: 0; inset-inline: 0; height: 2px; z-index: 80; pointer-events: none; }
/* Drawn with transform (compositor only) — no layout, no page-wide restyle. */
.cx-journey span {
  display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: right center;
  background: linear-gradient(90deg, rgba(255, 201, 40, .2), var(--gold));
}
[dir="ltr"] .cx-journey span { transform-origin: left center; }
.cx-rail {
  position: fixed; top: 50%; inset-inline-end: 22px; transform: translateY(-50%);
  z-index: 40; display: none; flex-direction: column; gap: 12px;
}
.cx-3d .cx-rail { display: flex; }
.cx-rail { gap: 0; }
/* A 24px touch target (WCAG 2.2 target size); the visible dot stays 9px. */
.cx-rail a {
  position: relative; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
}
.cx-rail a::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35); transition: all .3s var(--cx-ease);
}
.cx-rail a.is-on::before { background: var(--gold); border-color: var(--gold); transform: scale(1.25); }
.cx-rail a:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.cx-rail a span {
  position: absolute; inset-inline-end: 20px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: 11.5px; color: #c9ccd4; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.cx-rail a:hover span, .cx-rail a:focus-visible span { opacity: 1; }
.cx-rail a:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

/* =====================================================================
   ACTS
   ===================================================================== */
.cx-act { position: relative; }
.cx-layer { position: relative; }

/* Pinned while the scene plays. --len is in screen heights. */
.cx-3d .cx-act { height: calc(var(--len, 1.6) * 100vh); height: calc(var(--len, 1.6) * 100svh); }
.cx-3d .cx-layer { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

/* A scrim on the text side keeps Persian text readable over a lit object. */
.cx-3d .cx-layer::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(to left, rgba(5, 6, 9, .78) 0%, rgba(5, 6, 9, .35) 38%, transparent 62%);
}
[dir="ltr"] .cx-3d .cx-layer::before, .cx-3d[dir="ltr"] .cx-layer::before {
  background: linear-gradient(to right, rgba(5, 6, 9, .78) 0%, rgba(5, 6, 9, .35) 38%, transparent 62%);
}
.cx-3d .cx-act[data-act="services"] .cx-layer::before,
.cx-3d .cx-act[data-act="finale"] .cx-layer::before {
  background: linear-gradient(to top, rgba(5, 6, 9, .88) 0%, rgba(5, 6, 9, .45) 36%, transparent 60%);
}

/* Text column: on the reading side, vertically centred. */
.cx-copy {
  position: relative; z-index: 2;
  width: min(520px, 44vw);
  margin-inline-start: max(22px, calc((100vw - 1180px) / 2 + 22px));
}
.cx-3d .cx-copy { position: absolute; top: calc(50% + 34px); transform: translateY(-50%); inset-inline-start: 0; margin-inline-start: max(22px, calc((100vw - 1180px) / 2 + 22px)); }
.cx-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700; color: var(--gold); margin-bottom: 16px;
}
.cx-kicker::before { content: ''; width: 28px; height: 1px; background: currentColor; opacity: .6; }
.cx-copy h1 {
  font-size: clamp(32px, min(5.2vw, 7.2vh), 70px); line-height: 1.42; margin: 0 0 20px; font-weight: 800;
}
.cx-copy h1 .hl {
  background: linear-gradient(100deg, #fff 10%, var(--gold) 55%, #fff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cx-copy h1 > span { display: block; }
.cx-copy h2 { font-size: clamp(25px, min(3.4vw, 5.4vh), 46px); line-height: 1.5; margin: 0 0 16px; font-weight: 800; }
.cx-copy p { font-size: clamp(14.5px, 1.25vw, 17px); line-height: 2.05; color: #b9bdc8; margin: 0 0 26px; max-width: 42ch; }
.cx-cta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cx-note { font-size: 12px; color: #7c818f; margin-top: 18px; line-height: 1.9; }

/* Progress-driven reveal: text arrives along the reading axis while its
   act plays, and leaves before the next one. Pure CSS from one variable. */
/* q runs 0→2: the act scrolling in (e) then playing (p). Text starts to
   appear as its screen arrives, so there is never a stretch of scrolling
   with no text; at the end it simply scrolls away with its screen. */
.cx-3d:not(.cx-reduced) .cx-rv {
  --q: calc(var(--e, 1) + var(--p, 0));
  --in: clamp(0, (var(--q) - .4 - var(--a, .06)) * 3, 1);
  --out: clamp(0, (var(--b, 1.05) - var(--p, 0)) * 8, 1);
  opacity: min(var(--in), var(--out));
  translate: calc((1 - var(--in)) * var(--dx, 34px)) calc((1 - var(--in)) * 16px - (1 - var(--out)) * 16px);
  will-change: opacity, translate;
}
[dir="ltr"] .cx-rv { --dx: -34px; }

/* The first act is visible from the first frame; the model emerges
   behind it as the light arrives. */
.cx-act[data-act="arrival"] .cx-rv { --a: -1; }
.cx-act[data-act="finale"] .cx-rv { --b: 2; }

/* Scroll cue. */
.cx-cue {
  position: absolute; bottom: 30px; left: 50%; translate: -50% 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  font-size: 11.5px; color: #8b90a0;
}
.cx-cue i { width: 1px; height: 38px; background: linear-gradient(var(--gold), transparent); animation: cxCue 2.2s var(--cx-ease) infinite; }
@keyframes cxCue { 0% { transform: scaleY(0); transform-origin: top } 50% { transform: scaleY(1); transform-origin: top } 51% { transform-origin: bottom } 100% { transform: scaleY(0); transform-origin: bottom } }
.cx-3d:not(.cx-reduced) .cx-cue { opacity: clamp(0, 1 - var(--p, 0) * 6, 1); }

/* =====================================================================
   ANCHORED LABELS — positioned from 3D points by the script
   ===================================================================== */
.cx-3d .cx-anchor {
  position: absolute; left: 0; top: 0; z-index: 3;
  opacity: 0; visibility: hidden; will-change: transform, opacity;
  transition: filter .3s ease;
}
.cx-anchor.is-behind { filter: blur(1.4px) saturate(.6); }

/* Concept words orbiting the object. */
.cx-concept {
  font-size: clamp(15px, 1.6vw, 22px); font-weight: 700; color: #e9ebf0; white-space: nowrap;
  padding: 8px 16px; border-radius: 40px;
  background: rgba(12, 13, 18, .55); border: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}
.cx-concept::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); margin-inline-end: 9px; vertical-align: middle; }

/* The AI network: every node is a real link. */
.cx-eco { list-style: none; margin: 0; padding: 0; }
.cx-eco a {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none;
  font-size: 12.5px; font-weight: 600; color: #e6e8ee;
  padding: 7px 13px 7px 11px; border-radius: 30px;
  background: rgba(10, 12, 18, .72); border: 1px solid rgba(160, 190, 255, .16);
  transition: border-color .25s, background .25s;
}
.cx-eco a:hover { border-color: rgba(255, 201, 40, .55); background: rgba(22, 24, 30, .9); }
.cx-eco a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.cx-tag { font-size: 9.5px; font-weight: 800; padding: 2px 8px; border-radius: 20px; }
.cx-tag-free { background: rgba(70, 220, 120, .16); color: #7ee6a0; }
.cx-tag-pro  { background: rgba(255, 201, 40, .16); color: var(--gold); }
.cx-legend { display: flex; gap: 14px; font-size: 12px; color: #9aa0ae; margin: 0 0 20px; align-items: center; flex-wrap: wrap; }

/* =====================================================================
   CAPABILITIES — one panel that becomes each tool in turn
   ===================================================================== */
.cx-panel {
  position: relative; z-index: 2; min-height: 330px;
  width: min(460px, 40vw);
  border-radius: 22px; padding: 26px 26px 22px;
  background: linear-gradient(160deg, rgba(20, 22, 30, .86), rgba(10, 11, 16, .92));
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.cx-3d .cx-panel { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: max(22px, calc((100vw - 1180px) / 2 + 22px)); }
.cx-beat { transition: opacity .55s var(--cx-ease), transform .6s var(--cx-ease); }
.cx-3d .cx-beat { position: absolute; inset: 26px 26px 22px; opacity: 0; transform: translateY(14px); pointer-events: none; }
.cx-3d .cx-beat.is-on { opacity: 1; transform: none; pointer-events: auto; }
.cx-beat .cx-kicker { margin-bottom: 10px; }
.cx-beat h3 { font-size: clamp(20px, 2vw, 27px); line-height: 1.55; margin: 0 0 10px; font-weight: 800; }
.cx-beat p { font-size: 13.5px; line-height: 2; color: #aeb3bf; margin: 0 0 16px; }
.cx-beat .cx-beat-cta { display: flex; align-items: center; gap: 10px; }
.cx-count { position: absolute; top: 24px; inset-inline-end: 26px; font-size: 12px; color: #7d828e; }
.cx-3d .cx-count { display: block; }

/* Conceptual mini-interfaces inside the panel: shapes, not fake data. */
.cx-mini { border-radius: 13px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .05); padding: 12px; margin-bottom: 16px; }
.cx-mini-lines span { display: block; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .09); margin: 7px 0; }
.cx-mini-lines span:nth-child(2) { width: 86%; } .cx-mini-lines span:nth-child(3) { width: 64%; } .cx-mini-lines span:nth-child(4) { width: 78%; }
.cx-mini-chat .b { font-size: 12px; line-height: 1.9; padding: 8px 12px; border-radius: 12px; margin: 5px 0; max-width: 88%; }
.cx-mini-chat .b.me { background: rgba(255, 201, 40, .1); border: 1px solid rgba(255, 201, 40, .2); margin-inline-start: auto; }
.cx-mini-chat .b.ai { background: #151821; border: 1px solid rgba(255, 255, 255, .06); }
.cx-mini-titles div { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px dashed rgba(255, 255, 255, .06); }
.cx-mini-titles div:last-child { border: 0; }
.cx-mini-titles i { width: 18px; height: 18px; border-radius: 6px; border: 1px solid rgba(255, 201, 40, .45); flex: none; }
.cx-mini-titles span { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .1); flex: 1; }
.cx-mini-thumb { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cx-mini-thumb div { aspect-ratio: 16/9; border-radius: 8px; background: linear-gradient(135deg, rgba(255, 30, 40, .28), rgba(255, 201, 40, .12)); border: 1px solid rgba(255, 255, 255, .06); position: relative; }
.cx-mini-thumb div::after { content: ''; position: absolute; inset-inline-start: 12%; bottom: 16%; width: 42%; height: 12%; border-radius: 3px; background: rgba(255, 255, 255, .5); }
.cx-mini-score { display: flex; align-items: center; gap: 16px; }
.cx-mini-score svg { width: 74px; height: 74px; flex: none; }
.cx-mini-score .cx-mini-lines { flex: 1; }
.cx-mini-label { display: block; font-size: 10.5px; color: #7d828e; margin-top: 8px; }

.cx-connector { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
.cx-connector path { fill: none; stroke: url(#cxLine); stroke-width: 1.2; stroke-dasharray: 3 5; animation: cxDash 1.4s linear infinite; }
@keyframes cxDash { to { stroke-dashoffset: -16; } }

/* =====================================================================
   SERVICES — cards standing in the same space as the object
   ===================================================================== */
.cx-services-head { position: relative; z-index: 2; text-align: center; max-width: 720px; margin: 0 auto; padding: 0 22px; }
.cx-3d .cx-services-head {
  position: absolute; top: 15vh; text-align: start; margin: 0; padding: 0;
  width: min(500px, 42vw); inset-inline-start: max(22px, calc((100vw - 1180px) / 2 + 22px));
}
.cx-3d .cx-services-head p { margin-inline: 0; }
.cx-services-head p { margin-inline: auto; }
.cx-svcs {
  position: relative; z-index: 2; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  padding: 0 22px; perspective: 1400px; max-width: 1180px; margin: 0 auto;
}
.cx-3d .cx-svcs { position: absolute; bottom: 7vh; left: 0; right: 0; flex-wrap: nowrap; }
.cx-svc {
  --lx: 50%;
  position: relative; flex: 1 1 0; min-width: 0; max-width: 270px; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit;
  padding: 20px 18px 18px; border-radius: 18px;
  background: linear-gradient(170deg, rgba(24, 26, 34, .9), rgba(12, 13, 18, .94));
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  transform: rotateY(calc(var(--arc, 0) * 1deg)) translateZ(calc(var(--depth, 0) * 1px));
  transition: transform .5s var(--cx-ease), border-color .3s;
}
/* The same light that lights the object slides across the cards. */
.cx-svc::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 70% at var(--lx) -10%, rgba(255, 255, 255, .14), transparent 60%);
}
.cx-svc:hover, .cx-svc:focus-visible { transform: translateY(-8px) rotateY(0) translateZ(30px); border-color: rgba(255, 201, 40, .45); }
.cx-svc:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.cx-svc b { font-size: 15px; line-height: 1.7; }
.cx-svc small { font-size: 12px; line-height: 1.9; color: #9ea3b0; flex: 1; }
.cx-svc .cx-price { color: var(--gold); font-weight: 800; font-size: 15px; }
.cx-svc .cx-more { font-size: 11.5px; color: #c9ccd4; }

/* =====================================================================
   AUDIT — conceptual readouts pinned to the object
   ===================================================================== */
.cx-frame {
  display: flex; flex-direction: column; gap: 5px; min-width: 150px;
  padding: 10px 13px; border-radius: 12px;
  background: rgba(8, 10, 14, .72); border: 1px solid rgba(255, 211, 90, .22);
  font-size: 12px; color: #dfe2ea;
}
.cx-frame::before { content: ''; position: absolute; inset: -6px; border: 1px solid rgba(255, 211, 90, .35); border-radius: 15px;
  clip-path: polygon(0 0, 18% 0, 18% 2px, 2px 2px, 2px 18%, 0 18%, 0 82%, 2px 82%, 2px calc(100% - 2px), 18% calc(100% - 2px), 18% 100%, 82% 100%, 82% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 82%, 100% 82%, 100% 18%, calc(100% - 2px) 18%, calc(100% - 2px) 2px, 82% 2px, 82% 0); }
.cx-frame .bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.cx-frame .bar i { display: block; height: 100%; width: 60%; background: linear-gradient(90deg, rgba(255, 211, 90, .2), #ffd35a); }
.cx-concept-note { display: inline-block; font-size: 11px; color: #7c818f; border: 1px dashed rgba(255, 255, 255, .14); border-radius: 8px; padding: 4px 9px; margin-bottom: 20px; }

/* =====================================================================
   LIBRARY
   ===================================================================== */
.cx-shelf { list-style: none; margin: 0; padding: 0; }
.cx-book-info { text-align: center; }
.cx-book-info a { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: inherit;
  padding: 10px 16px; border-radius: 14px; background: rgba(10, 9, 8, .7); border: 1px solid rgba(255, 210, 150, .18); }
.cx-book-info a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.cx-book-info b { font-size: 13.5px; max-width: 220px; }
.cx-book-info .cx-price { color: var(--gold); font-weight: 800; }
.cx-book-info img { display: none; }
.cx-badge { font-size: 10px; font-weight: 800; padding: 2px 9px; border-radius: 20px; background: var(--gold); color: #111; }

/* =====================================================================
   GUIDE — the screening room
   ===================================================================== */
.cx-screen {
  position: relative; z-index: 2; width: min(620px, 50vw);
  border-radius: 18px; overflow: hidden; background: #000;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7), 0 0 80px rgba(255, 40, 50, .12);
}
.cx-3d .cx-screen-wrap { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: max(22px, calc((100vw - 1180px) / 2 + 22px)); z-index: 2; }
.cx-screen-wrap h2 { font-size: clamp(22px, 2.4vw, 32px); margin: 0 0 14px; }

/* =====================================================================
   FINALE
   ===================================================================== */
.cx-finale-copy { position: relative; z-index: 2; text-align: center; max-width: 760px; margin: 0 auto; padding: 0 22px; }
.cx-3d .cx-finale-copy { position: absolute; bottom: 10vh; left: 0; right: 0; }
.cx-finale-copy h2 { font-size: clamp(30px, 4.4vw, 58px); line-height: 1.45; margin: 0 0 16px; font-weight: 800; }
.cx-finale-copy p { margin-inline: auto; }
.cx-finale-copy .cx-cta { justify-content: center; }
.cx-credit { font-size: 11px; color: #6c717e; margin-top: 26px; line-height: 1.9; }
.cx-credit a { color: #8b90a0; }

/* =====================================================================
   FLAT MODE — no WebGL, no JS, or a failure: everything still here
   ===================================================================== */
html:not(.cx-3d) .cx-act { padding: clamp(64px, 11vh, 120px) 0; }
html:not(.cx-3d) .cx-act[data-act="arrival"] { padding-top: 130px; min-height: 88vh; display: flex; align-items: center; }
html:not(.cx-3d) .cx-act[data-act="arrival"] .cx-layer { width: 100%; }
html:not(.cx-3d) .cx-copy { width: auto; max-width: 620px; }
html:not(.cx-3d) .cx-concept, html:not(.cx-3d) .cx-frame, html:not(.cx-3d) .cx-connector, html:not(.cx-3d) .cx-cue, html:not(.cx-3d) .cx-count { display: none; }
html:not(.cx-3d) .cx-eco, html:not(.cx-3d) .cx-shelf {
  display: flex; flex-wrap: wrap; gap: 9px; max-width: 1180px; margin: 22px auto 0; padding: 0 22px;
}
html:not(.cx-3d) .cx-eco li, html:not(.cx-3d) .cx-shelf li { list-style: none; }
html:not(.cx-3d) .cx-panel { width: auto; max-width: 1180px; margin: 0 auto; background: none; border: 0; box-shadow: none; padding: 0 22px; min-height: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
html:not(.cx-3d) .cx-beat { padding: 20px; border-radius: 18px; background: rgba(18, 20, 27, .9); border: 1px solid rgba(255, 255, 255, .07); }
html:not(.cx-3d) .cx-book-info img { display: block; width: 150px; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
html:not(.cx-3d) .cx-screen { width: auto; max-width: 760px; margin: 0 auto; }
html:not(.cx-3d) .cx-screen-wrap { padding: 0 22px; max-width: 760px; margin: 0 auto; }

/* The rendered model — only when the live stage is not running. */
.cx-poster { display: none; }
html:not(.cx-3d) .cx-poster {
  display: block; position: absolute; z-index: 0; pointer-events: none;
  inset-inline-end: max(0px, calc((100vw - 1180px) / 2 - 40px)); top: 50%; translate: 0 -50%;
  width: min(640px, 52vw); height: auto;
  filter: drop-shadow(0 40px 70px rgba(0, 0, 0, .55));
  animation: cxFloat 7s ease-in-out infinite;
}
html:not(.cx-3d) .cx-act[data-act="finale"] .cx-poster { position: relative; inset: auto; translate: none; display: block; margin: 0 auto 10px; width: min(460px, 70vw); }
@keyframes cxFloat { 0%, 100% { transform: translateY(0) rotate(-1.2deg) } 50% { transform: translateY(-14px) rotate(.6deg) } }

/* =====================================================================
   PHONES — a different composition, not a shrunken one
   ===================================================================== */
@media (max-width: 760px) {
  .cx-3d .cx-layer::before, .cx-3d[dir="ltr"] .cx-layer::before {
    background: linear-gradient(to top, rgba(5, 6, 9, .92) 0%, rgba(5, 6, 9, .6) 42%, transparent 64%);
  }
  .cx-3d .cx-copy, .cx-3d .cx-panel, .cx-3d .cx-screen-wrap {
    top: auto; bottom: 7vh; transform: none; width: auto;
    inset-inline: 18px; margin: 0;
  }
  .cx-copy h1 { font-size: clamp(30px, 8.6vw, 40px); }
  .cx-copy h2 { font-size: clamp(24px, 7vw, 32px); }
  .cx-copy p { font-size: 14px; margin-bottom: 18px; }
  .cx-rail { display: none !important; }
  .cx-3d .cx-panel { min-height: 262px; padding: 20px; }
  .cx-3d .cx-beat { inset: 20px; }
  .cx-mini { display: none; }          /* the story stays; the illustration makes way for the text */
  .cx-beat p { font-size: 13px; }
  .cx-3d .cx-concept:nth-child(n+5) { display: none; }
  /* Projected labels would collide on a narrow screen: the network
     becomes a tidy chip list under the text; the 3D nodes remain. */
  .cx-3d .cx-eco { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
  .cx-3d .cx-eco .cx-anchor { position: static; transform: none !important; opacity: 1 !important; visibility: visible !important; filter: none !important; }
  .cx-3d .cx-eco a { font-size: 11.5px; padding: 6px 11px; }
  .cx-3d .cx-svcs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; bottom: 5vh; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .cx-3d .cx-svc { flex: 0 0 72%; max-width: none; scroll-snap-align: center; transform: none; }
  .cx-3d .cx-services-head { top: auto; bottom: calc(5vh + 210px); }
  .cx-3d .cx-frame { display: none; }
  .cx-screen { width: auto; }
  html:not(.cx-3d) .cx-poster { position: relative; inset: auto; translate: none; width: 86vw; margin: 0 auto 18px; }
  html:not(.cx-3d) .cx-act[data-act="arrival"] { flex-direction: column; }
}

/* =====================================================================
   REDUCED MOTION — the same compositions, held still
   ===================================================================== */
.cx-3d.cx-reduced .cx-act { height: auto; min-height: 100vh; min-height: 100svh; }
.cx-3d.cx-reduced .cx-layer { position: relative; height: auto; min-height: 100vh; min-height: 100svh; }
@media (prefers-reduced-motion: reduce) {
  .cx-cue i, .cx-connector path, html:not(.cx-3d) .cx-poster { animation: none !important; }
  .cx-beat, .cx-svc, .cx-canvas canvas { transition: none !important; }
  .cx-svc:hover { transform: none; }
}
.cx-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The network list: a full-screen, click-through layer in 3D mode. */
.cx-3d .cx-eco { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.cx-3d .cx-eco .cx-anchor { pointer-events: auto; }
.cx-eco a { font-size: 12px; }

/* Navigation must never wrap onto two lines. */
.nav-links a { white-space: nowrap; }
@media (max-width: 1360px) { .nav-links { gap: 18px; } }

@media (max-width: 760px) {
  .cx-3d .cx-eco { inset: auto 0 3vh 0; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 7px; padding: 0 18px 4px; pointer-events: auto; }
  .cx-3d .cx-act[data-act="ai"] .cx-copy { bottom: 13vh; }
  .cx-3d .cx-services-head { width: auto; inset-inline: 18px; top: auto; bottom: calc(5vh + 205px); }
}

/* ---------- phones: keep the GPU for the scene ---------- */
@media (max-width: 900px), (pointer: coarse) {
  .cx-atmos::after { mix-blend-mode: normal; opacity: .18; }          /* no full-screen blend every frame */
  body.home-cinema.scrolled .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(7, 8, 11, .92); }
}
/* The mobile menu covers the scene: dim what shows at the edges while it animates. */
html.nav-open .cx-canvas canvas { opacity: .25; transition: opacity .3s ease; }

@media (max-width: 760px) {
  [dir="rtl"] .cx-rv { --dx: 16px; }  [dir="ltr"] .cx-rv { --dx: -16px; }   /* calmer entrances on phones */
}

/* =====================================================================
   PHONES — a fixed stage with cross-fading captions (html.cx-m)
   Acts stay tall so the page still scrolls natively; their layers sit
   fixed on screen and cross-fade by --vis (set by the script).
   ===================================================================== */
.cx-m .cx-act .cx-layer {
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100svh;
  opacity: var(--vis, 0); pointer-events: none;
}
.cx-m .cx-act .cx-layer.is-live { pointer-events: auto; }
.cx-m .cx-act .cx-layer.is-off { visibility: hidden; }
.cx-m .cx-rv {                       /* one calm movement per caption, driven by the cross-fade */
  opacity: 1 !important;
  translate: 0 calc((1 - var(--vis, 1)) * 14px) !important;
}
.cx-m .cx-cue { opacity: calc(var(--vis, 1)); }
