/*
 * hresh.com: the top bar and dialogs every page shares, and the home page.
 * Markup: templates/components/HreshComHomePartials.html.
 * Script: static/js/ui/pages/hresh-com.js.
 *
 * The site sets data-site="hresh" on <html>, which turns the accent (primary
 * buttons) to the wordmark's red. Red is kept to that and the wordmark;
 * frames and glows stay blue and gold like the rest of the studio's pages.
 */
@layer page {
    /* ---------- top bar ---------- */

    .hc-top {
        position: sticky;
        top: 0;
        z-index: 30;
        background: color-mix(in oklab, var(--bg) 78%, transparent);
        -webkit-backdrop-filter: blur(14px) saturate(1.3);
        backdrop-filter: blur(14px) saturate(1.3);
        border-bottom: 1px solid var(--line);
        /* full width, like the footer: reach back through the room the shell
           keeps for the dock, and pad by the same amount */
        margin-left: calc(var(--dock-left) * -1);
        padding-left: var(--dock-left);
    }

    .hc-top__inner {
        display: flex;
        align-items: center;
        gap: var(--s-5);
        min-height: 64px;
    }

    .hc-top__brand {
        display: inline-flex;
        align-items: center;
        gap: var(--s-3);
        font-family: var(--font-pixel);
        font-size: 12px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--ink);
    }

    .hc-top__nav {
        display: flex;
        gap: var(--s-1);
        margin-inline: auto;
    }

    .hc-top__nav a {
        position: relative;
        padding: 10px 12px;
        font-size: var(--text-sm);
        font-weight: 600;
        color: var(--muted);
        transition: color var(--fast);
    }

    .hc-top__nav a::after {
        content: "";
        position: absolute;
        left: 12px;
        right: 12px;
        bottom: 4px;
        height: 2px;
        background: var(--gold);
        scale: 0 1;
        transition: scale var(--fast) var(--ease);
    }

    .hc-top__nav a:hover,
    .hc-top__nav a.is-here {
        color: var(--ink);
    }

    .hc-top__nav a.is-here::after {
        scale: 1 1;
    }

    .hc-top__ctas {
        display: flex;
        gap: var(--s-4);
        margin-left: auto;
    }

    .hc-top__nav + .hc-top__ctas {
        margin-left: 0;
    }

    /* the three-line button that opens the section links where the bar has
       no room for them; hidden while they fit */
    .hc-top__toggle {
        display: none;
        place-items: center;
        flex: none;
        width: 40px;
        height: 38px;
        color: var(--ink);
        box-shadow: 0 0 0 1px var(--line-strong);
    }

    .hc-top__toggle span,
    .hc-top__toggle span::before,
    .hc-top__toggle span::after {
        display: block;
        width: 18px;
        height: 2px;
        background: currentColor;
    }

    .hc-top__toggle span {
        position: relative;
    }

    .hc-top__toggle span::before,
    .hc-top__toggle span::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .hc-top__toggle span::before {
        top: -6px;
    }

    .hc-top__toggle span::after {
        top: 6px;
    }

    .hc-top__toggle[aria-expanded="true"] {
        color: var(--gold);
        box-shadow: 0 0 0 1px var(--gold-deep);
    }

    .hc-top .btn {
        min-height: 38px;
        padding: 0 var(--s-4);
        font-size: 9px;
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--btn-edge),
            0 var(--px) 0 0 var(--btn-edge),
            calc(var(--px) * -1) 0 0 0 var(--btn-edge),
            var(--px) 0 0 0 var(--btn-edge),
            0 4px 0 0 var(--btn-drop);
    }

    /* anchors land below the bar */
    [id] {
        scroll-margin-top: 88px;
    }

    /* ---------- hero ---------- */

    .hc-hero {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
        align-items: center;
        gap: clamp(24px, 5vw, 72px);
        min-height: min(84dvh, 780px);
        padding-block: var(--s-7);
    }

    .hc-hero__copy {
        display: grid;
        gap: var(--s-5);
        justify-items: start;
    }

    /* the heading holds the logo and the line under it, spaced as the rest
       of the column is */
    .hc-hero__heading {
        display: grid;
        gap: var(--s-5);
        justify-items: start;
        font: inherit;
        letter-spacing: normal;
    }

    .hc-hero__logo {
        width: 200px;
    }

    .hc-hero__title {
        display: block;
        font-family: var(--font-pixel);
        font-weight: 400;
        font-size: clamp(15px, 0.6rem + 0.9vw, 22px);
        line-height: 1.75;
        letter-spacing: 0;
        color: var(--ink);
        text-shadow: 3px 3px 0 var(--blood-deep);
        max-width: 24em;
    }

    .hc-hero .lede {
        font-size: var(--text-md);
    }

    .hc-badges {
        display: flex;
        flex-wrap: wrap;
        gap: var(--s-2) var(--s-5);
        padding: 0;
        list-style: none;
        font-size: var(--text-sm);
        color: var(--muted);
    }

    .hc-badges li::before {
        content: "";
        display: inline-block;
        width: 6px;
        height: 6px;
        margin-right: var(--s-2);
        background: var(--gold);
        vertical-align: 2px;
    }

    .hc-hero__media {
        position: relative;
    }

    /* the red light behind the trailer */
    .hc-hero__media::before {
        content: "";
        position: absolute;
        inset: -12%;
        z-index: -1;
        background: radial-gradient(closest-side, rgb(194 45 35 / 0.3), rgb(9 95 143 / 0.16) 60%, transparent 78%);
        pointer-events: none;
    }

    /* a 16:9 screen in a pixel frame */
    .hc-trailer {
        position: relative;
        aspect-ratio: 16 / 9;
        container-type: inline-size;
        background: #000;
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--gold),
            0 var(--px) 0 0 var(--gold),
            calc(var(--px) * -1) 0 0 0 var(--gold),
            var(--px) 0 0 0 var(--gold),
            0 30px 70px -24px rgb(0 0 0 / 0.9);
    }

    .hc-trailer__video {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: #000;
    }

    /* The whole poster plays the trailer. Its visible part is a primary
       button in the empty band between the poster's logo (50% down) and the
       row of units (73%); the button itself takes no pointer, so hovering anywhere
       on the poster lifts it as hovering a .btn does. */
    .hc-trailer__cover {
        position: absolute;
        inset: 0;
        display: block;
        padding: 0;
        border: 0;
        background: transparent;
        cursor: pointer;
    }

    .hc-trailer__cover[hidden],
    .hc-trailer.is-playing .hc-trailer__cover {
        display: none;
    }

    /* gold, the grigoriangames.com primary: it belongs to the gold frame and
       the poster's gold lettering, and Play Now stays the page's red button */
    .hc-trailer__badge {
        --accent: var(--gold);
        --accent-hi: var(--gold-hi);
        --accent-ink: var(--gold-ink);
        position: absolute;
        top: 62%;
        left: 50%;
        translate: -50% -50%;
        /* placed from the middle, it would get only half the frame to lay
           out in, and on a phone the row squeezes the play mark to nothing */
        width: max-content;
        pointer-events: none;
    }

    .hc-trailer__badge svg {
        flex: none;
    }

    .hc-trailer__cover:hover .hc-trailer__badge {
        transform: translateY(-2px);
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--btn-edge),
            0 var(--px) 0 0 var(--btn-edge),
            calc(var(--px) * -1) 0 0 0 var(--btn-edge),
            var(--px) 0 0 0 var(--btn-edge),
            0 8px 0 0 var(--btn-drop);
    }

    .hc-trailer__cover:active .hc-trailer__badge {
        transform: translateY(4px);
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--btn-edge),
            0 var(--px) 0 0 var(--btn-edge),
            calc(var(--px) * -1) 0 0 0 var(--btn-edge),
            var(--px) 0 0 0 var(--btn-edge),
            0 2px 0 0 var(--btn-drop);
    }

    /* On a phone the poster's empty band is about 40px tall: a slimmer button
       with 8px type (one dot per pixel) keeps clear of the logo and the units */
    @container (max-width: 520px) {
        .hc-trailer__badge {
            min-height: 30px;
            padding: 0 var(--s-3);
            gap: var(--s-2);
            font-size: 8px;
        }
    }

    /* ---------- the mini player ----------
       Scrolled away from while it plays, the hero's player floats in the
       bottom right corner, and docks again when its place comes back into
       view (hresh-com.js sets .is-floating). Its place keeps the player's
       height (.is-holding) and drops the lean-back scroll animation while it
       floats: a transformed parent would carry a fixed child along with it,
       and its fade would fade the mini player too. On a phone it sits above
       the dock bar. */
    .hc-trailer.is-floating {
        position: fixed;
        z-index: 60;
        right: var(--s-4);
        bottom: var(--s-4);
        width: min(360px, 100vw - 32px);
        animation: hc-mini-in 0.2s steps(4, end);
    }

    @keyframes hc-mini-in {
        from {
            opacity: 0;
            translate: 0 16px;
        }
    }

    .hc-hero__media.is-holding {
        animation: none;
    }

    @media (max-width: 767px), (hover: none) and (pointer: coarse) {
        .hc-trailer.is-floating {
            right: var(--s-3);
            bottom: var(--dock-bottom, var(--s-3));
            width: min(62vw, 300px);
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .hc-trailer.is-floating {
            animation: none;
        }
    }

    /* its close button, top right over the picture */
    .hc-trailer__dock {
        position: absolute;
        top: 4px;
        right: 4px;
        z-index: 1;
        display: grid;
        place-items: center;
        width: 32px;
        height: 32px;
        border: 0;
        background: rgb(0 0 0 / 0.7);
        color: #fff;
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
    }

    .hc-trailer__dock:hover {
        color: var(--gold);
    }

    .hc-trailer:not(.is-floating) .hc-trailer__dock {
        display: none;
    }

    /* ---------- cards ---------- */

    .hc-grid {
        display: grid;
        gap: var(--s-5);
    }

    .hc-grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hc-grid--4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .hc-grid--5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .hc-card {
        position: relative;
        display: grid;
        align-content: start;
        justify-items: start;
        gap: var(--s-3);
        padding: var(--s-5);
        text-align: left;
        color: var(--ink-soft);
        background: linear-gradient(180deg, var(--panel-hi), var(--panel));
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--line-strong),
            0 var(--px) 0 0 var(--line-strong),
            calc(var(--px) * -1) 0 0 0 var(--line-strong),
            var(--px) 0 0 0 var(--line-strong);
        transition:
            opacity var(--slow) var(--ease),
            transform var(--slow) var(--ease),
            box-shadow var(--fast) var(--ease);
    }

    .hc-card h3 {
        font-size: var(--text-md);
    }

    .hc-card p {
        font-size: var(--text-sm);
        color: var(--muted);
    }

    /* cards in a row arrive one after another */
    .hc-grid > :nth-child(2),
    .hc-steps > :nth-child(2),
    .hc-store > :nth-child(2) {
        transition-delay: 70ms;
    }

    .hc-grid > :nth-child(3),
    .hc-steps > :nth-child(3),
    .hc-store > :nth-child(3) {
        transition-delay: 140ms;
    }

    .hc-grid > :nth-child(4),
    .hc-steps > :nth-child(4),
    .hc-store > :nth-child(4) {
        transition-delay: 210ms;
    }

    .hc-grid > :nth-child(5),
    .hc-store > :nth-child(5) {
        transition-delay: 280ms;
    }

    .hc-card--link {
        cursor: pointer;
    }

    .hc-card--link:hover,
    .hc-card--link:focus-visible {
        transform: translateY(-4px);
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--gold),
            0 var(--px) 0 0 var(--gold),
            calc(var(--px) * -1) 0 0 0 var(--gold),
            var(--px) 0 0 0 var(--gold),
            0 18px 40px -20px rgb(245 212 112 / 0.4);
    }

    .hc-card--soon {
        background: repeating-linear-gradient(135deg, rgb(255 255 255 / 0.02) 0 10px, transparent 10px 20px), var(--panel);
    }

    .hc-pill {
        position: absolute;
        top: var(--s-3);
        right: var(--s-3);
        padding: 5px 8px;
        font-family: var(--font-pixel);
        font-size: 8px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--gold);
        box-shadow: 0 0 0 1px rgb(245 212 112 / 0.5);
    }

    /* a card led by a picture */
    .hc-card--art {
        justify-items: center;
        text-align: center;
    }

    .hc-card--art > img {
        height: 160px;
        width: auto;
        margin-bottom: var(--s-2);
    }

    /* 36px pixel art: four times its size, with the room of the others */
    .hc-card--art > img.px {
        height: 144px;
        margin-block: 8px calc(var(--s-2) + 8px);
    }

    .hc-chips {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--s-1);
        margin-top: var(--s-3);
        padding: 0;
        list-style: none;
    }

    .hc-chips li {
        display: grid;
        place-items: center;
        width: 48px;
        height: 48px;
        background: var(--bg-deep);
        box-shadow: 0 0 0 1px var(--line);
    }

    .hc-chips img {
        width: 32px;
        height: 32px;
    }

    .hc-chips--small img {
        width: 36px;
        height: 36px;
    }

    /* a card with its picture beside the words */
    .hc-card--row {
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: var(--s-4);
    }

    .hc-card--row > div {
        display: grid;
        gap: var(--s-1);
    }

    /* ---------- how it works: four steps beside the board ---------- */

    .hc-loop {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: clamp(24px, 5vw, 72px);
    }

    .hc-steps {
        display: grid;
        gap: var(--s-5);
        padding: 0;
        list-style: none;
        counter-reset: step;
    }

    .hc-steps li {
        counter-increment: step;
        display: grid;
        grid-template-columns: 72px 1fr;
        align-items: center;
        gap: var(--s-5);
        padding-left: var(--s-7);
        position: relative;
    }

    .hc-steps li::before {
        content: "0" counter(step);
        position: absolute;
        left: 0;
        font-family: var(--font-pixel);
        font-size: 12px;
        color: var(--gold);
    }

    .hc-steps img {
        justify-self: center;
        max-width: 72px;
        height: auto;
    }

    .hc-steps p {
        font-size: var(--text-sm);
        color: var(--muted);
    }

    .hc-loop__stage {
        display: grid;
        gap: var(--s-3);
    }

    /* ---------- try a turn: the playable board ---------- */

    /* The board is drawn with the game's own tiles, cream and charcoal
       (--tiles, set on the board), cut from the same art as the tree and the
       fight frames, so those sit on it without a seam. The flat colours
       under them are only a fallback. On a phone --tile is set by fit() in
       hresh-demo.js. Unit sizing and the idle bob come from
       static/css/ui/board.css. */
    .demo {
        justify-items: center;
    }

    .demo__caption {
        width: calc(var(--demo-tile) * 8);
    }

    .demo {
        --demo-tile: 64px;
    }

    .demo__board {
        --tile: var(--demo-tile);
        position: relative;
        display: grid;
        grid-template-columns: repeat(8, var(--tile));
        grid-template-rows: repeat(6, var(--tile));
        background:
            var(--tiles, none) 0 0 / calc(var(--tile) * 2) calc(var(--tile) * 2),
            repeating-conic-gradient(#ffebbf 0 25%, #3b3b40 0 50%) 0 0 / calc(var(--tile) * 2) calc(var(--tile) * 2);
        image-rendering: pixelated;
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--gold),
            0 var(--px) 0 0 var(--gold),
            calc(var(--px) * -1) 0 0 0 var(--gold),
            var(--px) 0 0 0 var(--gold),
            0 30px 60px -30px rgb(0 0 0 / 0.9);
    }

    .demo__tree {
        grid-column: 4 / span 2;
        grid-row: 3 / span 2;
        width: calc(var(--tile) * 2);
        height: calc(var(--tile) * 2);
        z-index: 5;
    }

    /* No ground shadow on this board. The shared unit style draws one three
       pixels below the feet, which on these tiles lands on the tile underneath
       and reads as the piece bleeding out of its square. The game has none. */
    .demo__board .unit {
        z-index: 2;
        pointer-events: none;
        filter: none;
    }

    /* The hurt pawn leans on his sword and does not bob like the others. He
       is held at the top of the others' bob (two art pixels up), which keeps
       his feet and sword clear of the tile below. */
    .demo__board .unit--still {
        animation: none;
        translate: 0 calc(var(--tile) / -32);
    }

    /* on this board the Hresh face the player, as they do in the game */
    .demo__board .unit--foe {
        scale: none;
    }

    /* the Bishop is a button */
    .demo__board .unit--hero {
        position: relative;
        display: block;
        padding: 0;
        cursor: pointer;
        pointer-events: auto;
    }

    .unit--hero img {
        width: 100%;
        height: 100%;
    }

    /* a gold ring says "this one": breathing until she is selected, solid after */
    .unit--hero::before {
        content: "";
        position: absolute;
        inset: 2px;
        border-radius: 50%;
        box-shadow: 0 0 0 2px var(--gold);
        animation: dock-ping 1.6s ease-in-out infinite;
    }

    .unit--hero.is-selected::before {
        animation: none;
        box-shadow:
            0 0 0 2px var(--gold),
            0 0 16px 2px rgb(245 212 112 / 0.7);
    }

    /* a tile she can move to (blue) or a Hresh she can strike (red) */
    .demo__mark {
        grid-column: var(--c);
        grid-row: var(--r);
        z-index: 3;
        padding: 0;
        cursor: pointer;
        animation: demo-mark 180ms steps(3, end);
    }

    .demo__mark--move {
        background: rgb(52 110 224 / 0.55);
        box-shadow: inset 0 0 0 2px rgb(150 190 255 / 0.75);
    }

    .demo__mark--strike {
        background: rgb(206 40 30 / 0.5);
        box-shadow: inset 0 0 0 2px rgb(255 120 105 / 0.9);
        animation:
            demo-mark 180ms steps(3, end),
            demo-strike 1s steps(2, jump-none) infinite;
    }

    .demo__mark:hover,
    .demo__mark:focus-visible {
        filter: brightness(1.35);
        outline-offset: -2px;
    }

    /* marks grow into their tile; they are never fully hidden, so a browser
       that is slow to start the animation still shows them */
    @keyframes demo-mark {
        from {
            transform: scale(0.5);
            opacity: 0.6;
        }
    }

    @keyframes demo-strike {
        50% {
            background: rgb(206 40 30 / 0.75);
        }
    }

    /* The fight. The board goes dark, as in the game, except for the tree and
       the two tiles the fighters stand on; the frames play across all four. */
    .demo__shade {
        grid-column: 1 / -1;
        grid-row: 1 / -1;
        z-index: 4;
        background: rgb(22 20 15 / 0.84);
        opacity: 0;
        pointer-events: none;
        transition: opacity 220ms ease;
    }

    .demo__fight {
        grid-column: 3 / span 4;
        grid-row: 3 / span 2;
        position: relative;
        z-index: 6;
        opacity: 0; /* kept in the page, not display:none, so the frames are already loaded */
        pointer-events: none;
        transition: opacity 220ms ease;
    }

    .demo.is-fighting .demo__shade,
    .demo.is-fighting .demo__fight {
        opacity: 1;
    }

    /* sixteen 256x128 frames side by side; --fight is set on the board. The
       frames carry their own tiles and the tree, both fighters on lit tiles,
       exactly as the game draws the scene. */
    .demo__strip {
        position: absolute;
        inset: 0;
        z-index: 1;
        background: var(--fight) 0 0 / calc(var(--tile) * 64) 100% no-repeat;
        image-rendering: pixelated;
    }

    .demo__strip.is-playing {
        animation: demo-fight 1.6s steps(16, jump-none) forwards;
    }

    @keyframes demo-fight {
        to {
            background-position-x: calc(var(--tile) * -60);
        }
    }

    /* Room for the longest message, three lines on the narrowest board, so
       the autoplay changing the message never moves the page below it. */
    .demo__caption {
        min-height: calc(3 * 1.8em);
        font-family: var(--font-pixel);
        font-size: 9px;
        line-height: 1.8;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--gold);
    }

    /* ---------- wave rewards: a track that fills as it is scrolled to ---------- */

    .hc-waves {
        position: relative;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        padding: var(--s-6) 0 0;
        list-style: none;
    }

    /* the track, and the gold that fills it */
    .hc-waves::before,
    .hc-waves::after {
        content: "";
        position: absolute;
        top: calc(var(--s-6) + 60px);
        left: 10%;
        right: 10%;
        height: 4px;
        background: var(--line-strong);
    }

    .hc-waves::after {
        background: linear-gradient(90deg, var(--sapphire-hi), var(--gold));
        transform-origin: left center;
        transform: scaleX(1);
    }

    .hc-waves li {
        position: relative;
        z-index: 1;
        display: grid;
        justify-items: center;
        gap: var(--s-2);
        text-align: center;
    }

    .hc-waves__num {
        font-family: var(--font-pixel);
        font-size: 10px;
        color: var(--gold);
    }

    .hc-waves img {
        width: 64px;
        height: 64px;
        padding: 8px;
        box-sizing: content-box;
        background: var(--panel);
        box-shadow: 0 0 0 2px var(--line-strong);
    }

    .hc-waves .is-final img {
        box-shadow:
            0 0 0 2px var(--gold),
            0 0 26px -2px rgb(245 212 112 / 0.6);
    }

    .hc-waves__label {
        font-size: var(--text-sm);
        font-weight: 600;
        color: var(--ink-soft);
    }

    /* ---------- battle pass preview and store ---------- */

    .hc-pass {
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        align-items: start;
        gap: var(--s-6);
    }

    .hc-passcard {
        --frame: color-mix(in oklab, var(--sapphire-hi) 55%, var(--line-strong));
        display: grid;
        gap: var(--s-5);
    }

    .hc-passcard__head {
        display: flex;
        flex-wrap: wrap;
        align-items: end;
        justify-content: space-between;
        gap: var(--s-4);
    }

    .hc-passcard__points {
        min-width: 200px;
        flex: 1;
    }

    .hc-passcard__points p {
        display: flex;
        justify-content: space-between;
        margin-bottom: var(--s-2);
        font-family: var(--font-pixel);
        font-size: 8px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--dim);
    }

    .hc-passcard__points b {
        font-weight: 400;
        color: var(--gold);
    }

    .hc-bar {
        height: 10px;
        background: var(--bg-deep);
        box-shadow: 0 0 0 2px var(--line-strong);
    }

    /* fills to its mark once the card has been revealed */
    .hc-bar__fill {
        height: 100%;
        width: var(--to, 0%);
        background: linear-gradient(90deg, var(--sapphire-hi), var(--gold));
    }

    html.js .hc-passcard:not(.is-in) .hc-bar__fill {
        width: 0;
    }

    html.js .hc-passcard .hc-bar__fill {
        transition: width 1.2s steps(10, end) 0.3s;
    }

    .hc-tiles {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--s-3);
        padding: 0;
        list-style: none;
    }

    .hc-tile {
        position: relative;
        display: grid;
        place-items: center;
        aspect-ratio: 1.25;
        background: var(--bg-deep);
        box-shadow: 0 0 0 2px var(--line-strong);
    }

    .hc-tile > img {
        width: 64px;
        height: 64px;
    }

    .hc-tile.is-locked > img {
        filter: grayscale(0.8) brightness(0.55);
    }

    .hc-tile.is-claimed > img {
        opacity: 0.45;
    }

    .hc-tile.is-premium {
        box-shadow: 0 0 0 2px rgb(245 212 112 / 0.55);
    }

    .hc-tile.is-claimable {
        box-shadow: 0 0 0 2px var(--gold);
        animation: dock-ping 2s ease-in-out infinite;
    }

    .hc-tile__mark {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
    }

    .hc-tile__mark img {
        width: 32px;
        height: 32px;
    }

    .hc-tile__id,
    .hc-tile__qty {
        position: absolute;
        font-family: var(--font-pixel);
        font-size: 8px;
        color: var(--dim);
    }

    .hc-tile__id {
        left: 6px;
        top: 6px;
    }

    .hc-tile__qty {
        right: 6px;
        bottom: 6px;
        color: var(--ink);
    }

    .hc-passcard__foot {
        font-size: var(--text-xs);
        color: var(--dim);
    }

    .hc-store {
        display: grid;
        gap: var(--s-3);
    }

    /* ---------- leaderboards ---------- */

    .hc-card--board {
        justify-items: stretch;
    }

    .hc-card--board header {
        display: flex;
        align-items: center;
        gap: var(--s-3);
    }

    .hc-table {
        width: 100%;
        border-collapse: collapse;
        font-size: var(--text-sm);
    }

    .hc-table th {
        padding: var(--s-2) 0;
        font-family: var(--font-pixel);
        font-size: 8px;
        font-weight: 400;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        text-align: left;
        color: var(--dim);
        border-bottom: 1px solid var(--line);
    }

    .hc-table td {
        padding: var(--s-3) 0;
        border-bottom: 1px solid var(--line);
        color: var(--ink-soft);
    }

    .hc-table th:last-child,
    .hc-table td:last-child {
        text-align: right;
        font-variant-numeric: tabular-nums;
    }

    .hc-table td:first-child {
        width: 2.5em;
        font-family: var(--font-pixel);
        font-size: 10px;
        color: var(--dim);
    }

    .hc-table tbody tr:first-child td {
        color: var(--gold);
        font-weight: 650;
    }

    .hc-table tbody tr:last-child td {
        border-bottom: 0;
    }

    /* ---------- questions: two columns of rows that open in place ---------- */

    /* <details> does the opening and closing, and its answers are in the page
       whether open or not, for readers and for search engines alike. Each
       column opens on its own, so an answer only moves the rows below it. */
    .hc-faq {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: var(--s-6);
        interpolate-size: allow-keywords; /* lets an answer slide open to its own height */
    }

    .hc-faq__col {
        display: grid;
        gap: var(--s-4);
    }

    /* the column's label, set like the kickers above the headings */
    .hc-faq__group {
        font-family: var(--font-pixel);
        font-size: 10px;
        font-weight: 400;
        line-height: 1.8;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--gold);
    }

    .hc-faq__list {
        display: grid;
        gap: var(--s-3);
    }

    .hc-faq__item {
        background: linear-gradient(180deg, var(--panel-hi), var(--panel));
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--line-strong),
            0 var(--px) 0 0 var(--line-strong),
            calc(var(--px) * -1) 0 0 0 var(--line-strong),
            var(--px) 0 0 0 var(--line-strong);
        transition: box-shadow var(--fast) var(--ease);
    }

    .hc-faq__item[open] {
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--gold-deep),
            0 var(--px) 0 0 var(--gold-deep),
            calc(var(--px) * -1) 0 0 0 var(--gold-deep),
            var(--px) 0 0 0 var(--gold-deep);
    }

    .hc-faq__item > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--s-4);
        padding: var(--s-4) var(--s-5);
        list-style: none;
        cursor: pointer;
    }

    .hc-faq__item > summary::-webkit-details-marker {
        display: none;
    }

    /* a plus drawn from two 2px bars; opening turns it a quarter while the
       crossbar folds away, so the upright bar lies down as the minus */
    .hc-faq__item > summary::after {
        content: "";
        flex: none;
        width: 14px;
        height: 14px;
        background:
            linear-gradient(var(--gold), var(--gold)) center / 14px 2px no-repeat,
            linear-gradient(var(--gold), var(--gold)) center / 2px 14px no-repeat;
        transition:
            background-size var(--slow) var(--ease),
            rotate var(--slow) var(--ease);
    }

    .hc-faq__item[open] > summary::after {
        background-size: 0 2px, 2px 14px;
        rotate: 90deg;
    }

    .hc-faq__q {
        font-size: var(--text-md);
        font-weight: 650;
        line-height: 1.4;
        letter-spacing: 0;
        text-wrap: pretty;
        transition: color var(--fast);
    }

    .hc-faq__item[open] .hc-faq__q {
        color: var(--gold);
    }

    /* The answer slides open to its own height where the browser can animate
       a <details> (::details-content); elsewhere it simply appears. */
    .hc-faq__item::details-content {
        block-size: 0;
        overflow: hidden;
        transition:
            block-size var(--slow) var(--ease),
            content-visibility var(--slow) allow-discrete;
    }

    .hc-faq__item[open]::details-content {
        block-size: auto;
    }

    .hc-faq__a {
        padding: 0 var(--s-5) var(--s-5);
        color: var(--ink-soft);
        line-height: 1.65;
        opacity: 0;
        transition: opacity var(--slow) var(--ease);
    }

    .hc-faq__item[open] .hc-faq__a {
        opacity: 1;
    }

    .hc-faq__a a {
        color: var(--gold);
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    /* only where a pointer can rest: on a touch screen a tap leaves hover on */
    @media (hover: hover) {
        .hc-faq__item:has(> summary:hover) {
            box-shadow:
                0 calc(var(--px) * -1) 0 0 var(--gold-deep),
                0 var(--px) 0 0 var(--gold-deep),
                calc(var(--px) * -1) 0 0 0 var(--gold-deep),
                var(--px) 0 0 0 var(--gold-deep);
        }

        .hc-faq__item > summary:hover .hc-faq__q {
            color: var(--gold);
        }
    }

    /* ---------- the last call ---------- */

    .hc-final {
        --frame: var(--gold);
        display: flex;
        align-items: center;
        gap: clamp(24px, 5vw, 64px);
        padding: clamp(24px, 5vw, 64px);
        background:
            radial-gradient(60% 120% at 0% 50%, rgb(194 45 35 / 0.22), transparent 65%),
            linear-gradient(180deg, var(--panel-hi), var(--panel));
    }

    .hc-final > img {
        flex: none;
        width: 192px;
        animation: unit-idle-big 1.2s steps(2, jump-none) infinite;
    }

    @keyframes unit-idle-big {
        50% {
            translate: 0 -6px;
        }
    }

    .hc-final > div {
        display: grid;
        gap: var(--s-4);
        justify-items: start;
    }

    /* ---------- dialogs: community links, trailer ---------- */

    .hc-dialog {
        width: min(100% - 32px, 560px);
        max-height: calc(100dvh - 32px);
        padding: var(--s-6);
        border: 0;
        color: var(--ink-soft);
        background: linear-gradient(180deg, var(--panel-hi), var(--panel));
        box-shadow:
            0 calc(var(--px) * -1) 0 0 var(--gold),
            0 var(--px) 0 0 var(--gold),
            calc(var(--px) * -1) 0 0 0 var(--gold),
            var(--px) 0 0 0 var(--gold),
            0 40px 90px -20px #000;
        overflow: auto;
    }

    /* showModal() leaves the page behind free to scroll under the dimmed
       backdrop; hold it still while a dialog is open. */
    html:has(dialog.hc-dialog[open]) {
        overflow: hidden;
    }

    .hc-dialog::backdrop {
        background: rgb(4 6 12 / 0.78);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
    }

    .hc-dialog[open] {
        animation: hc-dialog-in 0.22s steps(5, end);
    }

    @keyframes hc-dialog-in {
        from {
            opacity: 0;
            transform: translateY(12px);
        }
    }

    .hc-dialog h2 {
        margin-bottom: var(--s-2);
        font-size: var(--text-lg);
    }

    .hc-dialog__close {
        position: absolute;
        top: 8px;
        right: 8px;
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        font-size: 24px;
        line-height: 1;
        color: var(--muted);
    }

    .hc-dialog__close:hover {
        color: var(--gold);
    }

    /* The community dialog is the one soft thing on the page: rounded, two
       links to a row, each with its platform's own colour. */
    #social-popup {
        width: min(100% - 32px, 660px);
        border-radius: 18px;
        background: #1b1e29;
        box-shadow:
            0 0 0 1px var(--line-strong),
            0 40px 90px -20px #000;
    }

    /* This dialog scrolls on a small phone; keep the close button pinned
       to its corner instead of letting it scroll away with the links. The
       negative margins put it where the absolute one sat, and the bottom
       one keeps the heading from wrapping around it. The sticky edge is
       measured inside the dialog's padding, hence the negative top. */
    #social-popup .hc-dialog__close {
        position: sticky;
        top: calc(8px - var(--s-6));
        right: auto;
        z-index: 1;
        float: right;
        margin: calc(8px - var(--s-6)) calc(8px - var(--s-6)) -40px 0;
        border-radius: 10px;
        background: #1b1e29;
    }

    .hc-socials {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--s-3);
        margin-top: var(--s-5);
        padding: 0;
        list-style: none;
    }

    .hc-social {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
        grid-template-rows: auto auto;
        column-gap: var(--s-4);
        align-items: center;
        height: 100%;
        padding: var(--s-3) var(--s-4);
        border-radius: 12px;
        background: rgb(255 255 255 / 0.03);
        box-shadow: 0 0 0 1px var(--line);
        transition:
            box-shadow var(--fast),
            background-color var(--fast),
            transform var(--fast);
    }

    .hc-social:hover,
    .hc-social:focus-visible {
        background: rgb(255 255 255 / 0.06);
        box-shadow: 0 0 0 1px var(--brand, var(--gold));
        transform: translateY(-2px);
    }

    .hc-social__icon {
        grid-row: 1 / 3;
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        color: var(--brand, var(--ink));
        background: rgb(255 255 255 / 0.06);
    }

    .hc-social__icon svg {
        width: 24px;
        height: 24px;
        fill: currentColor;
    }

    .hc-social--discord { --brand: #7289ff; }
    .hc-social--x { --brand: #f3eedd; }
    .hc-social--youtube { --brand: #ff4b3e; }
    .hc-social--twitch { --brand: #a970ff; }
    .hc-social--instagram { --brand: #f0527a; }
    .hc-social--patreon { --brand: #ff5a5f; }

    .hc-social__label {
        align-self: end;
        font-weight: 650;
        color: var(--ink);
    }

    .hc-social__sub {
        align-self: start;
        font-size: var(--text-xs);
        color: var(--muted);
    }

    /* The video is 16:9 and the dialog does not scroll, so on a short or
       sideways screen the width is also held to what the height allows,
       or the bottom of the player falls off the screen. */
    .hc-dialog--video {
        width: min(100% - 32px, 1100px, (100dvh - 32px - var(--s-7) - var(--s-3)) * 16 / 9);
        padding: var(--s-7) var(--s-3) var(--s-3);
        background: #000;
        overflow: visible;
    }

    .hc-dialog--video .hc-trailer {
        box-shadow: none;
    }
}

/* ---------- motion tied to the scrollbar ---------- */

@media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
        @layer page {
            /* the wave track fills as it crosses the screen */
            .hc-waves::after {
                animation: hc-fill linear both;
                animation-timeline: view();
                animation-range: entry 40% cover 55%;
            }

            @keyframes hc-fill {
                from {
                    transform: scaleX(0);
                }
            }

            /* the trailer leans back a little as the hero leaves */
            .hc-hero__media {
                animation: hc-hero-away linear both;
                animation-timeline: scroll(root block);
                animation-range: 0px 640px;
            }

            @keyframes hc-hero-away {
                to {
                    transform: translateY(60px) scale(0.94);
                    opacity: 0.35;
                }
            }
        }
    }
}

/* ---------- narrower ---------- */

@media (max-width: 1180px) {
    @layer page {
        /* the section links leave the bar and open under it as a list */
        .hc-top__toggle {
            display: grid;
        }

        .hc-top__nav {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            flex-direction: column;
            gap: 0;
            margin: 0;
            padding: var(--s-2) var(--gutter) var(--s-3) calc(var(--dock-left) + var(--gutter));
            background: var(--bg-raise);
            border-bottom: 1px solid var(--line-strong);
            box-shadow: var(--shadow);
        }

        .hc-top__nav.is-open {
            display: flex;
        }

        .hc-top__nav a {
            padding: 12px 0;
        }

        .hc-top__nav a::after {
            left: 0;
            right: auto;
            width: 24px;
        }

        .hc-top__nav + .hc-top__ctas {
            margin-left: auto;
        }

        .hc-grid--5 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .hc-grid--4 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .hc-loop,
        .hc-pass {
            grid-template-columns: 1fr;
        }

        .hc-loop__stage {
            justify-self: center;
        }
    }
}

@media (max-width: 900px) {
    @layer page {
        .hc-faq {
            grid-template-columns: 1fr;
        }

        .hc-hero {
            grid-template-columns: 1fr;
            min-height: 0;
            padding-block: var(--s-6) var(--s-7);
        }

        .hc-hero__media {
            order: -1;
        }

        .hc-grid--3 {
            grid-template-columns: 1fr;
        }

        .hc-final {
            flex-direction: column;
            text-align: center;
        }

        .hc-final > div {
            justify-items: center;
        }

        .hc-final .btn-row {
            justify-content: center;
        }
    }
}

@media (max-width: 640px) {
    @layer page {
        .hc-top__community {
            display: none;
        }

        /* 32px is the fallback; the script makes the board fill the screen
           (see fit() in hresh-demo.js). The stage reaches past the page
           gutters so the board can use the full width. */
        .demo {
            --demo-tile: 32px;
            margin-inline: calc(var(--gutter) * -1);
        }

        .hc-socials {
            grid-template-columns: 1fr;
        }

        /* minmax(0, 1fr): two equal columns that never grow past the screen,
           whatever the longest word in a card */
        .hc-grid--5,
        .hc-grid--4 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        /* the icons keep their drawn size (64px and 72px pixel art) */
        .hc-steps li {
            grid-template-columns: 72px 1fr;
            gap: var(--s-4);
            padding-left: var(--s-6);
        }

        /* five chests no longer fit in a line: three and two, and no track */
        .hc-waves {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            row-gap: var(--s-5);
        }

        .hc-waves::before,
        .hc-waves::after {
            display: none;
        }

        /* chests and pass items stay at their drawn 64px; only the frame
           around a chest tightens */
        .hc-waves img {
            padding: 4px;
        }

        .hc-final > img {
            width: 128px;
        }
    }
}

/* the narrowest phones: the four links under "Learn, Watch, and Get Involved"
   are words, not pictures, and two to a row leaves them too little room */
@media (max-width: 400px) {
    @layer page {
        #community .hc-grid--4 {
            grid-template-columns: 1fr;
        }
    }
}

/* On a 2x or 1x phone the board's art lands on uneven screen pixels, which
   break it up; hresh-demo.js marks the stage .is-smooth there (see fit()). */
@layer page {
    .demo.is-smooth .demo__board,
    .demo.is-smooth .demo__board .px,
    .demo.is-smooth .demo__strip {
        image-rendering: auto;
    }
}
