/*
 * The static library pages built for crawlers and first-time readers
 * (scripts/build-static-pages.mjs). Not the app's stylesheet: these pages are
 * one column of text with no shell, and they load before anything else does,
 * so they carry no web font and no JS beyond /page-handoff.js.
 *
 * Flat cards, hairline borders, brand teal — the app's own look.
 */
:root {
    --sp-ink: #1e293b;
    --sp-ink-soft: #64748b;
    --sp-line: #e2e8f0;
    --sp-teal: #0f766e;
    --sp-teal-soft: #ccfbf1;
    --sp-bg: #f8fafc;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--sp-bg);
    color: var(--sp-ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

[lang='zh-Hans'] {
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

a { color: var(--sp-teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Chrome ─────────────────────────────────────────────────────────── */
.sp-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 52rem;
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

.sp-brand { font-weight: 600; font-size: 1.125rem; color: var(--sp-ink); }

.sp-open {
    border: 1px solid var(--sp-line);
    border-radius: 0.5rem;
    background: #fff;
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
}

.sp-crumbs {
    max-width: 52rem;
    margin: 0 auto;
    padding: 0 1.25rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--sp-ink-soft);
}

.sp-crumb-sep { padding: 0 0.4rem; }

.sp-main { max-width: 52rem; margin: 0 auto; padding: 0 1.25rem 2rem; }

/* ── The entry ──────────────────────────────────────────────────────── */
.sp-head {
    background: #fff;
    border: 1px solid var(--sp-line);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.sp-kind {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sp-ink-soft);
}

.sp-head h1 { margin: 0; font-size: 1.75rem; line-height: 1.25; }

.sp-glyph { font-size: 4rem; line-height: 1.1; }

.sp-read { margin: 0.5rem 0 0; color: var(--sp-ink-soft); }

.sp-formula {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.75rem;
    background: var(--sp-teal-soft);
    border-radius: 0.5rem;
    color: #115e59;
    font-weight: 500;
}

.sp-lede { margin: 0.75rem 0 0; }

/* The ways one pattern is written (比 · 较): each stand-in has a page of its
   own, and this is the switcher between them (app.css .grammar-page-faces). */
.sp-face-note { margin: 0.5rem 0 0; font-size: 0.875rem; color: var(--sp-ink-soft); }

.sp-faces {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.85rem 0 0;
    padding: 0.25rem;
    border: 1px solid var(--sp-line);
    background: var(--sp-bg);
    border-radius: 0.9rem;
}

.sp-face {
    padding: 0.35rem 0.85rem;
    border-radius: 0.65rem;
    color: var(--sp-ink-soft);
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none;
}

.sp-face-on { background: #ffffff; color: var(--sp-teal); box-shadow: 0 1px 2px rgb(15 23 42 / 0.08); }

.sp-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 0;
    padding: 0;
}

.sp-facts dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--sp-ink-soft); }
.sp-facts dd { margin: 0.15rem 0 0; font-weight: 500; }

.sp-section {
    margin-top: 1.25rem;
    background: #fff;
    border: 1px solid var(--sp-line);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
}

.sp-section h2 { margin: 0 0 0.75rem; font-size: 1.0625rem; }
.sp-section > p { margin: 0 0 0.5rem; }
.sp-points { margin: 0.5rem 0 0; padding-left: 1.25rem; display: grid; gap: 0.3rem; }

/* ── Examples ───────────────────────────────────────────────────────── */
.sp-ex { margin: 0; padding-left: 1.25rem; }
.sp-ex > li { margin-bottom: 1rem; }
.sp-ex > li:last-child { margin-bottom: 0; }
.sp-ex-hanzi { margin: 0; font-size: 1.25rem; }
.sp-ex-pinyin { margin: 0.15rem 0 0; color: var(--sp-ink-soft); }
.sp-ex-english { margin: 0.15rem 0 0; }
.sp-ex-parts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 0; }

.sp-slot {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    border: 1px solid var(--sp-line);
    border-radius: 0.375rem;
    padding: 0.1rem 0.5rem;
    font-size: 0.875rem;
}

.sp-slot-role { color: var(--sp-ink-soft); font-size: 0.75rem; }

/* ── Lists of characters and words ──────────────────────────────────── */
.sp-chars, .sp-words, .sp-links { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.sp-chars { grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); }
.sp-words, .sp-links { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }

.sp-chars a, .sp-words a, .sp-links a, .sp-part {
    display: block;
    border: 1px solid var(--sp-line);
    border-radius: 0.5rem;
    padding: 0.5rem 0.65rem;
    color: inherit;
}

.sp-chars a:hover, .sp-words a:hover, .sp-links a:hover { border-color: var(--sp-teal); text-decoration: none; }

.sp-char { display: block; font-size: 1.5rem; }
.sp-word { display: block; font-size: 1.125rem; }
.sp-char-read, .sp-word-read { display: block; font-size: 0.8125rem; color: var(--sp-teal); }
.sp-link-title { display: block; font-weight: 600; }
.sp-link-sub { display: block; font-size: 0.8125rem; color: var(--sp-ink-soft); }
.sp-char-mean, .sp-word-mean { display: block; font-size: 0.8125rem; color: var(--sp-ink-soft); }

.sp-chip {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    color: var(--sp-ink-soft);
}

/* ── A word's meanings ─────────────────────────────────────────────── */
.sp-sense + .sp-sense { margin-top: 1.25rem; }
.sp-sense-title { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 600; }
.sp-sense-title .sp-chip { margin: 0 0 0 0.4rem; font-weight: 400; }

/* ── Call to action and paging ──────────────────────────────────────── */
.sp-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.25rem;
    background: var(--sp-teal);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    color: #fff;
}

.sp-cta-text { margin: 0; max-width: 32rem; }

.sp-cta-btn {
    background: #fff;
    color: var(--sp-teal);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

/* A level's pages (1 2 3 …) and the levels themselves, on the list pages. */
.sp-pager { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; font-size: 0.875rem; }
.sp-section .sp-pager { margin-top: 0; }

.sp-pager a, .sp-pager span {
    min-width: 2.25rem;
    border: 1px solid var(--sp-line);
    border-radius: 0.5rem;
    background: #fff;
    padding: 0.3rem 0.65rem;
    text-align: center;
}

.sp-pager a:hover { border-color: var(--sp-teal); text-decoration: none; }
.sp-pager [aria-current] { border-color: var(--sp-teal); background: var(--sp-teal-soft); color: #115e59; font-weight: 600; }

.sp-steps { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; font-size: 0.875rem; }
.sp-step-next { margin-left: auto; text-align: right; }

/* ── Footer ─────────────────────────────────────────────────────────── */
.sp-foot {
    max-width: 52rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    border-top: 1px solid var(--sp-line);
    color: var(--sp-ink-soft);
    font-size: 0.875rem;
}

.sp-foot-nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.sp-foot-note { margin: 0.75rem 0 0; }
