/**
 * ==============================================
 * BASE STYLES
 * ==============================================
 * Resets, global styles, accessibility utilities
 */

/* ===== CSS Reset ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Lenis Smooth Scroll ===== */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

/* ===== Reduced Motion ===== */
@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;
    }
}

/* ===== Body ===== */
body {
    background: var(--color-bg-darker);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Noise Texture Overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: var(--z-top);
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ===== Skip Link (Accessibility) ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-md) var(--space-xl);
    background: var(--color-primary);
    color: var(--color-bg-darker);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: calc(var(--z-top) + 1);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--space-md);
    outline: none;
}

/* ===== Focus Styles (Accessibility) ===== */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ===== Selection ===== */
::selection {
    background: var(--color-primary);
    color: var(--color-bg-darker);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--color-text-muted);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

/* ===== Cursor Glow ===== */
.cursor-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.04) 0%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 0;
    transition: opacity var(--transition-base);
}

@media (max-width: 768px) {
    .cursor-glow {
        display: none;
    }
}

/* ===== Scroll Progress ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary), var(--color-accent));
    width: 0%;
    z-index: var(--z-top);
    transition: width 0.1s ease-out;
}

/* ===== Floating Background ===== */
.floating-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: var(--z-base);
    overflow: hidden;
}

.floating-bg__element {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: 900;
    color: rgba(255, 255, 255, 0.03);
    animation: floatAround 25s linear infinite;
    user-select: none;
    will-change: transform, opacity;
}

.floating-bg__element--date {
    font-size: clamp(6rem, 12vw, 18rem);
}

.floating-bg__element--text {
    font-size: clamp(3rem, 6vw, 8rem);
}

.floating-bg__element--code {
    font-size: clamp(2rem, 4vw, 5rem);
    color: rgba(250, 204, 21, 0.04);
}

@keyframes floatAround {
    0% {
        transform: translate(0, 100vh) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% { opacity: 1; }
    50% {
        transform: translate(30vw, 50vh) rotate(180deg) scale(1.1);
        opacity: 0.8;
    }
    90% { opacity: 1; }
    100% {
        transform: translate(60vw, -100vh) rotate(360deg) scale(0.9);
        opacity: 0;
    }
}

/* ===== Section Title (Shared) ===== */
.section-title {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: var(--space-3xl);
    color: var(--color-text-primary);
}

.section-title__word {
    display: inline-block;
    overflow: hidden;
}

.section-title__char {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
}

/* ===== Visually Hidden (Screen Readers Only) ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-3xl);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-lg);
    }
}
