/* rfc.dk - one stylesheet, no build step.
   Light colours on :root; the dark set applies when the system prefers dark and the visitor
   has not chosen light, or when the visitor chose dark (data-theme, set by theme.js). Kept as
   plain values rather than light-dark(): some browsers do not recompute light-dark() inside
   inherited custom properties when color-scheme changes at runtime. */
:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --bg-raised: #fffffe;
  --bg-sunken: #edebe4;
  --text: #1c2129;
  --text-muted: #5e6672;
  --text-faint: #8a919c;
  --line: #ddd9cf;
  --line-strong: #c4bfb2;
  --link: #124d8f;
  --link-hover: #0b3a6e;
  --brand: #1b2a41;
  --on-brand: #ffffff;
  --accent: #d7263d;
  --mark: #fff0a8;
  --doc-bg: #fffffe;
  --st-standard: #1f7a3a;
  --st-standard-bg: #e3f4e7;
  --st-proposed: #1d5fa8;
  --st-proposed-bg: #e4eefb;
  --st-bcp: #0f766e;
  --st-bcp-bg: #dff5f2;
  --st-info: #4b5563;
  --st-info-bg: #ebedf0;
  --st-exp: #6d4fb8;
  --st-exp-bg: #eee9fb;
  --st-hist: #8a5a2b;
  --st-hist-bg: #f5ebe0;
  --st-unknown: #6b7280;
  --st-unknown-bg: transparent;
  --warn: #9a5b00;
  --warn-bg: #fff4dc;
  --obs: #a3242f;
  --obs-bg: #fdecec;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --wrap: 68rem;
  --radius: 6px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171c;
    --bg-raised: #1c2027;
    --bg-sunken: #0f1115;
    --text: #e6e4de;
    --text-muted: #a2a8b3;
    --text-faint: #6f7682;
    --line: #2b3039;
    --line-strong: #3d434e;
    --link: #7fb2ee;
    --link-hover: #a9cbf5;
    --brand: #e6e4de;
    --on-brand: #14171c;
    --accent: #f0455b;
    --mark: #5a4a00;
    --doc-bg: #181b21;
    --st-standard: #7dd39a;
    --st-standard-bg: #16301f;
    --st-proposed: #8cb8f0;
    --st-proposed-bg: #17263b;
    --st-bcp: #6fd1c6;
    --st-bcp-bg: #0f2c29;
    --st-info: #b8bec8;
    --st-info-bg: #262b33;
    --st-exp: #bfaaf2;
    --st-exp-bg: #27203d;
    --st-hist: #e0b184;
    --st-hist-bg: #33271b;
    --st-unknown: #8b919c;
    --warn: #f3c66b;
    --warn-bg: #33270f;
    --obs: #f19aa2;
    --obs-bg: #3a1c1f;
  }
}
:root[data-theme="dark"] {
  --bg: #14171c;
  --bg-raised: #1c2027;
  --bg-sunken: #0f1115;
  --text: #e6e4de;
  --text-muted: #a2a8b3;
  --text-faint: #6f7682;
  --line: #2b3039;
  --line-strong: #3d434e;
  --link: #7fb2ee;
  --link-hover: #a9cbf5;
  --brand: #e6e4de;
  --on-brand: #14171c;
  --accent: #f0455b;
  --mark: #5a4a00;
  --doc-bg: #181b21;
  --st-standard: #7dd39a;
  --st-standard-bg: #16301f;
  --st-proposed: #8cb8f0;
  --st-proposed-bg: #17263b;
  --st-bcp: #6fd1c6;
  --st-bcp-bg: #0f2c29;
  --st-info: #b8bec8;
  --st-info-bg: #262b33;
  --st-exp: #bfaaf2;
  --st-exp-bg: #27203d;
  --st-hist: #e0b184;
  --st-hist-bg: #33271b;
  --st-unknown: #8b919c;
  --warn: #f3c66b;
  --warn-bg: #33270f;
  --obs: #f19aa2;
  --obs-bg: #3a1c1f;
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/space-grotesk-700-latin.woff2") format("woff2");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; width: 100%; padding-block: 1.5rem 3rem; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 1.25rem; }
a { color: var(--link); text-decoration: none; text-underline-offset: .15em; }
a:hover { color: var(--link-hover); text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; margin-top: 2rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--bg-sunken); padding: .1em .35em; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.sep { color: var(--text-faint); margin-inline: .15em; }
.dim { color: var(--text-muted); font-weight: 400; }
.count { color: var(--text-faint); font-variant-numeric: tabular-nums; font-size: .85em; }
.meta, .small { color: var(--text-muted); font-size: .875rem; }
.lede { color: var(--text-muted); font-size: 1.05rem; max-width: 60ch; margin: 0 0 1rem; }

/* header */
header.site { background: var(--bg-raised); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 1.25rem; min-height: 3.5rem; flex-wrap: wrap; padding-block: .5rem; }
.brand { font-family: "Space Grotesk", var(--sans); font-weight: 700; font-size: 1.45rem; color: var(--brand); letter-spacing: -.035em; line-height: 1; }
.brand:hover { text-decoration: none; color: var(--link); }

/* theme switch: auto → light → dark; the icon shown depends on data-theme, so CSS alone keeps it in sync */
.theme { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); color: var(--text-muted); cursor: pointer; padding: 0; }
.theme:hover { color: var(--text); border-color: var(--text-faint); }
.theme[hidden] { display: none; }
.theme svg { display: none; width: 18px; height: 18px; }
:root:not([data-theme]) .theme .ico-auto, :root[data-theme="light"] .theme .ico-light, :root[data-theme="dark"] .theme .ico-dark { display: block; }
.nav { display: flex; gap: .25rem; }
.nav a { color: var(--text-muted); padding: .35rem .6rem; border-radius: var(--radius); font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }

