/* koshi.ai — one stylesheet for every page.
   No inline styles anywhere: the Content-Security-Policy in firebase.json
   only allows this file. Colours mirror the app's ThemeContext palettes. */

:root {
    --bg: #FFFDFA;
    --bg-soft: #F6F0E8;
    --surface: #FFFFFF;
    --text: #292C60;
    --sub: rgba(46, 46, 78, 0.72);
    --border: rgba(41, 44, 96, 0.10);
    --accent: #5E62FF;
    --accent-ink: #FFFFFF;
    --accent-soft: rgba(94, 98, 255, 0.10);
    --sun: #FFD465;
    --sun-ink: #2B2E66;
    --shadow: 0 1px 2px rgba(41, 44, 96, 0.06), 0 12px 32px rgba(41, 44, 96, 0.10);
    --radius: 28px;
    --gutter: clamp(16px, 4vw, 40px);
    --font-round: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #282A62;
        --bg-soft: #2C2E68;
        --surface: #31346E;
        --text: #F5F6FC;
        --sub: rgba(220, 225, 240, 0.86);
        --border: rgba(255, 255, 255, 0.10);
        --accent: #8A8FFF;
        --accent-ink: #1E2050;
        --accent-soft: rgba(138, 143, 255, 0.16);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 14px 36px rgba(0, 0, 0, 0.28);
    }
    /* Yellow over navy goes muddy — keep only a hint of it. */
    .blob.b2 { opacity: 0.18; }
}

*, *::before, *::after { box-sizing: border-box; }

/* overflow-x on BOTH html and body: iOS Safari ignores it on body alone and
   lets the page pinch out to the overflow width. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; overflow-x: clip; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-x: clip;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

h1, h2, h3 { font-family: var(--font-round); line-height: 1.12; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6.4vw, 4.4rem); font-weight: 800; }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 800; }
h3 { font-size: 1.35rem; font-weight: 700; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-round); font-weight: 800; font-size: 1.35rem; color: var(--text); text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 10px; }
.nav-links { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.nav-links a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.98rem; opacity: 0.82; }
.nav-links a:hover { opacity: 1; color: var(--accent); }

/* ---------- Buttons / pills ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 15px 26px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-family: var(--font-round); font-weight: 700; font-size: 1.05rem; text-decoration: none; box-shadow: 0 10px 24px rgba(94, 98, 255, 0.32); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(94, 98, 255, 0.40); }
.btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.btn small { display: block; font-family: var(--font-body); font-weight: 600; font-size: 0.72rem; opacity: 0.85; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; }
.btn span { display: block; line-height: 1.15; text-align: left; }
.btn.is-soon { cursor: default; }
.btn.is-soon:hover { transform: none; box-shadow: 0 10px 24px rgba(94, 98, 255, 0.32); }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--sun); color: var(--sun-ink); font-weight: 700; font-size: 0.88rem; font-family: var(--font-round); }

/* ---------- Hero ---------- */
/* The glow blobs hang past the edges on purpose — the hero clips them (and
   `isolation` keeps their z-index:-1 inside the hero instead of behind the page). */
.hero { position: relative; overflow: hidden; overflow: clip; isolation: isolate; padding: clamp(36px, 7vw, 88px) 0 clamp(48px, 8vw, 104px); }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { margin-top: 22px; font-size: clamp(1.1rem, 1.9vw, 1.3rem); color: var(--sub); max-width: 34em; }
.hero .cta { margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; }
.hero .cta-note { color: var(--sub); font-size: 0.95rem; }
.hero .pill { margin-bottom: 22px; }

.hero-art { position: relative; justify-self: center; width: min(100%, 440px); }
.hero-art .frame { border-radius: 36px; overflow: hidden; box-shadow: var(--shadow); transform: rotate(2.2deg); border: 6px solid var(--surface); background: var(--surface); }
.hero-art img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.hero-art .star { position: absolute; color: var(--sun); animation: bob 5s ease-in-out infinite; }
.hero-art .star svg { width: 100%; height: 100%; fill: currentColor; filter: drop-shadow(0 6px 10px rgba(255, 180, 40, 0.35)); }
.hero-art .s1 { width: 58px; height: 58px; top: -22px; left: -18px; }
.hero-art .s2 { width: 34px; height: 34px; bottom: 12%; right: -20px; animation-delay: -1.6s; }
.hero-art .s3 { width: 24px; height: 24px; top: 18%; right: -30px; animation-delay: -3.1s; color: var(--accent); }

