:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #5d6679;
  --line: #e2e5ee;
  --brand: #0b3c78;
  --brand-2: #00a0c6;
  --link: #0a5bb5;
  --ins-bg: #ddf4e4;
  --ins-text: #0c5a2a;
  --ins-edge: #2f9e57;
  --del-bg: #fde3e3;
  --del-text: #8c1d1d;
  --del-edge: #d64545;
  --mod-edge: #d99a17;
  --ctx: #8b93a5;
  --hint: #eef5ff;
  --warn-bg: #fff6dd;
  --warn-edge: #e2b33c;
  --code-bg: #f3f4f8;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151d;
    --surface: #1a202b;
    --text: #e6e9f0;
    --muted: #9aa3b5;
    --line: #2c3442;
    --brand: #7fb2ff;
    --brand-2: #4fd1ee;
    --link: #8cbcff;
    --ins-bg: #173d27;
    --ins-text: #b9f0cc;
    --ins-edge: #3fbf6f;
    --del-bg: #4a1f22;
    --del-text: #ffc9c9;
    --del-edge: #f06a6a;
    --mod-edge: #e8b13a;
    --ctx: #7c8597;
    --hint: #1d2a3d;
    --warn-bg: #3a3017;
    --warn-edge: #c99a2b;
    --code-bg: #232a37;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #11151d; --surface: #1a202b; --text: #e6e9f0; --muted: #9aa3b5; --line: #2c3442;
  --brand: #7fb2ff; --brand-2: #4fd1ee; --link: #8cbcff; --ins-bg: #173d27; --ins-text: #b9f0cc;
  --ins-edge: #3fbf6f; --del-bg: #4a1f22; --del-text: #ffc9c9; --del-edge: #f06a6a; --mod-edge: #e8b13a;
  --ctx: #7c8597; --hint: #1d2a3d; --warn-bg: #3a3017; --warn-edge: #c99a2b; --code-bg: #232a37;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}
