/* ==========================================================================
   Hero carousel and the conversion demo inside it (homepage only).
   Markup: home/partials/hero-carousel.php + hero-promo.php
   Driver: assets/js/promo.js

   How the demo's choreography works
   - One scene is visible at a time (.scene.is-on). The driver only toggles
     that class; switching display none -> flex restarts every CSS animation
     inside the scene, so each scene replays itself from the top.
   - Every element's *base* styles are its FINAL state, and keyframes animate
     in from the hidden/empty state (`both` fill holds the `from` frame during
     the delay). That way "animations off" — reduced motion, or an old engine —
     leaves a complete, readable screen rather than a blank one.
   - Per-element timing comes from --d (delay) set inline in the markup, so the
     storyboard stays visible next to the content it belongs to.
   ========================================================================== */

/* ==========================================================================
   Hero carousel
   Sits in the hero's left column, under the headline and beside the live
   converter; on small screens it drops below the converter so the thing you
   came to use stays at the top.
   ========================================================================== */
/* The headline sits above the carousel in its own block — it is the page's
   strongest signal, so it must be visible on arrival rather than parked on a
   slide that starts hidden. The carousel then owns the rest of the column. */
.convert-hero .container > .hero-head { grid-column: 1; grid-row: 1; }
.convert-hero .container > .converter { grid-column: 2; grid-row: 1 / span 2; }
.hero-carousel { grid-column: 1; grid-row: 2; min-width: 0; margin-top: var(--s4); }

.hero-head h1 { font-size: 28px; letter-spacing: -.02em; margin-bottom: var(--s2); }
.hero-head .lede { font-size: 15px; color: var(--text-2); max-width: 440px; margin-bottom: 0; }

/* Free codes page: the carousel sits in the page head's place, above the list. */
.page .hero-carousel { margin-bottom: var(--s6); padding-bottom: var(--s6); border-bottom: 1px solid var(--border); }

.carousel-viewport { overflow: hidden; }
.carousel-track {
    display: flex; align-items: flex-start;
    transform: translate3d(calc(var(--i, 0) * -100%), 0, 0);
    transition: transform .45s cubic-bezier(.4, 0, .2, 1), height .35s ease;
}
/* Inactive slides are made `inert` by the driver (out of the tab order and the
   a11y tree) and hidden once the slide has finished moving — the delay keeps
   the outgoing slide on screen for the whole transition, and hiding it stops
   the phone's shadow bleeding past the clip edge. */
.carousel-slide {
    flex: 0 0 100%; min-width: 0;
    visibility: hidden; transition: visibility 0s .45s;
}
.carousel-slide.is-active { visibility: visible; transition-delay: 0s; }

