* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #121212;
    --fg: #ffffff;
    --error: #e51821; /* the red from assets/mrs.red.png */
    --font: 'Stack Sans Notch', system-ui, sans-serif;
    --cta-height: 62px;
    --cta-font: 36px;
    --cta-gap: 72px; /* space between the banners and the notify me button */
    --logo-gap: 28px; /* space between the logo and the first banner */
    --page-pad: 24px;
    /* The stage is exactly as wide as the "ruin" barcode in the logo, and is
       the thing that gets centred. In logo.png (1048 x 231) the barcode spans
       x = 100..945 (846px). Left of it is 100px of transparent space; right
       of it, "studio" runs to x = 1047, i.e. 102px past the barcode.
       The width leaves room for "studio" on the right and the same space on
       the left, so the barcode stays centred: 846 / (846 + 2 * 102) = 0.8057. */
    --stage-w: min(846px, calc((100vw - 2 * var(--page-pad)) * 0.8057));
    --logo-h: calc(var(--stage-w) * 231 / 846);
}

html, body {
    min-height: 100%;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

img { display: block; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* --- CREW (top-left decoration) --- */
.crew {
    position: absolute;
    top: 34px;
    left: 30px;
    display: flex;
    gap: 23px;
    z-index: 10;
}

.crew-member {
    display: flex;
    align-items: center;
    gap: 3px;
}

.crew-member img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.crew-member p {
    font-size: 21px;
    font-weight: 700;
    line-height: 0.85;
    text-transform: lowercase;
}

/* --- MAIN STAGE --- */
.main {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 100px 24px;
}

.stage {
    width: var(--stage-w);
    /* Matches the space the button takes below the banners, so the logo and
       banners sit in the vertical centre like in the design. */
    padding-top: calc(var(--cta-height) + var(--cta-gap));
}

.logo img {
    width: 123.877%;           /* 1048 / 846 */
    max-width: none;
    height: auto;
    margin-left: -11.820%;     /* -100 / 846: hides the transparent left edge */
}

.games {
    display: flex;
    justify-content: center;
    gap: 1.891%;               /* 16px at full size */
    margin-top: var(--logo-gap);
}

.game { position: relative; }
.game--pawrkour { width: 48.936%; }  /* 414px */
.game--feral    { width: 48.463%; }  /* 410px */

.game img {
    width: 100%;
    height: auto;
}

.game-hover {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.game:hover .game-hover { opacity: 1; }

/* --- NOTIFY ME / SIGNUP --- */
.signup {
    margin-top: var(--cta-gap);
    min-height: var(--cta-height);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn {
    height: var(--cta-height);
    padding: 0 21px;
    border: none;
    border-radius: 0;
    background: var(--fg);
    color: var(--bg);
    font-family: var(--font);
    font-size: var(--cta-font);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 4px;
}

.signup-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.signup-field {
    position: relative;
    flex: 0 1 450px;
    min-width: 0;
}

.signup-input {
    display: block;
    width: 100%;
    height: var(--cta-height);
    outline: none;
    padding: 0 20px;
    border: 2px solid var(--fg);
    border-radius: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: var(--cta-font);
    font-weight: 700;
}

.signup-input::placeholder {
    color: var(--fg);
    opacity: 1;
}

.signup-input:focus::placeholder { opacity: 0.4; }

.signup-input[aria-invalid="true"] { border-color: var(--error); }

/* Sits under the input without pushing the layout around. */
.signup-error {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    color: var(--error);
    font-size: calc(var(--cta-font) / 2);
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
}

.signup-done {
    font-size: var(--cta-font);
    font-weight: 700;
    text-align: center;
}

/* Only one of the three states is shown at a time. */
.signup-open,
.signup-form,
.signup-done { display: none; }

.signup[data-state="idle"] .signup-open { display: block; }
.signup[data-state="form"] .signup-form,
.signup[data-state="sending"] .signup-form { display: flex; }
.signup[data-state="done"] .signup-done,
.signup[data-state="error"] .signup-done { display: block; }

/* --- SIGNUP FORM ON NARROW STAGES ---
   The row needs about 630px: the 450px input, the 10px gap and the
   "send it" button (about 170px). When the space under the logo and banners
   is narrower than that, stack the input above the button. */
.signup {
    container-type: inline-size;
    width: 100%;
}

@container (max-width: 640px) {
    .signup-form {
        flex-direction: column;
        align-items: center;
    }

    .signup-field,
    .signup-submit {
        flex: none;
        width: min(450px, 100%);
    }

    /* In the stacked layout the message sits between the input and the
       button, so it takes up space instead of covering the button. */
    .signup-error {
        position: static;
        margin-top: 8px;
    }

    .signup-error:empty { display: none; }
}

/* --- TABLETS AND SMALL LAPTOPS --- */
@media (max-width: 900px) {
    :root {
        --cta-height: 54px;
        --cta-font: 30px;
        --cta-gap: 56px;
    }
}

/* --- PORTRAIT SCREENS (phones and tablets) ---
   Centre the whole group (logo, banners, button) vertically instead of only
   the logo and banners. */
@media (orientation: portrait) {
    .stage { padding-top: 0; }
}

/* --- LANDSCAPE TABLETS (4:3-ish, like iPads; 5:3 allows for browser toolbars) ---
   Touch screens close to 4:3 centre the whole group (logo, banners, button)
   vertically, like portrait screens. If the screen is too short for that,
   the page simply scrolls. */
@media (orientation: landscape) and (max-aspect-ratio: 5/3) and (pointer: coarse) {
    .stage { padding-top: 0; }
}

/* --- PHONES IN PORTRAIT --- */
@media (max-width: 600px) {
    :root {
        --cta-height: 50px;
        --cta-font: 26px;
        --cta-gap: 40px;
        --logo-gap: var(--cta-gap); /* same space above and below the banners */
        --page-pad: 20px;
    }

    /* Out of the flow so it doesn't push the centred group down. */
    .crew {
        left: 0;
        right: 0;
        top: 30px;
        justify-content: center;
    }

    /* Equal top and bottom padding keeps the group centred while leaving
       room for the crew above it on short screens. */
    .main { padding: 96px 20px; }

    .stage { padding-top: 0; }

    .games {
        flex-direction: column;
        gap: 12px;
    }

    /* Each banner as wide as the barcode part of the logo. */
    .game--pawrkour,
    .game--feral { width: 100%; }
}

/* --- PHONES IN LANDSCAPE ---
   Only the logo is centred vertically; the banners and button follow below
   it and the page scrolls. */
@media (orientation: landscape) and (max-height: 500px) {
    .main {
        align-items: flex-start;
        padding-top: max(80px, calc(50svh - var(--logo-h) / 2));
        padding-bottom: 48px;
    }

    .stage { padding-top: 0; }
}

/* --- INTRO ANIMATION (see intro.js) ---
   While <html> has the "intro" class the page is hidden; intro.js fades it in. */
html.intro .logo img,
html.intro .crew,
html.intro .games,
html.intro .signup { opacity: 0; }

/* The logo starts 50% larger; don't let it add a horizontal scrollbar. */
html.intro body { overflow-x: hidden; }
