/* CSS Reset & Base Styles */

/* Box Sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* HTML & Body */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

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

/* Typography Reset */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
}

p {
    margin: 0;
}

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

a:hover,
a:focus {
    text-decoration: none;
}

a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Lists */
ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

picture {
    display: block;
}

/* Forms */
input,
textarea,
select,
button {
    font: inherit;
    color: inherit;
    border: none;
    outline: none;
}

input:focus,
textarea:focus,
select:focus,
button:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Buttons */
button {
    cursor: pointer;
    background: none;
}

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

/* Tables */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

/* Remove default styles */
[hidden] {
    display: none !important;
}

/* Remove spinner from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Remove search decoration */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

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

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: var(--white);
    padding: var(--space-2) var(--space-4);
    z-index: var(--z-tooltip);
    transition: top var(--transition-base);
}

.skip-link:focus {
    top: 0;
}

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

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: var(--radius-full);
}

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

/* Focus visible polyfill */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Remove default button styles in iOS */
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    padding: 0;
}

/* Smooth rendering */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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