/* Reel designs (reel.js): comedy scenes that play like a short video. Motion = transform / opacity only. */

.hx.rl { display: block; padding: 0; min-height: 0; text-align: center; }
.rl-stage { position: relative; height: max(calc(100svh - 44px), 600px); overflow: hidden; isolation: isolate; user-select: none; -webkit-user-select: none; background: var(--rl-bg); }
.rl-wash { position: absolute; inset: -10%; z-index: 0; opacity: 0; filter: blur(18px) saturate(1.1); transition: opacity .9s ease; }
.rl-wash.on { opacity: var(--rl-wash-o, .85); }
.rl-scene { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 70px 22px 40px; pointer-events: none; }
.rl-s { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.rl-text { margin: 0; font-family: var(--rl-font); font-weight: 800; font-size: clamp(34px, 10.5vw, 54px); line-height: 1.15; color: var(--rl-ink); text-wrap: balance; }
.rl-line { display: inline; }
.rl-text .hl { color: var(--rl-hl-ink); background: var(--rl-hl); padding: 0 .18em; border-radius: .12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.rl-w { display: inline-block; opacity: 0; animation: rlPop .5s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes rlPop { from { opacity: 0; transform: translateY(18px) scale(.6); } to { opacity: 1; transform: none; } }
.fx-shake .rl-text { animation: rlIn .3s ease both, rlShake .45s ease-in-out .3s 3; }
@keyframes rlShake { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-8px) rotate(-2deg); } 75% { transform: translateX(8px) rotate(2deg); } }
@keyframes rlIn { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }
.fx-zoom .rl-text { animation: rlZoom .9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rlZoom { from { opacity: 0; transform: scale(2.6); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.fx-stamp .rl-text { font-size: clamp(64px, 24vw, 120px); letter-spacing: .02em; color: var(--rl-stamp-ink); background: var(--rl-stamp); padding: .05em .35em; border-radius: .08em; transform: rotate(-8deg); animation: rlStamp .55s cubic-bezier(.3,1.7,.5,1) both; box-shadow: 0 10px 0 rgba(0,0,0,.18); }
@keyframes rlStamp { from { opacity: 0; transform: rotate(-8deg) scale(3.2); } 60% { opacity: 1; } to { opacity: 1; transform: rotate(-8deg) scale(1); } }
.fx-stamp { animation: rlThud .4s ease .32s; }
@keyframes rlThud { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-6px, 4px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-3px, 2px); } }
.fx-question .rl-text { animation: rlIn .35s ease both; }
.fx-question .rl-text::after { content: '???'; display: inline-block; margin-left: .1em; color: var(--rl-hl); animation: rlBounce .7s ease-in-out .4s infinite alternate; }
@keyframes rlBounce { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-10px) rotate(6deg); } }
.fx-type .rl-text { font-size: clamp(30px, 9vw, 46px); }
.fx-type .rl-text::after { content: '|'; margin-left: 2px; animation: rlCaret .8s steps(2) infinite; }
@keyframes rlCaret { 50% { opacity: 0; } }
.fx-names .rl-text { font-family: var(--rl-name-font); font-weight: 400; font-size: clamp(40px, 12vw, 64px); }

