/* /solve-24: the Solve 24 landing page.
   Colors come from the game's brand (Brand.swift): the purples #4A4FA8 and
   #14153F, the cyans #32BFE5 and #1C75BC, the hint yellow #FEBC11 and the
   Survival orange #DC4018. The game's font (Urbane Rounded) has no confirmed
   web license, so the page uses the system rounded font. The game itself has
   one look; the page around it follows prefers-color-scheme. */

.s24 {
    position: relative;
    --s24-bg: #EEF0FB;
    --s24-surface: #FFFFFF;
    --s24-text: #14153F;
    --s24-text-2: #4F5487;
    --s24-sep: #D3D6F0;
    --s24-accent: #1C75BC;
    --s24-hint: #B07F00;
    --s24-survival: #DC4018;
    --s24-glow: rgba(50, 191, 229, .2);
    --s24-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --s24-round: ui-rounded, -apple-system, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;
    background: var(--s24-bg);
    color: var(--s24-text);
    font-family: var(--s24-font);
    overflow: clip;
}
@media (prefers-color-scheme: dark) {
    .s24 {
        --s24-bg: #0F1033;
        --s24-surface: #1A1C4D;
        --s24-text: #F2F3FF;
        --s24-text-2: #B4B7E0;
        --s24-sep: #2C2F6A;
        --s24-accent: #32BFE5;
        --s24-hint: #FEBC11;
        --s24-survival: #FF8A5C;
        --s24-glow: rgba(74, 79, 168, .45);
    }
}
@media (prefers-color-scheme: dark) { body.s24-page { background: #0F1033; } }

.s24::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 140vh; pointer-events: none;
    background: radial-gradient(60% 50% at 70% 30%, var(--s24-glow), transparent 70%);
}

/* ── Chapter text ─────────────────────────────────────────────────────────── */
.s24-card { position: relative; z-index: 2; max-width: 440px; }
.s24-card h1, .s24-card h2 { font-family: var(--s24-round); color: var(--s24-text); letter-spacing: -.02em; }
.s24-card h1 { font-size: clamp(3rem, 6vw, 4.6rem); font-weight: 800; line-height: 1; margin: 6px 0 18px; }
.s24-card h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 800; line-height: 1.08; margin: 4px 0 14px; }
.s24-card p { color: var(--s24-text-2); font-size: 1.08rem; line-height: 1.6; margin: 0 0 12px; }
.s24-card .s24-lede { font-size: 1.25rem; color: var(--s24-text); }
.s24-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .8rem !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--s24-accent) !important; margin-bottom: 6px !important;
}
.s24-feature h2 { color: var(--s24-text); }
.s24-aside { font-size: .95rem !important; font-weight: 600; color: var(--s24-text) !important; opacity: .8; }
.s24-note { font-size: .92rem !important; }
img.s24-icon { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 10px 30px rgba(20, 21, 63, .18); display: block; margin-bottom: 18px; }
/* Bottom center of the first screen; it scrolls away with the hero. */
.s24-scroll-cue {
    position: absolute; left: 50%; top: calc(100svh - var(--nav-h) - 96px); transform: translateX(-50%);
    margin: 0; text-align: center; white-space: nowrap; z-index: 2;
    font-size: .85rem; font-weight: 600; letter-spacing: .04em; color: var(--s24-text-2);
}
.s24-scroll-cue::after { content: ""; display: block; width: 2px; height: 34px; margin: 10px auto 0; background: linear-gradient(var(--s24-accent), transparent); animation: s24-cue 1.8s ease-in-out infinite; }
@keyframes s24-cue { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(8px); opacity: 1; } }

