/* ApostoliCards waitlist — "Cinéma" layer. Everything motion-related is
   scoped to html.cine (set by wow.js when motion is allowed); html.calm is
   the reduced-motion presentation. Without JS the base site is untouched. */

html {
  --gold-light: #f3e2b5;
  --glow: 220 195 140;
  --crimson-glow: 217 87 108;
  --sheen: 214 190 255;
  --error: #f4aab6;
  --veil: var(--bg);
  --halo-core: 243 226 181 / .34;
  --halo-mid: 112 100 168;
}
html[data-theme=light] {
  --gold-light: #fff7e2;
  --glow: 176 137 74;
  --crimson-glow: 166 45 66;
  --error: #8e1f33;
  --halo-core: 255 252 242 / .9;
  --halo-mid: 229 218 237;
}

/* ---------- shared: form status ---------- */
.cine-status {
  min-block-size: 1.5em;
  margin: .75rem 0 0;
  font-weight: 600;
  font-size: .95rem;
}
.cine-status[data-state=invalid] { color: var(--error); }
.cine-status[data-state=success] { color: var(--gold); }
.entry input[aria-invalid=true] { border-color: var(--error); }

/* ---------- calm mode ---------- */
.calm .fade { opacity: 0; transition: opacity .8s ease; }
.calm .fade.in { opacity: 1; }

