/* /sorry-im-late: the Sorry, I'm Late landing page.
   Colors follow the app (Packages Theme): cream #FBF3E3 with ink #231A13 and a
   wood brown #7A4A26 in light, a dark roast #231A13 with cream text in dark,
   and the running-figure orange #D9651E (#F2904A in dark) as the accent. The
   headings and the excuses use the system serif (New York on Apple devices),
   as the app's excuse cards do; the rest is the system font. Light and dark
   follow prefers-color-scheme. */

.sl {
    position: relative;
    --sl-bg: #FBF3E3;
    --sl-surface: #FFFBF3;
    --sl-text: #231A13;
    --sl-text-2: #5C4636;
    --sl-sep: #E7D8BC;
    --sl-accent: #B84F10;
    --sl-glow: rgba(217, 101, 30, .16);
    --sl-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --sl-festive: ui-serif, "New York", Georgia, "Times New Roman", serif;
    background: var(--sl-bg);
    color: var(--sl-text);
    font-family: var(--sl-font);
    overflow: clip;
}
@media (prefers-color-scheme: dark) {
    .sl {
        --sl-bg: #231A13;
        --sl-surface: #33271D;
        --sl-text: #FBF3E3;
        --sl-text-2: #D9C7AE;
        --sl-sep: #4A3A2C;
        --sl-accent: #F2904A;
        --sl-glow: rgba(242, 144, 74, .12);
    }
}
body.sl-page { background: var(--sl-bg, #FBF3E3); }
@media (prefers-color-scheme: dark) { body.sl-page { background: #231A13; } }

.sl::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 140vh; pointer-events: none;
    background: radial-gradient(55% 45% at 75% 22%, var(--sl-glow), transparent 70%);
}

/* ── Chapter text ─────────────────────────────────────────────────────────── */
.sl-card { position: relative; z-index: 2; max-width: 440px; }
.sl-card h1, .sl-card h2 { font-family: var(--sl-festive); font-weight: 700; color: var(--sl-text); letter-spacing: 0; }
.sl-card h1 { font-size: clamp(3.2rem, 6.4vw, 5rem); line-height: 1; margin: 6px 0 18px; }
.sl-card h2 { font-size: clamp(2.1rem, 3.6vw, 2.9rem); line-height: 1.08; margin: 4px 0 14px; }
.sl-card p { color: var(--sl-text-2); font-size: 1.08rem; line-height: 1.6; margin: 0 0 12px; }
.sl-card .sl-lede { font-size: 1.22rem; color: var(--sl-text); }
.sl-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .8rem !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--sl-accent) !important; margin-bottom: 6px !important;
}
.sl-aside { font-size: .95rem !important; font-weight: 600; color: var(--sl-text) !important; opacity: .8; }
.sl-note { font-size: .92rem !important; }
.sl-credit { font-size: .8rem !important; opacity: .75; }
.sl-icons { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; font-size: .88rem !important; margin-top: .4rem; }
.sl-icons img { width: 40px; height: 40px; border-radius: 9px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.sl-icons span { flex: 1 1 12rem; }
.sl-icon { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 10px 30px rgba(60, 36, 16, .22); display: block; margin-bottom: 18px; }
.sl-pieces { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 2px 0 12px !important; }
.sl-piece { display: block; height: 44px; width: auto; }

/* The three modes: a word for each, never color alone. */
.sl-modes { list-style: none; padding: 0; margin: 4px 0 14px; border-top: 1px solid var(--sl-sep); }
.sl-modes li {
    display: grid; grid-template-columns: 6rem 1fr; column-gap: 14px; align-items: baseline;
    color: var(--sl-text-2); line-height: 1.5; padding: 9px 0; border-bottom: 1px solid var(--sl-sep);
}
.sl-modes b { font-family: var(--sl-festive); font-size: 1.3rem; color: var(--sl-text); }
.sl-modes .sl-free b { color: var(--sl-accent); }
@media (max-width: 380px) { .sl-modes li { grid-template-columns: 1fr; row-gap: 2px; } }
.sl-price { font-family: var(--sl-festive); font-weight: 700; font-size: 1.5rem !important; color: var(--sl-accent) !important; margin: 6px 0 12px !important; }

/* Bottom center of the first screen; it scrolls away with the hero. */
.sl-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(--sl-text-2);
}
.sl-scroll-cue::after { content: ""; display: block; width: 2px; height: 34px; margin: 10px auto 0; background: linear-gradient(var(--sl-accent), transparent); animation: sl-cue 1.8s ease-in-out infinite; }
@keyframes sl-cue { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(8px); opacity: 1; } }

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

