/* Base CSS - Modern reset and foundational styles */

/* Modern CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Root color scheme */
:root {
    /* Default (dark) theme colors */
    --bg-primary: #0a0e27;
    --bg-secondary: #0d1117;
    --bg-tertiary: #161b22;
    
    --text-primary: #f0f6fc;
    --text-secondary: #b1bac4;
    --text-tertiary: #6e7681;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
    
    --accent-primary-alpha: rgba(59, 130, 246, 0.1);
    --accent-secondary-alpha: rgba(139, 92, 246, 0.1);
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #e1e7ed;
    
    --text-primary: #0a0e27;
    --text-secondary: #5d667a;
    --text-tertiary: #8891a0;
    
    --border-color: rgba(0, 0, 0, 0.1);
    --card-bg: rgba(0, 0, 0, 0.03);
    
    --accent-primary-alpha: rgba(59, 130, 246, 0.1);
    --accent-secondary-alpha: rgba(139, 92, 246, 0.1);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
    margin-bottom: 1em;
    color: var(--text-secondary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--accent-secondary);
}

/* Lists */
ul, ol {
    list-style: none;
}

/* Images */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Forms */
input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: var(--radius-md);
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: white;
}

/* Focus Styles */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Utility Classes */
.gradient-text {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Glass Morphism */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-slower), visibility var(--transition-slower);
}

.preloader.loaded {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
}

.echo-logo-animated {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
}

.echo-logo-animated svg {
    position: absolute;
    top: 0;
    left: 0;
}

.progress-ring {
    animation: progress 2s ease-out forwards;
}

@keyframes progress {
    to {
        stroke-dashoffset: 0;
    }
}

.echo-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--accent-primary);
}

.loading-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Custom Cursor */
@media (hover: hover) {
    .cursor-dot,
    .cursor-outline {
        position: fixed;
        top: 0;
        left: 0;
        transform: translate(-50%, -50%);
        pointer-events: none;
        z-index: 9998;
        mix-blend-mode: difference;
    }

    .cursor-dot {
        width: 8px;
        height: 8px;
        background: white;
        border-radius: 50%;
        transition: transform 0.15s ease-out;
    }

    .cursor-outline {
        width: 30px;
        height: 30px;
        border: 2px solid white;
        border-radius: 50%;
        transition: transform 0.2s ease-out;
        opacity: 0.5;
    }

    .cursor-dot.active {
        transform: translate(-50%, -50%) scale(0.5);
    }

    .cursor-outline.active {
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* Grid Pattern Background */
.grid-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.5;
}

/* Gradient Orbs */
.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    right: -200px;
    animation-duration: 25s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-secondary);
    bottom: -100px;
    left: -100px;
    animation-duration: 30s;
    animation-delay: -5s;
}

.orb-3 {
    width: 500px;
    height: 500px;
    background: var(--accent-tertiary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 35s;
    animation-delay: -10s;
}

/* Section Spacing */
section {
    padding: var(--space-3xl) 0;
    position: relative;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-label {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
    margin-bottom: var(--space-sm);
}

.section-title {
    font-size: var(--text-4xl);
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
}

/* Animation Keyframes */
@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    section {
        padding: var(--space-2xl) 0;
    }
    
    .section-title {
        font-size: var(--text-3xl);
    }
}