/* ==========================================================================
   Base Styles - Reset & Foundation
   ========================================================================== */

/* Box Sizing Rules */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove Default Margin & Padding */
* {
    margin: 0;
    padding: 0;
}

/* Prevent Font Size Inflation */
html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    scroll-behavior: smooth;
    font-size: 16px;
}

/* Remove Default List Styles */
ul,
ol {
    list-style: none;
}

/* Set Core Body Defaults */
body {
    min-height: 100vh;
    line-height: var(--leading-normal);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-regular);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* Remove Default Styles from Interactive Elements */
button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
    background: transparent;
    border: none;
    outline: none;
}

button {
    cursor: pointer;
}

/* Remove Default Link Styles */
a {
    color: inherit;
    text-decoration: none;
}

/* Remove Default Image Styles */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Inherit Fonts for Form Elements */
input,
button,
textarea,
select {
    font: inherit;
}

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

::-moz-selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* Focus Visible for Accessibility */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Remove Animations Based on User Preference */
@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 Base
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-regular);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-wide);
    text-wrap: balance;
}

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 {
    text-wrap: pretty;
    max-width: 70ch;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

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

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

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

.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: 10px;
    height: 10px;
}

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

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

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

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

/* ==========================================================================
   Hidden Elements
   ========================================================================== */

.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
}

.overflow-hidden {
    overflow: hidden;
}

/* ==========================================================================
   Text Utilities
   ========================================================================== */

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

.highlight {
    color: var(--color-primary);
    position: relative;
}

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

/* ==========================================================================
   Smooth Scroll Offset for Fixed Header
   ========================================================================== */

html {
    scroll-padding-top: 100px;
}

/* ==========================================================================
   Body Scroll Lock (for modals)
   ========================================================================== */

body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ==========================================================================
   Preloader Transition
   ========================================================================== */

body.loading {
    overflow: hidden;
}

body.loaded {
    overflow-x: hidden;
}