/* Variables */
:root {
    --primary-color: #007AFF;
    --primary-dark: #0051D5;
    --secondary-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;
    --text-primary: #1C1C1E;
    --text-secondary: #8E8E93;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F2F2F7;
    --bg-tertiary: #E5E5EA;
    --border-color: #D1D1D6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --max-width: 1200px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #FFFFFF;
        --text-secondary: #8E8E93;
        --bg-primary: #000000;
        --bg-secondary: #1C1C1E;
        --bg-tertiary: #2C2C2E;
        --border-color: #38383A;
    }
}

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

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

/* Section headings */
section h2.text-center {
    position: relative;
}

section h2.text-center::after {
    content: '';
    display: block;
    margin: 1rem auto 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navigation */
.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.nav-brand a {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-icon {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem;
    border-radius: var(--radius-sm);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--text-primary);
    font-weight: 500;
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.nav-appstore-link {
    display: inline-block;
    transition: all 0.2s;
}

.nav-appstore-link:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.nav-appstore-badge {
    height: 40px;
    width: auto;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
}

/* Hero Section */
.hero {
    padding: 4rem 0 6rem;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero .subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

.hero-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin: 0 auto;
}

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

.appstore-badge-link,
.appstore-badge-link-white {
    display: inline-block;
    transition: all 0.2s;
}

.appstore-badge-link:hover,
.appstore-badge-link-white:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Hero Carousel */
.hero-carousel {
    margin-top: 3rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.carousel-container {
    position: relative;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-btn-prev {
    left: -20px;
}

.carousel-btn-next {
    right: -20px;
}

@media (max-width: 768px) {
    .carousel-btn {
        width: 36px;
        height: 36px;
    }

    .carousel-btn-prev {
        left: -10px;
    }

    .carousel-btn-next {
        right: -10px;
    }
}

.carousel-track {
    position: relative;
    width: 100%;
    aspect-ratio: 9/19.5;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    touch-action: pan-y pinch-zoom;
    transition: aspect-ratio 0.3s ease;
}

/* iPad aspect ratio when showing iPad images */
.carousel-track.ipad-mode {
    aspect-ratio: 3/4;
}

@media (min-width: 768px) {
    .hero-carousel {
        max-width: 500px;
    }
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.carousel-image.active {
    opacity: 1;
    z-index: 1;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot:hover {
    background: var(--text-secondary);
    transform: scale(1.2);
}

.dot.active {
    background: var(--primary-color);
    width: 28px;
    border-radius: 5px;
}

/* Device Switcher */
.device-switcher {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.device-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
}

.device-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.device-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.device-btn svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .device-btn span {
        display: none;
    }

    .device-btn {
        padding: 0.5rem;
    }
}

/* Features Section */
.features {
    padding: 5rem 0;
}

.features h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

/* Responsive Features Grid - max 3 columns */
.features-grid-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

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

@media (min-width: 768px) and (max-width: 1023px) {
    .features-grid-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .features-grid-responsive {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    background: var(--bg-secondary);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-color);
}

.feature-card:hover::before {
    transform: translateY(0);
}

.feature-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    display: inline-block;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    .feature-card,
    .step {
        transition: none;
    }
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.7;
}

/* How It Works Section */
.how-it-works {
    padding: 5rem 0;
    background: var(--bg-secondary);
}

.how-it-works h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    margin-top: 3rem;
    position: relative;
}

/* Connecting line for desktop */
@media (min-width: 1024px) {
    .steps::before {
        content: '';
        position: absolute;
        top: 24px;
        left: 15%;
        right: 15%;
        height: 2px;
        background: linear-gradient(90deg,
                var(--primary-color) 0%,
                var(--primary-color) 25%,
                var(--border-color) 25%,
                var(--border-color) 50%,
                var(--border-color) 50%,
                var(--border-color) 75%,
                var(--border-color) 75%,
                var(--border-color) 100%);
        z-index: 0;
    }
}

.step {
    text-align: center;
    position: relative;
    background: var(--bg-primary);
    padding: 2rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

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

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.step h3 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.step p {
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

/* Screenshots Section */
.screenshots {
    padding: 5rem 0;
    overflow: hidden;
}

.screenshots h2 {
    font-size: 2.5rem;
}

.screenshot-carousel {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 2rem 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-secondary);
}

.screenshot-carousel::-webkit-scrollbar {
    height: 8px;
}

.screenshot-carousel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.screenshot-carousel::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.screenshot {
    flex: 0 0 300px;
    scroll-snap-align: center;
    transition: transform 0.3s ease;
}

.screenshot:hover {
    transform: scale(1.05);
}

.screenshot img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* CTA Section */
.cta {
    padding: 4rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.cta h2 {
    color: white;
    margin-bottom: 1rem;
}

.cta p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

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

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

/* Documentation */
.docs-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
    padding: 2rem 0;
}

.docs-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.docs-nav {
    list-style: none;
}

.docs-nav li {
    margin-bottom: 0.5rem;
}

.docs-nav a {
    color: var(--text-secondary);
    display: block;
    padding: 0.5rem 0;
}

.docs-nav a:hover,
.docs-nav a.active {
    color: var(--primary-color);
}

.docs-content {
    max-width: 800px;
}

.docs-content h2 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

.docs-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.docs-content pre {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: 1rem;
}

.docs-content code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.875rem;
}

.docs-content pre code {
    background: none;
    padding: 0;
}

/* Privacy Policy */
.privacy-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 0;
}

.privacy-content h2 {
    margin-top: 3rem;
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    padding: 3rem 0 2rem;
    margin-top: 6rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-secondary);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    color: var(--text-secondary);
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-md);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-appstore-link {
        display: flex;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

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

    .hero .subtitle {
        font-size: 1.25rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }

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

    .feature-card {
        padding: 2rem 1.5rem;
    }

    .feature-icon {
        font-size: 3rem;
    }

    .steps {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .steps::before {
        display: none;
    }

    .step {
        padding: 1.5rem;
    }

    .features h2,
    .how-it-works h2,
    .screenshots h2 {
        font-size: 2rem;
    }

    .features,
    .how-it-works,
    .screenshots {
        padding: 3rem 0;
    }

    .screenshot {
        flex: 0 0 280px;
    }
}

/* Markdown Content */
.docs-content ul,
.privacy-content ul {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.docs-content ol,
.privacy-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.docs-content li,
.privacy-content li {
    margin-bottom: 0.5rem;
}

.docs-content hr,
.privacy-content hr {
    margin: 3rem 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

.docs-content blockquote,
.privacy-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

/* Markdown headings */
.docs-content h1:first-child,
.privacy-content h1:first-child {
    margin-top: 0;
}

/* Privacy Summary Box */
.privacy-content h3:last-of-type+p {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-top: 3rem;
}

/* Code blocks in examples */
.docs-content h3+p+pre {
    margin-top: 0.5rem;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}
