/* Home hero: the board frame scaled as one piece, words, buttons and sky.
   Rules outside the motion block are the still state; motion is opt-in. */

/* Frame: 1440 x 900 on desktop, 390 x 844 on a phone, never above board size.
   Every board length below is calc(n * var(--hu)). */
#hero {
    --hu: min(1px, 100vw / 1440, 100lvh / 900);
    --fx: calc(50% - 720 * var(--hu));
    --fy: calc(50% - 450 * var(--hu));
    position: relative;
    height: 100dvh;
    overflow: clip;
}

/* Eased pointer pair, -0.5..0.5, written by hero.js on the four elements below that read it; 0 is rest. Registered as
   not inherited, so a write restyles the element it is on and nothing under it. */
@property --mx {
    syntax: '<number>';
    inherits: false;
    initial-value: 0;
}

@property --my {
    syntax: '<number>';
    inherits: false;
    initial-value: 0;
}

/* Pointer bindings: Nova tilts and the stage shifts toward the pointer as the board's art does. The star depths are stars.js's. */
.nova-stage {
    transform: translate(calc(var(--mx) * 16 * var(--hu)), calc(var(--my) * 12 * var(--hu)));
}

.nova-tilt {
    transform: rotateY(calc(var(--mx) * 6deg)) rotateX(calc(var(--my) * -3deg));
}

/* Top bar: in the film stage outside the three screens, so it works at every stop. Drawn on the hero's frame
   at every width: 76 px tall from 900 px up, 64 px on the phone's 390 px frame.
   film.js writes --bar-fill, 0 at the top to 1 from 240 px down; without the film the bar stays clear. */
.au-bar {
    --hu: min(1px, 100vw / 1440, 100lvh / 900);
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    height: calc(76 * var(--hu));
    padding: 0 calc(48 * var(--hu));
    background: rgba(3, 3, 10, calc(0.78 * var(--bar-fill, 0)));
    border-bottom: 1px solid rgba(255, 255, 255, calc(0.07 * var(--bar-fill, 0)));
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.au-bar-home {
    display: flex;
    align-items: center;
    gap: calc(12 * var(--hu));
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--au-text);
    font-family: var(--au-font);
    font-size: calc(16 * var(--hu));
    font-weight: 500;
    letter-spacing: -.01em;
}

.au-bar-live {
    display: flex;
    align-items: center;
    gap: calc(12 * var(--hu));
    box-sizing: border-box;
    height: calc(40 * var(--hu));
    padding: 0 calc(16 * var(--hu)) 0 calc(14 * var(--hu));
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(10, 10, 28, 0.6);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--au-text);
    font-size: calc(14 * var(--hu));
    text-decoration: none;
    white-space: nowrap;
}

@media (hover: hover) {
    .au-bar-home:hover {
        color: #FFFFFF;
    }

    .au-bar-live:hover {
        color: var(--au-text);
    }
}

.au-bar-dot {
    width: calc(8 * var(--hu));
    height: calc(8 * var(--hu));
    border-radius: 50%;
    background: var(--au-lime);
}

.au-bar-kicker {
    font-family: var(--au-mono);
    font-size: calc(11 * var(--hu));
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--au-lime);
}

.au-bar-rule {
    width: 1px;
    height: calc(14 * var(--hu));
    background: rgba(255, 255, 255, 0.14);
}

.au-bar-follow {
    color: var(--au-muted);
}

/* While a conversation is open the bar is gone: hidden, it takes no press and no Tab, and the
   open modal dialog makes it inert as well */
html[data-au-overlay="voice"] .au-bar {
    opacity: 0;
    visibility: hidden;
}

/* Words: right of the star, from the block's top-left corner, drawn over the art */
.hero-words {
    position: absolute;
    z-index: 1;
    left: calc(var(--fx) + 728 * var(--hu));
    top: calc(var(--fy) + 462 * var(--hu));
    width: calc(640 * var(--hu));
    display: flex;
    flex-direction: column;
}

.hero-title {
    margin: 0;
    font-weight: 500;
    font-size: calc(84 * var(--hu));
    line-height: 1;
    letter-spacing: -0.045em;
    white-space: nowrap;
}

.hero-mask {
    display: block;
    overflow: hidden;
    padding-bottom: .1em;
    margin-bottom: -.1em;
    perspective: 600px;
}