.carousel-nav { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); }
.carousel-arrow {
    width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
    border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer;
}
.carousel-arrow:hover { background: var(--bg-muted); color: var(--text); }
.carousel-arrow:focus-visible, .carousel-dots button:focus-visible {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus);
}
.carousel-dots { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.carousel-dots button {
    width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
    background: var(--border-strong); cursor: pointer; transition: width .25s ease, background-color .25s ease;
}
.carousel-dots button.is-active { width: 20px; border-radius: 999px; background: var(--primary); }

/* ==========================================================================
   The demo itself — a carousel slide on the homepage, and a standalone block
   on the viewer and free-codes pages.
   ========================================================================== */
.promo {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    gap: var(--s5);
    align-items: center;
}
.promo-copy { max-width: 540px; }

/* On the free codes page the carousel spans the full container, so the demo
   is centred as a pair rather than hugging the left edge. */
.page .promo { grid-template-columns: 268px minmax(0, 520px); gap: var(--s8); justify-content: center; }
.page .carousel-nav { justify-content: center; }

/* ---------- copy column ---------- */
.promo-copy h2 { font-size: 20px; letter-spacing: -.015em; margin-bottom: var(--s2); }
.promo-copy .lede { font-size: 14px; color: var(--text-2); max-width: 420px; margin-bottom: var(--s4); }

.promo-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: none; }
.promo-steps li {
    display: flex; gap: 10px; align-items: flex-start;
    font-size: 13px; line-height: 1.45; color: var(--text-3);
    padding: 6px 8px; margin-left: -8px; border-radius: var(--r);
    transition: color .25s ease, background-color .25s ease;
}
.promo-steps .n {
    flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-muted); color: var(--text-3);
    font-size: 11px; font-weight: 600; line-height: 1;
    transition: background-color .25s ease, color .25s ease;
}
.promo-steps li.is-done { color: var(--text-2); }
.promo-steps li.is-done .n { background: var(--primary-soft); color: var(--primary-text); }
.promo-steps li.is-on { color: var(--text); background: var(--bg-subtle); }
.promo-steps li.is-on .n { background: var(--primary); color: #fff; }

.promo-controls { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); max-width: 420px; }
.promo-toggle {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; cursor: pointer;
}
.promo-toggle:hover { background: var(--bg-muted); color: var(--text); }
.promo-toggle:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.promo-track { flex: 1; height: 4px; border-radius: 999px; background: var(--bg-muted); overflow: hidden; }
.promo-bar {
    display: block; height: 100%; border-radius: 999px; background: var(--primary);
    transform: scaleX(0); transform-origin: left;
    animation: promo-bar var(--dur, 4s) linear both;
}
@keyframes promo-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.promo-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- device ---------- */
.promo-phone { display: flex; justify-content: center; }
.promo-device {
    position: relative; width: 268px; padding: 9px;
    background: #16191d; border-radius: 30px;
    box-shadow: var(--shadow-pop);
}
.promo-notch {
    position: absolute; z-index: 6; top: 13px; left: 50%; transform: translateX(-50%);
    width: 62px; height: 5px; border-radius: 999px; background: #2c3239;
}
.promo-screen {
    position: relative; height: 420px; overflow: hidden;
    background: var(--bg); border-radius: 22px;
}

.promo .scr-bar {
    position: absolute; z-index: 5; top: 0; left: 0; right: 0; height: 24px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px; background: var(--bg);
    font-size: 9.5px; font-weight: 600; color: var(--text-3);
    font-variant-numeric: tabular-nums;
}
.promo .scr-bar .dots { display: flex; gap: 3px; }
.promo .scr-bar .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); }

/* ---------- scenes ---------- */
.promo .scene { position: absolute; inset: 24px 0 0; display: none; flex-direction: column; }
.promo .scene.is-on { display: flex; animation: scene-in .4s ease both; }
@keyframes scene-in { from { opacity: 0; transform: translateX(14px); } }

