/* ECG Tracker+ Landing Page - Clean iOS Medical Aesthetic
   White background, smooth corners, red accents
   Matches native iOS app design language
*/

/* ========================================
   CSS Variables - Clean iOS Medical Theme
   ======================================== */
:root {
    /* Core Colors - Clean Medical */
    --color-bg: #FFFFFF;
    --color-bg-secondary: #F5F5F7;
    --color-bg-tertiary: #EFEFF4;
    --color-card: rgba(255, 255, 255, 0.8);
    
    /* Medical Red - iOS System Red */
    --color-red: #FF3B30;
    --color-red-light: rgba(255, 59, 48, 0.08);
    --color-red-glow: rgba(255, 59, 48, 0.15);
    
    /* Success Green */
    --color-green: #34C759;
    --color-green-light: rgba(52, 199, 89, 0.08);
    
    /* Text */
    --text-primary: #1C1C1E;
    --text-secondary: #636366;
    --text-tertiary: #8E8E93;
    --text-muted: #C7C7CC;
    
    /* Borders */
    --border-light: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.1);
    
    /* Typography - iOS System Fonts */
    --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 3rem;
    --space-4xl: 4rem;
    --space-5xl: 6rem;
    
    /* Border Radius - Smooth iOS Style */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows - Soft iOS Style */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.1);
    
    /* Animation */
    --ease-out: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--color-bg);
}

/* ========================================
   Typography
   ======================================== */
.display-xl {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.display-lg {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.text-body {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.text-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ========================================
   Container
   ======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

/* ========================================
   Navigation - Clean Floating Style
   ======================================== */
.nav {
    position: fixed;
    top: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - var(--space-xl) * 2);
    max-width: 720px;
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: var(--radius-full);
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.4) inset,
        0 4px 24px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.02);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Ensure consistent appearance on scroll */
.nav.scrolled {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.4) inset,
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

.nav-logo svg {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
}

.nav-links {
    display: none;
    align-items: center;
    gap: var(--space-sm);
}

.nav-link {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.nav-cta {
    display: none;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .nav {
        padding: var(--space-sm) var(--space-lg);
    }
    
    .nav-links {
        display: flex;
    }
    
    .nav-cta {
        display: inline-flex;
    }
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-red);
    color: white;
}

.btn-primary:hover {
    background: #E6352B;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--color-red-glow);
}

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--color-bg-tertiary);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(100px + var(--space-3xl)) 0 var(--space-3xl);
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-secondary) 100%);
    overflow: hidden;
}

.hero-bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.4;
    background-image: 
        radial-gradient(circle at 20% 50%, var(--color-red-light) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(52, 199, 89, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.hero-ecg {
    position: absolute;
    bottom: 10%;
    left: 0;
    width: 100%;
    height: 200px;
    pointer-events: none;
    opacity: 0.6;
}

.ecg-line {
    fill: none;
    stroke: var(--color-red);
    stroke-width: 2;
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    animation: ecgDraw 2.5s linear infinite;
    filter: drop-shadow(0 0 6px var(--color-red-glow));
}

@keyframes ecgDraw {
    0% {
        stroke-dashoffset: 3000;
        opacity: 0.3;
    }
    8% {
        opacity: 0.8;
    }
    12% {
        stroke-dashoffset: 2700;
        opacity: 0.4;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0.3;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    text-align: center;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-green-light);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-xl);
}

.hero-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--color-green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.hero-badge span {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-green);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.hero-title {
    margin-bottom: var(--space-lg);
}

.hero-title .highlight {
    color: var(--color-red);
}

.hero-subtitle {
    max-width: 540px;
    margin: 0 auto var(--space-2xl);
}

.hero-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.app-store-btn img {
    height: 48px;
    width: auto;
    transition: transform 0.2s var(--ease-out);
}

.app-store-btn:hover img {
    transform: scale(1.03);
}

@media (min-width: 640px) {
    .hero-cta {
        flex-direction: row;
        justify-content: center;
    }
}

/* ========================================
   Section Headers
   ======================================== */
.section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.section-label {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--color-red-light);
    color: var(--color-red);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
}

.section-title {
    margin-bottom: var(--space-sm);
}

/* ========================================
   Features Section
   ======================================== */