.hero-lineup {
    display: block;
    transform-origin: 50% 100%;
}

.hero-grad {
    display: inline-block;
    padding: 0.04em calc(10 * var(--hu)) 0.12em 0;
    background-image: linear-gradient(90deg, #FFFFFF 0%, #EEEFFF 26%, #C3C7FF 52%, #8E94FF 78%, #D4D7FF 100%);
    background-size: 220% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-line {
    margin: calc(24 * var(--hu)) 0 0;
    max-width: calc(500 * var(--hu));
    font-size: calc(19 * var(--hu));
    font-weight: 300;
    line-height: 1.6;
    color: var(--au-muted);
}

/* The line holds both wordings. Until the api's switch answers it keeps its place and is hidden (and out of the
   accessibility tree); then only the wording for the answer is drawn. An unreadable answer is off. If no answer ever
   sets the attribute (the script fails to load, or the read outlasts the api's 10 s CATALOG_TIMEOUT_MS), CSS alone
   shows the line after 15 s, 5 s past that timeout; without the attribute the wording drawn is the off one. */
html:not([data-nova-talk-switch]) [data-talk-line] {
    visibility: hidden;
    animation: au-line-shown 0s linear 15s forwards;
}

@keyframes au-line-shown {
    to { visibility: visible; }
}

html:not([data-nova-talk-switch="on"]) [data-talk-words="on"] {
    display: none;
}

html[data-nova-talk-switch="on"] [data-talk-words="off"] {
    display: none;
}

/* The board's row of buttons: the Talk row and the quiet link to the strip side by side, 28 board px apart. The link sits outside
   the Talk row, so it shows at once and with scripts off. */
.hero-buttons {
    display: flex;
    align-items: center;
    gap: calc(28 * var(--hu));
    margin-top: calc(34 * var(--hu));
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: calc(28 * var(--hu));
}

/* Talk pill */
.hero-talk {
    position: relative;
    display: flex;
    align-items: center;
    gap: calc(12 * var(--hu));
    height: calc(48 * var(--hu));
    padding: 0 calc(22 * var(--hu)) 0 calc(6 * var(--hu));
    border: none;
    border-radius: 999px;
    cursor: pointer;
    background: linear-gradient(180deg, color-mix(in srgb, var(--au-lime) 82%, #FFFFFF) 0%, var(--au-lime) 100%);
    color: #0A0A1A;
    font-family: var(--au-font);
    font-size: calc(15 * var(--hu));
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 calc(10 * var(--hu)) calc(30 * var(--hu)) color-mix(in srgb, var(--au-lime) 26%, transparent), var(--au-3d-rest);
}

@media (hover: hover) {
    .hero-talk:hover {
        transform: translateY(calc(-2 * var(--hu)));
        filter: brightness(1.06);
    }
}

.hero-ring {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: calc(1 * var(--hu)) solid color-mix(in srgb, var(--au-lime) 60%, transparent);
    pointer-events: none;
    opacity: 0;
}

.hero-sheen-clip {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    overflow: hidden;
    pointer-events: none;
}

.hero-sheen {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 34%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0));
    transform: translateX(-120%) skewX(-18deg);
}

.hero-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(3 * var(--hu));
    width: calc(36 * var(--hu));
    height: calc(36 * var(--hu));
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #23265E 0%, #0B0B24 70%);
    color: var(--au-lime);
    box-shadow: inset 0 0 calc(12 * var(--hu)) color-mix(in srgb, var(--au-lime) 35%, transparent);
}

.hero-eq {
    display: block;
    width: calc(2.5 * var(--hu));
    height: calc(12 * var(--hu));
    border-radius: calc(2 * var(--hu));
    background: currentColor;
    transform-origin: 50% 50%;
}

.hero-eq:nth-child(1) { animation-delay: -.2s; }
.hero-eq:nth-child(2) { animation-delay: -.65s; }
.hero-eq:nth-child(3) { animation-delay: -.4s; }
.hero-eq:nth-child(4) { animation-delay: -.9s; }

/* Builds text button */
.hero-builds {
    display: flex;
    align-items: center;
    gap: calc(10 * var(--hu));
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--au-font);
    min-height: calc(44 * var(--hu));
    font-size: calc(15 * var(--hu));
    color: #B9BCD6;
    white-space: nowrap;
}

