/* ==========================================================================
   spike — spikehealth.app
   Brand tokens pulled from the iOS app's ColorScheme.swift
   ========================================================================== */

:root {
    /* Brand */
    --dark-teal: #0C2F31;      /* spikeDarkTeal — page background anchor */
    --house-green: #243832;    /* spikeHouseGreen — cards */
    --starbucks: #296044;      /* spikeStarbucksGreen */
    --accent: #32734E;         /* spikeAccentGreen — CTAs */
    --cream: #E5E7E3;          /* light primarybacklight — text on dark */
    --teal: #1D9E75;           /* glucoseInRange — the curve */
    --teal-bright: #5DCAA5;
    --amber: #EF9F27;          /* glucoseHigh — spikes */

    --bg: #0A1512;
    --bg-raised: #111F1A;
    --text: var(--cream);
    --text-dim: rgba(229, 231, 227, 0.62);
    --text-faint: rgba(229, 231, 227, 0.4);
    --border: rgba(229, 231, 227, 0.12);

    --font-head: 'Poppins', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    --radius: 16px;
    --container: 1080px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

h1, h2, h3 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 21, 18, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 0.04em;
}

.nav-logo svg { display: block; }

.nav-links {
    display: flex;
    gap: 28px;
    font-size: 15px;
    color: var(--text-dim);
}

.nav-links a:hover { color: var(--text); }

.nav-cta {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    padding: 9px 20px;
    border-radius: 999px;
    transition: background 0.15s ease;
}

.nav-cta:hover { background: var(--starbucks); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
    padding: 88px 0 64px;
    background:
        radial-gradient(ellipse 900px 500px at 70% -10%, rgba(41, 96, 68, 0.35), transparent),
        var(--bg);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 56px;
    align-items: center;
}

.hero h1 {
    font-size: clamp(40px, 6vw, 64px);
    margin-bottom: 20px;
}

.hero h1 .accent { color: var(--teal-bright); }

.hero-sub {
    font-size: 19px;
    color: var(--text-dim);
    max-width: 46ch;
    margin-bottom: 18px;
}

.works-with {
    font-size: 14px;
    color: var(--text-faint);
    margin-bottom: 32px;
}

.works-with strong { color: var(--text-dim); font-weight: 600; }

.store-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 10px 22px;
    transition: transform 0.15s ease;
}

.store-badge:hover { transform: scale(1.03); }

.store-badge .apple { font-size: 30px; line-height: 1; }

.store-badge .lines { display: flex; flex-direction: column; line-height: 1.25; }
.store-badge .small { font-size: 11px; color: rgba(255, 255, 255, 0.7); }
.store-badge .big { font-size: 18px; font-weight: 600; color: #fff; }

/* QR download modal */

.qr-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(4, 10, 8, 0.72);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* display:flex above would defeat the hidden attribute without this */
.qr-overlay[hidden] { display: none; }

.qr-card {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px 32px;
    max-width: 380px;
    text-align: center;
}

.qr-card h3 {
    font-size: 22px;
    margin: 20px 0 10px;
}

.qr-card p {
    color: var(--text-dim);
    font-size: 14.5px;
    margin-bottom: 18px;
}

.qr-card a {
    color: var(--teal-bright);
    font-weight: 600;
    font-size: 15px;
}

.qr-box {
    display: inline-block;
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    line-height: 0;
}

.qr-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(229, 231, 227, 0.1);
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
}

.qr-close:hover { background: rgba(229, 231, 227, 0.2); }

/* Phone mock */

.hero-phone {
    justify-self: center;
    width: min(320px, 80vw);
    border-radius: 44px;
    border: 10px solid #1c2a24;
    background: #000;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
}

.hero-phone img { width: 100%; }

/* --------------------------------------------------------------------------
   Curve demo
   -------------------------------------------------------------------------- */

.curve-demo {
    padding: 72px 0;
    border-top: 1px solid var(--border);
}

