/* ==========================================================================
   base.css — reset, typography, and base element styles.
   No component styling here; just sane defaults built on the tokens.
   ========================================================================== */

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

* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-default);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100dvh;
}

/* Media defaults */
img, picture, svg, video, canvas {
    display: block;
    max-width: 100%;
}
/* Icons are outline (stroke-based); each <svg> declares its own fill.
   Do NOT force a global fill here — CSS would override the fill="none"
   presentation attribute and make outline icons render solid. */

/* Form controls inherit type */
input, button, textarea, select {
    font: inherit;
    color: inherit;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-strong);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p { text-wrap: pretty; }

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

/* Lists used as nav etc. reset by default */
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

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

kbd {
    background: var(--bg-sunken);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    padding: 0.1em 0.4em;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin-block: var(--space-4);
}

/* Visible, consistent focus for keyboard users */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* Selection */
::selection {
    background: var(--accent-soft);
    color: var(--text-strong);
}

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

/* Utility: visually hidden but available to screen readers */
.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;
}