.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55; z-index: -1; pointer-events: none; }
.blob.b1 { width: 420px; height: 420px; background: rgba(94, 98, 255, 0.22); top: -140px; right: -120px; }
.blob.b2 { width: 360px; height: 360px; background: rgba(255, 212, 101, 0.38); bottom: -120px; left: -140px; }

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-10px) rotate(8deg); } }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section.soft { background: var(--bg-soft); }
.section-head { max-width: 40em; margin: 0 auto clamp(32px, 5vw, 56px); text-align: center; }
.section-head p { margin-top: 14px; color: var(--sub); font-size: 1.12rem; }
.eyebrow { display: block; font-family: var(--font-round); font-weight: 700; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.85rem; margin-bottom: 12px; }

/* Three worlds */
.worlds { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.4vw, 28px); }
.world { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 28px 32px; box-shadow: var(--shadow); transition: transform 0.2s ease; }
.world:hover { transform: translateY(-4px); }
.world img { width: 92px; height: 92px; object-fit: contain; margin-bottom: 18px; }
.world h3 { font-size: 1.7rem; font-weight: 800; }
.world .tag { display: block; color: var(--accent); font-weight: 700; font-family: var(--font-round); margin: 4px 0 12px; }
.world p { color: var(--sub); }

/* Parents */
.parents { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 2vw, 24px); }
.point { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 24px; }
.point .ico { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 16px; }
.point .ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.point h3 { font-size: 1.15rem; margin-bottom: 6px; }
.point p { color: var(--sub); font-size: 0.98rem; }

/* Theirs */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.split ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.split li { display: flex; gap: 14px; align-items: flex-start; color: var(--sub); }
.split li strong { color: var(--text); }
.split li::before { content: ""; flex: none; width: 12px; height: 12px; margin-top: 8px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 5px rgba(255, 212, 101, 0.28); }
.split .lead { margin-top: 14px; color: var(--sub); font-size: 1.1rem; }
.kids { display: flex; justify-content: center; align-items: flex-end; gap: clamp(12px, 3vw, 28px); }
.kid { width: clamp(130px, 22vw, 210px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: end center; overflow: hidden; box-shadow: var(--shadow); border: 6px solid var(--surface); }
.kid.sun { background: var(--sun); }
.kid.sky { background: #A9ACFF; margin-bottom: clamp(24px, 5vw, 56px); }
.kid img { width: 86%; height: 86%; object-fit: contain; object-position: bottom; }

/* FAQ */
.faq { max-width: 780px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 0 22px; }
.faq summary { cursor: pointer; list-style: none; padding: 18px 0; font-family: var(--font-round); font-weight: 700; font-size: 1.1rem; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; line-height: 1; color: var(--accent); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 20px; color: var(--sub); }

/* Final CTA */
.final { text-align: center; }
.final .card { background: linear-gradient(135deg, #5E62FF 0%, #8A8FFF 100%); color: #FFFFFF; border-radius: 36px; padding: clamp(40px, 6vw, 72px) var(--gutter); box-shadow: 0 24px 60px rgba(94, 98, 255, 0.35); }
.final p { margin: 14px auto 28px; max-width: 32em; opacity: 0.92; font-size: 1.12rem; }
.final .btn { background: #FFFFFF; color: #2B2E66; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }

/* Footer */
.footer { padding: 40px 0 56px; border-top: 1px solid var(--border); color: var(--sub); font-size: 0.95rem; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; justify-content: space-between; align-items: center; }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer a { color: var(--sub); text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--accent); }

/* ---------- Document pages (privacy / terms / support) ---------- */
.doc { padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); }
.doc .wrap { max-width: 780px; }
.doc h1 { font-size: clamp(2.1rem, 5vw, 3rem); }
.doc .updated { margin-top: 10px; color: var(--sub); font-size: 0.95rem; }
.doc h2 { font-size: 1.3rem; margin: 34px 0 8px; }
.doc p { color: var(--sub); margin-top: 12px; }
.doc .intro { font-size: 1.12rem; margin-top: 26px; color: var(--text); }
.doc .card { margin-top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); }
.doc .card h2 { margin-top: 0; }
.doc .card + .card { margin-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero .wrap, .split { grid-template-columns: 1fr; }
    .hero-art { order: -1; width: min(78%, 360px); }
    .hero { text-align: center; }
    .hero .lead { margin-left: auto; margin-right: auto; }
    .hero .cta { justify-content: center; }
    .worlds, .parents { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
    body { font-size: 16px; }
    .worlds, .parents { grid-template-columns: 1fr; }
    .nav-links .hide-s { display: none; }
    .hero-art .s2, .hero-art .s3 { right: -8px; }
    .hero-art .s1 { left: -8px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .hero-art .star { animation: none; }
    .btn, .world { transition: none; }
}
