/* altdown.org: design option A ("Standard"). */

@font-face { font-family: 'Source Serif 4'; src: url('/assets/fonts/SourceSerif4-Variable.woff2') format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Serif 4'; src: url('/assets/fonts/SourceSerif4-Variable-Italic.woff2') format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/assets/fonts/IBMPlexSans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/assets/fonts/IBMPlexSans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/assets/fonts/IBMPlexSans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/fonts/IBMPlexMono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/fonts/IBMPlexMono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --ink: #1b1b1b;
  --text: #26241f;
  --muted: #5e5a54;
  --accent: #8a1c1c;
  --accent-ink: #5e1212;
  --paper: #ffffff;
  --panel: #f6f4ef;
  --rule: #d9d6cf;
  --rule-light: #e6e2da;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 19px; line-height: 1.7; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.skip-link { position: absolute; left: 12px; top: -48px; padding: 8px 12px; background: var(--ink); color: #fff; font-family: var(--sans); font-size: 14px; z-index: 10; }
.skip-link:focus { top: 12px; color: #fff; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.wrap.narrow { max-width: 840px; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--ink); }
.header-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 24px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 22px; font-weight: 600; }
.brand:hover { color: var(--ink); }
.site-nav { display: flex; flex-wrap: wrap; gap: 6px 26px; font-family: var(--sans); font-size: 14px; letter-spacing: 0.01em; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 10px 0; }
.site-nav a:hover, .site-nav a[aria-current='page'] { color: var(--ink); }
.site-nav a[aria-current='page'] { font-weight: 600; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--ink); margin-top: 96px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; padding-top: 24px; padding-bottom: 40px; font-family: var(--sans); font-size: 14px; color: var(--muted); }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }

