/* ==========================================================================
   BASE STYLES - Reset, Typography, and Utilities
   ========================================================================== */

/* -------------------------------------------------------------------------
   CSS RESET - Modern reset for consistent cross-browser styling
   ------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-relaxed);
    color: var(--text-secondary);
    background: var(--bg-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Remove default list styles */
ul,
ol {
    list-style: none;
}

/* Remove default link styles */
a {
    color: var(--primary);
    text-decoration: none;
}

/* Media elements */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Form elements inherit font */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* Remove button styles */
button {
    background: none;
    border: none;
    cursor: pointer;
}

/* Remove fieldset styles */
fieldset {
    border: none;
}

/* Prevent textarea resize issues */
textarea {
    resize: vertical;
    margin-bottom: var(--space-4);
}

/* Accessibility - 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;
    }
}

/* -------------------------------------------------------------------------
   TYPOGRAPHY
   ------------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
}

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: var(--space-4);
}

p:last-child {
    margin-bottom: 0;
}

strong,
b {
    font-weight: var(--font-semibold);
}

em,
i {
    font-style: italic;
}

small {
    font-size: var(--text-sm);
}

/* Links */
.link {
    color: var(--primary-light);
    transition: color var(--transition-fast);
}

.link:hover {
    color: var(--primary);
}

/* Selection */
::selection {
    background: var(--primary);
    color: var(--text-primary);
}

/* -------------------------------------------------------------------------
   LAYOUT UTILITIES
   ------------------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-inline: auto;
    padding-inline: var(--space-6);
}

@media (min-width: 768px) {
    .container {
        padding-inline: var(--space-8);
    }
}

.section {
    padding-block: var(--section-padding);
    position: relative;
}

/* Flexbox */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

/* Grid */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 640px) {
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* -------------------------------------------------------------------------
   SPACING UTILITIES
   ------------------------------------------------------------------------- */

.m-auto {
    margin: auto;
}

.mx-auto {
    margin-inline: auto;
}

.my-auto {
    margin-block: auto;
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.p-4 {
    padding: var(--space-4);
}

.p-6 {
    padding: var(--space-6);
}

.p-8 {
    padding: var(--space-8);
}

/* -------------------------------------------------------------------------
   TEXT UTILITIES
   ------------------------------------------------------------------------- */

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.text-accent {
    color: var(--primary-light);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 50%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.font-light {
    font-weight: var(--font-light);
}

.font-medium {
    font-weight: var(--font-medium);
}

.font-semibold {
    font-weight: var(--font-semibold);
}

.font-bold {
    font-weight: var(--font-bold);
}

.uppercase {
    text-transform: uppercase;
}

.capitalize {
    text-transform: capitalize;
}

/* -------------------------------------------------------------------------
   VISIBILITY UTILITIES
   ------------------------------------------------------------------------- */

.hidden {
    display: none;
}

.visible {
    visibility: visible;
}

.invisible {
    visibility: hidden;
}

@media (max-width: 767px) {
    .md\:hidden {
        display: none;
    }
}

@media (min-width: 768px) {
    .md\:block {
        display: block;
    }

    .md\:flex {
        display: flex;
    }
}

/* 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: 0;
}

/* -------------------------------------------------------------------------
   SCROLLBAR STYLING
   ------------------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-800);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-700);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-800) var(--bg-darker);
}