/* search forms */
.q { display: flex; margin-left: auto; min-width: 0; }
.q input {
  flex: 1; min-width: 0; width: 18rem; max-width: 100%;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--radius) 0 0 var(--radius);
  padding: .4rem .7rem;
}
.q input::placeholder { color: var(--text-faint); }
.q input:focus { outline: 2px solid var(--link); outline-offset: -1px; position: relative; z-index: 1; }
.q button {
  font: inherit; font-weight: 600; cursor: pointer;
  color: var(--on-brand); background: var(--brand); border: 1px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0; padding: .4rem .8rem; display: inline-flex; align-items: center;
}
.q button:hover { filter: brightness(1.15); }
.q.big { margin: 1.25rem 0 .75rem; max-width: 42rem; }
.q.big input { width: 100%; padding: .7rem 1rem; font-size: 1.05rem; background: var(--bg-raised); }
.q.big button { padding: .7rem 1.2rem; }
.hint { color: var(--text-muted); font-size: .9rem; margin: 0; }

/* home */
.hero { padding-block: 2rem 1rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -.025em; margin-bottom: .75rem; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 3rem; margin-top: 1.5rem; }
.cols aside h2:first-child { margin-top: 2rem; }
.more { margin: .75rem 0 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .2rem 0; }

/* RFC tables */
table.rfcs { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.rfcs th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; padding: .4rem .5rem; border-bottom: 1px solid var(--line-strong); }
.rfcs td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.rfcs td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; width: 4.5rem; padding-left: 0; }
.rfcs td.num a { color: var(--text); font-weight: 600; }
.rfcs td.title a { color: var(--text); font-weight: 500; }
.rfcs td.title a:hover, .rfcs td.num a:hover { color: var(--link); }
.rfcs .meta { display: block; margin-top: .1rem; }
.rfcs td.st { white-space: nowrap; text-align: right; padding-right: 0; }
.rfcs td.date { white-space: nowrap; color: var(--text-muted); font-size: .875rem; text-align: right; padding-right: 0; }
.rfcs.wide td.st { text-align: left; padding-right: .5rem; }
.rfcs tr.obs td.title a { color: var(--text-muted); }

/* badges */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  padding: .12rem .45rem; border-radius: 999px; line-height: 1.5; white-space: nowrap;
  color: var(--st-unknown); background: var(--st-unknown-bg); border: 1px solid transparent;
}
.badge.st-unknown { border-color: var(--line-strong); }
.badge.st-internet-standard, .badge.st-draft-standard { color: var(--st-standard); background: var(--st-standard-bg); }
.badge.st-proposed-standard { color: var(--st-proposed); background: var(--st-proposed-bg); }
.badge.st-best-current-practice { color: var(--st-bcp); background: var(--st-bcp-bg); }
.badge.st-informational { color: var(--st-info); background: var(--st-info-bg); }
.badge.st-experimental { color: var(--st-exp); background: var(--st-exp-bg); }
.badge.st-historic { color: var(--st-hist); background: var(--st-hist-bg); }
.badge.muted { color: var(--text-muted); background: var(--bg-sunken); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .78rem; }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
a.badge:hover { text-decoration: none; filter: brightness(.92); }

