/* betweengames.app: the Between Games landing page. Colors follow the app (docs/DESIGN.md):
   background #F1F3F8 / #0D1430, surface #FFFFFF / #18214A, ink #0F1A40 / #F3F5FB, sub #5D6687 /
   #9AA3C4, red #E0263A / #FF4257, line #DCE1EC / #2A3462. Titles are the app's display face,
   Avenir Next Condensed Heavy Italic in uppercase, with Barlow Condensed (the Android app's open
   match, SIL Open Font License) where Avenir Next is missing. Body text is Avenir Next.
   The page follows prefers-color-scheme, like the app. */

@font-face { font-family: "BG Display"; src: local("AvenirNextCondensed-HeavyItalic"), url("fonts/barlow_condensed_extrabold_italic.ttf") format("truetype"); font-weight: 800; font-style: italic; font-display: swap; }
@font-face { font-family: "BG Label"; src: local("AvenirNextCondensed-Bold"), url("fonts/barlow_condensed_bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
    --bg-bg: #F1F3F8; --bg-surface: #FFFFFF; --bg-fill: #E9ECF4;
    --bg-ink: #0F1A40; --bg-sub: #5D6687; --bg-red: #E0263A; --bg-line: #DCE1EC; --bg-ok: #1C8C55;
    --bg-glow: rgba(224, 38, 58, .12);
    --bg-body: "Avenir Next", "Avenir", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
    --bg-display: "BG Display", "Avenir Next Condensed", "Arial Narrow", sans-serif;
    --bg-label: "BG Label", "Avenir Next Condensed", "Arial Narrow", sans-serif;
    color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg-bg: #0D1430; --bg-surface: #18214A; --bg-fill: #1F2954;
        --bg-ink: #F3F5FB; --bg-sub: #9AA3C4; --bg-red: #FF4257; --bg-line: #2A3462; --bg-ok: #47C987;
        --bg-glow: rgba(255, 66, 87, .14);
    }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body.bg-page { background: var(--bg-bg); }
.bg { color: var(--bg-ink); font-family: var(--bg-body); -webkit-font-smoothing: antialiased; }
.bg a { color: var(--bg-red); }

/* ── Header: full at the top and bottom, slim and see-through while the story plays ── */
.bg-nav {
    position: fixed; inset: 0 0 auto 0; z-index: 10; height: var(--nav-h);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 max(20px, calc((100vw - 1200px) / 2)) 0 max(20px, calc((100vw - 1200px) / 2));
    background: color-mix(in srgb, var(--bg-bg) 88%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-line);
    transition: height .35s ease, background .35s ease, border-color .35s ease;
}
.bg-nav::after { /* the app's navy and red stripes */
    content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
    background: linear-gradient(var(--bg-ink) 0 33%, transparent 33% 66%, var(--bg-red) 66%); opacity: .9;
}
.bg-nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bg-ink); }
.bg-nav-brand img { width: 32px; height: 32px; border-radius: 8px; display: block; transition: width .35s, height .35s; }
.bg-nav-brand span { font: italic 800 1.3rem/1 var(--bg-display); text-transform: uppercase; letter-spacing: .01em; }
.bg-nav-brand b { color: var(--bg-red); font-weight: inherit; }
.bg-nav-links { display: flex; gap: 22px; }
.bg-nav-links a { font: 700 .92rem/1 var(--bg-label); text-transform: uppercase; letter-spacing: .1em; color: var(--bg-ink); text-decoration: none; }
.bg-nav-links a:hover { color: var(--bg-red); }
body.bg-immersive .bg-nav { height: 48px; background: color-mix(in srgb, var(--bg-bg) 55%, transparent); border-bottom-color: transparent; }
body.bg-immersive .bg-nav::after { opacity: 0; }
body.bg-immersive .bg-nav-brand img { width: 26px; height: 26px; }
@media (max-width: 520px) { .bg-nav-links { gap: 14px; } .bg-nav-links a { font-size: .82rem; } }