.promo .scr-head {
    display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
    padding: 9px 12px; min-height: 38px;
    background: var(--bg-subtle); border-bottom: 1px solid var(--border);
    font-size: 11.5px; font-weight: 600; color: var(--text);
}
.promo .scr-head img { object-fit: contain; border-radius: 4px; background: #fff; }
.promo .scr-head.app { background: #16191d; color: #fff; border-bottom-color: #262b31; }
.promo .scr-head.app img { background: none; border-radius: 0; }
.promo .scr-head .units {
    margin-left: auto; font-size: 10px; font-weight: 500;
    padding: 2px 7px; border-radius: 999px;
    background: rgba(255, 255, 255, .12); color: #e6e9ec;
}
.promo .scr-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.promo .scr-note { margin: 0; font-size: 10.5px; line-height: 1.4; color: var(--text-3); animation: rise .4s var(--d, 0s) both; }

/* bet slip */
.promo .mini-slip {
    border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--bg);
    animation: rise .45s var(--d, 0s) both;
}
.promo .mini-slip.flush { border: 0; border-radius: 0; border-top: 1px solid var(--border); animation: none; }
.promo .ms-row {
    display: flex; align-items: center; gap: 8px; padding: 7px 9px;
    border-bottom: 1px solid var(--border); font-size: 11px;
    animation: rise .4s calc(var(--d, 0s)) both;
}
.promo .ms-row:last-child { border-bottom: 0; }
.promo .mini-slip > .ms-row:nth-child(1) { --d: .05s; }
.promo .mini-slip > .ms-row:nth-child(2) { --d: .14s; }
.promo .mini-slip > .ms-row:nth-child(3) { --d: .23s; }
.promo .ms-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.promo .ms-ev { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo .ms-sub { font-size: 10px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo .ms-odds { flex: 0 0 auto; font-family: var(--mono); font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.promo .ms-when { display: flex; align-items: center; gap: 4px; font-size: 9.5px; color: var(--text-3); margin-top: 1px; }
.promo .ms-when .lni { font-size: 10px; }

/* free-codes browse list */
.promo .fb-list { display: grid; gap: 6px; }
.promo .fb-row {
    display: flex; align-items: center; gap: 8px; padding: 7px 9px;
    border: 1px solid var(--border); border-radius: var(--r); background: var(--bg);
    animation: rise .4s var(--d, 0s) both;
}
.promo .fb-row img { object-fit: contain; border-radius: 3px; flex: 0 0 auto; background: #fff; }
.promo .fb-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
/* the one the demo goes on to take */
.promo .fb-row.is-pick { border-color: var(--primary); background: var(--primary-soft); }
.promo .fb-row.is-pick .code { color: var(--primary-text); }
.promo .ms-ic {
    flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--success-soft); color: var(--primary-text); font-size: 9px;
    animation: pop .35s var(--d, 0s) both;
}
.promo .ms-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 9px; border-top: 1px solid var(--border); background: var(--bg-subtle);
    font-size: 10.5px; color: var(--text-3);
    animation: rise .4s calc(var(--d, 0s) + .5s) both;
}
.promo .ms-foot strong { color: var(--text); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* booking-code chrome */
.promo .code-box {
    display: flex; align-items: center; gap: 8px; padding: 8px 9px;
    border: 1px dashed var(--border-strong); border-radius: var(--r); background: var(--bg-subtle);
    animation: rise .45s var(--d, 0s) both;
}
.promo .cb-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.promo .lbl { font-size: 9px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.promo .code { font-family: var(--mono); font-size: 15px; letter-spacing: .09em; color: var(--text); line-height: 1.2; }
.promo .code.sm { font-size: 11px; letter-spacing: .06em; color: var(--text-3); }
/* `forwards`, not `both`: without a backwards fill the highlight stays off
   until its delay is up, instead of sitting lit from the start of the scene. */
.promo .code[data-pulse] { animation: flash 1s var(--d, 0s) forwards; }

/* converter fields. The field itself rises in on --d; --l is when it lights up
   as the step reaches it, and the value inside swaps for the placeholder on
   its own --d. */
.promo .mini-field { display: grid; gap: 4px; animation: rise .4s var(--d, 0s) both; }
.promo .mini-field[data-lit] > .mini-pick, .promo .mini-field[data-lit] > .mini-input { animation: lit 1.1s var(--l, .3s) both; }
.promo .mini-pick, .promo .mini-input {
    position: relative;
    display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 10px;
    border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--bg);
    font-size: 12px; color: var(--text);
}
.promo .mini-pick img { object-fit: contain; border-radius: 3px; flex: 0 0 auto; }
.promo .mini-pick .val > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo .mini-input .code { font-size: 13px; }
/* placeholder sits under the value and clears out as the value lands */
.promo .ph {
    position: absolute; left: 10px; right: 10px;
    color: #858c95; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    opacity: 0; animation: out .15s var(--d, 0s) both;
}
.promo .val { display: flex; align-items: center; gap: 7px; min-width: 0; animation: pop .3s var(--d, 0s) both; }
.promo .mini-swap {
    align-self: center; width: 26px; height: 22px; margin: -4px 0;
    animation: pop .3s var(--d, 0s) both;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--bg); color: var(--text-3); font-size: 11px;
}
/* typed-in code: width grows one character at a time, caret blinks alongside */
.promo .typed {
    display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom;
    font-family: var(--mono); font-size: 13px; letter-spacing: .09em; color: var(--text);
    animation: type .75s steps(var(--len, 6)) var(--d, 0s) both;
}
.promo .caret {
    width: 1.5px; height: 15px; background: var(--primary); opacity: 0;
    animation: caret .5s steps(1, end) var(--d, 0s) 4 forwards;
}

/* conversion progress */
.promo .run-steps { display: grid; gap: 7px; }
.promo .run-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2); animation: rise .35s var(--d, 0s) both; }
.promo .run-row .ic { position: relative; flex: 0 0 auto; width: 14px; height: 14px; }
.promo .run-row .spinner {
    position: absolute; inset: 0; width: 14px; height: 14px; border-width: 1.5px; opacity: 0;
    animation: spin .7s linear infinite, out .2s calc(var(--d, 0s) + .7s) both;
}
.promo .run-row .ic .lni {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--primary);
    animation: pop .3s calc(var(--d, 0s) + .7s) both;
}

