/**
 * base.css — reset + body + headings + links + base elements.
 * Loaded after tokens.css. References --tokens, never hard-coded values.
 *
 * @import the @font-face declarations from /assets/fonts/_fonts.css.
 */

@import url("../fonts/_fonts.css");

/* ───── Reset ───── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--type-body-size);
    line-height: var(--type-body-leading);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* ───── Headings ───── */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    margin: 0 0 var(--space-3);
    color: var(--ink);
    font-feature-settings: "ss01";
}
h1 { font-size: var(--type-h1-size); font-weight: var(--type-h1-weight); line-height: var(--type-h1-leading); letter-spacing: var(--type-h1-tracking); }
h2 { font-size: var(--type-h2-size); font-weight: var(--type-h2-weight); line-height: var(--type-h2-leading); letter-spacing: var(--type-h2-tracking); }
h3 { font-size: var(--type-h3-size); font-weight: var(--type-h3-weight); line-height: var(--type-h3-leading); letter-spacing: var(--type-h3-tracking); }
h4 { font-size: var(--type-h4-size); font-weight: var(--type-h4-weight); line-height: var(--type-h4-leading); }

@media (max-width: 767px) {
    h1 { font-size: var(--type-h1-size-mobile); }
    h2 { font-size: var(--type-h2-size-mobile); }
    h3 { font-size: var(--type-h3-size-mobile); }
}

/* ───── Body text + links ───── */

p { margin: 0 0 var(--space-3); }
a { color: var(--accent); text-decoration: none; transition: color var(--motion-fast) ease; }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

strong, b { font-weight: 700; }
em, i { font-style: italic; }

hr { border: 0; border-top: 1px solid var(--rule); margin: var(--space-6) 0; }

ul, ol { margin: 0 0 var(--space-3); padding-left: 1.5rem; }
li { margin-bottom: 0.25rem; }

blockquote {
    margin: var(--space-4) 0;
    padding-left: var(--space-3);
    border-left: 4px solid var(--accent);
    font-style: italic;
    color: var(--ink-soft);
}

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

code, pre { font-family: var(--font-mono); }
code {
    background: var(--paper-soft);
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    font-size: 0.92em;
    border: 1px solid var(--rule);
}
pre {
    background: var(--paper-soft);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--rule);
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.5;
}
pre code { background: transparent; padding: 0; border: 0; }

/* Form elements — unify across browsers */
input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}
button { cursor: pointer; }

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

/* ───── Skip link (accessibility) ───── */

.skip-link {
    position: absolute;
    top: -40px;
    left: var(--gutter);
    background: var(--ink);
    color: #fff;
    padding: var(--space-1) var(--space-2);
    z-index: 1000;
    text-decoration: none;
    transition: top var(--motion-base) ease;
}
.skip-link:focus { top: var(--space-1); color: #fff; }

/* ───── Visually-hidden helper for screen readers ───── */

.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;
}