/* ── The story ─────────────────────────────────────────────────────────────── */
.bg { position: relative; overflow: clip; }
.bg::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 140vh; pointer-events: none;
    background: radial-gradient(60% 50% at 72% 30%, var(--bg-glow), transparent 70%);
}
.bg-card { position: relative; z-index: 2; max-width: 450px; }
.bg-card h1, .bg-card h2 {
    font-family: var(--bg-display); font-style: italic; font-weight: 800; text-transform: uppercase;
    color: var(--bg-ink); letter-spacing: -.005em; line-height: .98;
}
.bg-card h1 { font-size: clamp(2.6rem, 5vw, 4.1rem); margin: 6px 0 18px; }
.bg-card h2 { font-size: clamp(2.1rem, 3.8vw, 3.1rem); margin: 4px 0 14px; }
.bg-card p { color: var(--bg-sub); font-size: 1.06rem; line-height: 1.6; margin: 0 0 12px; }
.bg-card .bg-lede { font-size: 1.22rem; color: var(--bg-ink); font-weight: 500; }
.bg-eyebrow {
    font: 700 .86rem/1.2 var(--bg-label) !important; letter-spacing: .14em; text-transform: uppercase;
    color: var(--bg-red) !important; margin-bottom: 6px !important;
}
.bg-aside { font-size: .96rem !important; font-weight: 600; color: var(--bg-ink) !important; opacity: .85; }
.bg-note { font-size: .92rem !important; }
.bg-credit { font-size: .85rem !important; }
.bg-price { font: italic 800 1.7rem/1.1 var(--bg-display) !important; text-transform: uppercase; color: var(--bg-red) !important; margin: 6px 0 10px !important; }
/* Rounded like a Home Screen icon: the radius is on the <img>, since a <picture> does not clip. */
.bg-icon { display: block; margin-bottom: 18px; }
.bg-icon img { display: block; width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 10px 30px rgba(15, 26, 64, .22); }
.bg-facts { list-style: none; padding: 0; margin: 4px 0 16px; border-top: 1px solid var(--bg-line); }
.bg-facts li { display: grid; grid-template-columns: 5.2rem 1fr; column-gap: 14px; align-items: baseline; color: var(--bg-sub); line-height: 1.45; padding: 10px 0; border-bottom: 1px solid var(--bg-line); }
.bg-facts strong { color: var(--bg-red); font: 700 .86rem/1.2 var(--bg-label); letter-spacing: .1em; text-transform: uppercase; }
.bg-scroll-cue {
    position: absolute; left: 50%; top: calc(100svh - 96px); transform: translateX(-50%);
    margin: 0; white-space: nowrap; z-index: 2; font: 700 .9rem/1 var(--bg-label); letter-spacing: .12em; text-transform: uppercase; color: var(--bg-sub);
}
.bg-scroll-cue::after { content: ""; display: block; width: 2px; height: 34px; margin: 10px auto 0; background: linear-gradient(var(--bg-red), transparent); animation: bg-cue 1.8s ease-in-out infinite; }
@keyframes bg-cue { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(8px); opacity: 1; } }

/* Store badges: neither store is live yet, so plain text for both. */
.bg-badges { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 20px 0 12px; }
.bg-badge-soon {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 12px;
    border: 2px solid var(--bg-ink); color: var(--bg-ink); font: 700 .95rem/1 var(--bg-label); letter-spacing: .06em; text-transform: uppercase;
}

