/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #1a4b8c;
    --color-primary-dark: #0f3460;
    --color-primary-light: #2d6bc4;
    --color-accent: #3b82f6;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-border: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --color-card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.95);
    --color-footer-bg: #1f2937;
}

/* Dark mode - default */
:root[data-theme="dark"] {
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-primary-light: #60a5fa;
    --color-accent: #60a5fa;
    --color-text: #f1f5f9;
    --color-text-light: #94a3b8;
    --color-bg: #0f172a;
    --color-bg-alt: #1e293b;
    --color-border: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --color-card-bg: #1e293b;
    --header-bg: rgba(15, 23, 42, 0.95);
    --color-footer-bg: #0f172a;
}

html {
    scroll-behavior: smooth;
    background-color: var(--color-bg);
    min-height: 100%;
    min-height: -webkit-fill-available;
}

/* Cover macOS elastic overscroll area */
html::after {
    content: "";
    position: fixed;
    inset: -100vh -100vw;
    background-color: var(--color-bg);
    z-index: -9999;
    pointer-events: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Typography */
h1, h2, h3 {
    line-height: 1.2;
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    color: var(--color-text-light);
}

/* Layout */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

section {
    padding: 5rem 0;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.logo span {
    color: var(--color-text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

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

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    margin: 5px 0;
    transition: 0.3s;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

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

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

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

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

.btn-small {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
}

/* Hero Section */
.hero {
    padding-top: 8rem;
    padding-bottom: 5rem;
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
}

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

.hero-content h1 {
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.hero-content h1 span {
    color: var(--color-primary);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-graphic {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.hero-graphic .speed {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.hero-graphic .unit {
    font-size: 1.5rem;
    opacity: 0.9;
}

.hero-graphic .label {
    font-size: 1rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Features Section */
.features {
    background: var(--color-bg-alt);
}

.features h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    background: var(--color-card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feature-card h3 {
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.feature-card p {
    font-size: 0.95rem;
}

/* Datacenters Section */
.datacenters {
    background: var(--color-bg);
}

.datacenters h2 {
    text-align: center;
}

.datacenters > .container > p {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
}

.datacenter-region {
    margin-bottom: 2.5rem;
}

.datacenter-region:last-child {
    margin-bottom: 0;
}

.region-title {
    text-align: center;
    color: var(--color-primary);
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.datacenter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.datacenter-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.datacenter-flag {
    width: 60px;
    height: 40px;
    margin: 0 auto 1rem;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.datacenter-flag svg {
    width: 100%;
    height: 100%;
}

.datacenter-card h3 {
    margin-bottom: 0.25rem;
    color: var(--color-text);
}

.datacenter-card p {
    font-size: 0.9rem;
}

/* Pricing Section */
.pricing {
    background: var(--color-bg);
}

.pricing h2 {
    text-align: center;
}

.pricing > .container > p {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3rem;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.pricing-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.pricing-card.featured {
    border-color: var(--color-primary);
    position: relative;
}

.pricing-card.featured::before {
    content: 'Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.pricing-speed {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.pricing-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.pricing-price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text-light);
}

.pricing-card ul {
    list-style: none;
    margin: 1.5rem 0;
    text-align: left;
}

.pricing-card li {
    padding: 0.5rem 0;
    color: var(--color-text-light);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricing-card li::before {
    content: '';
    width: 18px;
    height: 18px;
    background: var(--color-primary);
    border-radius: 50%;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 12px;
    background-repeat: no-repeat;
    background-position: center;
}

.pricing-card .btn {
    width: 100%;
    margin-top: 1rem;
}

/* How It Works Section */
.how-it-works {
    background: var(--color-bg-alt);
}

.how-it-works h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.step {
    text-align: center;
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 auto 1rem;
}

.step h3 {
    margin-bottom: 0.5rem;
}

.step p {
    font-size: 0.95rem;
}

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

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

.cta p {
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto 2rem;
    font-size: 1.1rem;
}

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

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

/* Footer */
.footer {
    background: var(--color-footer-bg);
    color: rgba(255, 255, 255, 0.7);
    padding: 3rem 0;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-logo {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    margin-left: 1rem;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--color-bg-alt);
    border-color: var(--color-primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-text);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s;
}

.theme-toggle:hover svg {
    stroke: var(--color-primary);
}

/* Sun icon visible in dark mode, moon visible in light mode */
.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

/* Header nav wrapper for alignment */
.nav-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .datacenter-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    h2 {
        font-size: 1.75rem;
    }

    section {
        padding: 3.5rem 0;
    }

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

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

    .nav-links li {
        border-bottom: 1px solid var(--color-border);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        display: block;
        padding: 1rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .theme-toggle {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .hero .container {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .hero-content p {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-visual {
        order: -1;
    }

    .hero-graphic {
        max-width: 280px;
    }

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

    .datacenter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    .steps {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    .footer .container {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
        text-align: center;
    }
}