/* ---------- cinema: frame ---------- */
.cine header { position: sticky; top: 0; z-index: 30; }
.cine main :is(section, .cine-track) { scroll-margin-top: var(--HH); }
.cine main > section { overflow: visible; overflow-x: clip; }
.cine-sr {
  position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- hero ---------- */
.cine .cine-track { block-size: calc(var(--VH) * 1.25); }
.cine .cine-track:not(.is-loose) > .hero {
  position: sticky;
  top: var(--HH);
  block-size: calc(var(--VH) - var(--HH));
  min-block-size: 0;
}
.cine .cine-track.is-loose { block-size: auto; }
.cine .hero .margin img { will-change: transform, opacity; transform-origin: 50% 50%; }
.cine .hero h1 { perspective: 900px; transform-origin: 50% 55%; will-change: transform; }
.cine .hero .center > * { will-change: transform, opacity; }
.cine-split { display: inline; }
.cine-w { display: inline-block; white-space: nowrap; }
.cine-ch { display: inline-block; will-change: transform, opacity; }
.cine .cine-halo,
.cine .cine-aureole {
  position: absolute; left: 50%; top: 42%; z-index: -2; pointer-events: none;
  inline-size: min(110vmin, 1100px); aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%); opacity: 0; will-change: transform, opacity;
}
.cine .cine-halo {
  background: radial-gradient(circle, rgb(var(--halo-core)) 0, rgb(var(--halo-mid) / .55) 24%, rgb(var(--halo-mid) / .18) 44%, transparent 66%);
}
.cine .cine-aureole {
  inline-size: min(150vmin, 1500px);
  background: repeating-conic-gradient(from 0deg, rgb(var(--glow) / .085) 0deg .8deg, transparent .8deg 6deg);
  -webkit-mask: radial-gradient(circle, transparent 18%, #000 30%, #000 44%, transparent 68%);
  mask: radial-gradient(circle, transparent 18%, #000 30%, #000 44%, transparent 68%);
}
.cine .cine-veil {
  position: absolute; inset: 0; z-index: 5; background: var(--veil);
  opacity: 0; pointer-events: none;
}
.cine .hero-actions { z-index: 4; }

/* ---------- pinned sequences ---------- */
.cine .cine-seq { padding-block: 0; align-items: start; isolation: isolate; }
.cine #game { --len: 1.35; }
.cine #traditions { --len: 1.6; }
.cine #languages { --len: 1.2; }
.cine .cine-wrap { block-size: calc(var(--VH) * var(--len)); min-inline-size: 0; }
.cine .cine-stage {
  position: sticky; top: var(--HH);
  block-size: calc(var(--VH) - var(--HH));
  display: grid; place-items: center;
}
.cine .cine-stage > * { inline-size: 100%; }
.cine .cine-seq > .words { position: sticky; top: var(--wt, var(--HH)); z-index: 2; }
.cine .cine-seq > .words > * { will-change: transform, opacity; }
.cine .cine-seq.is-loose .cine-wrap { block-size: auto; padding-block: clamp(48px, 7vw, 100px); }
.cine .cine-seq.is-loose .cine-stage { position: relative; top: auto; block-size: auto; }
.cine .cine-seq.is-loose > .words { position: relative; top: auto; }
.cine .reverse .cine-wrap { order: 2; }

/* (1) booster */
.cine .pack { perspective: 1400px; }
.cine .pack .cine-pack3d {
  position: absolute; inset: 0 12%; z-index: 1;
  transform-style: preserve-3d; will-change: transform, opacity; opacity: 0;
}
.cine .cine-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cine .pack .cine-face img.foil {
  position: absolute; inset: 0; inline-size: 100%; block-size: 100%;
  object-fit: contain; transform: none; animation: none;
  filter: drop-shadow(2px 14px 18px #09071166);
}
.cine .cine-face--back {
  transform: rotateY(180deg);
  background: var(--pack-src) center / contain no-repeat;
  filter: brightness(.48) saturate(1.25) hue-rotate(-8deg);
}
.cine .cine-sweep {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0;
  -webkit-mask: var(--pack-mask) center / contain no-repeat;
  mask: var(--pack-mask) center / contain no-repeat;
}
.cine .cine-sweep i {
  position: absolute; inset: -10% auto -10% 0; inline-size: 55%;
  background: linear-gradient(100deg, transparent 8%, rgb(255 238 200 / .08) 26%, rgb(255 243 214 / .78) 46%, rgb(var(--sheen) / .5) 55%, rgb(160 226 255 / .22) 63%, transparent 84%);
  will-change: transform;
}
.cine .cine-pack-glow {
  position: absolute; left: 10%; right: 10%; top: 8%; bottom: 8%; z-index: 0;
  border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgb(var(--glow) / .42), rgb(var(--sheen) / .12) 55%, transparent);
  will-change: transform, opacity;
}
.cine .pack :is(.pack-vine, .pack-clasp) { animation: none; opacity: 0; will-change: transform, opacity; }

/* (2) Saint George carousel */
.cine .portrayal-gallery { --fw: clamp(160px, 16vw, 240px); }
.cine .portrayals {
  display: block; position: relative; min-block-size: 0;
  block-size: calc(var(--fw) * 1.42); padding: 0;
  perspective: 1200px; perspective-origin: 50% 40%;
}
.cine .cine-ring { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform, opacity; }
.cine .cine-ring .artwork-frame {
  position: absolute; left: 50%; top: 50%; inline-size: var(--fw);
  margin: 0; animation: none; will-change: transform, opacity;
  transition: box-shadow .5s ease, border-color .5s ease;
}
.cine .cine-ring .artwork-frame.is-front {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 1px rgb(var(--glow) / .5), 0 18px 50px -12px rgb(var(--glow) / .55), 1px 5px 5px #09071138;
}
.cine .cine-credits { display: grid; margin-block-start: 1.1rem; }
.cine .cine-credits > p { grid-area: 1 / 1; margin: 0; pointer-events: none; will-change: opacity, transform; }
.cine .cine-credits > p.is-active { pointer-events: auto; }

/* (3) languages */
.cine .languages ul { position: relative; z-index: 1; }
.cine .languages li { will-change: transform, opacity; transform-origin: 30% 50%; }
.cine .languages li.is-locked a { animation: cine-lock 1.1s ease-out 1; }
@keyframes cine-lock { 0% { color: var(--gold-light); text-shadow: 0 0 18px rgb(var(--glow) / .8); } 100% { color: inherit; text-shadow: none; } }
.cine .cine-cascade {
  position: absolute; top: 0; block-size: 100%; z-index: 0; overflow: hidden;
  pointer-events: none; opacity: 0;
}
.cine .cine-ghost {
  position: absolute; top: 0; white-space: nowrap;
  font-family: Georgia, LocalSans, LocalEthiopic, LocalDevanagari, LocalArabic, LocalChinese, serif;
  color: rgb(var(--glow) / .09); line-height: 1; will-change: transform;
}

/* (4) waitlist */
.cine .closing.cine-close {
  display: grid; grid-template-columns: minmax(0, 1fr); padding: 0;
  align-items: start; isolation: isolate;
  min-block-size: calc(var(--VH) * 1.3);
}
.cine .cine-close > * { grid-area: 1 / 1; }
.cine .cine-stage--closing {
  position: sticky; top: var(--HH); display: block;
  block-size: calc(var(--VH) - var(--HH)); overflow: hidden; pointer-events: none;
}
.cine .cine-camera { position: absolute; inset: 0; will-change: transform; }
.cine .cine-frag {
  position: absolute; left: 0; top: 0; block-size: auto; max-inline-size: none;
  filter: drop-shadow(1px 6px 8px #09071155); opacity: 0; will-change: transform, opacity;
}
.cine .cine-close > .words {
  position: relative; z-index: 2; justify-self: center;
  inline-size: min(36rem, calc(100% - 32px));
  margin-block: var(--cwt, 24px) calc(var(--VH) * .32);
  padding: clamp(22px, 3vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
  border-radius: 6px;
  box-shadow: 0 30px 80px -30px #090711aa, inset 0 1px 0 rgb(var(--glow) / .14);
  will-change: transform, opacity;
}
.cine .cine-confirm {
  position: absolute; left: 50%; top: 50%; z-index: 3; opacity: 0;
  inline-size: min(30rem, calc(var(--ring, 240px) * 1.22)); text-align: center;
  transform: translate(-50%, -50%);
}
.cine .cine-confirm::before {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: -1;
  inline-size: 170%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%) scale(.4); opacity: 0;
  background: radial-gradient(closest-side, rgb(var(--glow) / .38), rgb(var(--glow) / .1) 55%, transparent);
}
.cine .is-success .cine-confirm::before { animation: cine-bloom 1.6s cubic-bezier(.2, .7, .1, 1) forwards; }
@keyframes cine-bloom { to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.cine .cine-confirm-mark { inline-size: 44px; block-size: 44px; display: block; margin: 0 auto 14px; }
.cine .cine-confirm-text {
  margin: 0; font: clamp(24px, 4.2vw, 54px)/1.08 Georgia, 'Times New Roman', serif;
  letter-spacing: -.04em; color: var(--ink); text-wrap: balance;
}
html:is([lang=ar], [lang=hi], [lang=am], [lang|=zh], [lang=ja], [lang=ko]) .cine-confirm-text { letter-spacing: normal; line-height: 1.3; font-family: LocalSans, LocalEthiopic, LocalDevanagari, LocalArabic, LocalChinese, LocalJapanese, LocalKorean, sans-serif; }
html[lang=zh-Hant] .cine-confirm-text { font-family: LocalTraditionalChinese, LocalSans, sans-serif; }
.cine .is-success > .words { pointer-events: none; }

/* Crimson CTA pulse */
.cine .closing .cta { position: relative; isolation: isolate; }
.cine .closing .cta::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1;
  border: 2px solid rgb(var(--crimson-glow)); opacity: 0; pointer-events: none;
  animation: cine-pulse 2.4s cubic-bezier(.2, .6, .3, 1) infinite;
}
.cine .closing .cta::before {
  content: ""; position: absolute; inset: -14px; border-radius: 14px; z-index: -2; pointer-events: none;
  background: radial-gradient(closest-side, rgb(var(--crimson-glow) / .45), transparent);
  animation: cine-breathe 2.4s ease-in-out infinite;
}
@keyframes cine-pulse { 0% { opacity: .8; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.14, 1.55); } }
@keyframes cine-breathe { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
.cine .cine-shake .entry { animation: cine-shake .42s cubic-bezier(.36, .07, .19, .97) 1; }
@keyframes cine-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* Pause loops: motion toggle and off-screen sections */
html[data-motion=paused].cine .closing .cta::before,
html[data-motion=paused].cine .closing .cta::after,
.cine .cine-off .cta::before,
.cine .cine-off .cta::after,
.cine .cine-off :is(.margin img, .ensemble > img) { animation-play-state: paused; }

/* ---------- margin rail + mobile bar ---------- */
.cine-rail {
  position: fixed; inset-inline-end: 18px; top: 50%; z-index: 25;
  display: grid; gap: 10px; transform: translateY(-50%); pointer-events: none;
}
[data-cine-frame] { position: relative; }
[data-cine-frame] > .cine-rail { position: absolute; }
.cine-rail-item {
  display: grid; grid-template-columns: auto auto; justify-items: end; align-items: center;
  column-gap: 8px; color: var(--dim);
  font: 600 10px/1 Arial, LocalSans, sans-serif; letter-spacing: .14em;
}
html[lang=ar] .cine-rail-item { letter-spacing: normal; }
.cine-rail-num { grid-column: 2; opacity: .7; transition: color .3s, opacity .3s; }
.cine-rail-label {
  grid-column: 1; grid-row: 1; text-transform: uppercase; color: var(--gold);
  opacity: 0; transform: translateX(6px); transition: opacity .35s, transform .35s;
  white-space: nowrap; background: color-mix(in srgb, var(--bg) 80%, transparent); padding: 3px 5px; border-radius: 3px;
}
[dir=rtl] .cine-rail-label { transform: translateX(-6px); }
.cine-rail-line {
  grid-column: 2; justify-self: center; inline-size: 1px; block-size: 26px;
  background: color-mix(in srgb, var(--rule) 70%, transparent); position: relative; overflow: hidden;
}
.cine-rail-line i { position: absolute; inset: 0; background: var(--gold); transform-origin: top; transform: scaleY(0); }
.cine-rail-item.is-active .cine-rail-num { color: var(--gold); opacity: 1; }
.cine-rail-item.is-active .cine-rail-label { opacity: 1; transform: none; }
.cine-rail-item:last-child .cine-rail-line { display: none; }
.cine-bar { display: none; }
@media (width <= 1100px) { .cine-rail { display: none; } }
@media (width <= 1100px) {
  .cine .cine-bar {
    display: block; position: absolute; left: 0; right: 0; bottom: -1px; block-size: 2px; pointer-events: none;
  }
  .cine .cine-bar i { position: absolute; inset: 0; background: var(--gold); transform-origin: left; transform: scaleX(0); }
  [dir=rtl] .cine .cine-bar i { transform-origin: right; }
}

/* ---------- mobile: shorter pins, same story ---------- */
@media (width <= 700px) {
  .cine .cine-track { block-size: calc(var(--VH) * 1.2); }
  .cine #game { --len: 1.25; }
  .cine #traditions { --len: 1.5; }
  .cine #languages { --len: 1.15; }
  .cine .cine-seq { gap: 0; padding-inline: 7%; }
  .cine .cine-seq > .words { position: relative; top: auto; padding-block: 8px 46px; }
  .cine .reverse .cine-wrap { order: -1; }
  .cine .languages .cine-wrap { order: 2; }
  .cine .languages > .words { padding-block: 46px 0; }
  .cine .portrayal-gallery { --fw: min(48vw, 210px); }
  .cine .pack { inline-size: min(97%, 420px); min-block-size: min(calc(var(--VH) * .52), 470px); }
  .cine .cine-close > .words { background: color-mix(in srgb, var(--bg) 95%, transparent); }
  .cine .closing.cine-close { padding: 0; }
  .cine .cine-close > .words { inline-size: calc(100% - 24px); }
  .cine .cine-halo { inline-size: 130vmin; }
}

/* Keep the carousel and its labels inside the content column. */
@media (width > 1100px) {
  .cine #traditions .cine-wrap { overflow: clip; margin-inline-end: 150px; }
}
.motion-calm .cine-rail, .motion-calm .cine-bar { display: none; }
