/*
 * Base styles: reset, document defaults and the typographic hierarchy.
 * Uses platform tokens only.
 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: var(--line-body);
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ul,
ol {
    margin: 0;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

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

/* ---- Typographic hierarchy ---- */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    line-height: var(--line-heading);
    letter-spacing: var(--tracking-heading);
    text-wrap: balance;
}

h1 {
    font-size: var(--text-3xl);
    line-height: var(--line-tight);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

/* The smallest heading drops to the body face so it stays readable at text size. */
h4 {
    font-family: var(--font-body);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    line-height: 1.3;
}

a {
    color: var(--color-link);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--color-text);
}

strong {
    font-weight: var(--weight-bold);
}

/* ---- Focus ---- */
:focus-visible {
    outline: var(--rule-width) solid var(--color-focus);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: var(--space-2);
    top: var(--space-2);
    z-index: calc(var(--layer-header) + 1);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
    color: var(--color-text);
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

/* Available to screen readers, not shown on screen. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
