/* ============================================================
   SleepTyme — marketing site
   Bold, calming, sleep-themed dark UI matching the iOS app
   ============================================================ */

:root {
    --bg-deep:        #060c1f;
    --bg-mid:         #0b1026;
    --bg-card:        rgba(15, 23, 60, 0.7);
    --card-border:    rgba(120, 140, 200, 0.15);

    --text-primary:   #e8ecf8;
    --text-secondary: rgba(180, 190, 220, 0.7);
    --text-tertiary:  rgba(180, 190, 220, 0.45);

    --accent-indigo:  #a5b4fc;
    --accent-purple:  #c4b5fd;
    --accent-mid:     #818cf8;
    --accent-cyan:    #67e8f9;

    --phase-deep:     #6366f1;
    --phase-rem:      #a78bfa;
    --phase-light:    #67e8f9;

    --radius-card:    20px;
    --radius-btn:     16px;
    --radius-pill:    999px;

    --max-content:    1180px;
    --gap:            clamp(40px, 6vw, 80px);

    --shadow-md:      0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg:      0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow:    0 0 80px rgba(165, 180, 252, 0.25);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-primary);
}

a { color: var(--accent-indigo); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-purple); }

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

/* ============================================================
   Background — starfield + ambient glow + gradient
   ============================================================ */

.bg-cosmic {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse at 80% 0%, rgba(120, 130, 250, 0.18), transparent 50%),
        radial-gradient(ellipse at 20% 100%, rgba(180, 130, 240, 0.15), transparent 50%),
        linear-gradient(180deg, #060c1f 0%, #0b1026 40%, #11163c 100%);
}

.starfield {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 4s ease-in-out infinite;
    will-change: opacity;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.9; }
}

/* Slow drifting ambient orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    will-change: transform;
}
.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(120, 130, 250, 0.35), transparent 70%);
    top: -200px; right: -100px;
    animation: drift1 18s ease-in-out infinite;
}
.orb-2 {
    width: 450px; height: 450px;
    background: radial-gradient(circle, rgba(180, 130, 240, 0.30), transparent 70%);
    bottom: -150px; left: -100px;
    animation: drift2 22s ease-in-out infinite;
}
@keyframes drift1 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-40px, 60px); }
}
@keyframes drift2 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(50px, -40px); }
}

/* ============================================================
   Nav
   ============================================================ */

.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 18px 0;
    background: rgba(6, 12, 31, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: var(--text-primary);
}

.nav-brand svg { width: 28px; height: 28px; }

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--text-primary); }

.nav-cta {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-mid));
    color: var(--bg-deep) !important;
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 13px;
}
.nav-cta:hover { color: var(--bg-deep) !important; transform: translateY(-1px); }

@media (max-width: 700px) {
    .nav-links { display: none; }
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
    padding: 160px 24px 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-inner {
    max-width: 760px;
    margin: 0 auto;
}

.moon-emblem {
    width: 96px; height: 96px;
    margin: 0 auto 28px;
    animation: float 6s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

.hero h1 {
    font-size: clamp(40px, 7vw, 84px);
    font-weight: 800;
    background: linear-gradient(135deg, #e8ecf8 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 18px;
    line-height: 1.05;
}

.hero-tagline {
    font-size: clamp(18px, 2.4vw, 24px);
    color: var(--text-secondary);
    margin-bottom: 14px;
    font-weight: 400;
}

.hero-sub {
    font-size: 16px;
    color: var(--text-tertiary);
    max-width: 540px;
    margin: 0 auto 40px;
}

.hero-ctas {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 28px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 15px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-mid));
    color: var(--bg-deep);
    box-shadow: 0 10px 40px rgba(165, 180, 252, 0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 50px rgba(165, 180, 252, 0.5);
    color: var(--bg-deep);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--card-border);
    backdrop-filter: blur(10px);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.coming-soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.coming-soon-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent-cyan);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.3); }
}

/* ============================================================
   Phone screenshot slider
   ============================================================ */

.screenshot-strip {
    overflow: hidden;
    margin: 0 -24px;
    padding: 20px 0 80px;
    position: relative;
    mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.screenshot-track {
    display: flex;
    gap: 24px;
    animation: scroll-screens 50s linear infinite;
    width: max-content;
    padding: 0 24px;
}

.screenshot-track:hover { animation-play-state: paused; }

@keyframes scroll-screens {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.phone-frame {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    padding: 8px;
    border-radius: 40px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
}

.phone-frame img {
    border-radius: 32px;
    width: 100%;
    display: block;
}

/* ============================================================
   Section common
   ============================================================ */

section { padding: var(--gap) 24px; position: relative; }

.section-inner {
    max-width: var(--max-content);
    margin: 0 auto;
}

.section-label {
    display: inline-block;
    color: var(--accent-indigo);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(32px, 4.5vw, 52px);
    margin-bottom: 16px;
}

.section-sub {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 640px;
    margin-bottom: 56px;
    line-height: 1.6;
}

.text-center .section-sub { margin-left: auto; margin-right: auto; }
.text-center { text-align: center; }

/* ============================================================
   Feature grid
   ============================================================ */

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 22px;
}

.feature-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    padding: 32px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(165, 180, 252, 0.3);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, rgba(165, 180, 252, 0.2), rgba(196, 181, 253, 0.1));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 1px solid rgba(165, 180, 252, 0.2);
}
.feature-icon svg { width: 28px; height: 28px; color: var(--accent-indigo); }