/* page heads, pagers */
.page-head { margin-bottom: 1rem; }
.crumbs { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; color: var(--text-muted); }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--link); }
.pager { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* RFC page */
.rfc-head { max-width: 76ch; }
.rfc-head .crumbs { margin-bottom: 1.25rem; }
.kicker { font-family: var(--mono); color: var(--text-muted); font-size: .95rem; margin: 0 0 .25rem; }
.kicker a { color: var(--text-muted); }
.rfc-head h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin-bottom: .5rem; }
.byline { margin: 0 0 .6rem; color: var(--text-muted); }
.byline .authors { color: var(--text); }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1rem; }
.notice { background: var(--warn-bg); color: var(--text); border-left: 3px solid var(--warn); padding: .65rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 1rem; }
.notice.obsolete { background: var(--obs-bg); border-color: var(--obs); }
.notice.obsolete strong { color: var(--obs); }
.notice em { font-style: normal; color: var(--text-muted); }
.relations { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0 0 1rem; font-size: .95rem; }
.relations dt { color: var(--text-muted); }
.relations dd { margin: 0; }
.abstract { margin: 1.25rem 0; }
.abstract h2 { margin: 0 0 .25rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.abstract p { margin: 0 0 .6rem; max-width: 70ch; }
.formats { font-size: .9rem; color: var(--text-muted); margin: 0 0 1.5rem; }
.formats .draft { font-family: var(--mono); font-size: .85em; }

.doc-wrap { width: fit-content; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--doc-bg); overflow-x: auto; }
pre.doc {
  margin: 0; padding: 1.5rem 2rem;
  font: 14px/1.42 var(--mono); tab-size: 8;
  color: var(--text); white-space: pre; min-width: max-content;
}
pre.doc a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); }
pre.doc a:hover { text-decoration-color: currentColor; }
pre.doc .pb { display: block; height: 0; border-top: 1px dashed var(--line-strong); margin: .5em -2rem; }
.rfc-foot { margin-top: 1.25rem; }

/* browse */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips a { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .5rem .3rem .3rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-raised); }
.chips a:hover { text-decoration: none; border-color: var(--line-strong); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.grid a { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); color: var(--text); font-variant-numeric: tabular-nums; }
.grid a:hover { text-decoration: none; border-color: var(--link); color: var(--link); }
.grid.years { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
.grid.numbers { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); font-family: var(--mono); font-size: .9rem; }
.grid.numbers a { justify-content: center; }

/* series */
.series-entry { padding: 1rem 0; border-top: 1px solid var(--line); }
.series-entry h2 { margin: 0 0 .35rem; font-size: 1.05rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: baseline; }
.series-entry h2 .anchor { font-family: var(--mono); color: var(--text); }
.series-entry h2 .anchor:hover { color: var(--link); text-decoration: none; }
.series-title { font-weight: 500; color: var(--text-muted); }
.series-entry ul li { padding: .15rem 0; }
.series-entry .mono { color: var(--text); font-weight: 600; }
.series-entry:target { background: var(--mark); margin-inline: -1rem; padding-inline: 1rem; border-radius: var(--radius); }

/* search */
.hits { list-style: none; margin: 1rem 0 0; padding: 0; counter-reset: hit; }
.hits li { padding: .9rem 0; border-top: 1px solid var(--line); max-width: 76ch; }
.hit-title { font-weight: 600; font-size: 1.05rem; color: var(--text); }
.hit-title .mono { color: var(--text-muted); font-weight: 600; margin-right: .3rem; }
.hit-title:hover { color: var(--link); }
.hits .meta { margin: .25rem 0; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.hits li.obs .hit-title { color: var(--text-muted); }
.snippet { margin: .25rem 0 0; font-family: var(--mono); font-size: .84rem; color: var(--text-muted); line-height: 1.5; }
.snippet mark { background: var(--mark); color: var(--text); border-radius: 2px; padding: 0 .1em; }

/* prose */
.prose { max-width: 70ch; }
.prose p, .prose li { line-height: 1.65; }
.prose h2 { margin-top: 1.75rem; }

/* footer */
footer.site { border-top: 1px solid var(--line); color: var(--text-muted); font-size: .85rem; padding-block: 1.25rem; }
footer.site p { margin: .25rem 0; }
footer.site a { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--line-strong); }
footer.site a:hover { color: var(--link); }

@media (max-width: 720px) {
  .bar { gap: .5rem .75rem; }
  .nav { order: 3; width: 100%; margin: 0 -.6rem; }
  .q { margin-left: auto; }
  .q input { width: 11rem; }
  .cols { grid-template-columns: 1fr; gap: 1rem; }
  .rfcs td.st, .rfcs th.st, .rfcs td.date, .rfcs th.date { display: none; }
  .rfcs td.num { width: 3.5rem; }
  pre.doc { padding: 1rem; font-size: 13px; }
  pre.doc .pb { margin-inline: -1rem; }
  .relations { grid-template-columns: 1fr; gap: 0; }
  .relations dt { margin-top: .3rem; }
}
@media print {
  header.site, footer.site, .crumbs, .formats, .q { display: none; }
  .doc-wrap { border: 0; }
  pre.doc { white-space: pre-wrap; min-width: 0; }
}
