/* ===================================
   BASE & RESET STYLES
   Author: Hardik
   =================================== */

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

/* ===== ROOT & HTML ===== */
html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(80px + var(--safe-top));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ===== BODY ===== */
body {
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--fw-extrabold);
    line-height: var(--lh-tight);
    color: var(--text-primary);
    margin: 0;
}

h1 {
    font-size: var(--fs-hero);
    letter-spacing: var(--ls-tight);
}

h2 {
    font-size: clamp(1.875rem, 6vw, 2.875rem);
    letter-spacing: -0.03em;
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

p {
    margin: 0;
    color: var(--text-secondary);
}

a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color var(--transition-base);
}

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

a:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* ===== LISTS ===== */
ul, ol {
    list-style: none;
}

/* ===== IMAGES & MEDIA ===== */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===== FORMS ===== */
input, button, textarea, select {
    font: inherit;
    color: inherit;
}

input, textarea {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    width: 100%;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(var(--rgb-secondary), 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

/* ===== SELECTION ===== */
::selection {
    background: rgba(var(--rgb-primary), 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(var(--rgb-primary), 0.3);
    color: var(--text-primary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(var(--rgb-primary), 0.5);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--rgb-primary), 0.7);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--rgb-primary), 0.5) var(--bg-secondary);
}

/* ===== LAYOUT CONTAINERS ===== */
.wrap {
    position: relative;
    z-index: var(--z-base);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

section {
    padding: clamp(3rem, 8vw, 5rem) 0;
    position: relative;
}

/* ===== BACKGROUND ELEMENTS ===== */
#bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-background);
    pointer-events: none;
}

#glow {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    pointer-events: none;
    z-index: var(--z-background);
    background: radial-gradient(circle, var(--color-primary), transparent 65%);
    opacity: 0.18;
    transform: translate(-50%, -50%);
    transition: left var(--transition-base), top var(--transition-base);
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hidden {
    display: none !important;
}

.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;
}

/* ===== FOCUS MANAGEMENT ===== */
.focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 3px;
}

/* ===== 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;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .dock,
    #boot,
    #terminal,
    #cursor-trail,
    #glow,
    #bg {
        display: none !important;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(255, 255, 255, 0.3);
        --bg-card: rgba(255, 255, 255, 0.1);
    }
}

/* ===== FORCED COLORS MODE (Windows High Contrast) ===== */
@media (forced-colors: active) {
    button,
    a {
        border: 1px solid currentColor;
    }
}