.curve-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.curve-card h2 { font-size: 32px; margin-bottom: 14px; }
.curve-card p { color: var(--text-dim); margin-bottom: 10px; }

.spike-pill {
    display: inline-block;
    margin-top: 12px;
    background: rgba(239, 159, 39, 0.15);
    color: var(--amber);
    font-weight: 600;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    opacity: 0;
}

@keyframes pill-in {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.curve-svg { width: 100%; height: auto; }

/* Animations are armed but don't run until the card scrolls into view —
   the .in-view class is added by an IntersectionObserver in index.html.
   Without it, everything played at page load, invisible below the fold. */
.curve-path {
    stroke-dasharray: 620;
    stroke-dashoffset: 620;
}

.in-view .curve-path { animation: draw 2.2s ease-out 0.3s forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }

.peak-dot { opacity: 0; }

.in-view .peak-dot { animation: pill-in 0.4s ease 1.6s forwards; }

.in-view .spike-pill { animation: pill-in 0.5s ease 2.3s forwards; }

/* --------------------------------------------------------------------------
   How it works
   -------------------------------------------------------------------------- */

.section { padding: 88px 0; border-top: 1px solid var(--border); }

.section-head { text-align: center; max-width: 620px; margin: 0 auto 56px; }
.section-head h2 { font-size: clamp(30px, 4vw, 42px); margin-bottom: 14px; }
.section-head p { color: var(--text-dim); font-size: 17px; }

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.step {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--house-green);
    color: var(--teal-bright);
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 18px;
}

.step h3 { font-size: 20px; margin-bottom: 10px; }
.step p { color: var(--text-dim); font-size: 15px; }

/* --------------------------------------------------------------------------
   Features
   -------------------------------------------------------------------------- */

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--house-green);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 20px;
}

.feature h3 { font-size: 18px; margin-bottom: 8px; }
.feature p { color: var(--text-dim); font-size: 14.5px; }

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */

.faq-list { max-width: 720px; margin: 0 auto; }

.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 4px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 17px;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: '+';
    font-size: 24px;
    color: var(--teal-bright);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item p {
    color: var(--text-dim);
    font-size: 15.5px;
    padding: 0 4px 22px;
    max-width: 65ch;
}

/* --------------------------------------------------------------------------
   Download band + footer
   -------------------------------------------------------------------------- */

.download-band {
    text-align: center;
    padding: 96px 24px;
    background:
        radial-gradient(ellipse 700px 400px at 50% 120%, rgba(41, 96, 68, 0.45), transparent),
        var(--bg);
    border-top: 1px solid var(--border);
}

.download-band h2 { font-size: clamp(30px, 4vw, 44px); margin-bottom: 14px; }
.download-band p { color: var(--text-dim); margin-bottom: 32px; }

.footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    font-size: 14px;
    color: var(--text-faint);
}

.footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--text); }

.footer-legal {
    margin-top: 24px;
    font-size: 12.5px;
    color: var(--text-faint);
    max-width: 72ch;
}

/* --------------------------------------------------------------------------
   Legal pages
   -------------------------------------------------------------------------- */

.legal {
    max-width: 760px;
    margin: 0 auto;
    padding: 64px 24px 96px;
}

.legal h1 { font-size: 36px; margin-bottom: 8px; }
.legal .updated { color: var(--text-faint); font-size: 14px; margin-bottom: 40px; }
.legal h2 { font-size: 22px; margin: 40px 0 12px; }
.legal h3 { font-size: 17px; margin: 24px 0 8px; }
.legal p, .legal li { color: var(--text-dim); font-size: 15.5px; margin-bottom: 12px; }
.legal ul { padding-left: 22px; margin-bottom: 16px; }
.legal a { color: var(--teal-bright); }
.legal strong { color: var(--text); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .hero-grid, .curve-card { grid-template-columns: 1fr; }
    .hero { padding: 56px 0 48px; }
    .hero-phone { order: -1; width: min(260px, 70vw); }
    .steps, .features-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
}
