/* /scary-minds: the Scary Minds landing page, on Halloween night.
   Colors come from the app's default Moon Boo theme (docs/DESIGN.md): ink
   (#2E2347) on a peach sunset (#FFF0DC to #FFC48F) with pumpkin-orange tile
   edges (#FF9454) in light mode, and pale ink (#F2F4FF) with periwinkle
   (#AFC2FF) on a navy night (#152E56 to #060C1A) with gold edges (#E0B83A) in
   dark, and the app's purple candy (#9B5DE5). The 3D scene adds the moon, the
   hill and the six characters of the app's six themes (scary-minds.js). The
   app sets every tile, button and number in the system serif (New York), and
   so does the page. It follows the system's light and dark mode. */

.sm {
    position: relative;
    --sm-bg: #FFF0DC;
    --sm-bg-2: #FFC48F;
    --sm-surface: #FFFFFF;
    --sm-text: #2E2347;
    --sm-text-2: #5E4A6E;
    --sm-sep: #F2C9A2;
    --sm-accent: #4B44C9;
    --sm-candy: #8A3FD1;
    --sm-candy-fill: #FF9454;
    --sm-tile: #FFFFFF;
    --sm-tile-edge: #FF9454;
    --sm-tile-ink: #2E2347;
    --sm-ground: #3A2257;
    --sm-glow: rgba(255, 148, 84, .28);
    --sm-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --sm-round: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
    background: linear-gradient(180deg, var(--sm-bg) 0%, var(--sm-bg-2) 100%);
    color: var(--sm-text);
    font-family: var(--sm-font);
    overflow: clip;
}
@media (prefers-color-scheme: dark) {
    .sm {
        --sm-bg: #152E56;
        --sm-bg-2: #060C1A;
        --sm-surface: #1D3666;
        --sm-text: #F2F4FF;
        --sm-text-2: #B9C6E0;
        --sm-sep: #2C4775;
        --sm-accent: #AFC2FF;
        --sm-candy: #E0B83A;
        --sm-candy-fill: #E0B83A;
        --sm-tile: #F2F4FF;
        --sm-tile-edge: #E0B83A;
        --sm-tile-ink: #1A1640;
        --sm-ground: #04070F;
        --sm-glow: rgba(255, 226, 122, .16);
    }
}
@media (prefers-color-scheme: dark) { body.sm-page { background: #060C1A; } }

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

/* ── Chapter text ─────────────────────────────────────────────────────────── */
.sm-card { position: relative; z-index: 2; max-width: 440px; }
.sm-card h1, .sm-card h2 { font-family: var(--sm-round); color: var(--sm-text); letter-spacing: -.02em; }
.sm-card h1 { font-size: clamp(3rem, 6vw, 4.6rem); font-weight: 800; line-height: 1; margin: 6px 0 18px; }
.sm-card h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 800; line-height: 1.08; margin: 4px 0 14px; }
.sm-card p { color: var(--sm-text-2); font-size: 1.08rem; line-height: 1.6; margin: 0 0 12px; }
.sm-card .sm-lede { font-size: 1.25rem; color: var(--sm-text); }
.sm-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .8rem !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--sm-accent) !important; margin-bottom: 6px !important;
}
.sm-feature h2 { color: var(--sm-text); }
.sm-price { font-size: 1.35rem !important; font-weight: 700; color: var(--sm-accent) !important; margin: 6px 0 12px !important; }
.sm-aside { font-size: .95rem !important; font-weight: 600; color: var(--sm-text) !important; opacity: .8; }
.sm-note { font-size: .92rem !important; }
img.sm-icon { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 10px 30px rgba(30, 24, 80, .18); display: block; margin-bottom: 18px; }
/* Bottom center of the first screen; it scrolls away with the hero. */
.sm-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(--sm-text-2);
}
.sm-scroll-cue::after { content: ""; display: block; width: 2px; height: 34px; margin: 10px auto 0; background: linear-gradient(var(--sm-accent), transparent); animation: sm-cue 1.8s ease-in-out infinite; }
/* Over the 3D hill the cue is set in the app's poster ink, like its title cards. */
.sm.is-3d .sm-scroll-cue { color: #FFF0DC; text-shadow: 0 1px 8px rgba(20, 10, 40, .5); }
.sm.is-3d .sm-scroll-cue::after { background: linear-gradient(#FFF0DC, transparent); }
@keyframes sm-cue { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(8px); opacity: 1; } }

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

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

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

/* ── 3D layout (app-story.js adds .is-3d once WebGL is up) ────────────────── */
.sm.is-3d .sm-stage {
    /* The large viewport (lvh), not the small one: when Safari hides its address
       bar the screen grows, and a stage sized to the small viewport left a strip
       of bare sky under the hill. The extra height sits behind the toolbar while
       it shows. */
    display: block; position: sticky; top: 0; height: 100vh; height: 100lvh; margin-bottom: -100vh; margin-bottom: -100lvh;
    z-index: 0; pointer-events: none;
    /* The sky the 3D night stands in: one screen of sunset (or night), always. */
    background: linear-gradient(180deg, var(--sm-bg) 0%, var(--sm-bg-2) 100%);
}
.sm.is-3d::before { display: none; }
.sm.is-3d .sm-stage canvas { display: block; width: 100%; height: 100%; }
.sm.is-3d .sm-shot { display: none; }
.sm.is-3d .sm-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;
}
.sm.is-3d .sm-hero { min-height: 130vh; padding-top: max(12vh, 64px); }
.sm.is-3d .sm-feature { min-height: 200vh; }
.sm.is-3d .sm-finale { min-height: 190vh; }
.sm.is-3d .sm-card {
    position: sticky; top: max(calc(var(--nav-h) + 24px), 20vh);
    padding: 30px 32px; border-radius: 26px;
    background: color-mix(in srgb, var(--sm-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(--sm-sep) 70%, transparent);
    box-shadow: 0 20px 50px rgba(30, 24, 80, .08);
}
.sm.is-3d .sm-hero .sm-card { top: max(12vh, 64px); }

/* 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) {
    .sm.is-3d .sm-ch {
        display: flex; flex-direction: column; justify-content: flex-end;
        padding: 0 14px 0; min-height: 150vh;
    }
    .sm.is-3d .sm-feature { min-height: 175vh; }
    .sm.is-3d .sm-hero { min-height: 120vh; }
    .sm.is-3d .sm-card, .sm.is-3d .sm-hero .sm-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(--sm-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(--sm-sep) 70%, transparent);
    }
    .sm.is-3d .sm-card h1 { font-size: 2.6rem; margin-bottom: 10px; }
    .sm.is-3d .sm-card h2 { font-size: 1.6rem; margin-bottom: 8px; }
    .sm.is-3d .sm-card p { font-size: .97rem; line-height: 1.5; margin-bottom: 8px; }
    .sm.is-3d .sm-card .sm-lede { font-size: 1.05rem; }
    .sm.is-3d img.sm-icon { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 10px; }
    .sm.is-3d .sm-badges { margin: 12px 0 8px; }
    .sm.is-3d .sm-scroll-cue { display: none; }
}

/* ── The header while the story plays: slim and see-through ───────────────── */
body.sm-page .nav-inner, body.sm-page .nav-links { transition: height .35s ease; }
body.sm-page .nav-logo img { transition: height .35s ease; }
body.sm-page.sm-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.sm-page.sm-immersive .nav {
    --nav-h: 50px;
    background: color-mix(in srgb, var(--white) 55%, transparent);
    border-bottom-color: transparent;
}
body.sm-page.sm-immersive .nav-logo img { height: 34px !important; }
body.sm-page.sm-immersive .nav-links a:not(.nav-cta) { font-size: .82rem; }
}
.sm:not(.is-3d) .sm-scroll-cue { display: none; }

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

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

/* The welcome line and the solve line, in the app's own words. */
.sm-quote {
    font-family: var(--sm-round); font-weight: 700; font-size: 1.12rem !important; color: var(--sm-text) !important;
    border-left: 4px solid var(--sm-candy-fill); padding: 2px 0 2px 14px; margin: 14px 0 !important;
}
.sm-wrong { color: var(--sm-accent) !important; font-family: var(--sm-round); font-weight: 800; font-size: 1.2rem !important; }

/* The answer spelled in letter tiles, like the game's bank. */
.sm-tiles { list-style: none; padding: 0; margin: 14px 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.sm-tiles li {
    width: 44px; height: 48px; border-radius: 10px; display: grid; place-items: center;
    background: var(--sm-tile); color: var(--sm-tile-ink); border: 1px solid var(--sm-tile-edge); box-shadow: 0 3px 0 var(--sm-tile-edge);
    font-family: var(--sm-round); font-weight: 800; font-size: 1.35rem;
}

/* Candy rewards and costs, as small pink chips. */
.sm-candies { list-style: none; padding: 0; margin: 14px 0 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.sm-candies li {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
    background: color-mix(in srgb, var(--sm-surface) 85%, transparent); border: 1px solid var(--sm-sep);
    font-size: .92rem; font-weight: 600; color: var(--sm-text);
}
.sm-candies b { color: var(--sm-candy); font-family: var(--sm-round); }

/* The eight levels, by word length. */
.sm-levels { list-style: none; padding: 0; margin: 14px 0 6px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 360px; }
.sm-levels li {
    border-radius: 12px; padding: 6px 4px; text-align: center; font-size: .78rem; font-weight: 600; color: var(--sm-text-2);
    background: color-mix(in srgb, var(--sm-surface) 85%, transparent); border: 1px solid var(--sm-sep);
}
.sm-levels li b { display: block; font-family: var(--sm-round); font-size: 1.15rem; color: var(--sm-text); }
.sm-levels li.sm-free { border-color: var(--sm-candy-fill); }
.sm-levels li.sm-free b { color: var(--sm-candy); }
@media (max-aspect-ratio: 1/1) {
    .sm.is-3d .sm-candies li { font-size: .82rem; padding: 4px 10px; }
    .sm.is-3d .sm-tiles li { width: 36px; height: 40px; font-size: 1.1rem; }
    .sm.is-3d .sm-levels { display: none; }
}
.sm-age { display: inline-block; font-weight: 800; color: var(--sm-accent) !important; }

/* ── Halloween night without 3D: the six characters in a row on their hill ── */
.sm-gang { display: none; }
.sm:not(.is-3d) .sm-gang {
    display: flex; align-items: flex-end; justify-content: center; gap: clamp(6px, 2vw, 22px);
    max-width: 1100px; margin: 0 auto; padding: 24px 24px 0; position: relative;
}
.sm:not(.is-3d) .sm-gang::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26%;
    background: var(--sm-ground); border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.sm-gang img { display: block; width: auto; height: clamp(64px, 12vw, 150px); position: relative; z-index: 0; margin-bottom: -2%; }
.sm-gang .sm-gang-tall img { height: clamp(96px, 18vw, 220px); }
.sm-gang .sm-gang-fly { align-self: flex-start; }
