/* ─────────────────────────────────────────────────────────────
   Documentation pages.

   Same paper-and-ink vocabulary as the app (tokens.css), but a separate sheet:
   app.css is ~35KB of rail, tables, drawers and modals, none of which exists
   here. These pages are prose on a slow connection.

   NO WEBFONT IS LOADED. tokens.css names Archivo first, then system fallbacks —
   and Archivo carries no Sinhala or Tamil glyphs anyway, so two of three
   languages were always going to fall back. Dropping the Google Fonts link costs
   English a little polish and buys si/ta an immediate first paint on a 3G phone.
   ───────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Sinhala and Tamil stack marks above and below the baseline, so Latin-tuned
   leading crowds them. Same rule as the app — and it matters far more here,
   where the whole page is prose. */
html:lang(si) body,
html:lang(ta) body {
  line-height: 1.85;
}

/* ── Header ────────────────────────────────────────────────── */

.dochead {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.dochead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  max-width: 720px;
  margin-inline: auto;
  padding: var(--s3) var(--s5);
}

.dochead__mark {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.dochead__stamp {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--stamp);
}

.dochead__name {
  font-family: var(--font-data);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dochead__langs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}

/* Finger-sized: this is the first thing touched, often on a cheap phone. */
.dochead__lang {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--s3);
  border-radius: 999px;
  font-size: var(--t-sm);
  color: var(--muted);
  text-decoration: none;
}

.dochead__lang:hover {
  color: var(--ink);
  background: var(--sunk);
}

.dochead__lang.is-current {
  color: var(--ink);
  font-weight: 500;
}

/* ── Prose ─────────────────────────────────────────────────── */

/* ~65 characters. Longer and the eye loses the line on the return sweep — the
   one measurement that matters most on a page that is only prose. */
.doc {
  max-width: 680px;
  margin-inline: auto;
  padding: var(--s7) var(--s5) var(--s8);
}

.doc h1 {
  margin: 0 0 var(--s4);
  font-size: clamp(26px, 1.5rem + 1.2vw, 36px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

html:lang(si) .doc h1,
html:lang(ta) .doc h1 {
  font-size: clamp(22px, 1.3rem + 0.9vw, 30px);
  line-height: 1.45;
  letter-spacing: 0;
  text-wrap: initial;
}

.doc h2 {
  margin: var(--s7) 0 var(--s3);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

html:lang(si) .doc h2,
html:lang(ta) .doc h2 {
  letter-spacing: 0;
}

.doc p {
  margin: 0 0 var(--s4);
}

.doc__lede {
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--muted);
}

html:lang(si) .doc__lede,
html:lang(ta) .doc__lede {
  line-height: 1.75;
}

.doc ul,
.doc ol {
  margin: 0 0 var(--s4);
  padding-left: var(--s5);
}

.doc li {
  margin-bottom: var(--s2);
}

.doc__links {
  list-style: none;
  padding-left: 0;
}

.doc__links li {
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
}

.doc a {
  color: var(--stamp);
  text-underline-offset: 2px;
}

.doc__links a {
  display: block;
  font-size: var(--t-md);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 2px;
}

.doc__links a:hover {
  color: var(--stamp);
}

/* "Not on file is not a clearance" — the same ochre the app uses for every
   caution, because it is the same warning and must not read as reassurance. */
.doc__warn {
  padding: var(--s3) var(--s4);
  background: var(--ochre-wash);
  border-left: 2px solid var(--ochre);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── The way in ────────────────────────────────────────────── */

.doc__cta {
  margin-top: var(--s7);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule);
}

/* `.doc a` (0-1-1) outranks a bare `.doc__btn` (0-1-0) and would paint this
   stamp-on-stamp — an invisible label on a visible button. Qualify it. */
.doc a.doc__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 48px;
  padding: 0 var(--s5);
  background: var(--stamp);
  border-radius: var(--radius);
  color: #fff;
  font-size: var(--t-md);
  font-weight: 500;
  text-decoration: none;
}

.doc a.doc__btn:hover {
  filter: brightness(1.08);
}

/* ── Footer ────────────────────────────────────────────────── */

.docfoot {
  border-top: 1px solid var(--rule);
  background: var(--surface);
}

.docfoot__nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  max-width: 680px;
  margin-inline: auto;
  padding: var(--s5);
  font-size: var(--t-sm);
}

.docfoot__nav a {
  color: var(--muted);
  text-decoration: none;
  min-height: 24px;
}

.docfoot__nav a:hover {
  color: var(--ink);
}

@media (max-width: 800px) {
  .doc {
    padding: var(--s5) var(--s4) var(--s7);
  }

  .dochead__inner,
  .docfoot__nav {
    padding-inline: var(--s4);
  }
}
