/* The 13fragments document language (13fweb docs/style-guide.md, Part 1 and Part 2): a ruled header, numbered
   sections, and the Ledger palette. One type family in three roles: IBM Plex Serif for reading, IBM Plex Sans for
   structure, IBM Plex Mono for labels, numbers, and code.
   The rules come from 13fweb dist/assets/site.css. This site adds its frame (header and footer partials outside
   <main>), buttons, and status lines. .status here is a live status line, not the claim box of site.css. */

/* ------------------------------------------------------------------ tokens */
:root {
  /* Ledger palette. */
  --paper: #f3f4ef;            /* page background */
  --surface: #fdfdfb;          /* cards, figures, tables, header */
  --surface-alt: #e9ebe3;      /* table heads, code, quotes */
  --rule: #dde0d6;             /* hairlines inside components */
  --frame: #cdd1c5;            /* outer lines of the header, cards, and footer */
  --ink: #141815;              /* text */
  --ink-soft: #39403a;         /* deks, secondary text */
  --muted: #5b635c;            /* captions, labels, footers */
  --faint: #8a918a;            /* inactive numbers, separators */
  --accent: #25604c;           /* bookcloth green: section numbers, rules, active states */
  --accent-text: #1d4d3d;      /* the accent on text */
  --accent-tint: #e4ede7;      /* claim boxes, chips */
  --accent-line: rgba(29, 77, 61, .3);
  --accent-line-soft: rgba(29, 77, 61, .15);
  --mark: #f1ecb8;             /* highlighter for one marked phrase */
  --link: #1d4d3d;
  --link-hover: #25604c;
  --link-line: rgba(37, 96, 76, .38);
  --chip-line: #c2d6cb;

  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --measure: 660px;            /* reading width */
  --wide: 940px;               /* figures, tables, and code in articles */
  --rail: 200px;               /* contents rail in articles */
  --gutter: 40px;
  --page: 680px;               /* the frame: header, main, and footer */
  --control: 44px;
  color-scheme: light;
}

/* An article widens the frame to a contents rail, a reading column, and wide figures. The account pages widen it
   for their tables. */
body:has(main > .post) { --page: calc(var(--rail) + var(--gutter) + var(--wide)); }
body:has(main.wide) { --page: var(--wide); }

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; color: var(--ink); background: var(--paper);
  font-family: var(--serif); font-size: 18px; line-height: 1.7; -webkit-font-smoothing: antialiased; font-kerning: normal; }
p { margin: 0; text-wrap: pretty; }
strong { font-weight: 600; }
code { font-family: var(--mono); font-size: .8em; background: var(--surface-alt); color: var(--ink-soft); padding: 1px 5px;
  border-radius: 4px; overflow-wrap: anywhere; }
pre, kbd { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
[id] { scroll-margin-top: 24px; }
[hidden] { display: none !important; }
::selection { background: var(--mark); color: var(--ink); }

/* ------------------------------------------------------------------ links and focus */
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--link-line);
  text-underline-offset: 3px; }
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a:focus-visible { border-radius: 2px; }
a.primary { font-family: var(--sans); font-weight: 600; text-decoration-thickness: 2px; text-decoration-color: var(--accent); }
.links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--sans); font-size: 15px; font-weight: 500; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 10; padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--frame); font-family: var(--sans); font-weight: 600; }
.skip-link:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ page frame */
.wrap { width: min(calc(100% - 40px), var(--page)); margin-inline: auto; }
main { flex: 1 0 auto; margin-top: 40px; display: flex; flex-direction: column; gap: 40px; }

.env-banner { margin: 0; padding: 8px 20px; background: var(--accent-text); color: var(--surface); font-family: var(--sans);
  font-size: 14px; line-height: 1.5; text-align: center; }

.doc-header { margin-top: 40px; border: 1px solid var(--frame); background: var(--surface); display: flex; }
.doc-header > :is(div, nav) { flex: 1 1 0; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
  font-family: var(--sans); font-size: 14px; line-height: 1.45; }
