/* /arabic-alphabet: the Arabic Alphabet landing page.
   Colors follow the app: a calm blue paper in light, deep night blue in dark,
   the blue accent and a teal second color. Arabic is set in the system's
   Naskh face (Geeza Pro on Apple devices). Light and dark follow
   prefers-color-scheme, the same query the site's palette uses. */

.aa {
    --aa-bg: #F3F6FC;
    --aa-surface: #FFFFFF;
    --aa-sunken: #E6ECF7;
    --aa-text: #14213D;
    --aa-text-2: #4B5673;
    --aa-sep: #D3DBEA;
    --aa-accent: #1D4ED8;
    --aa-accent-2: #0F766E;
    --aa-glow: rgba(37, 99, 235, .16);
    --aa-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --aa-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --aa-arabic: "Geeza Pro", "Noto Naskh Arabic", "Noto Sans Arabic", Amiri, Tahoma, serif;
    position: relative;
    background: var(--aa-bg);
    color: var(--aa-text);
    font-family: var(--aa-font);
    overflow: clip;
}
@media (prefers-color-scheme: dark) {
    .aa {
        --aa-bg: #0B1324;
        --aa-surface: #16213A;
        --aa-sunken: #1C2945;
        --aa-text: #EEF2FA;
        --aa-text-2: #A3AECB;
        --aa-sep: #26324F;
        --aa-accent: #7DB3FF;
        --aa-accent-2: #5EEAD4;
        --aa-glow: rgba(96, 165, 250, .14);
    }
}
body.aa-page { background: var(--aa-bg, #F3F6FC); }
@media (prefers-color-scheme: dark) { body.aa-page { background: #0B1324; } }

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

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

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

/* ── Screenshots (shown when the page is not in 3D) ───────────────────────── */
.aa-shot { margin: 0; display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; }
.aa-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); }
.aa-shot-wide img { max-height: 460px; border-radius: 22px; }
.aa-shot-watch img { max-height: 300px; border-radius: 0; box-shadow: none; }
.aa-shot-widgets img { max-height: 200px; border-radius: 0; box-shadow: none; }

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

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

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

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