a { color: var(--link); }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand b { color: var(--brand); }
.brand .mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700;
}
.top .ext { font-size: 0.9rem; white-space: nowrap; }
.trail { margin: 20px 0 0; font-size: 0.9rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.trail span { color: var(--ctx); }
footer { color: var(--muted); font-size: 0.85rem; padding-top: 32px; padding-bottom: 40px; }

/* headings and intro */
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 8px 0 12px; }
.intro { padding: 32px 0 8px; }
.intro p { color: var(--muted); max-width: 720px; }
.rfc-head { padding: 24px 0 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.summary { color: var(--text); max-width: 780px; }
h2.sec { font-size: 1.2rem; margin: 32px 0 12px; }

/* chips */
.chip {
  display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--code-bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; line-height: 1.6;
}
.st-impact-analysis { background: #fff1d6; color: #7a4b00; border-color: #f0d49a; }
.st-approved, .st-implementation, .st-implemented { background: var(--ins-bg); color: var(--ins-text); border-color: transparent; }
.st-rejected { background: var(--del-bg); color: var(--del-text); border-color: transparent; }
.t-added { background: var(--ins-bg); color: var(--ins-text); border-color: transparent; }
.t-deleted { background: var(--del-bg); color: var(--del-text); border-color: transparent; }
.t-modified, .t-renamed { background: #fff1d6; color: #7a4b00; border-color: #f0d49a; }
.normative { background: var(--brand); color: #fff; border-color: transparent; }
.multi { background: var(--warn-bg); color: var(--text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .st-impact-analysis,
  :root:not([data-theme="light"]) .t-modified,
  :root:not([data-theme="light"]) .t-renamed { background: #3d3013; color: #ffd98a; border-color: transparent; }
  :root:not([data-theme="light"]) .normative { color: #11151d; }
}

/* legend & warnings */
.legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.85rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 16px 0;
}
.lg-ctx { border-left: 3px solid var(--line); padding-left: 8px; }
.warn { background: var(--warn-bg); border-left: 4px solid var(--warn-edge); padding: 10px 14px; border-radius: 6px; margin: 16px 0; font-size: 0.9rem; }
.warn ul { margin: 6px 0 0; padding-left: 20px; }
.warn.small { margin: 0 20px 12px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table.overview { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.overview th, .overview td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.overview th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.overview tr:last-child td { border-bottom: 0; }
.overview td .chip + .chip { margin-left: 4px; }

/* repo sections & cards */
section.repo, section.release { margin-top: 36px; }
.repo-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; border-bottom: 2px solid var(--brand); margin-bottom: 14px; }
.repo-head h2 { margin: 0 0 6px; font-size: 1.35rem; }
.repo-links { font-size: 0.88rem; color: var(--muted); padding-bottom: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 22px; overflow: hidden; scroll-margin-top: 16px; }
.card:target { box-shadow: 0 0 0 3px var(--brand-2); }
.card-head { padding: 16px 20px 10px; border-bottom: 1px solid var(--line); }
.card-head .ids { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.8rem; font-weight: 700; color: var(--muted); letter-spacing: 0.03em; }
.card-head h3 { margin: 6px 0 0; font-size: 1.15rem; }
.card-head .path { font: 0.8rem ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); }
.card-head .what p { margin: 8px 0 4px; }
.card-head .item { font-size: 0.85rem; color: var(--muted); }
.card-head .item span { font-weight: 600; margin-right: 6px; }
.card-head .links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.88rem; margin-top: 6px; }
.card-body { padding: 4px 20px 18px; }
.muted { color: var(--muted); }

/* rendered snippets */
.hunk-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 16px 0 6px; font-size: 0.82rem; }
.hunk-head .crumb { color: var(--muted); font-weight: 600; }
.hunk-head .live { white-space: nowrap; }
.hunk, .page-new, .page-del { border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px; }
.page-new { border-left: 4px solid var(--ins-edge); }
.page-del { border-left: 4px solid var(--del-edge); opacity: 0.85; }
.blk { padding: 2px 0 2px 12px; margin: 6px 0; border-left: 3px solid transparent; }
.blk.ctx { border-left-color: var(--line); color: var(--muted); }
.blk.ctx :is(h1, h2, h3, h4) { color: var(--muted); }
.blk.ins { border-left-color: var(--ins-edge); background: var(--ins-bg); color: var(--ins-text); }
.blk.del { border-left-color: var(--del-edge); background: var(--del-bg); color: var(--del-text); text-decoration: line-through; text-decoration-thickness: 1px; }
.blk.mod { border-left-color: var(--mod-edge); }
ins { background: var(--ins-bg); color: var(--ins-text); text-decoration: none; border-radius: 3px; padding: 0 1px; }
del { background: var(--del-bg); color: var(--del-text); text-decoration: line-through; border-radius: 3px; padding: 0 1px; }
.hunk :is(h1, h2, h3, h4, h5), .page-new :is(h1, h2, h3, h4, h5) { line-height: 1.3; margin: 10px 0 6px; }
.hunk h1, .page-new h1 { font-size: 1.4rem; }
.hunk h2, .page-new h2 { font-size: 1.2rem; }
.hunk h3, .page-new h3, .hunk h4, .page-new h4 { font-size: 1.05rem; }
.hunk table, .page-new table, .page-del table { border-collapse: collapse; font-size: 0.88rem; display: block; overflow-x: auto; max-width: 100%; }
.hunk th, .hunk td, .page-new th, .page-new td, .page-del th, .page-del td { border: 1px solid var(--line); padding: 5px 8px; vertical-align: top; text-align: left; }
.hunk img, .page-new img { max-width: 100%; height: auto; }
.hunk pre, .page-new pre { background: var(--code-bg); padding: 10px; border-radius: 6px; overflow-x: auto; font-size: 0.85rem; }
details { border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; margin: 6px 0; }
details > summary { cursor: pointer; font-weight: 600; }
.gb-hint { background: var(--hint); border-left: 4px solid var(--brand-2); padding: 4px 14px; border-radius: 6px; margin: 8px 0; }
.gb-hint-warning { border-left-color: var(--warn-edge); background: var(--warn-bg); }
.gb-hint-danger { border-left-color: var(--del-edge); }
.gb-hint-success { border-left-color: var(--ins-edge); }
.gb-tab { border: 1px dashed var(--line); border-radius: 6px; padding: 4px 12px; margin: 8px 0; }
.gb-tab-title { font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
a.dead { color: inherit; text-decoration: underline dotted; cursor: help; }

/* source diff */
.srcwrap { margin-top: 14px; border: 0; padding: 0; }
.srcwrap > summary { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
table.src { width: 100%; border-collapse: collapse; font: 0.8rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; table-layout: fixed; }
table.src td { padding: 1px 8px; vertical-align: top; }
table.src col.ln { width: 4.4em; }
table.src td.ln { white-space: nowrap; color: var(--ctx); text-align: right; user-select: none; padding-right: 6px; }
table.src td.code { white-space: pre-wrap; word-break: break-all; }
table.src tr.hunk td { background: var(--code-bg); color: var(--muted); font-family: system-ui, sans-serif; font-size: 0.8rem; font-weight: 600; padding: 4px 8px; }
table.src tr.ins td.code { background: color-mix(in srgb, var(--ins-bg) 55%, transparent); }
table.src tr.del td.code { background: color-mix(in srgb, var(--del-bg) 55%, transparent); }
table.src tr.ctx td.code { color: var(--muted); }

/* release page */
ul.files { padding-left: 20px; }
ul.files li { margin: 4px 0; }

@media (max-width: 640px) {
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }
  .hunk, .page-new, .page-del { padding: 2px 10px; }
  table.src col.ln { width: 3.4em; }
  table.src td.ln { font-size: 0.7rem; padding-right: 3px; }
}

/* history */
details.history { margin-top: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 14px; }
details.history > summary { font-weight: 600; color: var(--muted); }
details.history .table-wrap { margin-top: 12px; border: 0; }

/* change types */
.k-hotfix { background: var(--del-bg); color: var(--del-text); border-color: var(--del-edge); }
.k-change { background: var(--code-bg); color: var(--brand); border-color: var(--line); }
.route { border-radius: 8px; padding: 8px 12px; margin: 10px 0 0; font-size: 0.92rem; max-width: 780px; background: var(--surface); border: 1px solid var(--line); }
.route-hotfix { border-left: 4px solid var(--del-edge); }
.route-change { border-left: 4px solid var(--brand); }
.kinds { display: grid; gap: 8px; margin-top: 12px; }
.meta .chip + .chip { margin-left: 0; }
.overview th { white-space: nowrap; }