.doc-header > :is(div, nav) + :is(div, nav) { border-left: 1px solid var(--frame); }
.doc-header > nav { flex-grow: 1.4; }
.doc-header strong { font-weight: 600; }
.doc-header a { color: var(--ink); }
.doc-header [aria-current="page"] { font-weight: 600; }
/* The language switch, last in the header: the page's language in bold, the other one as a link. */
.doc-header > .lang-switch { flex: 0 0 auto; }
.doc-header .lang-switch [aria-current="true"] { font-weight: 600; color: var(--ink); }
.doc-header .links { font-size: 14px; gap: 2px 14px; }
.doc-mark { flex: 0 0 58px; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--frame);
  color: var(--ink); text-decoration: none; }
.doc-mark svg { display: block; width: 26px; height: 26px; fill: currentColor; }
.doc-mark:focus-visible { outline-offset: -4px; }

.site-foot { margin-top: 48px; margin-bottom: calc(24px + env(safe-area-inset-bottom)); display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid var(--frame);
  font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); }
.site-foot a { color: inherit; }
.site-foot > :last-child { justify-self: end; }
.site-foot > * { white-space: nowrap; }
.site-foot > :first-child { white-space: normal; }
.site-foot a { white-space: nowrap; }

/* ------------------------------------------------------------------ text roles */
.label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.kicker { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.soft { color: var(--ink-soft); }
.muted { color: var(--muted); }
.note { font-family: var(--sans); font-size: 14px; line-height: 1.6; color: var(--muted); }
mark { background: linear-gradient(transparent 12%, var(--mark) 12%, var(--mark) 92%, transparent 92%); color: inherit; padding: 0 2px; }
.todo { background: #fff3c4; padding: 0 3px; }

/* A claim box marks the one statement or summary a reader must not miss. At most one or two on a page. */
.claim { background: var(--accent-tint); border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0;
  padding: 14px 18px; color: var(--ink-soft); font-size: 16px; line-height: 1.6; }

/* An error: the claim shape in ink, with a "!" mark. */
.note.error { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--frame); border-left: 3px solid var(--ink); border-radius: 0 12px 12px 0;
  font-size: 15px; color: var(--ink); }
.note.error::before, .status.error::before { content: "!"; display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--ink); color: var(--surface); font-family: var(--sans); font-size: 12px;
  font-weight: 600; line-height: 1; }
.note.error::before { margin-top: 3px; }

