/* Variables and base */
:root {
  --bg: #F5F0E6;
  --card: #FFFCF5;
  --text: #17231E;
  --muted: #48584D;
  --primary: #16543D;
  --accent: #9A402C;
  --rule: color-mix(in srgb, var(--text) 26%, var(--bg));
  --radius: 4px;
  --title: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font: Inter, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font); }
h1, h2, h3 { margin: 0; font-family: var(--title); line-height: 1.1; }
h1 { font-size: 48px; font-weight: 700; }
h2 { font-size: 32px; font-weight: 700; }
h3 { font-size: 24px; font-weight: 600; }
p { margin: 0 0 16px; max-width: 70ch; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, select, button { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
kbd, code { font-family: ui-monospace, Consolas, monospace; font-size: .94em; overflow-wrap: anywhere; }
kbd { padding: 2px 5px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.skip-link { position: absolute; z-index: 3; left: 16px; top: 8px; transform: translateY(-150%); background: var(--card); padding: 8px 16px; }
.skip-link:focus { transform: translateY(0); }

/* Layout */
.wrap { width: min(calc(100% - 48px), 1120px); margin-inline: auto; }
.site-head { border-top: 4px solid var(--primary); border-bottom: 1px solid var(--rule); background: var(--card); }
.masthead { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font: 700 26px/1 var(--title); color: var(--text); text-decoration: none; min-height: 44px; }
.brand-mark { display: grid; place-items: center; width: 36px; aspect-ratio: 1; flex: none; background: var(--primary); color: white; border-radius: var(--radius); font-size: 19px; }
.site-nav { display: flex; gap: 24px; align-items: center; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current] { border-bottom-color: currentColor; }
.main { min-height: 66vh; padding: 24px 0 64px; }
.entry { margin-bottom: 24px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.updated { margin: 8px 0 12px; color: var(--muted); font-size: 14px; }
.lede { margin-bottom: 0; font-size: 18px; }
.article-body > section, .faq { margin-top: 48px; scroll-margin-top: 16px; }
.reference .article-body > section:first-child { margin-top: 0; }
.article-body h2, .faq h2 { margin-bottom: 12px; }
.article-body h3 { margin: 24px 0 8px; }
.site-foot { border-top: 1px solid var(--rule); padding: 32px 0; background: var(--card); }
.foot-grid { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 24px; }
.foot-brand p { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.site-foot nav strong { font-family: var(--title); font-size: 20px; }
.site-foot ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; }
.site-foot li a { display: inline-block; padding: 6px 0; }

/* Components */
.btn, .copy-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--primary); border-radius: var(--radius); text-decoration: none; font-weight: 700; text-align: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--text); color: #fff; }
.btn-secondary, .copy-btn { background: var(--card); color: var(--primary); }
.btn-secondary:hover, .copy-btn:hover { color: var(--accent); border-color: currentColor; }
.copy-btn { padding-inline: 12px; }
.table-wrap { margin: 12px 0 16px; }
table { table-layout: fixed; width: 100%; border: 1px solid var(--rule); border-collapse: collapse; background: var(--card); font-size: 15px; }
caption { text-align: left; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
thead { background: var(--primary); color: #fff; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
tbody th { font-weight: 700; }
ol, ul { padding-inline-start: 24px; }
.article-body li { margin-bottom: 8px; }
.sources { font-size: 14px; color: var(--muted); }
.notice { background: var(--card); padding: 12px 16px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.badge { display: inline-block; width: fit-content; padding: 1px 8px; border: 3px double var(--primary); border-radius: var(--radius); font-size: 12px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.unknown { color: var(--accent); font-weight: 600; }
details { border-bottom: 1px solid var(--rule); }
details:first-of-type { border-top: 1px solid var(--rule); }
summary { min-height: 44px; cursor: pointer; padding: 12px 0; font-weight: 700; }
details p { margin: 0 0 16px 16px; }
.inline-links { display: flex; flex-wrap: wrap; column-gap: 16px; row-gap: 0; }
.inline-links a { padding: 8px 0; }

/* Page sections */
.quick { display: grid; grid-template-columns: 1.55fr 1fr; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.quick-main, .quick-side { padding: 24px; }
.quick-side { border-left: 1px solid var(--rule); display: flex; align-items: flex-start; flex-direction: column; }
.quick h2 { font-size: 28px; margin-bottom: 8px; }
.quick-side .btn { margin-top: auto; }
.code-line { margin: 0; }
.code-line code { font-size: 22px; color: var(--primary); font-weight: 700; }
.quick-reward { margin: 4px 0; }
.quick-state { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.field-index { display: flex; flex-wrap: wrap; gap: 4px 24px; border-bottom: 1px solid var(--rule); margin-top: 12px; padding: 4px 0; }
.field-index a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.route-list { list-style: none; padding: 0; }
.route-list li { margin: 0; border-top: 1px solid var(--rule); padding: 12px 0; display: grid; grid-template-columns: minmax(140px, 1fr) 3fr; gap: 16px; }
.route-list li:last-child { border-bottom: 1px solid var(--rule); }
.route-list a { font-weight: 700; }
.tier-lane { display: grid; grid-template-columns: 160px minmax(0, 1fr); border-top: 1px solid var(--rule); padding: 16px 0; gap: 24px; }
.tier-lane h3 { margin: 0; }
.tier-lane p { margin: 0; }
.stand-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 240px); gap: 16px; margin: 16px 0; }
.stand-filter label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.stand-filter input, .stand-filter select { width: 100%; min-height: 44px; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 8px 12px; }
.result-summary { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.stand-group { margin: 24px 0; }
.stand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 8px 0; }
.stand-grid li { min-width: 0; margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; }
.stand-grid a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; line-height: 1.3; }
.stand-grid small { display: block; margin-top: 4px; color: var(--muted); }
.copy-feedback { font-size: 14px; color: var(--primary); min-height: 0; }

/* Mobile breakpoints */
@media (max-width: 840px) {
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .masthead { flex-wrap: wrap; justify-content: flex-start; gap: 0 16px; padding-top: 6px; }
  .site-nav { width: 100%; gap: 24px; }
  .site-nav a { font-size: 14px; }
  .brand { font-size: 24px; }
  .brand-mark { width: 30px; font-size: 16px; }
  .main { padding: 16px 0 48px; }
  h1 { font-size: 32px; }
  h2 { font-size: 28px; }
  .lede { font-size: 16px; }
  .entry { margin-bottom: 16px; }
  .crumbs { margin-bottom: 8px; }
  .quick { grid-template-columns: 1fr; }
  .quick-main, .quick-side { padding: 16px; }
  .quick-side { border-left: 0; border-top: 1px solid var(--rule); }
  .quick-side p { margin-bottom: 8px; }
  .btn { width: 100%; }
  .field-index { gap: 0 16px; }
  .article-body > section, .faq { margin-top: 32px; }
  .route-list li, .tier-lane { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .stand-filter { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stand-grid { grid-template-columns: minmax(0, 1fr); }
  th, td { padding: 8px; font-size: 14px; }
  .stack-table thead { position: absolute; clip-path: inset(50%); overflow: hidden; width: 1px; height: 1px; white-space: nowrap; }
  .stack-table, .stack-table tbody, .stack-table tr { display: block; }
  .stack-table caption { display: block; width: 100%; padding: 8px 12px 0; }
  .stack-table tr { padding: 8px 12px; border-bottom: 1px solid var(--rule); }
  .stack-table tr:last-child { border-bottom: 0; }
  .stack-table th, .stack-table td { display: block; border: 0; padding: 4px 0; }
  .stack-table td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-weight: 600; }
  .stack-table .copy-btn { width: 100%; }
  .foot-brand { grid-column: 1 / -1; }
  .site-foot li a { min-height: 44px; display: inline-flex; align-items: center; }
}

