/* Scott Operations base — element resets, body/heading defaults, link styles.
 *
 * Built on top of tokens.css. Mobile-first per BRAND.md §11.
 * Loaded after Bootstrap so token-based defaults win.
 */

/* ── Box-sizing reset ─────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--scott-font-sans);
    font-size: var(--scott-text-base);
    font-weight: var(--scott-weight-regular);
    line-height: var(--scott-line-body);
    color: var(--scott-ink);
    background-color: var(--scott-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ── Headings ─────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--scott-space-3) 0;
    font-family: var(--scott-font-sans);
    line-height: var(--scott-line-heading);
    color: var(--scott-ink);
}

h1 { font-size: var(--scott-text-3xl); font-weight: var(--scott-weight-bold); }
h2 { font-size: var(--scott-text-2xl); font-weight: var(--scott-weight-semibold); }
h3 { font-size: var(--scott-text-xl); font-weight: var(--scott-weight-semibold); }
h4 { font-size: var(--scott-text-lg); font-weight: var(--scott-weight-semibold); }
h5 { font-size: var(--scott-text-base); font-weight: var(--scott-weight-semibold); }
h6 { font-size: var(--scott-text-sm); font-weight: var(--scott-weight-semibold); }

/* ── Paragraphs and text ──────────────────────────────────────────── */
p {
    margin: 0 0 var(--scott-space-3) 0;
}

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

.scott-text-muted {
    color: var(--scott-muted);
}

.scott-text-secondary {
    color: var(--scott-ink-secondary);
}

.scott-text-mono {
    font-family: var(--scott-font-mono);
}

/* ── Links ────────────────────────────────────────────────────────── */
a {
    color: var(--scott-primary);
    text-decoration: none;
    transition: color var(--scott-transition-fast);
}

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

a:focus-visible {
    outline: 2px solid var(--scott-primary);
    outline-offset: 2px;
    border-radius: var(--scott-radius-sm);
}

/* ── Focus indicator (BRAND.md §12) ───────────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--scott-primary);
    outline-offset: 0;
}

/* Remove default outline only when we replace it with focus-visible */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ── Lists ────────────────────────────────────────────────────────── */
ul, ol {
    margin: 0 0 var(--scott-space-3) 0;
    padding-left: var(--scott-space-6);
}

/* ── Tables (base reset; component styles in components.css) ──────── */
table {
    border-collapse: collapse;
    width: 100%;
}

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

code {
    padding: 2px var(--scott-space-1);
    background-color: var(--scott-surface-tint);
    border-radius: var(--scott-radius-sm);
}

pre {
    padding: var(--scott-space-3);
    background-color: var(--scott-surface-tint);
    border-radius: var(--scott-radius-sm);
    overflow-x: auto;
}

pre code {
    padding: 0;
    background: transparent;
}

/* ── HR ───────────────────────────────────────────────────────────── */
hr {
    border: none;
    border-top: 1px solid var(--scott-border);
    margin: var(--scott-space-6) 0;
}

/* ── Images ───────────────────────────────────────────────────────── */
img {
    max-width: 100%;
    height: auto;
}

/* ── Form elements (base reset; component styles in components.css) ─ */
button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ── Container ────────────────────────────────────────────────────── */
.scott-container {
    max-width: var(--scott-container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--scott-space-4);
    padding-right: var(--scott-space-4);
}

/* ── Skip link (a11y) ─────────────────────────────────────────────── */
.scott-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: var(--scott-space-2) var(--scott-space-3);
    background: var(--scott-primary);
    color: var(--scott-surface);
    z-index: 9999;
}

.scott-skip-link:focus {
    top: 0;
    color: var(--scott-surface);
    text-decoration: none;
}

/* ── Visually hidden but accessible to screen readers ─────────────── */
.scott-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;
}

/* ── Print ────────────────────────────────────────────────────────── */
@media print {
    body { background: white; color: black; }
    a { color: black; text-decoration: underline; }
    .scott-no-print { display: none !important; }
}