/* result */
.promo .result-card, .promo .won-card {
    border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); overflow: hidden;
    animation: pop .45s var(--d, 0s) both;
}
.promo .won-card { border-color: #bfe0cb; }
.promo .rc-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 9px; border-bottom: 1px solid var(--border); background: var(--bg-subtle);
}
.promo .rc-to { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-2); font-weight: 500; }
.promo .rc-to img { object-fit: contain; border-radius: 3px; background: #fff; }
.promo .pill { font-size: 9.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--bg-muted); color: var(--text-2); }
.promo .pill.ok { background: var(--success-soft); color: var(--primary-text); }
.promo .pill.won {
    background: var(--primary); color: #fff; letter-spacing: .1em; text-transform: uppercase;
    animation: stamp .5s var(--d, 0s) both;
}
.promo .rc-code { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px; }
.promo .rc-sub { font-size: 11px; color: var(--text-2); }
/* When a button and the badge share a screen, only the button takes the slack. */
.promo .mini-btn + .won-badge { margin-top: 10px; }

.promo .won-pay {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 9px; border-top: 1px solid #cfe6d8; background: var(--success-soft);
    font-size: 10.5px; color: var(--primary-text);
    animation: rise .4s var(--d, 0s) both;
}
.promo .won-pay strong { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.promo .won-badge {
    margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 7px;
    padding-top: 10px; border-top: 1px dashed var(--border);
    font-size: 10px; color: var(--text-3);
    animation: rise .45s var(--d, 0s) both;
}
.promo .won-badge img { height: 20px; width: auto; object-fit: contain; }

/* tap target + buttons it presses. The tap circle lives inside its button, so
   it stays on target whatever the screen does to the layout. */
.promo .mini-btn {
    position: relative;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 34px; padding: 0 12px; border-radius: var(--r);
    background: var(--primary); color: #fff; font-size: 12px; font-weight: 600;
    animation: press 1s var(--d, 0s) both;
}
.promo .scr-body > .mini-btn { margin-top: auto; }
.promo .mini-btn.sm { min-height: 26px; padding: 0 9px; font-size: 10.5px; flex: 0 0 auto; }
.promo .mini-btn.ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); }
.promo .mini-btn .lni { font-size: 11px; }

.promo .tap {
    position: absolute; z-index: 4; left: 50%; top: 50%;
    width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
    border: 1.5px solid var(--primary); background: rgba(21, 128, 61, .14);
    opacity: 0; animation: tap 1s var(--d, 0s) both;
}
.promo .tap::after {
    content: ""; position: absolute; inset: -6px; border-radius: 50%;
    border: 1.5px solid var(--primary); opacity: 0;
    animation: ripple .8s calc(var(--d, 0s) + .3s) both;
}

