/* /tap-tap-read: the Tap Tap Read landing page. Colors follow the app's own
   palette (docs/DESIGN.md): reading paper #FCF7ED with ink #211F1C, the Teal
   brand from #35B8BB to #0A68AD, accent ink #0A68AD; dark is the app's night
   paper #171F26 with ink #EBEBE6 and accent #35B8BB. Headings are in the
   reader's serif (New York through ui-serif), the rest in the system font.
   The page follows prefers-color-scheme, the same query the site's palette uses. */

.ttr {
    --ttr-bg: #FCF7ED;
    --ttr-surface: #FFFFFF;
    --ttr-sunken: #E6EEF2;
    --ttr-text: #211F1C;
    --ttr-text-2: #5C5750;
    --ttr-sep: #E3DACB;
    --ttr-accent: #0A68AD;
    --ttr-accent-2: #0F7C8C;
    --ttr-glow: rgba(53, 184, 187, .22);
    --ttr-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --ttr-round: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
    position: relative;
    background: var(--ttr-bg);
    color: var(--ttr-text);
    font-family: var(--ttr-font);
    overflow: clip;
}
@media (prefers-color-scheme: dark) {
    .ttr {
        --ttr-bg: #171F26;
        --ttr-surface: #172026;
        --ttr-sunken: #223039;
        --ttr-text: #EBEBE6;
        --ttr-text-2: #B4BAB8;
        --ttr-sep: #2C3A44;
        --ttr-accent: #35B8BB;
        --ttr-accent-2: #4CC3C6;
        --ttr-glow: rgba(53, 184, 187, .14);
    }
}
body.ttr-page { background: var(--ttr-bg, #FCF7ED); }
@media (prefers-color-scheme: dark) { body.ttr-page { background: #171F26; } }

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

/* ── Chapter text ─────────────────────────────────────────────────────────── */
.ttr-card { position: relative; z-index: 2; max-width: 440px; }
.ttr-card h1, .ttr-card h2 { font-family: var(--ttr-round); color: var(--ttr-text); letter-spacing: -.02em; }
.ttr-card h1 { font-size: clamp(2.3rem, 4.2vw, 3.5rem); font-weight: 800; line-height: 1.06; margin: 6px 0 18px; }
.ttr-card h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 800; line-height: 1.08; margin: 4px 0 14px; }
.ttr-card p { color: var(--ttr-text-2); font-size: 1.08rem; line-height: 1.6; margin: 0 0 12px; }
.ttr-card .ttr-lede { font-size: 1.25rem; color: var(--ttr-text); }
.ttr-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .8rem !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ttr-accent) !important; margin-bottom: 6px !important;
}
.ttr-feature h2 { color: var(--ttr-text); }
.ttr-quote { margin: 8px 0 0; }
.ttr-quote p { font-family: "New York", ui-serif, "Iowan Old Style", Georgia, serif; font-size: 1.22rem; line-height: 1.55; color: var(--ttr-text); }
.ttr-quote footer { font-size: .92rem; font-weight: 600; color: var(--ttr-text-2); }
.ttr-aside { font-size: .95rem !important; font-weight: 600; color: var(--ttr-text) !important; opacity: .8; }
.ttr-note { font-size: .92rem !important; }
.ttr-icon { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 10px 30px rgba(11, 42, 91, .18); display: block; margin-bottom: 18px; }
/* Facts: a quiet two-column list, label left and detail right, split by hairlines. */
.ttr-facts { list-style: none; padding: 0; margin: 4px 0 16px; border-top: 1px solid var(--ttr-sep); }
.ttr-facts li {
    display: grid; grid-template-columns: 5.5rem 1fr; column-gap: 16px; align-items: baseline;
    color: var(--ttr-text-2); line-height: 1.5; padding: 11px 0; border-bottom: 1px solid var(--ttr-sep);
}
.ttr-facts strong {
    color: var(--ttr-accent); font-family: var(--ttr-round); font-weight: 650;
    font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
}
@media (max-width: 380px) { .ttr-facts li { grid-template-columns: 1fr; row-gap: 2px; } }
/* Bottom center of the first screen; it scrolls away with the hero. */
.ttr-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(--ttr-text-2);
}
.ttr-scroll-cue::after { content: ""; display: block; width: 2px; height: 34px; margin: 10px auto 0; background: linear-gradient(var(--ttr-accent), transparent); animation: ttr-cue 1.8s ease-in-out infinite; }
@keyframes ttr-cue { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(8px); opacity: 1; } }

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

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

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

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

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

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

/* ── This app's own bits ─────────────────────────────────────────────────── */
.ttr-card h1, .ttr-card h2 { font-weight: 700; letter-spacing: -.01em; }
.ttr-quote { font-family: var(--ttr-round); font-size: 1.12rem !important; color: var(--ttr-text) !important; border-left: 3px solid var(--ttr-accent); padding-left: 14px; }
.ttr-quote cite { display: block; margin-top: 6px; font: 600 .82rem/1.3 var(--ttr-font); font-style: normal; color: var(--ttr-text-2); }
.ttr-price { font-family: var(--ttr-round); font-weight: 700; font-size: 1.2rem !important; color: var(--ttr-text) !important; }
.ttr-steps { list-style: none; padding: 0; margin: 6px 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.ttr-steps li { font: 700 .82rem/1 var(--ttr-font); padding: 7px 10px; border-radius: 999px; background: var(--ttr-sunken); color: var(--ttr-text); }
.ttr-steps li b { color: var(--ttr-accent); font-weight: 800; margin-right: 4px; }
.ttr-widgets { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.ttr-widgets img { max-height: 200px; border-radius: 26px; }
.ttr-credit { font-size: .85rem !important; }
.ttr-credit a { color: var(--ttr-accent); }

/* Theme strip: the nine reader themes as small phones */
.ttr-themes { list-style: none; padding: 0; margin: 4px 0 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ttr-themes li { margin: 0; text-align: center; }
.ttr-themes img { width: 100%; height: auto; border-radius: 10px; display: block; }
.ttr-themes span { display: block; margin-top: 4px; font-size: .78rem; }
@media (min-width: 900px) { .ttr-themes { grid-template-columns: repeat(5, 1fr); } }
