/* Base CSS - Combined Reset & Typography */

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

/* Remove default margin and padding */
html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
    margin: 0;
}

/* Set core root defaults */
html:focus-within {
    scroll-behavior: smooth;
}

/* Set core body defaults */
body {
    min-height: 100vh;
    text-rendering: optimizeSpeed;
    line-height: var(--line-height-normal);
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Set default link styles */
a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* Remove all button styles */
button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

/* Typography Base */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
}

h1 {
    font-size: var(--font-size-4xl);
    letter-spacing: -0.025em;
}

h2 {
    font-size: var(--font-size-3xl);
    letter-spacing: -0.025em;
}

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

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

/* Paragraphs */
p {
    margin-bottom: 1em;
    line-height: var(--line-height-relaxed);
}

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

a:hover {
    color: var(--primary-light);
}

/* Lists */
ul, ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

ul {
    list-style-type: disc;
}

ol {
    list-style-type: decimal;
}

li {
    margin-bottom: 0.5em;
}

/* Reset list styles for navigation */
nav ul,
nav ol,
.nav-links,
.menu-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

nav li,
.nav-links li,
.menu-items li {
    margin: 0;
}

/* Inline Text Elements */
strong, b {
    font-weight: var(--font-weight-semibold);
}

em, i {
    font-style: italic;
}

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

code, pre, kbd {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    background: var(--bg-secondary);
    padding: 0.2em 0.4em;
    border-radius: var(--border-radius-sm);
}

/* Form Elements Reset */
fieldset {
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
}

legend {
    padding: 0;
}

/* Table Reset */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* Horizontal Rule */
hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-md) 0;
}

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

/* Focus Styles */
:focus {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 2px;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--border-radius);
}

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

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High Contrast Mode */
@media (forced-colors: active) {
    :root {
        --primary-color: Highlight;
        --focus-ring-color: Highlight;
    }
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Main Content Area */
main {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    width: 100%;
}

/* Section Defaults */
section {
    padding: var(--spacing-2xl) 0;
}

/* Hidden Elements */
[hidden] {
    display: none !important;
}

[aria-hidden="true"] {
    display: none !important;
}
