/* ==========================================================================
   base.css
   --------------------------------------------------------------------------
   Global base styles: reset, defaults for HTML elements, accessibility.
   Loaded after theme.css so it can use design tokens.
   ========================================================================== */

/* ----- Modern reset ------------------------------------------------------- */

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

html {
    font-size: 100%;
    line-height: var(--line-height-base);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ----- Typography defaults ------------------------------------------------ */

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.75em;
    font-family: var(--font-heading);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-heading);
    color: var(--color-text);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 4vw + 0.5rem, 3rem); }
h2 { font-size: clamp(1.5rem, 2vw + 0.75rem, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9375rem; }

p {
    margin: 0 0 1rem;
}

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

a {
    color: var(--color-text);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

ul, ol {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}

li + li {
    margin-top: 0.25rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

/* ----- Media -------------------------------------------------------------- */

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

/* ----- Forms / interactive ------------------------------------------------ */

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0;
}

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

/* ----- Accessibility ------------------------------------------------------ */

:focus {
    outline: none;
}

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

/* Skip to main content link */
.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    padding: 0.625rem 1rem;
    background-color: var(--color-card);
    color: var(--color-text);
    font-size: 0.9375rem;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-soft);
    transform: translateY(-200%);
    transition: transform var(--transition-fast);
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .skip-link {
        transition: none;
    }
}

/* Skip / screen-reader-only helper */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Respect users who prefer less motion */
@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;
    }
}
