/*
 * CollatCred — Global Styles
 * Base element styles, accessibility utilities, and cross-cutting concerns.
 * No component-specific rules belong here.
 * Depends on: variables.css
 */

/* ── Base reset ──────────────────────────────────────── */

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

body {
    font-family: var(--font-sans);
    background-color: var(--color-surface-0);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ── Text selection ──────────────────────────────────── */

::selection {
    background-color: rgba(34, 211, 238, 0.3);
    color: #cffafe;
}

/* ── Accessibility — Screen-reader only ─────────────── */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ── Accessibility — Focus visible ring ─────────────── */
/*
 * Brand-cyan ring applied to all interactive elements.
 * This is the single, consistent focus indicator for the entire site.
 */

:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.8);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
}

button:focus-visible,
[role="button"]:focus-visible {
    outline-offset: 4px;
}

nav a:focus-visible {
    outline-offset: 6px;
    border-radius: 4px;
}

/* Range slider thumb uses box-shadow ring to follow the circular shape */
input[type=range]:focus-visible {
    outline: none;
}

input[type=range]:focus-visible::-webkit-slider-thumb {
    box-shadow:
        0 0 0 3px var(--color-brand-dim),
        0 0 10px var(--color-brand-glow);
}
