/**
 * Abdur Rehman Portfolio - Base Stylesheet
 * Resets, font applications, scroll behavior, text selection colors, and key utility structures.
 */

/* ==========================================================================
   1. CSS Reset & Box-Sizing
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    font-weight: var(--fw-regular);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   2. Typography Standards
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-text-primary);
    font-weight: var(--fw-bold);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

ul, ol {
    list-style: none;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
    background: transparent;
    border: none;
}

button {
    cursor: pointer;
}

/* ==========================================================================
   3. Custom Scrollbar & Text Selection
   ========================================================================== */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--color-surface);
    border: 2px solid var(--color-bg-darker);
    border-radius: var(--border-radius-full);
    transition: background var(--transition-fast);
}

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

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

/* ==========================================================================
   4. Core Global Layout Utilities
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

.section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
    position: relative;
}

@media (min-width: 768px) {
    .section {
        padding-top: var(--space-4xl);
        padding-bottom: var(--space-4xl);
    }
}

/* Screen reader only helper */
.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;
}

/* Decorative background glowing grid patterns */
.bg-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

.bg-glow-orb {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--color-accent-rgb), 0.08) 0%, transparent 70%);
    filter: blur(40px);
    pointer-events: none;
    z-index: -1;
}

/* ==========================================================================
   5. Accessibility Keyboard Focus States
   ========================================================================== */
a:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
details:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