.promo .toast-mini {
    position: absolute; z-index: 5; left: 12px; right: 12px; bottom: 12px;
    display: flex; align-items: center; gap: 7px; padding: 8px 10px;
    border-radius: var(--r); background: #16191d; color: #fff; font-size: 11px; font-weight: 500;
    opacity: 0; animation: toast-in 1.3s var(--d, 0s) both;
}
.promo .toast-mini.lifted { bottom: 58px; }  /* clear of the button it confirms */
.promo .toast-mini .lni { color: #6fd39a; font-size: 13px; }

/* confetti */
.promo .confetti { position: absolute; z-index: 3; inset: 0; overflow: hidden; }
.promo .confetti span {
    position: absolute; top: 24%; left: var(--x); width: 5px; height: 8px; border-radius: 1px;
    background: var(--c); opacity: 0; animation: conf 1.5s var(--d, 0s) both;
}

/* ---------- keyframes (all animate IN from a hidden state) ---------- */
@keyframes rise  { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop   { from { opacity: 0; transform: scale(.88); } }
@keyframes out   { from { opacity: 1; } to { opacity: 0; } }
@keyframes type  { from { width: 0; } to { width: calc(var(--len, 6) * 1ch + var(--len, 6) * .09em); } }
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes flash { 0% { background: var(--primary-soft); box-shadow: 0 0 0 4px var(--primary-soft); } 100% { background: transparent; box-shadow: 0 0 0 4px transparent; } }
@keyframes lit   { 0% { border-color: var(--border-strong); box-shadow: none; } 25%, 60% { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); } 100% { border-color: var(--border-strong); box-shadow: none; } }
@keyframes press { 0%, 38%, 62%, 100% { transform: none; filter: none; } 50% { transform: scale(.965); filter: brightness(.93); } }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.1) rotate(-12deg); } 60% { opacity: 1; transform: scale(.94) rotate(2deg); } 100% { opacity: 1; transform: none; } }
@keyframes tap   { 0% { opacity: 0; transform: scale(1.8); } 30% { opacity: 1; transform: scale(1); } 48% { opacity: 1; transform: scale(.7); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes ripple { 0% { opacity: .7; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes toast-in { 0% { opacity: 0; transform: translateY(10px); } 14%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(4px); } }
@keyframes conf  { 0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--r)); } }

/* ---------- paused / offscreen ---------- */
.promo.is-paused .promo-screen *,
.promo.is-paused .promo-bar { animation-play-state: paused; }

/* ---------- small screens ----------
   The carousel moves below the converter, and the demo stacks: copy first,
   phone under it, both full width. */
@media (max-width: 991.98px) {
    /* One column, source order: headline, the form, then the demo under it. */
    .convert-hero .container > .hero-head,
    .convert-hero .container > .converter,
    .hero-carousel { grid-column: 1; grid-row: auto; }
    .hero-head h1 { font-size: 22px; margin-bottom: 4px; }
    .hero-head .lede { font-size: 14px; }
    .hero-carousel { margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid var(--border); }
    .page .hero-carousel { margin-top: 0; padding-top: 0; border-top: 0; }

    .carousel-slide .logo-row { display: none; }

    .promo, .page .promo { grid-template-columns: 1fr; gap: var(--s4); justify-content: stretch; }
    .page .carousel-nav { justify-content: flex-start; }
    .promo-phone { order: 2; }
    .promo-copy { order: 1; }
    .promo-copy h2 { font-size: 18px; }
    .promo-copy .lede, .promo-controls { max-width: none; }
    .promo-steps li { font-size: 13px; }
}
@media (max-width: 575.98px) {
    .promo-device { width: 248px; }
    .promo-screen { height: 400px; }
    .intro-slide .facts { font-size: 13px; }
}

/* ---------- reduced motion: a static, complete final frame ---------- */
@media (prefers-reduced-motion: reduce) {
    .promo .promo-screen *, .promo .promo-bar, .promo .scene.is-on { animation: none !important; }
    .promo .tap, .promo .toast-mini, .promo .confetti, .promo-track { display: none; }
    .promo-steps li { transition: none; }
    .carousel-track { transition: none; }
}
