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

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

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Animated Background */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 30%, var(--bg-gradient-1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, var(--bg-gradient-2) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, var(--bg-gradient-3) 0%, transparent 60%),
        var(--bg-primary);
    animation: gradientShift 15s ease infinite;
}

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

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

h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
}

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

h3 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
}

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color var(--transition-normal);
}

a:hover {
    color: var(--accent-magenta);
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-cyan);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scroll Animation System - Content visible by default */
section,
.glass-card {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Animation classes (applied by JavaScript only when appropriate) */
.animate-on-scroll {
    opacity: 0 !important;
    transform: translateY(30px) !important;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Ensure immediate visibility on page load */
body.page-loaded section,
body.page-loaded .glass-card {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Prevent flash of invisible content */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important;
    }
}

/* Selection styling */
::selection {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

::-moz-selection {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Button reset */
button {
    font-family: inherit;
    cursor: pointer;
}

/* Prevent layout shift */
.prevent-shift {
    min-height: 100vh;
}
