/* ===========================
   CapiSleep — Product Page
   Refined light mode design
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
.capi-page {
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;

    --bg: #fafbfe;
    --bg-alt: #f5f3ff;
    --bg-soft: #f8fafc;
    --ink: #1a1d2e;
    --muted: #475569;
    --subtle: #94a3b8;
    --card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: #eef2ff;
    --violet: #8b5cf6;
    --blue: #3b82f6;
    --teal: #14b8a6;
    --green: #22c55e;
    --amber: #f59e0b;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.07);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.10);
    --shadow-hero: 0 32px 80px rgba(0,0,0,0.13);

    --section-pad: 100px;
    --container: 1100px;
}

/* --- Base --- */
html { scroll-behavior: smooth; }

.capi-page {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.65;
    letter-spacing: -0.01em;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

.capi-page img { display: block; max-width: 100%; height: auto; }
.capi-page a { color: inherit; }

/* --- Typography --- */
.capi-page h1, .capi-page h2, .capi-page h3 {
    font-family: var(--font-heading);
    letter-spacing: -0.025em;
    line-height: 1.08;
}
.capi-page h1 { font-size: 68px; font-weight: 800; margin-bottom: 20px; }
.capi-page h2 { font-size: 40px; font-weight: 800; margin-bottom: 18px; }
.capi-page h3 { font-size: 21px; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }

/* --- Container --- */
.capi-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* --- Scroll reveal --- */
.capi-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.capi-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =======================
   NAVIGATION
   ======================= */
.capi-nav {
    display: block !important; /* Override global flex nav from main.css */
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 251, 254, 0.85);
    backdrop-filter: blur(20px) saturate(1.7);
    -webkit-backdrop-filter: blur(20px) saturate(1.7);
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    padding: 0 !important; /* Reset global padding */
    margin: 0 !important; /* Reset global margin */
}
.capi-nav.is-scrolled {
    border-bottom-color: var(--border);
}
.capi-nav-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.capi-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    color: var(--ink);
}
.capi-nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-left: auto; /* Push links to the right */
    margin-right: 32px;
}
.capi-nav-links a {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}
.capi-nav-links a:hover { color: var(--ink); }
.capi-nav-cta {
    background: var(--ink) !important;
    color: #fff !important;
    padding: 8px 18px !important;
    border-radius: var(--radius-sm) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    transition: background 0.2s, transform 0.2s !important;
}
.capi-nav-cta:hover {
    background: var(--accent) !important;
    transform: translateY(-1px) !important;
}

/* =======================
   APP ICON
   ======================= */
.capi-icon {
    background: linear-gradient(145deg, #234c80, #112d51);
    border-radius: 22%;
    display: inline-block;
    position: relative;
    box-shadow: 0 6px 20px rgba(20, 55, 95, 0.22);
    flex-shrink: 0;
}
.capi-icon--sm { width: 34px; height: 34px; }
.capi-icon--lg { width: 80px; height: 80px; box-shadow: 0 14px 40px rgba(20, 55, 95, 0.28); }
.capi-icon::before,
.capi-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center;
}
.capi-icon::before { background-image: url("../images/capi-icon-zzz.svg"); }
.capi-icon::after  { background-image: url("../images/capi-icon-capybara.svg"); }

/* =======================
   HERO
   ======================= */
.capi-hero {
    background: linear-gradient(180deg, #f5f3ff 0%, #eef2ff 35%, var(--bg) 100%);
    padding-top: 60px;
    padding-bottom: var(--section-pad);
    overflow: hidden;
}
.capi-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: 48px;
    align-items: center;
}
.capi-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-light);
    padding: 5px 12px;
    border-radius: 6px;
    margin-bottom: 20px;
}
.capi-title-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 4px;
}
.capi-lede {
    font-size: 1.2rem;
    color: var(--muted);
    max-width: 500px;
    margin-bottom: 32px;
    line-height: 1.65;
}
.capi-hero-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}
.capi-trust-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}
.capi-trust-list li {
    font-size: 14px;
    font-weight: 600;
    color: var(--subtle);
    display: flex;
    align-items: center;
    gap: 6px;
}
.capi-trust-list li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.5;
}