/* ── Screenshots (shown when the page is not in 3D) ───────────────────────── */
.sl-shot { margin: 0; display: flex; justify-content: center; align-items: center; }
.sl-shot img { display: block; width: auto; max-width: 100%; height: auto; max-height: 640px; border-radius: 32px; box-shadow: 0 24px 60px rgba(60, 36, 16, .22); }
.sl-shot-ipad img { border-radius: 24px; }

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

/* ── 3D layout (santa-helper.js adds .is-3d once WebGL is up) ─────────────── */
.sl.is-3d .sl-stage {
    display: block; position: sticky; top: 0; height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh;
    z-index: 0; pointer-events: none;
}
.sl.is-3d .sl-stage canvas { display: block; width: 100%; height: 100%; }
.sl.is-3d .sl-shot { display: none; }
.sl.is-3d .sl-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;
}
.sl.is-3d .sl-hero { min-height: 130vh; padding-top: max(12vh, 64px); }
.sl.is-3d .sl-feature { min-height: 200vh; }
.sl.is-3d .sl-finale { min-height: 140vh; }
.sl.is-3d .sl-card {
    position: sticky; top: max(calc(var(--nav-h) + 24px), 20vh);
    padding: 30px 32px; border-radius: 26px;
    background: color-mix(in srgb, var(--sl-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(--sl-sep) 70%, transparent);
    box-shadow: 0 20px 50px rgba(60, 36, 16, .1);
}
.sl.is-3d .sl-hero .sl-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 santa-helper.js (aspect below 1). */
@media (max-aspect-ratio: 1/1) {
    .sl.is-3d .sl-ch {
        display: flex; flex-direction: column; justify-content: flex-end;
        padding: 0 14px 0; min-height: 150vh;
    }
    .sl.is-3d .sl-feature { min-height: 175vh; }
    .sl.is-3d .sl-hero { min-height: 120vh; }
    .sl.is-3d .sl-card, .sl.is-3d .sl-hero .sl-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(--sl-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(--sl-sep) 70%, transparent);
    }
    .sl.is-3d .sl-card h1 { font-size: 2.8rem; margin-bottom: 10px; }
    .sl.is-3d .sl-card h2 { font-size: 1.8rem; margin-bottom: 8px; }
    .sl.is-3d .sl-card p { font-size: .97rem; line-height: 1.5; margin-bottom: 8px; }
    .sl.is-3d .sl-card .sl-lede { font-size: 1.05rem; }
    .sl.is-3d .sl-icon { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 10px; }
    .sl.is-3d .sl-badges { margin: 12px 0 8px; }
    .sl.is-3d .sl-scroll-cue { display: none; }
    .sl.is-3d .sl-modes li { padding: 6px 0; font-size: .92rem; }
    .sl.is-3d .sl-piece { height: 32px; }
}

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

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


/* The nine situations as plain chips (the 3D scene draws them too). */
.sl-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 2px 0 12px; }
.sl-chips li { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--sl-sep); background: var(--sl-surface); color: var(--sl-text); font-size: .86rem; font-weight: 600; }
.sl-shot-widget img { border-radius: 28px; max-height: 300px; }