.hero-arrow {
    display: inline-block;
}

@media (hover: hover) {
    .hero-builds:hover .hero-arrow {
        transform: translateY(calc(3 * var(--hu)));
    }
}

/* Switch off: the same button is the board's lime pill (.ex-cta, HomeScroll-q4v8.dc.html:258), drawn 48 px tall with 22 px
   sides and 15 px words where the board drew 56, 26 and 16. With the switch on, or
   unknown (the row is hidden then), it stays the text link above. */
html[data-nova-talk-switch="off"] .hero-builds {
    height: calc(48 * var(--hu));
    box-sizing: border-box;
    padding: 0 calc(22 * var(--hu));
    border-radius: 999px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--au-lime) 82%, #FFFFFF) 0%, var(--au-lime) 100%);
    color: #0A0A1A;
    font-size: calc(15 * var(--hu));
    font-weight: 500;
    box-shadow: 0 calc(10 * var(--hu)) calc(30 * var(--hu)) color-mix(in srgb, var(--au-lime) 26%, transparent), var(--au-3d-rest);
}

@media (hover: hover) {
    html[data-nova-talk-switch="off"] .hero-builds:hover {
        filter: brightness(1.08);
    }

    html[data-nova-talk-switch="off"] .hero-builds:hover .hero-arrow {
        transform: none;
    }
}

/* The lift moves, so it needs motion as well as a hover */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    html[data-nova-talk-switch="off"] .hero-builds:hover {
        transform: translateY(calc(-1 * var(--hu)));
    }
}

/* Pressed: the canvas's pressed shadow, after the hover rules so it wins at the same weight; the 2 px move is in the motion block below */
.hero-talk:active {
    box-shadow: var(--au-3d-press);
}

html[data-nova-talk-switch="off"] .hero-builds:active {
    box-shadow: var(--au-3d-press);
}

/* Phone: frame 390 x 844 */
@media not all and (min-width: 900px) {
    .au-bar {
        --hu: min(1px, 100vw / 390, 100lvh / 844);
        height: calc(64 * var(--hu));
        padding: 0 calc(18 * var(--hu));
    }

    .au-bar-live {
        gap: calc(10 * var(--hu));
        height: calc(36 * var(--hu));
        padding: 0 calc(14 * var(--hu)) 0 calc(12 * var(--hu));
    }

    /* The phone's pill keeps the dot and "Live builds" */
    .au-bar-rule,
    .au-bar-soon,
    .au-bar-follow {
        display: none;
    }

    #hero {
        --hu: min(1px, 100vw / 390, 100lvh / 844);
        --fx: calc(50% - 195 * var(--hu));
        --fy: calc(50% - 422 * var(--hu));
    }

    .hero-words {
        left: calc(var(--fx) + 20 * var(--hu));
        top: calc(var(--fy) + 372 * var(--hu));
        width: calc(350 * var(--hu));
        height: auto;
        justify-content: flex-start;
        text-align: center;
    }

    .hero-title {
        font-size: calc(46 * var(--hu));
    }

    .hero-line {
        margin: calc(18 * var(--hu)) auto 0;
        max-width: calc(330 * var(--hu));
        font-size: calc(16 * var(--hu));
        line-height: 1.6;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: calc(14 * var(--hu));
        margin-top: calc(30 * var(--hu));
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: calc(14 * var(--hu));
    }
}