.feature-card h3 {
    font-size: 22px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.65;
}

/* ============================================================
   How it works
   ============================================================ */

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    counter-reset: step;
}

.step {
    position: relative;
    padding: 36px 32px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
}
.step::before {
    counter-increment: step;
    content: "0" counter(step);
    position: absolute;
    top: 20px; right: 24px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 56px;
    color: rgba(165, 180, 252, 0.15);
    line-height: 1;
}

.step h3 {
    font-size: 20px;
    margin: 0 0 10px 0;
    color: var(--accent-indigo);
}
.step p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.65;
}

/* ============================================================
   Sleep science visual
   ============================================================ */

.science-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    padding: 40px;
    margin-bottom: 24px;
}

.cycle-bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    margin: 24px 0 14px;
}
.cycle-segment {
    height: 100%;
    transition: opacity 0.3s ease;
}
.cycle-segment.deep  { background: var(--phase-deep);  flex: 22; }
.cycle-segment.rem   { background: var(--phase-rem);   flex: 28; }
.cycle-segment.light { background: var(--phase-light); flex: 50; }

.cycle-legend {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-tertiary);
}
.cycle-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cycle-legend i {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.cycle-legend i.deep  { background: var(--phase-deep); }
.cycle-legend i.rem   { background: var(--phase-rem); }
.cycle-legend i.light { background: var(--phase-light); }

/* Age comparison table */
.age-table {
    width: 100%;
    margin-top: 32px;
    border-collapse: collapse;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    overflow: hidden;
}
.age-table th, .age-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}
.age-table th {
    color: var(--accent-indigo);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: rgba(255, 255, 255, 0.03);
}
.age-table td { color: var(--text-secondary); font-size: 15px; }
.age-table tr:last-child td { border-bottom: none; }

/* ============================================================
   Apple Watch section
   ============================================================ */

.watch-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}
@media (max-width: 800px) {
    .watch-section { grid-template-columns: 1fr; }
}

.watch-mockup {
    background: linear-gradient(135deg, #1a1f3a, #0b1026);
    border-radius: 40px;
    aspect-ratio: 1;
    max-width: 380px;
    margin: 0 auto;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 8px solid #2a2f4a;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.watch-screen {
    width: 100%; height: 100%;
    background: var(--bg-deep);
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-primary);
}
.watch-screen .moon-mini {
    font-size: 28px;
    margin-bottom: 6px;
}
.watch-screen .title { font-size: 16px; font-weight: 700; }
.watch-screen .time {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-indigo);
    margin: 8px 0;
}
.watch-screen .label { font-size: 10px; color: var(--text-tertiary); }

/* ============================================================
   FAQ
   ============================================================ */

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

.faq-item {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item summary {
    padding: 22px 26px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+';
    color: var(--accent-indigo);
    font-size: 22px;
    font-weight: 400;
    transition: transform 0.3s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item div.faq-body {
    padding: 0 26px 22px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
}

/* ============================================================
   CTA section
   ============================================================ */

.cta-block {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    padding: 64px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.cta-block::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(165, 180, 252, 0.12), transparent 50%);
    z-index: 0;
    pointer-events: none;
}
.cta-block > * { position: relative; z-index: 1; }

.cta-block h2 {
    font-size: clamp(28px, 4vw, 44px);
    margin-bottom: 14px;
}
.cta-block p {
    color: var(--text-secondary);
    font-size: 17px;
    margin-bottom: 32px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
    padding: 50px 24px 30px;
    border-top: 1px solid var(--card-border);
    background: rgba(6, 12, 31, 0.6);
    backdrop-filter: blur(20px);
}

.footer-inner {
    max-width: var(--max-content);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}
@media (max-width: 720px) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
}

.footer-brand p {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-top: 12px;
    line-height: 1.7;
}

.footer-col h4 {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 18px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a {
    color: var(--text-secondary);
    font-size: 14px;
}
.footer-col a:hover { color: var(--accent-indigo); }

.footer-bottom {
    max-width: var(--max-content);
    margin: 0 auto;
    padding-top: 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-tertiary);
    font-size: 13px;
    flex-wrap: wrap;
    gap: 16px;
}

/* ============================================================
   Article pages (privacy / support)
   ============================================================ */

.article {
    max-width: 760px;
    margin: 130px auto 80px;
    padding: 0 24px;
}
.article h1 {
    font-size: clamp(32px, 5vw, 52px);
    margin-bottom: 14px;
    background: linear-gradient(135deg, #e8ecf8, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.article .meta { color: var(--text-tertiary); font-size: 14px; margin-bottom: 50px; }
.article h2 {
    font-size: 24px;
    margin-top: 48px;
    margin-bottom: 14px;
    color: var(--accent-indigo);
}
.article h3 {
    font-size: 18px;
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--text-primary);
}
.article p, .article li {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.75;
    margin-bottom: 14px;
}
.article ul, .article ol { padding-left: 24px; margin-bottom: 18px; }
.article strong { color: var(--text-primary); font-weight: 600; }
.article a { border-bottom: 1px dashed currentColor; }

/* ============================================================
   Reveal on scroll
   ============================================================ */

.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);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Utilities
   ============================================================ */

.gradient-text {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