.features-section {
    padding: var(--space-4xl) 0;
    background: var(--color-bg);
}

.feature-grid {
    display: grid;
    gap: var(--space-lg);
}

.feature-card {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    transition: all 0.3s var(--ease-out);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: var(--color-bg);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--color-red-light);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-red);
    margin-bottom: var(--space-md);
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.feature-desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

@media (min-width: 640px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .feature-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Showcase Section
   ======================================== */
.showcase-section {
    padding: var(--space-4xl) 0;
    background: var(--color-bg-secondary);
}

.showcase-grid {
    display: grid;
    gap: var(--space-3xl);
    align-items: center;
}

.showcase-content {
    text-align: center;
}

.showcase-device {
    display: flex;
    justify-content: center;
}

.iphone-frame {
    position: relative;
    width: 280px;
    height: 570px;
    background: linear-gradient(145deg, #f0f0f2 0%, #e0e0e2 100%);
    border-radius: 44px;
    padding: 12px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

.iphone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 28px;
    background: #000;
    border-radius: 0 0 18px 18px;
    z-index: 10;
}

.iphone-screen {
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    border-radius: 36px;
    overflow: hidden;
    position: relative;
}

.screenshot-placeholder {
    width: 100%;
    height: 100%;
    background: var(--color-bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    text-align: center;
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    background: var(--color-red-light);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-red);
    margin-bottom: var(--space-md);
}

.placeholder-text {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.placeholder-hint {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

@media (min-width: 1024px) {
    .showcase-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .showcase-content {
        text-align: left;
    }
    
    .showcase-grid.reverse .showcase-content {
        order: 2;
    }
    
    .showcase-grid.reverse .showcase-device {
        order: 1;
    }
}

/* ========================================
   Privacy Section
   ======================================== */
.privacy-section {
    padding: var(--space-4xl) 0;
    background: var(--color-bg);
}

.privacy-grid {
    display: grid;
    gap: var(--space-3xl);
    align-items: center;
}

.privacy-visual {
    display: flex;
    justify-content: center;
}

.privacy-icon {
    width: 160px;
    height: 160px;
    background: var(--color-green-light);
    border-radius: var(--radius-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-green);
}

.privacy-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.privacy-feature {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
}

.privacy-feature-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--color-green-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-green);
}

.privacy-feature-content h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.privacy-feature-content p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

@media (min-width: 1024px) {
    .privacy-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ========================================
   FAQ Section
   ======================================== */
.faq-section {
    padding: var(--space-4xl) 0;
    background: var(--color-bg-secondary);
}

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

.faq-item {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.faq-question:hover {
    color: var(--color-red);
}

.faq-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
    transition: transform 0.3s var(--ease-spring);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
    color: var(--color-red);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease-out);
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 var(--space-lg) var(--space-lg);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========================================
   CTA Section
   ======================================== */
.cta-section {
    padding: var(--space-4xl) 0;
    background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg) 100%);
    text-align: center;
}

.cta-title {
    margin-bottom: var(--space-sm);
}

.cta-subtitle {
    max-width: 480px;
    margin: 0 auto var(--space-xl);
}

.cta-features {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-top: var(--space-xl);
    flex-wrap: wrap;
}

.cta-feature {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.cta-feature svg {
    color: var(--color-green);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    padding: var(--space-2xl) 0;
    background: var(--color-bg);
    border-top: 1px solid var(--border-light);
}

.footer-grid {
    display: grid;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.footer-brand {
    max-width: 280px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.footer-logo svg {
    border-radius: var(--radius-md);
}

.footer-tagline {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
}

.footer-column h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.footer-column ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer-column a {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--color-red);
}

.footer-bottom {
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.footer-copyright {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.footer-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 2fr;
    }
    
    .footer-links {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Scroll Animations
   ======================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays */
.feature-card:nth-child(1) { transition-delay: 0ms; }
.feature-card:nth-child(2) { transition-delay: 80ms; }
.feature-card:nth-child(3) { transition-delay: 160ms; }
.feature-card:nth-child(4) { transition-delay: 240ms; }
.feature-card:nth-child(5) { transition-delay: 320ms; }
.feature-card:nth-child(6) { transition-delay: 400ms; }

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}