/* ---------- prose ---------- */
.prose { color: var(--text); overflow-wrap: break-word; }
.prose h1 { margin: 0; color: var(--ink); font-size: 52px; line-height: 1.06; font-weight: 600; letter-spacing: -0.01em; }
.prose h2 { margin: 56px 0 16px; padding-top: 18px; border-top: 1px solid var(--rule); color: var(--ink); font-size: 30px; line-height: 1.2; font-weight: 600; }
.prose h3 { margin: 36px 0 12px; color: var(--ink); font-size: 22px; line-height: 1.3; font-weight: 600; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0 0 8px; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose :not(pre) > code { font-family: var(--mono); font-size: 0.84em; padding: 1px 5px; background: var(--panel); border: 1px solid var(--rule-light); }
.heading-anchor { margin-left: 10px; color: var(--rule) !important; text-decoration: none !important; font-weight: 400; opacity: 0; }
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor { opacity: 1; }
.rfc { font-variant: small-caps; font-weight: 600; letter-spacing: 0.03em; }

.table-wrap { margin: 0 0 22px; overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
.table-wrap table { width: 100%; min-width: 560px; border-collapse: collapse; font-family: var(--sans); font-size: 14.5px; line-height: 1.5; }
.table-wrap th { padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.table-wrap td { padding: 12px; vertical-align: top; border-top: 1px solid var(--rule); }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 0; }
.table-wrap td:first-child { font-weight: 600; color: var(--ink); }
.table-wrap code { font-size: 13px !important; }

.code-block { margin: 0 0 22px; border: 1px solid var(--rule); background: var(--panel); }
.code-block figcaption { padding: 6px 14px; border-bottom: 1px solid var(--rule); font-family: var(--sans); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.code-block pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.65; background: transparent !important; }

.prose li.task { list-style: none; position: relative; }
.prose ul:has(> li.task) { padding-left: 4px; }
.box { display: inline-block; width: 15px; height: 15px; margin: 0 10px 0 0; vertical-align: -2px; border: 1.5px solid var(--ink); }
.box.done { background: var(--ink); }

/* ---------- home ---------- */
.home { padding-top: 88px; }
.home h1 { font-size: 64px; }
.home h1 + p { margin: 22px 0 0; font-size: 26px; line-height: 1.4; color: var(--ink); max-width: 760px; }
.home h1 + p + p { margin: 18px 0 0; color: #3e3b37; max-width: 720px; }
.home h1 + p + p + p { margin: 34px 0 8px; display: flex; flex-wrap: wrap; gap: 12px; }
.home h1 + p + p + p a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border: 1px solid var(--ink); color: var(--ink); text-decoration: none; font-family: var(--sans); font-size: 15px; font-weight: 500; }
.home h1 + p + p + p a:first-child { background: var(--ink); color: #fff; }
.home h1 + p + p + p a:hover { background: var(--panel); color: var(--ink); }
.home h1 + p + p + p a:first-child:hover { background: #000; color: #fff; }

/* ---------- other pages ---------- */
.doc { padding-top: 72px; }
.doc h1 { font-size: 46px; }
.doc h1 + p { margin-top: 18px; font-size: 21px; color: #3e3b37; }

/* ---------- specification ---------- */
.spec-layout { display: flex; flex-wrap: wrap; gap: 0 56px; }
.toc { flex: 1 1 240px; max-width: 290px; padding-top: 64px; font-family: var(--sans); }
.toc-title { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 1.45; }
.toc li { margin: 0; }
.toc a { display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--rule-light); color: #3e3b37; text-decoration: none; }
.toc a:hover, .toc a.active { border-left-color: var(--accent); color: var(--ink); }
.toc a.active { font-weight: 600; }
.spec-main { flex: 999 1 560px; min-width: 0; max-width: 780px; padding-top: 64px; }
.eyebrow { margin: 0 0 14px; font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.status { margin: 0 0 28px; padding: 16px 20px; background: var(--panel); border-top: 2px solid var(--ink); display: grid; gap: 4px; font-family: var(--sans); font-size: 14px; line-height: 1.55; }
.status div { display: grid; grid-template-columns: 130px 1fr; gap: 16px; }
.status dt { color: var(--muted); }
.status dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.spec h1 { font-size: 46px; }
.spec h1 + p { margin-top: 12px; font-size: 20px; color: #3e3b37; }

/* ---------- read as human / agent ---------- */
.read-as { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 0 20px; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.layout-home .read-as, .layout-doc .read-as { margin: 24px 0 -48px; }
.read-as-toggle { display: inline-flex; border: 1px solid var(--ink); }
.read-as-toggle button { min-height: 40px; padding: 0 16px; border: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; font-weight: 500; cursor: pointer; }
.read-as-toggle button[aria-pressed='true'] { background: var(--ink); color: #fff; }
.agent-view { margin: 0 0 24px; border: 1px solid var(--ink); }
.layout-home .agent-view, .layout-doc .agent-view { margin-top: 72px; }
.agent-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 8px 14px; background: var(--ink); color: #d9d6cf; font-size: 12px; }
.agent-actions { display: flex; gap: 14px; align-items: center; font-family: var(--sans); font-size: 13px; }
.agent-actions a { color: #fff; }
.agent-actions button { min-height: 32px; padding: 0 12px; border: 1px solid #5e5a54; background: transparent; color: #fff; font-family: var(--sans); font-size: 13px; cursor: pointer; }
.agent-text { margin: 0; padding: 20px; max-height: none; overflow-x: auto; white-space: pre-wrap; font-family: var(--mono); font-size: 13.5px; line-height: 1.65; color: var(--ink); background: var(--paper); }
.agent-note { margin: 0; padding: 12px 14px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 13px; line-height: 1.55; color: var(--muted); }
.agent-note code { font-family: var(--mono); font-size: 12px; }

@media (max-width: 760px) {
  body { font-size: 17.5px; }
  .wrap { padding-left: 20px; padding-right: 20px; }
  .prose h1, .home h1 { font-size: 40px; }
  .spec h1, .doc h1 { font-size: 34px; }
  .prose h2 { font-size: 25px; }
  .home { padding-top: 56px; }
  .home h1 + p { font-size: 21px; }
  .toc { max-width: none; padding-top: 28px; }
  .toc ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; font-size: 13px; }
  .toc a { padding: 5px 0 5px 8px; }
  .spec-main { padding-top: 32px; }
  .status div { grid-template-columns: 1fr; gap: 0; margin-bottom: 6px; }
  .read-as { justify-content: flex-start; }
}

@media print {
  .site-header nav, .read-as, .agent-view, .toc, .site-footer .footer-links { display: none !important; }
  body { font-size: 11.5pt; }
  .spec-main { max-width: none; }
  a { color: inherit; text-decoration: none; }
}