/* --- Hero screenshots --- */
.capi-hero-visuals {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 20px 0;
}
.capi-hero-shot {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-hero);
    background: var(--card);
    border: 1px solid var(--border-light);
}
.capi-hero-shot img { width: 100%; }
.capi-hero-shot--main {
    width: 58%;
    transform: rotate(-1.5deg);
    z-index: 2;
    animation: heroFloat 6s ease-in-out infinite;
}
.capi-hero-shot--secondary {
    position: absolute;
    width: 48%;
    right: 0;
    top: 10%;
    transform: rotate(2deg);
    z-index: 1;
    animation: heroFloat 6s ease-in-out 1.5s infinite;
    box-shadow: var(--shadow-lg);
}
.capi-hero-shot--tertiary {
    position: absolute;
    width: 40%;
    left: 2%;
    bottom: -5%;
    transform: rotate(-2.5deg);
    z-index: 3;
    animation: heroFloat 6s ease-in-out 3s infinite;
    box-shadow: var(--shadow-lg);
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0) rotate(var(--rot, -1.5deg)); }
    50% { transform: translateY(-12px) rotate(var(--rot, -1.5deg)); }
}
.capi-hero-shot--main  { --rot: -1.5deg; }
.capi-hero-shot--secondary { --rot: 2deg; }
.capi-hero-shot--tertiary { --rot: -2.5deg; }

/* =======================
   APP STORE BADGE
   ======================= */
.capi-store-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--ink) !important;
    color: #ffffff !important; /* Force white text to avoid inheritance issues */
    text-decoration: none;
    padding: 12px 24px 12px 18px;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
.capi-store-badge:hover {
    background: #0f111d;
    transform: translateY(-2px);
}
.capi-store-badge svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    flex-shrink: 0;
}
.capi-store-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.capi-store-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0.85;
}
.capi-store-name {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
}

/* --- Secondary button --- */
.capi-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 12px;
    background: var(--accent-light);
    transition: background 0.2s, transform 0.2s;
}
.capi-btn-secondary:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
}

/* =======================
   SECTION SHARED
   ======================= */
.capi-section {
    padding: var(--section-pad) 0;
}
.capi-section--band {
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.capi-section--lavender {
    background: linear-gradient(180deg, #f5f3ff 0%, #faf8ff 100%);
    border-top: 1px solid #ede9fe;
    border-bottom: 1px solid #ede9fe;
}
.capi-section-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 14px;
}
.capi-section-desc {
    font-size: 1.1rem;
    color: var(--muted);
    max-width: 600px;
    line-height: 1.65;
}
section[id] { scroll-margin-top: 70px; }

/* =======================
   FEATURES
   ======================= */
.capi-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 48px;
}
.capi-feature-card {
    background: var(--card);
    padding: 32px 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}
.capi-feature-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}
.capi-feature-card:nth-child(1)::before { background: var(--green); }
.capi-feature-card:nth-child(2)::before { background: var(--blue); }
.capi-feature-card:nth-child(3)::before { background: var(--violet); }

.capi-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.capi-feature-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 20px;
}
.capi-feature-card:nth-child(1) .capi-feature-num { background: #dcfce7; color: #166534; }
.capi-feature-card:nth-child(2) .capi-feature-num { background: #dbeafe; color: #1e40af; }
.capi-feature-card:nth-child(3) .capi-feature-num { background: #ede9fe; color: #5b21b6; }

.capi-feature-card p {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

/* =======================
   SCIENCE
   ======================= */
.capi-science-layout {
    display: grid;
    grid-template-columns: 1fr 0.85fr;
    gap: 60px;
    align-items: start;
}
.capi-metrics-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card);
}
.capi-metric {
    padding: 28px;
    border: 0.5px solid var(--border);
}
.capi-metric strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--ink);
}
.capi-metric span {
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

/* =======================
   SCREENSHOTS
   ======================= */
.capi-shots-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 48px;
}
.capi-shot {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s;
}
.capi-shot:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}
.capi-shot img { width: 100%; }
.capi-shot figcaption {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    border-top: 1px solid var(--border-light);
}
.capi-shot--hero {
    grid-column: span 2;
    grid-row: span 2;
}

