/* =====================================================
   GainFrame — Clinical Fitness Minimalism
   Monochrome design system matching Theme.swift
   ===================================================== */

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

:root {
    /* Palette — monochrome + rare sage accent */
    --color-bg: #ffffff;
    --color-surface: #F2F2F7;
    --color-text: #111111;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --color-border: rgba(0, 0, 0, 0.06);
    --color-sage: #6B8F71;
    --color-sage-light: rgba(107, 143, 113, 0.08);
    --color-brand-red: #E84C3D;

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'DM Sans', sans-serif;

    /* Spacing — 8pt grid */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 40px;
    --sp-2xl: 64px;
    --sp-section: 120px;

    /* Radii */
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --radius-full: 9999px;

    /* Shadow */
    --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.06);
    --shadow-phone: 0 24px 64px rgba(0, 0, 0, 0.10);
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =====================================================
   COMMON
   ===================================================== */

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

.section-title {
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: var(--sp-md);
    letter-spacing: -0.03em;
    line-height: 1.12;
    color: var(--color-text);
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 1.125rem;
    max-width: 540px;
    margin: 0 auto var(--sp-2xl);
    line-height: 1.7;
}

/* App Store Badge */
.appstore-badge {
    height: 52px;
    width: auto;
    display: block;
}

.appstore-link {
    display: inline-block;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.appstore-link:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* =====================================================
   SCROLL ANIMATIONS
   ===================================================== */

.scroll-reveal,
.scroll-reveal-left,
.scroll-reveal-right,
.parallax-float,
.badge-pop,
.tilt-in,
.hero-text-stagger,
.hero-image-stagger {
    opacity: 0;
    will-change: transform, opacity;
}

.scroll-reveal {
    transform: translateY(32px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-reveal-left {
    transform: translateX(-48px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-reveal-right {
    transform: translateX(48px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.parallax-float {
    transform: translateY(40px) scale(0.97);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.badge-pop {
    transform: scale(0.7);
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tilt-in {
    transform: perspective(800px) rotateX(6deg) translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-text-stagger {
    transform: translateY(24px);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-image-stagger {
    transform: translateY(48px) scale(0.94);
    transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1),
        transform 1s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0.15s;
}

/* Visible states */
.scroll-reveal.visible,
.scroll-reveal-left.visible,
.scroll-reveal-right.visible,
.parallax-float.visible,
.tilt-in.visible,
.hero-text-stagger.visible,
.hero-image-stagger.visible {
    opacity: 1;
    transform: none;
}

.badge-pop.visible {
    opacity: 1;
    transform: scale(1);
}

/* Stagger delays */
.reveal-delay-1 { transition-delay: 0ms; }
.reveal-delay-2 { transition-delay: 80ms; }
.reveal-delay-3 { transition-delay: 160ms; }
.reveal-delay-4 { transition-delay: 240ms; }
.reveal-delay-5 { transition-delay: 320ms; }
.reveal-delay-6 { transition-delay: 400ms; }
.reveal-delay-7 { transition-delay: 480ms; }
.reveal-delay-8 { transition-delay: 560ms; }

@media (prefers-reduced-motion: reduce) {
    .scroll-reveal,
    .scroll-reveal-left,
    .scroll-reveal-right,
    .parallax-float,
    .badge-pop,
    .tilt-in,
    .hero-text-stagger,
    .hero-image-stagger {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* =====================================================
   HERO
   ===================================================== */

.hero {
    padding: var(--sp-section) 0 var(--sp-2xl);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 80px;
}

.hero-content {
    display: flex;
    flex-direction: column;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 3.75rem;
    font-weight: 900;
    line-height: 1.06;
    letter-spacing: -0.035em;
    margin-bottom: var(--sp-lg);
    color: var(--color-text);
}

.hero-title .accent-underline {
    position: relative;
    display: inline-block;
}

.hero-title .accent-underline::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--color-brand-red);
    border-radius: 3px;
    opacity: 0.7;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--sp-xl);
    max-width: 460px;
    line-height: 1.7;
}

.hero-mockup {
    display: flex;
    justify-content: center;
}

.hero-mockup-image {
    max-width: 100%;
    height: auto;
    max-height: 680px;
    object-fit: contain;
    border-radius: var(--radius-lg);
    filter: drop-shadow(0 32px 64px rgba(0, 0, 0, 0.10));
}

/* =====================================================
   PHONE PLACEHOLDER (reusable)
   ===================================================== */

.phone-placeholder {
    width: 280px;
    height: 580px;
    border-radius: 40px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-md);
    position: relative;
    box-shadow: var(--shadow-phone);
    overflow: hidden;
}

/* Dynamic Island notch */
.phone-placeholder::before {
    content: '';
    position: absolute;
    top: 14px;
    width: 90px;
    height: 26px;
    background: var(--color-text);
    border-radius: 20px;
    opacity: 0.12;
}

.phone-placeholder .placeholder-label {
    color: var(--color-text-tertiary);
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    padding: 0 var(--sp-lg);
}

.phone-placeholder .placeholder-icon {
    font-size: 2rem;
    opacity: 0.15;
}

/* =====================================================
   HOW IT WORKS
   ===================================================== */

.how-it-works {
    padding: var(--sp-section) 0;
    background: var(--color-surface);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-lg);
}

.step {
    text-align: center;
    padding: var(--sp-lg);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.step:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-elevated);
}

.step-number {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-bottom: var(--sp-sm);
}

.step-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-md);
    background: var(--color-surface);
    color: var(--color-text);
}

.step-icon svg {
    width: 22px;
    height: 22px;
}

.step h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: var(--sp-xs);
    color: var(--color-text);
}

.step p {
    color: var(--color-text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
}

/* =====================================================
   FEATURE SECTIONS
   ===================================================== */

.feature-section {
    padding: var(--sp-section) 0;
}

.feature-section.alt-bg {
    background: var(--color-surface);
}

.feature-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 80px;
}

.feature-split.reverse {
    direction: rtl;
}

.feature-split.reverse > * {
    direction: ltr;
}

.feature-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--color-text);
    color: var(--color-bg);
    margin-bottom: var(--sp-md);
    letter-spacing: 0.01em;
}

.feature-badge.sage-badge {
    background: var(--color-sage-light);
    color: var(--color-sage);
}

.feature-badge.pro-badge {
    background: var(--color-text);
    color: var(--color-bg);
}

.feature-text h2 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.025em;
    margin-bottom: var(--sp-lg);
    color: var(--color-text);
}