/* Motion is opt-in: the rules above are the still states */
@media (prefers-reduced-motion: no-preference) {
    @keyframes au-emblemin{0%{opacity:0;transform:perspective(600px) translateY(24px) rotateY(-120deg) scale(.6);filter:blur(10px)}60%{opacity:1;filter:blur(0)}100%{opacity:1;transform:perspective(600px) translateY(0) rotateY(0deg) scale(1)}}
    @keyframes au-lineup{from{transform:translateY(112%) rotateX(-50deg)}to{transform:none}}
    @keyframes au-fadeup{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}
    @keyframes au-track{from{letter-spacing:.05em}to{letter-spacing:-0.045em}}
    @keyframes au-sweepin{from{background-position:100% 50%}to{background-position:0% 50%}}
    @keyframes au-shimmer{from{background-position:0% 50%}to{background-position:100% 50%}}
    @keyframes au-eq{0%,100%{transform:scaleY(.3)}50%{transform:scaleY(1)}}
    @keyframes au-softping{0%{transform:scale(1);opacity:.55}70%,100%{transform:scale(1.5);opacity:0}}
    @keyframes au-sheen2{0%{transform:translateX(-120%) skewX(-18deg)}14%,100%{transform:translateX(320%) skewX(-18deg)}}
    @keyframes au-fadein{from{opacity:0}to{opacity:1}}
    @keyframes au-softdot{0%,100%{box-shadow:0 0 0 0 rgba(124,131,255,.55)}50%{box-shadow:0 0 0 calc(5 * var(--hu)) rgba(124,131,255,0)}}

    .au-bar .au-logo { animation: au-emblemin 1.6s cubic-bezier(.2,.7,.2,1) 1.1s both; }
    .au-bar-live { animation: au-fadeup 1.3s cubic-bezier(.16,1,.3,1) 3s both; }
    .au-bar-dot { animation: au-softdot 2.2s ease-in-out infinite; }
    .hero-title { animation: au-track 2.6s cubic-bezier(.16,1,.3,1) 1.35s both; }
    .hero-lineup { animation: au-lineup 1.4s cubic-bezier(.16,1,.3,1) 1.85s both; }
    .hero-grad { animation: au-sweepin 2s cubic-bezier(.4,0,.2,1) 2.3s both, au-shimmer 12s ease-in-out 4.3s infinite alternate; }
    /* The line fades in once the api's switch has answered, 2.3 s after load or the answer if later (--talk-line-delay is
       written by nova-voice.js on <html>), so it never plays while it is hidden */
    html[data-nova-talk-switch] .hero-line { animation: au-fadeup 1.3s cubic-bezier(.16,1,.3,1) var(--talk-line-delay) both; }
    /* The row's fade-up starts once the api's switch has answered (nova-voice.js sets the attribute and the delay: 2.5 s
       after load, or the answer if later), so the row never plays while it is invisible */
    html[data-nova-talk-switch] .hero-actions { animation: au-fadeup 1.3s cubic-bezier(.16,1,.3,1) var(--talk-row-delay) both; }
    .hero-ring { animation: au-softping 3.4s cubic-bezier(.2,.7,.2,1) infinite; }
    .hero-sheen { animation: au-sheen2 9s cubic-bezier(.4,0,.2,1) 3.3s infinite both; }
    .hero-eq { animation: au-eq 1.3s ease-in-out infinite; }

    .au-bar { transition: opacity .3s ease, visibility .3s; }
    .hero-talk { transition: var(--au-3d-transition); }
    .hero-arrow { transition: transform .35s cubic-bezier(.16,1,.3,1); }
    html[data-nova-talk-switch="off"] .hero-builds { transition: var(--au-3d-transition); }

    .hero-talk:active {
        transform: translateY(var(--au-3d-press-y));
    }

    html[data-nova-talk-switch="off"] .hero-builds:active {
        transform: translateY(var(--au-3d-press-y));
    }
}

/* Reduced motion: nothing runs, the screen shows its final state at once.
   The base rules already are that state (opacity 1, no transform, no filter);
   the pill's ring and sheen stay hidden there. */
@media (prefers-reduced-motion: reduce) {
    .au-stars,
    .au-bar,
    .au-bar .au-logo,
    .au-bar-live,
    .au-bar-dot,
    .hero-title,
    .hero-lineup,
    .hero-grad,
    .hero-line,
    .hero-actions,
    .hero-talk,
    .hero-ring,
    .hero-sheen,
    .hero-eq,
    .hero-builds,
    .hero-arrow {
        animation: none;
        transition: none;
    }

    /* A pressed pill sits still: the hover lift would float it over the collapsed lip */
    .hero-talk:active {
        transform: none;
    }
}

/* Keyboard focus on a lime pill: the shared ring, in a colour that reads over the pill's lime glow */
.hero-talk:focus-visible {
    outline-color: var(--au-ring-lime);
}

html[data-nova-talk-switch="off"] .hero-builds:focus-visible {
    outline-color: var(--au-ring-lime);
}

/* film.js makes every screen but the current one inert, so the first screen's loops run only while it shows; the
   animations exist under the same gates as the rules above, so reduce motion still leaves none to run */
#hero[inert] *,
#hero[inert] *::before,
#hero[inert] *::after {
    animation-play-state: paused;
}