/* A live status line under a form or a button. */
.status { min-height: 1.5em; font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.status.error { color: var(--ink); font-weight: 600; }
.status.error::before { margin-right: 8px; vertical-align: 1px; }

/* ------------------------------------------------------------------ headings and numbering */
h1, h2 { margin: 0; font-family: var(--sans); font-weight: 600; font-size: 26px; line-height: 1.25; letter-spacing: -.012em;
  text-wrap: balance; }
h3 { margin: 0; font-family: var(--sans); font-weight: 600; font-size: 19px; line-height: 1.35; }
.num { font-family: var(--mono); font-weight: 500; font-size: .8em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
:is(h1, h2) > .num { font-size: 13px; letter-spacing: .04em; vertical-align: .3em; margin-right: .15em; }
.section { display: flex; flex-direction: column; gap: 14px; }
/* A title block: an optional kicker, the title in serif, and the dek. */
.title { display: flex; flex-direction: column; gap: 18px; }
.title h1 { font-family: var(--serif); font-weight: 600; font-size: 50px; line-height: 1.08; letter-spacing: -.02em; }
.title .dek { font-size: 21px; line-height: 1.55; color: var(--ink-soft); }
.refs { display: grid; grid-template-columns: max-content 1fr; column-gap: 20px; row-gap: 8px; }
.refs > :nth-child(odd) { font-family: var(--mono); font-size: 13px; color: var(--accent-text); padding-top: 3px; }
.refs > :nth-child(even) { min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ buttons */
/* Sans, as the style guide sets for buttons. The main action is filled with the accent; the others are framed. */
.btn { min-height: var(--control); padding: 0 18px; border: 1px solid transparent; border-radius: 8px; font-family: var(--sans);
  font-size: 15px; font-weight: 600; line-height: 1.2; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-main { background: var(--accent); color: var(--surface); }
.btn-main:hover { background: var(--accent-text); color: var(--surface); }
.btn-line { background: var(--surface); color: var(--ink); border-color: var(--frame); }
.btn-line:hover { color: var(--ink); border-color: var(--accent); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 14px; font-weight: 500; }
/* A destructive action: an ink frame and a cross mark; the confirmed form is filled with ink. */
.btn-danger { background: var(--surface); color: var(--ink); border: 2px solid var(--ink); }
.btn-danger::before { content: "\00d7"; font-weight: 600; }
.btn-danger.solid { background: var(--ink); color: var(--surface); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-alt); color: var(--muted); border-color: var(--rule);
  cursor: not-allowed; }
/* "Copied": a check mark and the tint, for two seconds. */
.btn[data-state="copied"] { background: var(--accent-tint); color: var(--ink); border-color: var(--accent); }
.btn[data-state="copied"]::before { content: ""; width: 10px; height: 5px; border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(-45deg); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.data th { text-align: left; vertical-align: bottom; font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); background: var(--surface-alt); padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.data td { vertical-align: top; padding: 9px 12px; border-top: 1px solid var(--rule); }
.data tbody tr:first-child td { border-top: 0; }
.data .r { text-align: right; }
.data td.r { white-space: nowrap; }
.data a { overflow-wrap: anywhere; }
.data tr:last-child td { font-weight: 600; }
.data.slices tr:last-child td { font-weight: 400; }
.data tbody tr:hover td { background: #f6f7f2; }

/* ------------------------------------------------------------------ figures and chips */
figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
figcaption { font-family: var(--sans); font-size: 14px; line-height: 1.6; color: var(--muted); max-width: var(--measure); }
.figlabel { color: var(--ink); font-weight: 600; }
.plate-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-family: var(--sans); font-size: 12px;
  font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.chip { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: none; color: var(--accent-text);
  background: var(--accent-tint); border: 1px solid var(--chip-line); border-radius: 4px; padding: 1px 7px; white-space: nowrap; }
/* Folded details: a sans summary with a +/- mark; the content keeps the text style of the page. */
details > summary { list-style: none; display: flex; gap: 10px; align-items: baseline; cursor: pointer; font-family: var(--sans);
  font-size: 15px; font-weight: 600; line-height: 1.45; color: var(--ink); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+"; flex: 0 0 1ch; font-family: var(--mono); font-weight: 500; color: var(--accent-text); }
details[open] > summary::before { content: "\2212"; }
details > summary:hover { color: var(--accent-text); }
details > :not(summary) { margin-top: 12px; }

/* ------------------------------------------------------------------ phones */
@media (max-width: 640px) {
  body { font-size: 17px; }
  main { margin-top: 24px; gap: 32px; }
  .doc-header { margin-top: 24px; flex-wrap: wrap; }
  .doc-header > :is(div, nav) { padding: 10px 10px; font-size: 13px; }
  .doc-header > nav { flex-basis: 100%; border-left: 0; border-top: 1px solid var(--frame); }
  .doc-header > .lang-switch { flex-basis: 100%; flex-direction: row; align-items: baseline; gap: 12px; }
  .doc-mark { flex-basis: 100%; justify-content: flex-start; padding: 10px; border-right: 0; border-bottom: 1px solid var(--frame); }
  .doc-mark svg { width: 22px; height: 22px; }
  h1, h2 { font-size: 22px; }
  .title h1 { font-size: 34px; }
  .title .dek { font-size: 18px; }
  .site-foot { grid-template-columns: 1fr auto; row-gap: 4px; }
  .site-foot > :first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