.feature-text p {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    line-height: 1.75;
    margin-bottom: var(--sp-lg);
}

.feature-list {
    list-style: none;
}

.feature-list li {
    padding: var(--sp-sm) 0;
    padding-left: 28px;
    position: relative;
    color: var(--color-text-secondary);
    font-size: 1rem;
    line-height: 1.55;
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-text);
    font-weight: 700;
    font-size: 0.95rem;
}

.feature-images {
    display: flex;
    justify-content: center;
}

.feature-image-mockup {
    max-width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    border-radius: var(--radius-lg);
    filter: drop-shadow(0 16px 48px rgba(0, 0, 0, 0.08));
}

/* =====================================================
   FEATURE CARDS GRID
   ===================================================== */

.features {
    padding: var(--sp-section) 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-lg);
}

.feature-card {
    padding: var(--sp-xl);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-elevated);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-md);
    color: var(--color-text);
}

.feature-icon svg {
    width: 22px;
    height: 22px;
}

.feature-icon.sage-icon {
    background: var(--color-sage-light);
    color: var(--color-sage);
}

.pro-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-bg);
    background: var(--color-text);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    margin-left: var(--sp-xs);
    vertical-align: middle;
    letter-spacing: 0.05em;
}

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--sp-sm);
    color: var(--color-text);
}

.feature-card p {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

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

.cta {
    padding: var(--sp-section) 0;
    text-align: center;
    background: var(--color-surface);
}

.cta .section-title {
    font-size: 2.75rem;
    margin-bottom: var(--sp-md);
}

.cta-subtitle {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--sp-xl);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* =====================================================
   FOOTER
   ===================================================== */

.footer {
    padding: var(--sp-xl) 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.footer-links {
    display: flex;
    gap: var(--sp-lg);
    justify-content: center;
    margin-bottom: var(--sp-md);
}

.footer-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s ease;
}

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

.footer-copy {
    color: var(--color-text-tertiary);
    font-size: 0.85rem;
}

/* =====================================================
   RESPONSIVE — Tablet
   ===================================================== */

@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .feature-split {
        gap: 48px;
    }

    .hero .container {
        gap: 48px;
    }
}

/* =====================================================
   RESPONSIVE — Mobile
   ===================================================== */

@media (max-width: 768px) {
    :root {
        --sp-section: 80px;
    }

    .container {
        padding: 0 var(--sp-md);
    }

    .section-title {
        font-size: 2rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    .hero {
        padding: var(--sp-2xl) 0 var(--sp-xl);
    }

    .hero .container {
        grid-template-columns: 1fr;
        gap: var(--sp-xl);
        text-align: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-cta {
        display: flex;
        justify-content: center;
    }

    .hero-mockup-image {
        max-height: 480px;
        max-width: calc(100vw - 32px);
    }

    .feature-image-mockup {
        max-height: 480px;
        max-width: calc(100vw - 32px);
    }

    .phone-placeholder {
        width: 240px;
        height: 500px;
    }

    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--sp-md);
    }

    .feature-split,
    .feature-split.reverse {
        grid-template-columns: 1fr;
        gap: var(--sp-xl);
        text-align: center;
        direction: ltr;
    }

    .feature-text h2 {
        font-size: 1.75rem;
    }

    .feature-list li {
        text-align: left;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .cta .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .steps-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2rem;
    }

    .phone-placeholder {
        width: 200px;
        height: 420px;
    }
}