/* Tokens, fonts, reset and type. Brand colours live only here. */

@font-face {
    font-family: "Manrope";
    src: url("../fonts/manrope-wght.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Mono";
    src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}

:root {
    /* Taken from the JacCode favicon: #0d0e10 tile, #ffa579 brackets. */
    --bg: #0d0e10;
    --bg-2: #121316;
    --panel: #17191c;
    --panel-2: #1e2024;
    --control: #24272b;
    --line: #25282d;
    --line-2: #34383e;

    --text: #f4f5f7;
    --muted: #a3a8b2;
    --faint: #868b95;

    --accent: #ffa579;
    --accent-hover: #ffb894;
    --on-accent: #0d0e10;
    --accent-wash: rgba(255, 165, 121, 0.1);
    --accent-line: rgba(255, 165, 121, 0.35);

    --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans", "Yu Gothic UI", "Noto Sans CJK SC", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --content-max: 1200px;
    --gutter: 24px;
    --header-h: 64px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 24px);
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }
main:focus { outline: none; }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

/* Chinese and Japanese read badly with negative tracking. */
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3,
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { letter-spacing: 0; line-height: 1.25; }
:lang(zh) body, :lang(ja) body { line-height: 1.75; }

p { text-wrap: pretty; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

a, button, summary, [role="tab"] { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }

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

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
}

strong { font-weight: 700; color: var(--text); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

::selection { background: var(--accent); color: var(--on-accent); }

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

.skip-link {
    position: absolute;
    left: 16px; top: -56px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-decoration: none;
}
.skip-link:focus { top: 12px; }

.num { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