/* cut-out photos slide in */
.rl-photos { display: flex; justify-content: center; align-items: flex-end; gap: 4px; width: 100%; }
.rl-photos:empty { display: none; }
.rl-photo { max-height: 44svh; max-width: 70%; object-fit: contain; filter: drop-shadow(0 14px 18px rgba(0,0,0,.25)); animation: rlPhoto .7s cubic-bezier(.2,1.2,.4,1) both; }
.rl-photos.n2 .rl-photo { max-width: 49%; }
.rl-photo.l { animation-name: rlPhotoL; } .rl-photo.r { animation-name: rlPhotoR; animation-delay: .15s; }
@keyframes rlPhoto { from { opacity: 0; transform: translateY(60px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes rlPhotoL { from { opacity: 0; transform: translateX(-80px) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes rlPhotoR { from { opacity: 0; transform: translateX(80px) rotate(6deg); } to { opacity: 1; transform: none; } }

/* last scene: date & venue */
.fx-details { animation: rlIn .6s ease both; gap: 6px; pointer-events: auto; }
.rl-names { margin: 0 0 10px; font-family: var(--rl-name-font); font-size: clamp(40px, 12vw, 60px); line-height: 1.1; color: var(--rl-ink); }
.rl-d-date { margin: 0; font-family: var(--rl-name-font); font-size: clamp(30px, 9vw, 42px); color: var(--rl-ink); }
.rl-d-sub, .rl-d-venue { margin: 0; font-family: var(--rl-name-font); font-size: clamp(22px, 6.5vw, 30px); color: var(--rl-ink); }
.rl-ending { margin: 18px 0 0; min-height: 1.4em; font-family: var(--rl-name-font); font-size: clamp(24px, 7vw, 34px); color: var(--rl-ink); }
.rl-more { margin-top: 18px; padding: 12px 22px; border-radius: 999px; text-decoration: none; font-family: var(--f-caps); font-size: 12.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--rl-btn-ink); background: var(--rl-btn); }
.rl-replay { width: 42px; height: 42px; margin-top: 10px; border-radius: 50%; border: 1px solid currentColor; background: transparent; color: var(--rl-ink); font-size: 20px; cursor: pointer; }

/* story-style progress */
.rl-bars { position: absolute; left: 10px; right: 10px; top: 10px; z-index: 6; display: flex; gap: 4px; }
.rl-bars i { flex: 1; height: 3px; border-radius: 3px; background: var(--rl-bar-bg, rgba(0,0,0,.18)); overflow: hidden; }
.rl-bars b { display: block; height: 100%; background: var(--rl-bar, rgba(0,0,0,.65)); transform-origin: 0 50%; transform: scaleX(0); }
.rl-bars i.done b { transform: scaleX(1); }
.rl-bars i.now b { animation: rlBar linear forwards; }
@keyframes rlBar { to { transform: scaleX(1); } }
.rl-stage.paused .rl-bars i.now b, .rl-stage.paused .rl-w, .rl-stage.paused .rl-text { animation-play-state: paused; }
.rl-tap { position: absolute; top: 0; bottom: 0; z-index: 5; width: 35%; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rl-tap.prev { left: 0; } .rl-tap.next { right: 0; width: 65%; }
.fx-details ~ * , .rl-stage:has(.fx-details) .rl-tap { pointer-events: none; }
.rl-stage:has(.fx-details) .rl-tap.prev { pointer-events: auto; width: 18%; }

/* ===== Watercolour (like a hand-made reel) ===== */
.reel-watercolor { --rl-bg: #fbfaf7; --rl-font: 'Baloo Chettan 2', 'Anek Malayalam', system-ui, sans-serif; --rl-name-font: var(--f-script), 'Baloo Chettan 2', cursive; --rl-ink: #111; --rl-hl: #ffe14d; --rl-hl-ink: #111; --rl-stamp: #ffe14d; --rl-stamp-ink: #111; --rl-btn: #111; --rl-btn-ink: #fff; }
.reel-watercolor .rl-text { color: #111; text-shadow: 0 0 1px #fff, 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 0 6px 14px rgba(0,0,0,.18); }
.reel-watercolor .fx-names .rl-text, .reel-watercolor .fx-details p { text-shadow: 0 2px 10px rgba(255,255,255,.9); }
.rl-floral { position: absolute; z-index: 2; width: 62%; opacity: .75; pointer-events: none; }
.rl-floral svg { display: block; width: 100%; }
.rl-floral.tl { left: -6%; top: 2%; }
.rl-floral.br { right: -6%; bottom: 2%; transform: rotate(180deg); }

/* ===== Breaking News ===== */
.reel-news { --rl-bg: linear-gradient(180deg, #0b1d4a, #12306e 60%, #0a1838); --rl-font: 'Oswald', 'Baloo Chettan 2', system-ui, sans-serif; --rl-name-font: 'Oswald', 'Baloo Chettan 2', sans-serif; --rl-ink: #fff; --rl-hl: #e11d2a; --rl-hl-ink: #fff; --rl-stamp: #e11d2a; --rl-stamp-ink: #fff; --rl-btn: #e11d2a; --rl-btn-ink: #fff; --rl-bar: #fff; --rl-bar-bg: rgba(255,255,255,.25); --rl-wash-o: .25; }
.reel-news .rl-text { font-weight: 700; text-transform: uppercase; letter-spacing: .01em; text-shadow: 0 4px 0 rgba(0,0,0,.35); }
.reel-news .rl-scene { padding-top: 110px; padding-bottom: 90px; }
.rl-news-top { position: absolute; left: 0; right: 0; top: 26px; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #e11d2a; color: #fff; font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: .06em; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.rl-live { padding: 1px 8px; border-radius: 3px; background: #fff; color: #e11d2a; font-size: 14px; animation: rlCaret 1s steps(2) infinite; }
.rl-ticker { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; overflow: hidden; white-space: nowrap; padding: 9px 0; background: #ffd400; color: #111; font-family: 'Oswald', sans-serif; font-weight: 500; font-size: 17px; text-transform: uppercase; }
.rl-ticker span { display: inline-block; padding-left: 100%; animation: rlTicker 16s linear infinite; }
@keyframes rlTicker { to { transform: translateX(-100%); } }

/* ===== Movie Trailer ===== */
.reel-trailer { --rl-bg: #050505; --rl-font: 'Bebas Neue', 'Baloo Chettan 2', Impact, sans-serif; --rl-name-font: 'Cinzel', var(--f-caps), serif; --rl-ink: #f2efe6; --rl-hl: transparent; --rl-hl-ink: #e8c27a; --rl-stamp: transparent; --rl-stamp-ink: #e8c27a; --rl-btn: #e8c27a; --rl-btn-ink: #111; --rl-bar: #e8c27a; --rl-bar-bg: rgba(255,255,255,.18); --rl-wash-o: .12; }
.reel-trailer .rl-text { font-weight: 400; letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 0 30px rgba(232,194,122,.25); }
.reel-trailer .fx-stamp .rl-text { transform: none; box-shadow: none; letter-spacing: .1em; animation-name: rlZoom; }
.rl-bar-top, .rl-bar-bot { position: absolute; left: 0; right: 0; z-index: 4; height: 11%; background: #000; }
.rl-bar-top { top: 0; } .rl-bar-bot { bottom: 0; }
.reel-trailer .rl-bars { top: calc(11% - 14px); }
.rl-grain { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: .14; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); animation: rlGrain .5s steps(4) infinite; }
@keyframes rlGrain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } }
.rl-flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
.reel-trailer .rl-stage.flash .rl-flash { animation: rlFlash .45s ease-out; }
@keyframes rlFlash { 0% { opacity: .55; } 100% { opacity: 0; } }

/* ===== Comic Pop ===== */
.reel-comic { --rl-bg: #ffd84d; --rl-font: 'Bangers', 'Baloo Chettan 2', Impact, sans-serif; --rl-name-font: 'Bangers', 'Baloo Chettan 2', sans-serif; --rl-ink: #111; --rl-hl: #ff3b5c; --rl-hl-ink: #fff; --rl-stamp: #ff3b5c; --rl-stamp-ink: #fff; --rl-btn: #111; --rl-btn-ink: #ffd84d; --rl-wash-o: .5; }
.reel-comic .rl-text { font-weight: 400; letter-spacing: .03em; background: #fff; padding: .25em .5em; border: 4px solid #111; border-radius: 22px; box-shadow: 7px 7px 0 #111; position: relative; }
.reel-comic .rl-text::before { content: ''; position: absolute; left: 22%; bottom: -24px; border: 12px solid transparent; border-top: 16px solid #111; }
.reel-comic .fx-stamp .rl-text { border-radius: 0; clip-path: polygon(50% 0, 61% 18%, 82% 8%, 78% 30%, 100% 36%, 82% 52%, 98% 72%, 74% 70%, 70% 96%, 52% 78%, 32% 100%, 30% 74%, 4% 80%, 18% 56%, 0 38%, 22% 30%, 16% 6%, 38% 18%); padding: .6em .7em; box-shadow: none; border: 0; }
.reel-comic .fx-stamp .rl-text::before { display: none; }
.rl-dots { position: absolute; inset: 0; z-index: 1; opacity: .35; background-image: radial-gradient(#e2a600 22%, transparent 24%); background-size: 14px 14px; }

/* ===== cover: Tap to play ===== */
.envelope.ev-play { overflow: hidden; background: var(--rl-bg, #fbfaf7); }
.ev-play .evp-txt { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 0 30px; text-align: center; color: var(--rl-ink, #111); }
.ev-play p { margin: 0; }
.evp2-greet { font-family: var(--f-script); font-size: calc(26px * var(--ss)); }
.evp2-l1 { font-family: var(--rl-font, sans-serif); font-weight: 800; font-size: clamp(28px, 8.5vw, 40px); line-height: 1.15; }
.evp2-l2 { font-family: var(--f-caps); font-size: 13px; letter-spacing: .24em; text-transform: uppercase; opacity: .85; }
.evp2-sound { font-size: 13px; opacity: .7; animation: cerBob 2.4s ease-in-out infinite; }
.ev-play .seal { position: relative; left: auto; top: auto; margin: 6px 0; width: 96px; height: 96px; border-radius: 50%; background: var(--rl-btn, #111); box-shadow: 0 12px 30px rgba(0,0,0,.3); animation: rlPulse 1.6s ease-in-out infinite; }
.ev-play .seal > * { display: none; }
.ev-play .seal::after { content: ''; margin-left: 8px; border-style: solid; border-width: 18px 0 18px 30px; border-color: transparent transparent transparent var(--rl-btn-ink, #fff); }
@keyframes rlPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,.25), 0 12px 30px rgba(0,0,0,.3); } 50% { box-shadow: 0 0 0 16px rgba(0,0,0,0), 0 12px 30px rgba(0,0,0,.3); } }
.cover-playreel.opening .envelope.ev-play { opacity: 0; transform: scale(1.15); transition: opacity .6s ease .2s, transform .8s ease; }
.ev-play.reel-trailer .evp2-l1, .ev-play.reel-news .evp2-l1 { text-transform: uppercase; }

.hx-nav[class*="hx-nav-reel-"] { --hx-navbg: rgba(255, 255, 255, .92); --hx-navink: #111; }
.hx-nav.hx-nav-reel-news, .hx-nav.hx-nav-reel-trailer { --hx-navbg: rgba(10, 10, 12, .9); --hx-navink: #f2efe6; }

@media (prefers-reduced-motion: reduce) { .rl-w, .rl-text, .rl-photo, .rl-grain, .rl-ticker span { animation: none !important; opacity: 1 !important; } }

/* whole page colours per look (page.matchPage) */
body[data-page="reel-watercolor"] { --bg: #fbfaf7; --paper: #ffffff; --ink: #1f1f1f; --text: #3a3a3a; --muted: #777; --gold: #d4a017; --soft: #f3ecd2; --env: #2b2b2b; --env-2: #1f1f1f; --env-deep: #111; --cover-text: #111; --dark-1: #1f1f1f; --dark-2: #111; --on-dark: #fff; }
body[data-page="reel-news"] { --bg: #0b1d4a; --paper: #12306e; --ink: #ffffff; --text: #e8eefc; --muted: #a9b6d6; --gold: #ffd400; --soft: rgba(255,212,0,.12); --env: #e11d2a; --env-2: #b5141f; --env-deep: #0b1d4a; --cover-text: #fff; --dark-1: #e11d2a; --dark-2: #0b1d4a; --on-dark: #fff; color-scheme: dark; }
body[data-page="reel-trailer"] { --bg: #070707; --paper: #141414; --ink: #e8c27a; --text: #ece6d6; --muted: #a39b8a; --gold: #e8c27a; --soft: rgba(232,194,122,.1); --env: #141414; --env-2: #0c0c0c; --env-deep: #000; --cover-text: #e8c27a; --dark-1: #1a1a1a; --dark-2: #000; --on-dark: #f2efe6; color-scheme: dark; }
body[data-page="reel-comic"] { --bg: #fff3c4; --paper: #ffffff; --ink: #111; --text: #222; --muted: #555; --gold: #ff3b5c; --soft: #ffe58a; --env: #ff3b5c; --env-2: #e02a49; --env-deep: #111; --cover-text: #111; --dark-1: #111; --dark-2: #000; --on-dark: #ffd84d; }
body[data-page="reel-comic"] main .card { border: 3px solid #111; box-shadow: 6px 6px 0 #111; }

/* fixes: a clean play button, stamps that fit, comic burst colours, typewriter keeps its lines */
.ev-play .seal::before { display: none; }
.ev-play .seal::after { position: static; inset: auto; width: 0; height: 0; margin-left: 8px; border-radius: 0; background: none; box-shadow: none; transform: none; border-style: solid; border-width: 18px 0 18px 30px; border-color: transparent transparent transparent var(--rl-btn-ink, #fff); }
.fx-stamp .rl-text { font-size: min(clamp(64px, 24vw, 120px), calc(78vw / (var(--len, 4) * .66))); white-space: nowrap; }
.reel-comic .fx-stamp .rl-text { background: var(--rl-stamp); color: var(--rl-stamp-ink); }
.fx-type .rl-text { white-space: pre-line; }