/* ── Store badges ─────────────────────────────────────────────────────────── */
.s24-badges { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 14px; }
.s24-badge {
    display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 18px 8px 14px;
    border-radius: 12px; font-family: var(--s24-font); font-size: 1.2rem; font-weight: 600; line-height: 1.05; text-decoration: none;
}
.s24-badge svg { width: 22px; height: 26px; flex: none; }
.s24-badge span { display: flex; flex-direction: column; }
.s24-badge small { font-size: .68rem; font-weight: 500; letter-spacing: .01em; }
.s24-badge-apple { background: #000; color: #fff; border: 1px solid #000; transition: transform .2s, box-shadow .2s; }
.s24-badge-apple:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .22); color: #fff; }
.s24-badge-apple:focus-visible { outline: 3px solid var(--s24-accent); outline-offset: 3px; }
@media (prefers-color-scheme: dark) { .s24-badge-apple { border-color: #A6A6A6; } }

/* ── Screenshots (shown when the page is not in 3D) ───────────────────────── */
.s24-shot { margin: 0; display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; }
.s24-shot img { display: block; width: auto; max-width: 100%; height: auto; max-height: 640px; border-radius: 32px; box-shadow: 0 24px 60px rgba(20, 21, 63, .18); }
.s24-shot-wide img { max-height: 460px; border-radius: 22px; }
.s24-shot-watch img { max-height: 300px; border-radius: 0; box-shadow: none; }
.s24-shot-widgets img { max-height: 200px; border-radius: 0; box-shadow: none; }

/* Flat layout: a normal stack of chapters, text beside the screen. */
.s24-ch { padding: 72px 24px; max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.s24-ch + .s24-ch { border-top: 1px solid var(--s24-sep); }
.s24-stage { display: none; }
@media (max-width: 820px) {
    .s24-ch { grid-template-columns: 1fr; gap: 28px; padding: 56px 20px; }
    .s24-shot img { max-height: 520px; }
}

/* ── 3D layout (app-story.js adds .is-3d once WebGL is up) ────────────────── */
.s24.is-3d .s24-stage {
    display: block; position: sticky; top: 0; height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh;
    z-index: 0; pointer-events: none;
}
.s24.is-3d .s24-stage canvas { display: block; width: 100%; height: 100%; }
.s24.is-3d .s24-shot { display: none; }
.s24.is-3d .s24-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;
}
.s24.is-3d .s24-hero { min-height: 130vh; padding-top: max(12vh, 64px); }
.s24.is-3d .s24-feature { min-height: 200vh; }
.s24.is-3d .s24-finale { min-height: 190vh; }
.s24.is-3d .s24-card {
    position: sticky; top: max(calc(var(--nav-h) + 24px), 20vh);
    padding: 30px 32px; border-radius: 26px;
    background: color-mix(in srgb, var(--s24-bg) 74%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
    border: 1px solid color-mix(in srgb, var(--s24-sep) 70%, transparent);
    box-shadow: 0 20px 50px rgba(20, 21, 63, .08);
}
.s24.is-3d .s24-hero .s24-card { top: max(12vh, 64px); 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
   chapter text pins to the bottom. Matches solve-24.js (aspect below 1). */
@media (max-aspect-ratio: 1/1) {
    .s24.is-3d .s24-ch {
        display: flex; flex-direction: column; justify-content: flex-end;
        padding: 0 14px 0; min-height: 150vh;
    }
    .s24.is-3d .s24-feature { min-height: 175vh; }
    .s24.is-3d .s24-hero { min-height: 120vh; }
    .s24.is-3d .s24-card, .s24.is-3d .s24-hero .s24-card {
        position: sticky; top: auto; bottom: 14px; max-width: 560px; width: 100%; margin: 0 auto;
        padding: 20px 22px; border-radius: 22px;
        background: color-mix(in srgb, var(--s24-bg) 80%, transparent);
        -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
        border: 1px solid color-mix(in srgb, var(--s24-sep) 70%, transparent);
    }
    .s24.is-3d .s24-card h1 { font-size: 2.6rem; margin-bottom: 10px; }
    .s24.is-3d .s24-card h2 { font-size: 1.6rem; margin-bottom: 8px; }
    .s24.is-3d .s24-card p { font-size: .97rem; line-height: 1.5; margin-bottom: 8px; }
    .s24.is-3d .s24-card .s24-lede { font-size: 1.05rem; }
    .s24.is-3d img.s24-icon { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 10px; }
    .s24.is-3d .s24-badges { margin: 12px 0 8px; }
    .s24.is-3d .s24-scroll-cue { display: none; }
}

/* ── The header while the story plays: slim and see-through ───────────────── */
body.s24-page .nav-inner, body.s24-page .nav-links { transition: height .35s ease; }
body.s24-page .nav-logo img { transition: height .35s ease; }
body.s24-page.s24-immersive .nav {
    background: color-mix(in srgb, var(--white) 55%, transparent);
    border-bottom-color: transparent;
}
/* Only the desktop bar shrinks: on phones the menu is a drawer sized from --nav-h. */
@media (min-width: 769px) {
body.s24-page.s24-immersive .nav {
    --nav-h: 50px;
    background: color-mix(in srgb, var(--white) 55%, transparent);
    border-bottom-color: transparent;
}
body.s24-page.s24-immersive .nav-logo img { height: 34px !important; }
body.s24-page.s24-immersive .nav-links a:not(.nav-cta) { font-size: .82rem; }
}
.s24:not(.is-3d) .s24-scroll-cue { display: none; }

@media (prefers-reduced-motion: reduce) {
    .s24-scroll-cue::after { animation: none; }
    body.s24-page .nav-inner, body.s24-page .nav-links, body.s24-page .nav-logo img { transition: none; }
}

/* Google Play is not out yet: a quiet label, not a link. */
.s24-badge-soon {
    border: 1.5px dashed var(--s24-sep); color: var(--s24-text-2);
    font-size: .95rem; font-weight: 650; padding: 8px 16px; background: transparent;
}

/* The three rules, numbered like the tutorial. */
.s24-rules { list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 8px; }
.s24-rules li { display: flex; gap: 12px; align-items: baseline; color: var(--s24-text); font-size: 1.02rem; line-height: 1.45; }
.s24-rules span {
    flex: none; display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%;
    background: var(--s24-accent); color: #fff; font-family: var(--s24-round); font-weight: 800; font-size: .9rem;
}
@media (prefers-color-scheme: dark) { .s24-rules span { color: #0F1033; } }

/* The Survival solution, as the game shows it when time runs out. */
.s24-solution {
    display: grid; gap: 2px; padding: 12px 16px; border-radius: 16px; max-width: 360px;
    background: color-mix(in srgb, var(--s24-surface) 85%, transparent); border: 1px solid var(--s24-sep);
    font-family: var(--s24-round); font-weight: 800; font-size: 1.1rem !important; color: var(--s24-text) !important;
    white-space: pre-wrap;
}
.s24-solution small { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--s24-survival); font-weight: 700; margin-top: 4px; }
#hints .s24-eyebrow { color: var(--s24-hint) !important; }
#survival .s24-eyebrow { color: var(--s24-survival) !important; }
