/* ============================================
   Base Styles
   ============================================ */

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

/* Body */
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    color-scheme: var(--color-scheme);
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 800;
    line-height: 1.1;
}

h2 {
    font-size: clamp(2rem, 5vw, 3rem);
}

h3 {
    font-size: var(--font-size-2xl);
}

p {
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Animated Background Gradient */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-base);
    background: radial-gradient(circle at 20% 20%, var(--primary-subtle) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(175, 82, 222, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(52, 199, 89, 0.08) 0%, transparent 50%);
    animation: gradientShift 20s ease infinite;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

[data-theme="light"] .bg-gradient {
    opacity: 0.4;
}

[data-theme="dark"] .bg-gradient {
    opacity: 1;
}

@keyframes gradientShift {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1) rotate(0deg) translateZ(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) rotate(5deg) translateZ(0);
    }
}

/* Grain Texture */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)"/></svg>');
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(20px, 5vw, 24px);
    position: relative;
    z-index: 2;
}

/* Skip to content */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    z-index: var(--z-toast);
    transition: top 0.3s ease;
}

.skip-to-content:focus {
    top: 16px;
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Focus styles */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Force GPU acceleration for smooth animations */
.feature-card,
.btn,
.visual-item,
.app-icon-large {
    transform: translateZ(0);
    will-change: transform;
}

@media (hover: hover) {
    .feature-card:not(:hover),
    .btn:not(:hover),
    .visual-item:not(:hover) {
        will-change: auto;
    }
}

/* Scroll animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s var(--ease-out-expo);
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Reduced motion support */
@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;
        will-change: auto !important;
    }

    .bg-gradient {
        animation: none;
        transform: none;
    }

    .app-icon-large {
        animation: none;
    }

    .scroll-reveal {
        opacity: 1;
        transform: none;
    }

    .visual-item {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