/* ── Screenshots (shown when the page is not in 3D) ─────────────────────────── */
.bg-shot { margin: 0; display: flex; justify-content: center; }
.bg-shot img { display: block; width: auto; max-width: 100%; height: auto; max-height: 640px; border-radius: 32px; box-shadow: 0 24px 60px rgba(15, 26, 64, .2); }
.bg-shot-wide img { max-height: 600px; border-radius: 22px; }
.bg-ch { padding: 72px 24px; max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.bg-ch + .bg-ch { border-top: 1px solid var(--bg-line); }
/* The header is fixed, so a jump link (Picks, Vote, Pro) lands below it, not under it. */
.bg-ch { scroll-margin-top: var(--nav-h); }
.bg-stage { display: none; }
@media (max-width: 820px) {
    .bg-ch { grid-template-columns: 1fr; gap: 28px; padding: 56px 20px; }
    .bg-shot img { max-height: 520px; }
}

/* ── 3D layout (between-games.js adds .is-3d once WebGL is up) ──────────────── */
.bg.is-3d .bg-stage {
    display: block; position: sticky; top: 0; height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh;
    z-index: 0; pointer-events: none;
}
.bg.is-3d .bg-stage canvas { display: block; width: 100%; height: 100%; }
.bg.is-3d .bg-shot { display: none; }
.bg.is-3d .bg-ch {
    display: block; max-width: none; margin: 0; border: 0; position: relative; z-index: 1;
    min-height: 170vh; padding: 24vh max(32px, calc((100vw - 1200px) / 2)) 0;
}
.bg.is-3d .bg-hero { min-height: 130vh; padding-top: max(10vh, 48px); }
.bg.is-3d .bg-feature { min-height: 200vh; }
.bg.is-3d .bg-finale { min-height: 190vh; }
.bg.is-3d .bg-card {
    position: sticky; top: max(calc(var(--nav-h) + 24px), 20vh);
    padding: 30px 32px; border-radius: 26px;
    background: color-mix(in srgb, var(--bg-surface) 76%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
    border: 1px solid color-mix(in srgb, var(--bg-line) 70%, transparent);
    box-shadow: 0 20px 50px rgba(15, 26, 64, .1);
}
.bg.is-3d .bg-feature .bg-card::before { /* the app's red card edge */
    content: ""; position: absolute; left: 0; top: 26px; bottom: 26px; width: 4px; border-radius: 0 4px 4px 0; background: var(--bg-red);
}
.bg.is-3d .bg-hero .bg-card { top: max(14vh, 84px); background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding-left: 0; }

/* Phones and portrait tablets: the devices take the top of the screen and the text pins to the bottom. */
@media (max-aspect-ratio: 1/1) {
    /* The 3D stage starts below the header, so no device, label or screen ever sits under it. */
    .bg.is-3d .bg-stage {
        top: var(--nav-h); height: calc(100vh - var(--nav-h)); height: calc(100svh - var(--nav-h));
        margin-bottom: calc(var(--nav-h) - 100vh); margin-bottom: calc(var(--nav-h) - 100svh);
    }
    .bg.is-3d .bg-ch { display: flex; flex-direction: column; justify-content: flex-end; padding: 0 14px; min-height: 150vh; }
    .bg.is-3d .bg-feature { min-height: 175vh; }
    .bg.is-3d .bg-hero { min-height: 120vh; }
    .bg.is-3d .bg-card, .bg.is-3d .bg-hero .bg-card {
        position: sticky; top: auto; bottom: 14px; max-width: 560px; width: 100%; margin: 0 auto;
        padding: 20px 22px; border-radius: 22px;
        /* An opened card (More) never grows under the header: past that it scrolls inside. */
        max-height: calc(100vh - var(--nav-h) - 28px); max-height: calc(100svh - var(--nav-h) - 28px);
        overflow-y: auto; overscroll-behavior: contain;
        background: color-mix(in srgb, var(--bg-surface) 82%, transparent);
        -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
        border: 1px solid color-mix(in srgb, var(--bg-line) 70%, transparent);
    }
    .bg.is-3d .bg-card h1 { font-size: 2.5rem; margin-bottom: 10px; }
    .bg.is-3d .bg-card h2 { font-size: 1.9rem; margin-bottom: 8px; }
    .bg.is-3d .bg-card p { font-size: .97rem; line-height: 1.5; margin-bottom: 8px; }
    .bg.is-3d .bg-card .bg-lede { font-size: 1.04rem; }
    .bg.is-3d .bg-icon img { width: 56px; height: 56px; border-radius: 14px; }
    .bg.is-3d .bg-icon { margin-bottom: 10px; }
    .bg.is-3d .bg-badges { margin: 10px 0 6px; }
    .bg.is-3d .bg-badge-soon { min-height: 36px; font-size: .82rem; }
    .bg.is-3d .bg-scroll-cue { display: none; }
    .bg.is-3d .bg-facts li { padding: 6px 0; font-size: .92rem; }
}
.bg:not(.is-3d) .bg-scroll-cue { display: none; }

.bg-footer { position: relative; z-index: 2; text-align: center; padding: 40px 20px 56px; border-top: 1px solid var(--bg-line); color: var(--bg-sub); font-size: .92rem; }
.bg-footer p { margin: 4px 0; }
.bg-footer a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
    .bg-scroll-cue::after { animation: none; }
    .bg-nav, .bg-nav-brand img { transition: none; }
}
