/* ==========================================================================
   Frontend Base — Resets & Element Defaults
   Layer 2 — requires tokens.css
   /css/frontend/base.css

   Purpose: Universal box-model reset, sensible element defaults, and
   body-level inheritance so downstream layers never need to repeat
   font-family, color, or background.
   ========================================================================== */

/* ==========================================================================
   1. Universal Reset
   ========================================================================== */

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

/* ==========================================================================
   2. Document & Body Defaults
   ========================================================================== */

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    line-height: var(--leading-normal);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-system), sans-serif;
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    /* 2026-04-11: offset for position:fixed header; default in tokens.css :root, overridden precisely at runtime by header.js */
    padding-top: var(--header-height);
}

/* ==========================================================================
   3. Typography Defaults
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--spacing-4);
    color: var(--color-text-secondary);
}

small {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

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

/* ==========================================================================
   4. Links
   ========================================================================== */

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

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

a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    text-decoration: underline;
}

/* ==========================================================================
   5. Lists
   ========================================================================== */

ul, ol {
    list-style: none;
}

/* ==========================================================================
   6. Media
   ========================================================================== */

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

img {
    border: 0;
}

/* ==========================================================================
   7. Tables
   ========================================================================== */

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

/* ==========================================================================
   8. Form Element Resets
   ========================================================================== */

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

button {
    cursor: pointer;
}

textarea {
    resize: vertical;
}

fieldset {
    border: none;
}

/* ==========================================================================
   9. Accessibility
   ========================================================================== */

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Screen reader only utility */
.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;
}

/* ==========================================================================
   10. Selection
   ========================================================================== */

::selection {
    background: var(--color-accent);
    color: var(--color-text-primary);
}

/* ==========================================================================
   11. Scrollbar Styling
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
}

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

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

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