/* ==========================================================================
   Homepage hero: one 1440x1080 frame, every element placed in frame units.
   --u = min(100vw/1440, 100vh/1080). Phones (<=820px) switch to a stacked layout.
   ========================================================================== */

.hero {
    --u: min(calc(100vw / 1440), calc(100svh / 1080));
    position: relative;
    height: 100svh;
    min-height: calc(1080 * var(--u));
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--page);
}

.hero-frame {
    position: relative;
    width: calc(1440 * var(--u));
    height: calc(1080 * var(--u));
    overflow: hidden;
}

.hero-frame > * { position: absolute; }

/* ---- Top bar ---- */
.hero-logo {
    left: calc(37 * var(--u));
    top: calc(24 * var(--u));
    display: block;
}

.hero-logo img {
    height: calc(58 * var(--u));
    width: auto;
}

[data-theme="dark"] .hero-logo img {
    background: #F5F8EF;
    border-radius: calc(10 * var(--u));
    padding: calc(4 * var(--u)) calc(8 * var(--u));
}

.hero-nav {
    left: calc(505 * var(--u));
    top: calc(29 * var(--u));
    height: calc(40 * var(--u));
    display: flex;
    align-items: center;
    gap: calc(31 * var(--u));
}

.hero-nav a {
    font: 400 calc(16.4 * var(--u)) / 1 var(--font-ui);
    color: var(--ink);
    opacity: .82;
}

.hero-nav a:hover { opacity: 1; }

.hero-actions {
    right: calc(39 * var(--u));
    top: calc(29 * var(--u));
    display: flex;
    gap: calc(8 * var(--u));
    align-items: center;
}

.hero-actions .pill {
    height: calc(40 * var(--u));
    min-width: calc(92 * var(--u));
    padding: 0 calc(18 * var(--u));
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: 500 calc(15 * var(--u)) / 1 var(--font-ui);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
}

.hero-actions .pill-solid {
    min-width: calc(97 * var(--u));
    background: var(--forest);
    color: var(--on-forest);
    border-color: var(--forest);
}

.hero-actions .theme-toggle {
    width: calc(40 * var(--u));
    height: calc(40 * var(--u));
    font-size: calc(15 * var(--u));
}

/* ---- Copy ---- */
.hero-badge {
    left: 50%;
    top: calc(115 * var(--u));
    transform: translateX(-50%);
    height: calc(37 * var(--u));
    padding: 0 calc(18 * var(--u));
    border-radius: 999px;
    background: var(--mint);
    color: var(--forest);
    font: 500 calc(16.6 * var(--u)) / 1 var(--font-ui);
    display: inline-flex;
    align-items: center;
    gap: calc(8 * var(--u));
    white-space: nowrap;
}

.hero-title {
    left: 0;
    right: 0;
    top: calc(176 * var(--u));
    text-align: center;
    font: 700 calc(88 * var(--u)) / calc(92 * var(--u)) var(--font-display);
    letter-spacing: -0.035em;
    color: var(--ink);
}

.hero-title span { display: block; }
.hero-title span + span { letter-spacing: -0.022em; }

.hero-sub {
    left: 0;
    right: 0;
    top: calc(394 * var(--u));
    margin: 0 auto;
    max-width: none;
    text-align: center;
    font: 400 calc(20.8 * var(--u)) / calc(32 * var(--u)) var(--font-ui);
    color: var(--sub);
}

/* ---- Hand-drawn notes ---- */
.hero-doodle {
    left: calc(263 * var(--u));
    top: calc(377 * var(--u));
    width: calc(54 * var(--u));
    height: calc(44 * var(--u));
}

.hero-note {
    font-family: var(--font-hand);
    font-weight: 600;
    color: var(--forest);
    line-height: .95;
    white-space: nowrap;
}

.hero-note-seen {
    left: calc(1212 * var(--u));
    top: calc(310 * var(--u));
    font-size: calc(34 * var(--u));
    transform: rotate(16deg);
    transform-origin: left top;
    text-align: center;
}

.hero-arrow-seen {
    left: calc(1190 * var(--u));
    top: calc(392 * var(--u));
    width: calc(150 * var(--u));
    height: calc(200 * var(--u));
}

