/* ==========================================================================
   Global element defaults — resets and base typography built on tokens.css.
   ========================================================================== */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    /* Defensive: `.full-bleed` (components.css) uses a `100vw`-based breakout
       trick that measures the viewport INCLUDING the scrollbar's width, which
       is wider than the visible area whenever a scrollbar is present — this
       clips that harmless few-pixel overhang instead of letting it add
       horizontal scroll. Every existing horizontal-scroll UI (e.g.
       `.table-shell`) already scopes `overflow-x: auto` to its own bounded
       element rather than relying on the page scrolling sideways, so this is
       safe site-wide. */
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: var(--text);
}

p {
    line-height: var(--lh-relaxed);
}

/* Responsive media baseline — without this, anything with an intrinsic pixel
   size (an <img>, a Chart.js <canvas>, embedded <svg>/<video>) can force its
   container wider than the viewport instead of scaling down with it, which is
   what "not responsive" usually turns out to mean in practice. */
img, canvas, svg, video {
    max-width: 100%;
    height: auto;
}

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

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

label {
    color: var(--gray-700);
    font-weight: var(--fw-semibold);
}

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

hr {
    border: 0;
    border-top: 1px solid var(--line);
}

::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

/* Focus is always visible and always consistent — never suppressed. */
:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}

/* Skip link — first focusable element on every page, invisible until tabbed to. */
.skip-link {
    position: absolute;
    top: -48px;
    left: var(--space-4);
    z-index: 1100;
    padding: var(--space-2) var(--space-4);
    background: var(--primary);
    color: #fff;
    font-weight: var(--fw-semibold);
    border-radius: var(--radius-md);
    transition: top var(--duration-base) var(--ease-standard);
}

.skip-link:focus {
    top: var(--space-4);
    color: #fff;
    text-decoration: none;
}
