/* ============================================================
   L10N.md - specification document
   Monochrome, ink on paper. No accent color.
   ============================================================ */

:root {
  --paper: #ffffff;
  --ink: #17181b;
  --ink-soft: #6a6c72;
  --ink-faint: #9a9ca2;
  --rule: #e2e2e4;
  --rule-strong: #c9c9cc;
  --code-bg: #f6f6f7;
  --measure: 42rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.72;
  font-feature-settings: "onum" 1;
  -webkit-font-smoothing: antialiased;
}

p {
  margin: 0 0 1.15rem;
  hyphens: auto;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-color: var(--ink);
}

code,
pre,
.mono {
  font-family: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
}

:not(pre) > code {
  font-size: 0.84em;
  padding: 0.1em 0.32em;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  word-break: break-word;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.55rem 1rem;
  z-index: 20;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Running head ---------- */

.runninghead {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: min(calc(100% - 3rem), var(--measure));
  margin: 0 auto;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.rh-name {
  color: var(--ink);
  font-weight: 500;
}

.rh-sep {
  color: var(--ink-faint);
}

.rh-locales {
  margin-left: auto;
  display: flex;
  gap: 0.6rem;
}

.rh-locale {
  color: var(--ink-soft);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.rh-locale:hover {
  color: var(--ink);
}

.rh-locale-current {
  color: var(--ink);
  font-weight: 500;
}

.rh-source {
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
}

.rh-locales + .rh-source {
  margin-left: 1.1rem;
  padding-left: 1.1rem;
  border-left: 1px solid var(--rule);
}

/* ---------- Document column ---------- */

.doc {
  width: min(calc(100% - 3rem), var(--measure));
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

/* ---------- Specification head ---------- */

.spec-head {
  margin-bottom: 3.25rem;
}

.spec-eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

.spec-title {
  font-size: clamp(2.6rem, 7vw, 3.9rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.04;
  margin: 0;
}

.spec-subtitle {
  margin: 0.85rem 0 2.1rem;
  font-size: 1.22rem;
  font-style: italic;
  color: var(--ink-soft);
}

.spec-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
}

.spec-meta > div {
  display: flex;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.spec-meta dt {
  flex: 0 0 5.5rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 0.18em;
}

.spec-meta dd {
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92rem;
  color: var(--ink);
}

/* ---------- Labelled blocks ---------- */

.label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}

.abstract,
.status-note {
  margin: 2.4rem 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--rule-strong);
}

.abstract p,
.status-note p {
  margin: 0;
}

.status-note {
  font-size: 0.96rem;
  color: var(--ink-soft);
}

/* ---------- Table of contents ---------- */

.toc {
  margin: 2.8rem 0 0;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc > ol > li {
  padding: 0.32rem 0;
}

.toc ol ol {
  margin: 0.2rem 0 0.4rem 1.6rem;
}

.toc ol ol li {
  padding: 0.18rem 0;
}

.toc a {
  text-decoration: none;
  color: var(--ink);
}

.toc a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.toc-n {
  display: inline-block;
  min-width: 2.4rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.toc ol ol .toc-n {
  min-width: 2.8rem;
}

.rule {
  border: 0;
  border-top: 1px solid var(--rule-strong);
  margin: 3rem 0;
}

/* ---------- Sections ---------- */

.sec {
  margin: 3.5rem 0 0;
}

.subsec {
  margin: 2.75rem 0 0;
}

.sec h2,
.sec h3,
.subsec h3 {
  position: relative;
  margin: 0 0 1.1rem;
  padding-left: 3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sec h2 {
  font-size: 1.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
}

.sec h3,
.subsec h3 {
  font-size: 1.28rem;
  margin-top: 2.75rem;
  padding-left: 0;
}

.num {
  position: absolute;
  left: 0;
  top: 0.08em;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82em;
  font-weight: 500;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.sec p,
.subsec p {
  max-width: 38rem;
}

/* ---------- Listings ---------- */

.listing {
  margin: 1.5rem 0 1.9rem;
}

.listing figcaption {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

.listing figcaption code {
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
}

.listing pre {
  margin: 0;
  max-height: 32rem;
  overflow: auto;
  padding: 1.05rem 1.2rem;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

.listing pre code {
  font-size: inherit;
}

/* ---------- Colophon ---------- */

.colophon {
  width: min(calc(100% - 3rem), var(--measure));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.colophon p {
  margin: 0 0 0.4rem;
}

.colophon a {
  color: var(--ink-soft);
}

/* ---------- RFC 2119 keywords ---------- */

.kw {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78em;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ---------- Terminology and references ---------- */

.terms,
.refs {
  margin: 1.4rem 0 0;
}

.terms dt {
  font-weight: 600;
  margin-top: 1rem;
}

.terms dt:first-child {
  margin-top: 0;
}

.terms dd {
  margin: 0.15rem 0 0;
  color: var(--ink-soft);
  max-width: 38rem;
}

.refs {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1.1rem;
  row-gap: 0.7rem;
  max-width: 38rem;
}

.refs dt {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--ink-soft);
  white-space: nowrap;
  padding-top: 0.12em;
}

.refs dd {
  margin: 0;
}

.refs dd a {
  word-break: break-word;
}

/* ---------- Field tables ---------- */

.table-wrap {
  margin: 1.4rem 0 0;
  overflow-x: auto;
}

.fieldtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.fieldtable th,
.fieldtable td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.9rem 0.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.fieldtable th:not(:last-child),
.fieldtable td:not(:last-child) {
  padding-right: 1.4rem;
}

.fieldtable thead th {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-strong);
}

.fieldtable tbody tr:last-child td {
  border-bottom: 0;
}

.fieldtable td:first-child code {
  white-space: nowrap;
}

.fieldtable td:last-child {
  overflow-wrap: anywhere;
}

.fieldtable code {
  font-size: 0.84em;
}

.schema-source {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 1.1rem 0 0;
}

.schema-source a {
  color: var(--ink-soft);
}

/* ---------- Informative notices ---------- */

.note {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.1rem;
}

/* ---------- Dark (system preference, still monochrome) ---------- */

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121316;
    --ink: #e9e9ec;
    --ink-soft: #9a9ca3;
    --ink-faint: #6c6e75;
    --rule: #2b2c30;
    --rule-strong: #3c3d43;
    --code-bg: #1a1b1f;
  }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  .doc {
    padding: 2.5rem 0 3rem;
  }

  .spec-meta {
    grid-template-columns: 1fr;
  }

  .sec h2,
  .subsec h3 {
    padding-left: 2.4rem;
  }

  .subsec h3 {
    padding-left: 2.6rem;
  }
}

/* ---------- Print ---------- */

@media print {
  :root {
    --paper: #fff;
    --ink: #000;
    --code-bg: #fff;
  }

  .runninghead,
  .skip-link {
    display: none;
  }

  .listing pre {
    max-height: none;
    overflow: visible;
  }

  a {
    text-decoration: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