/* =======================
   PRIVACY
   ======================= */
.capi-privacy-layout {
    display: grid;
    grid-template-columns: 0.9fr 1fr;
    gap: 48px;
    align-items: center;
}
.capi-privacy-body {
    font-size: 1.05rem;
    color: var(--muted);
    line-height: 1.7;
}
.capi-trust-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}
.capi-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #065f46;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
}
.capi-trust-badge svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* =======================
   DOWNLOAD CTA
   ======================= */
.capi-cta-section {
    background: linear-gradient(135deg, #1a1d2e 0%, #252a3d 50%, #1e2235 100%);
    color: #fff;
    text-align: center;
    padding: 80px 24px;
}
.capi-cta-section h2 {
    color: #fff;
    font-size: 36px;
    margin-bottom: 12px;
}
.capi-cta-section p {
    color: rgba(255,255,255,0.65);
    font-size: 1.1rem;
    max-width: 480px;
    margin: 0 auto 32px;
}
.capi-cta-section .capi-store-badge {
    background: #fff;
    color: var(--ink);
}
.capi-cta-section .capi-store-badge:hover {
    background: #f1f5f9;
}

/* =======================
   FOOTER (capi-specific)
   ======================= */
.capi-page + .container footer,
.capi-footer {
    max-width: var(--container);
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--subtle);
    border-top: 1px solid var(--border);
}
.capi-footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}
.capi-footer a:hover { color: var(--ink); }
.capi-footer-links {
    display: flex;
    gap: 24px;
}

/* =======================
   ANIMATIONS
   ======================= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
.capi-hero-copy > * {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.capi-hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
.capi-hero-copy > *:nth-child(2) { animation-delay: 0.12s; }
.capi-hero-copy > *:nth-child(3) { animation-delay: 0.20s; }
.capi-hero-copy > *:nth-child(4) { animation-delay: 0.28s; }
.capi-hero-copy > *:nth-child(5) { animation-delay: 0.36s; }
.capi-hero-copy > *:nth-child(6) { animation-delay: 0.44s; }

.capi-hero-visuals {
    animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

/* =======================
   RESPONSIVE
   ======================= */
@media (max-width: 900px) {
    .capi-page h1 { font-size: 44px; }
    .capi-page h2 { font-size: 32px; }
    .capi-page { --section-pad: 72px; }

    .capi-hero-grid,
    .capi-science-layout,
    .capi-privacy-layout {
        grid-template-columns: 1fr;
    }
    .capi-features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .capi-shots-grid {
        grid-template-columns: 1fr 1fr;
    }
    .capi-shot--hero {
        grid-column: span 2;
        grid-row: auto;
    }
    .capi-hero-visuals {
        max-width: 380px;
        margin: 0 auto;
    }
    .capi-hero-shot--secondary { width: 44%; top: 5%; }
    .capi-hero-shot--tertiary { width: 38%; bottom: -2%; }
    .capi-nav-links a:not(.capi-nav-cta) { display: none; }
    .capi-cta-section h2 { font-size: 28px; }
}

@media (max-width: 560px) {
    .capi-page h1 { font-size: 36px; }
    .capi-page h2 { font-size: 26px; }
    .capi-page { --section-pad: 56px; }

    .capi-shots-grid {
        grid-template-columns: 1fr;
    }
    .capi-shot--hero {
        grid-column: auto;
    }
    .capi-hero-shot--secondary,
    .capi-hero-shot--tertiary { display: none; }
    .capi-hero-shot--main {
        width: 85%;
        margin: 0 auto;
    }
    .capi-metrics-panel {
        grid-template-columns: 1fr;
    }
    .capi-footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
