/* =================================================================
   BASE STYLES & MODERN CSS RESET
   ================================================================= */

/* ===== CSS RESET ===== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    line-height: var(--leading-normal);
    font-family: var(--font-sans);

    /* Smooth scrolling */
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    /* For fixed header */
}

/* RTL Support */
html[dir="rtl"] {
    font-family: var(--font-arabic);
}

body {
    margin: 0;
    font-family: inherit;
    line-height: inherit;
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: var(--text-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ===== TYPOGRAPHY RESET ===== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: inherit;
    font-weight: inherit;
    margin: 0;
}

p {
    margin: 0;
}

strong {
    font-weight: var(--font-bold);
}

small {
    font-size: var(--text-sm);
}

/* ===== LINKS ===== */

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--color-accent);
}

/* ===== LISTS ===== */

ol,
ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ===== MEDIA ===== */

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
    display: block;
    max-width: 100%;
}

img,
video {
    height: auto;
}

svg {
    fill: currentColor;
}

/* ===== FORMS ===== */

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    color: inherit;
    margin: 0;
    padding: 0;
}

button,
select {
    text-transform: none;
}

button,
[type='button'],
[type='reset'],
[type='submit'] {
    -webkit-appearance: button;
    background-color: transparent;
    background-image: none;
    cursor: pointer;
    border: none;
}

button:disabled,
[type='button']:disabled,
[type='reset']:disabled,
[type='submit']:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

input,
textarea,
select {
    border: none;
    outline: none;
}

textarea {
    resize: vertical;
}

::placeholder {
    color: var(--color-gray-500);
    opacity: 1;
}

/* ===== FOCUS STYLES ===== */

:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===== SELECTION ===== */

::selection {
    background-color: var(--color-accent);
    color: var(--color-white);
}

::-moz-selection {
    background-color: var(--color-accent);
    color: var(--color-white);
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 #f0f0f0;
}

/* ===== TABLES ===== */

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* ===== HIDDEN ATTRIBUTE ===== */

[hidden] {
    display: none !important;
}

/* ===== DISABLED STATE ===== */

[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ===== ACCESSIBILITY ===== */

/* Screen reader 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-width: 0;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    z-index: var(--z-tooltip);
}

.skip-to-content:focus {
    top: 0;
}

/* Reduce motion for users who prefer it */
@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;
    }
}

/* ===== BASE TYPOGRAPHY STYLES ===== */

h1 {
    font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl));
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
}

h2 {
    font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
}

h3 {
    font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
}

h4 {
    font-size: clamp(var(--text-xl), 2vw, var(--text-3xl));
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
}

h5 {
    font-size: var(--text-xl);
    font-weight: var(--font-medium);
    line-height: var(--leading-normal);
}

h6 {
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
    line-height: var(--leading-normal);
}

p {
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

/* ===== PRINT STYLES ===== */

@media print {

    *,
    *::before,
    *::after {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    img {
        page-break-inside: avoid;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}