/* ===================================
   BASE STYLES & RESET
   =================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-regular);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: linear-gradient(to bottom, var(--bg-gradient-top), var(--bg-gradient-bottom)) no-repeat;
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--bg-texture-url);
    background-size: 2200px;
    /* Much larger to cover the screen elegantly */
    background-position: center center;
    background-repeat: repeat;
    opacity: var(--bg-texture-opacity);
    mix-blend-mode: var(--bg-texture-blend);
    pointer-events: none;
    z-index: -1;
    transition: background-image 0.3s ease, opacity 0.3s ease;
}

[data-theme="dark"] body {
    background: linear-gradient(to bottom, var(--bg-gradient-top), var(--bg-gradient-bottom)) no-repeat;
    background-attachment: fixed;
}

/* Smooth scroll with Lenis will override this */
html.lenis {
    height: auto;
}

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

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

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

/* ===================================
   TYPOGRAPHY
   =================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: var(--text-5xl);
    font-weight: var(--font-extrabold);
}

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);
    color: var(--text-secondary);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-base) var(--ease-in-out);
}

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

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

em,
i {
    font-style: italic;
}

/* ===================================
   LAYOUT
   =================================== */

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

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

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-12);
    }
}

.section {
    padding: var(--space-8) 0;
    /* Reduced from space-20 (5rem) on mobile */
    position: relative;
    background: transparent;
    /* Allow body gradient to show through */
}

@media (min-width: 768px) {
    .section {
        padding: var(--space-24) 0;
    }
}

.main {
    min-height: 100vh;
    padding-top: var(--header-height-mobile);
}

@media (min-width: 768px) {
    .main {
        padding-top: var(--header-height);
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent-color);
    color: var(--text-inverse);
    padding: var(--space-3) var(--space-6);
    text-decoration: none;
    border-radius: var(--radius-base);
    z-index: var(--z-tooltip);
    transition: top var(--transition-base) var(--ease-out);
}

.skip-link:focus {
    top: var(--space-4);
}

/* Focus visible styles */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

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

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

/* ===================================
   IMAGES & MEDIA
   =================================== */

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

img {
    border-style: none;
}

svg {
    fill: currentColor;
}

/* ===================================
   FORMS
   =================================== */

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

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

input:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===================================
   UTILITY CLASSES
   =================================== */

/* Display */
.hidden {
    display: none !important;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.grid {
    display: grid;
}

/* Flex utilities */
.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-start {
    justify-content: flex-start;
}

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

/* Text alignment */
.text-left {
    text-align: left;
}

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

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

/* Text colors */
.text-primary {
    color: var(--text-primary);
}

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

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

/* Background colors */
.bg-primary {
    background-color: var(--bg-primary);
}

.bg-secondary {
    background-color: var(--bg-secondary);
}

/* Spacing utilities */
.mt-auto {
    margin-top: auto;
}

.mb-auto {
    margin-bottom: auto;
}

.ml-auto {
    margin-left: auto;
}

.mr-auto {
    margin-right: auto;
}

/* Position */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

/* Overflow */
.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

/* Pointer events */
.pointer-events-none {
    pointer-events: none;
}

/* ===================================
   SECTION HEADERS
   =================================== */

.section-header {
    text-align: center;
    margin-bottom: var(--space-6);
    /* Reduced from space-8 */
}

.section-subtitle {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-color);
    margin-bottom: var(--space-3);
}

.section-title {
    font-size: var(--text-4xl);
    font-weight: var(--font-extrabold);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
    .section-title {
        font-size: var(--text-5xl);
    }
}

/* ===================================
   RESPONSIVE UTILITIES
   =================================== */

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .hide-tablet {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ===================================
   SELECTION
   =================================== */

::selection {
    background-color: var(--accent-color);
    color: var(--text-inverse);
}

::-moz-selection {
    background-color: var(--accent-color);
    color: var(--text-inverse);
}

/* ===================================
   SCROLLBAR
   =================================== */

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: var(--radius-full);
}

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}

/* ===================================
   LOADING STATE
   =================================== */

.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* ===================================
   RESPONSIVE TYPOGRAPHY
   =================================== */

@media (min-width: 768px) {
    h1 {
        font-size: var(--text-6xl);
    }

    h2 {
        font-size: var(--text-5xl);
    }

    h3 {
        font-size: var(--text-4xl);
    }
}

@media (min-width: 1024px) {
    h1 {
        font-size: var(--text-7xl);
    }
}