*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    z-index: var(--z-10);
}

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

.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
    color: inherit;
    flex-shrink: 0;
}

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

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

a {
    text-decoration: none;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-4);
    overflow-wrap: balance;
}

h1 {
    font-size: var(--text-5xl);
    font-weight: 800;
    letter-spacing: -0.03em;
}

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);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

p {
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
    overflow-wrap: pretty;
}

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

a {
    color: var(--color-accent);
    transition: color var(--transition-fast) var(--ease-in-out);
}

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

strong, b {
    font-weight: 600;
    color: var(--text-primary);
}

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

code, pre, kbd, samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    background-color: var(--code-bg);
    color: var(--code-text);
    font-weight: 500;
}

pre {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-4) 0;
    line-height: 1.5;
}

pre code {
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
}

blockquote {
    padding: var(--space-4) var(--space-5);
    margin: var(--space-6) 0;
    border-radius: var(--radius-md);
    font-style: italic;
    font-size: var(--text-lg);
}

::selection {
    background-color: var(--selection-bg);
    color: var(--selection-text);
    text-shadow: none;
}

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

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

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

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
    border: 2px solid var(--scrollbar-track);
}

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

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

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

:focus {
    outline: none;
}

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

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent);
    color: var(--text-inverse);
    padding: var(--space-2) var(--space-4);
    z-index: var(--z-9999);
    border-radius: 0 0 var(--radius-md) 0;
    font-weight: 600;
}

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

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    h1 {
        font-size: var(--text-4xl);
    }
    h2 {
        font-size: var(--text-3xl);
    }
    h3 {
        font-size: var(--text-2xl);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