.hero-note-pay {
    left: calc(500 * var(--u));
    top: calc(937 * var(--u));
    font-size: calc(30 * var(--u));
    transform: rotate(24deg);
    transform-origin: left top;
}

.hero-arrow-pay {
    left: calc(560 * var(--u));
    top: calc(905 * var(--u));
    width: calc(64 * var(--u));
    height: calc(44 * var(--u));
}

.hero-frame svg path {
    fill: none;
    stroke: var(--forest);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---- CTA ---- */
.hero-cta-ring {
    left: calc(626 * var(--u));
    top: calc(901 * var(--u));
    width: calc(190 * var(--u));
    height: calc(74 * var(--u));
    border: 1.5px dashed var(--forest);
    border-radius: 999px;
    display: grid;
    place-items: center;
}

.hero-cta {
    width: calc(172 * var(--u));
    height: calc(58 * var(--u));
    border-radius: 999px;
    background: var(--forest);
    color: var(--on-forest);
    font: 500 calc(17 * var(--u)) / 1 var(--font-ui);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s;
}

.hero-cta:hover { background: var(--forest-hover); }

/* ---- Curved card carousel ---- */
.hero-track {
    inset: 0;
    top: calc(470 * var(--u));
    bottom: calc(190 * var(--u));
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    /* soften the frame edges so cards fade out instead of being cut off on wide screens */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.hero-track.dragging { cursor: grabbing; }

.hero-band {
    position: absolute;
    inset: 0;
}

.reel {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    background: var(--mint);
    will-change: transform, clip-path;
}

.reel img,
.reel video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

.reel video {
    opacity: 0;
    transition: opacity .5s ease;
}

.reel video.ready { opacity: 1; }

.reel .play {
    position: absolute;
    left: 12px;
    bottom: 12px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .32);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
}

.reel .play::before {
    content: "";
    margin-left: 2px;
    border-left: 9px solid #fff;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Before the fonts and script are ready, keep the entrance elements hidden
   only when motion is allowed and JS is running. */
.js-enter [data-enter] {
    opacity: 0;
    animation: hero-failsafe 0s linear 2.5s forwards;
}

@keyframes hero-failsafe { to { opacity: 1; } }

/* ---------- Phones ---------- */
@media (max-width: 820px) {
    .hero {
        --u: calc(100vw / 640);
        height: auto;
        min-height: 0;
        display: block;
        padding: 0 0 28px;
    }

    .hero-frame {
        width: 100%;
        height: auto;
        overflow: visible;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .hero-frame > * { position: static; }

    .hero-top {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
    }

    .hero-logo img { height: 40px; }
    .hero-nav,
    .hero-doodle,
    .hero-note-seen,
    .hero-arrow-seen,
    .hero-arrow-pay,
    .hero-actions .pill-ghost { display: none; }

    .hero-actions { position: static; gap: 8px; }
    .hero-actions .pill { height: 40px; min-width: 0; padding: 0 18px; font-size: 15px; }
    .hero-actions .theme-toggle { width: 40px; height: 40px; font-size: 15px; }

    .hero-badge {
        transform: none;
        margin-top: 18px;
        height: 34px;
        font-size: 14px;
        padding: 0 14px;
    }

    .hero-title {
        margin-top: 16px;
        padding: 0 16px;
        font-size: clamp(38px, 11vw, 56px);
        line-height: 1.04;
    }

    .hero-sub {
        margin-top: 14px;
        padding: 0 20px;
        font-size: 16px;
        line-height: 1.55;
        max-width: 34ch;
    }

    .hero-sub br { display: none; }

    .hero-track {
        position: relative;
        inset: auto;
        width: 100%;
        height: 250px;
        margin-top: 22px;
    }

    .reel .play { left: 8px; bottom: 8px; width: 24px; height: 24px; }

    .hero-cta-ring {
        width: 190px;
        height: 74px;
        margin-top: 22px;
    }

    .hero-cta { width: 172px; height: 58px; font-size: 17px; }

    .hero-note-pay {
        transform: rotate(-4deg);
        margin-top: 10px;
        font-size: 26px;
    }
}

/* Desktop: the hero contains the top bar, so hide the wrapper box model. */
@media (min-width: 821px) {
    .hero-top { display: contents; }
    .hero-top > * { position: absolute; }
}
