/* The post's shared language, as on the OpenWorld pages: sihanxu.me's tokens (system fonts, #333 ink, #2563eb accent,
   white and #f8f9fa grounds, 12px corners), its labels and facts; amber is the second accent of the pieces. */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --ink: #333;
    --ink-strong: #111;
    --muted: #666;
    --faint: #999;
    --line: #e9ecef;
    --bg: #fff;
    --bg-alt: #f8f9fa;
    --accent: #2563eb;
    --accent-soft: #eef3fe;
    --amber: #e08a1e;
    --amber-soft: #fff3e2;
    --radius: 12px;
    --nav-h: 64px;
    --mono: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    --line-strong: #dcdfe3;
    --card: #fff;
    --banner: rgba(255, 255, 255, 0.88);
    --piece-bg: #f7f8fb;
}
/* dark: the same tokens at night; the canvas figures keep their own light ground, like prints */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #d4d8de; --ink-strong: #f2f4f7; --muted: #a2a9b4; --faint: #7f8794; --line: #2a3038; --line-strong: #3a414b;
        --bg: #101318; --bg-alt: #181c22; --card: #1b2027; --accent: #6d9cff; --accent-soft: #172440;
        --amber: #f0a64a; --amber-soft: #33270f; --banner: rgba(16, 19, 24, 0.86); --piece-bg: #e9edf3;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
        --ink: #d4d8de; --ink-strong: #f2f4f7; --muted: #a2a9b4; --faint: #7f8794; --line: #2a3038; --line-strong: #3a414b;
        --bg: #101318; --bg-alt: #181c22; --card: #1b2027; --accent: #6d9cff; --accent-soft: #172440;
        --amber: #f0a64a; --amber-soft: #33270f; --banner: rgba(16, 19, 24, 0.86); --piece-bg: #e9edf3;
        color-scheme: dark;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; width: 100%; }

/* top bar */
.banner {
    position: fixed; top: 0; left: 0; right: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
    background: var(--banner);
    -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06); z-index: 1000;
}
.banner .container { height: 100%; display: flex; justify-content: space-between; align-items: center; }
.nav-title { font-size: 1.35rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.nav-title small { font-size: 0.8rem; font-weight: 500; color: var(--faint); margin-left: 0.6rem; letter-spacing: 0; }
.nav-links { display: flex; gap: 2rem; }
.nav-links a, .nav-links span { color: var(--muted); font-weight: 500; transition: color 0.2s ease; }
.nav-links a:hover { color: var(--ink-strong); }
.nav-links .soon { color: var(--faint); }

/* small uppercase label */
.label { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.kw { color: var(--accent); }

/* facts */
.fact dt { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.fact dd { font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* code: the layer's equations as it computes them (NEPA's algorithm colours) */
.code { font-family: var(--mono); font-size: 0.8rem; line-height: 1.75; color: var(--ink); white-space: pre; overflow-x: auto; }
.code .c { color: #3a9696; }
.code .k { color: #c0265b; font-weight: 600; }
.code .f { color: #0057b7; }
.code .a { color: #b8620c; font-weight: 600; }

/* a value still to come */
.tbd { color: var(--faint); border-bottom: 1.5px dashed var(--line-strong); }

/* footer */
.footer { padding: 2rem 0 2.5rem; border-top: 1px solid var(--line); }
.footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }

@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    .nav-links { gap: 1.1rem; }
    .nav-links .hide-sm { display: none; }
    .nav-title { font-size: 1.15rem; }
    .nav-title small { display: none; }
}
