:root {
  --paper: #f7f5ef;
  --surface: #ffffff;
  --ink: #1d252c;
  --muted: #5b6770;
  --line: #cfd5d8;
  --line-dark: #8e999f;
  --blue: #165d7a;
  --blue-soft: #dcecf2;
  --green: #27634f;
  --green-soft: #e1efe8;
  --amber: #765519;
  --amber-soft: #f4ead1;
  --red: #913e38;
  --red-soft: #f3dfdc;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 116px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid #e28b32;
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 300;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 0 clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line-dark);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.site-bar a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.site-bar a:hover {
  text-decoration: underline;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(36px, 7vw, 92px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(72px, 10vw, 132px) clamp(24px, 6vw, 84px);
}

.eyebrow,
.section-kicker,
.label,
.status-line {
  margin: 0;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 760px;
  margin: 18px 0 28px;
  font-size: clamp(52px, 8vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-deck {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(21px, 2.2vw, 30px);
  line-height: 1.42;
}

.hero-summary {
  align-self: end;
  padding: 28px;
  border: 1px solid var(--line-dark);
  background: var(--surface);
}

.hero-summary h2 {
  margin: 8px 0 18px;
  font-size: 25px;
  line-height: 1.25;
}

.hero-summary ol {
  margin: 0;
  padding-left: 24px;
}

.scope-note {
  max-width: 1240px;
  margin: 0 auto 36px;
  padding: 0 clamp(24px, 6vw, 84px);
}

.scope-note > div {
  padding: 18px 22px;
  border-left: 5px solid var(--amber);
  background: var(--amber-soft);
}

.scope-note p {
  margin: 0;
}

.region-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(24px, 6vw, 84px) 32px;
}

.region-switcher button {
  min-height: 44px;
  padding: 8px 18px;
  color: var(--ink);
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.region-switcher button[aria-pressed="true"] {
  color: white;
  border-color: var(--blue);
  background: var(--blue);
}

.region-status {
  max-width: 1240px;
  margin: -20px auto 28px;
  padding: 0 clamp(24px, 6vw, 84px);
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: none;
}

.toc {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  overflow-x: auto;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
  background: rgba(247, 245, 239, 0.97);
  scrollbar-width: thin;
}

.toc a {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 12px 18px;
  color: var(--ink);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}

.toc a:hover {
  color: white;
  background: var(--blue);
}

.chapter {
  padding: clamp(64px, 8vw, 104px) clamp(24px, 6vw, 84px);
  border-bottom: 1px solid var(--line-dark);
}

.chapter-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 0.68fr) minmax(260px, 0.32fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: end;
  margin-bottom: 48px;
}

.chapter h2 {
  margin: 8px 0 0;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.chapter-head > p:last-child {
  margin: 0;
  color: var(--muted);
}

.chapter h3 {
  margin: 0 0 12px;
  font-size: 23px;
  line-height: 1.25;
}

.chapter p:first-child {
  margin-top: 0;
}

.plain-grid,
.document-grid,
.country-grid,
.example-grid,
.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.plain-card,
.document-card,
.country-card,
.example-card,
.source-card {
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.plain-card p,
.document-card p,
.country-card p,
.example-card p,
.source-card p {
  margin-bottom: 0;
}

.wide-card {
  grid-column: 1 / -1;
}

.takeaway {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 5px solid var(--green);
  background: var(--green-soft);
}

.takeaway strong {
  color: var(--green);
}

.warning {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 5px solid var(--red);
  background: var(--red-soft);
}

.pay-stack {
  display: grid;
  gap: 10px;
  margin: 28px 0 38px;
}

.pay-layer {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 130px;
  gap: 20px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.pay-layer b {
  font-size: 18px;
}

.pay-layer span {
  color: var(--muted);
}

.pay-layer em {
  justify-self: end;
  color: var(--blue);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  margin: 26px 0;
}

table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 14px 16px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--blue-soft);
  font-size: 14px;
}

.calculator {
  margin-top: 42px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--line-dark);
  background: var(--surface);
}

.calculator-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.calculator-head p {
  max-width: 580px;
  margin: 0;
  color: var(--muted);
}

.calculator-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.calculator label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.calculator input,
.calculator select,
.glossary-tools input {
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  color: var(--ink);
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  background: white;
}

.calculator-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.calculator-results div {
  padding: 16px;
  background: var(--blue-soft);
}

.calculator-results span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.calculator-results b {
  display: block;
  margin-top: 6px;
  color: var(--blue);
  font-size: 22px;
}

.definition-list {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
}

.definition-list dt,
.definition-list dd {
  margin: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.definition-list dt {
  padding-right: 24px;
  font-weight: 800;
}

.definition-list dd {
  color: var(--muted);
}

.step-list {
  counter-reset: steps;
  display: grid;
  gap: 14px;
  padding: 0;
  list-style: none;
}

.step-list li {
  counter-increment: steps;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.step-list li::before {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: white;
  border-radius: 50%;
  background: var(--blue);
  font-weight: 800;
  content: counter(steps);
}

.step-list p {
  margin: 0;
}

.example-lines {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.example-lines li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.example-lines b {
  white-space: nowrap;
}

.example-total {
  margin-top: 18px;
  padding: 16px;
  background: var(--blue-soft);
}

.glossary-tools {
  display: grid;
  grid-template-columns: minmax(0, 540px) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.glossary-tools .status-line {
  color: var(--muted);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.term {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.term dt {
  font-weight: 800;
}

.term dd {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.checklist {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.checklist label {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.checklist input {
  width: 19px;
  height: 19px;
  margin-top: 4px;
}

.checklist-actions {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
}

.checklist-actions button {
  min-height: 44px;
  padding: 8px 16px;
  color: var(--ink);
  border: 1px solid var(--line-dark);
  background: transparent;
  cursor: pointer;
}

.advanced-link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  margin-top: 44px;
  padding: 24px;
  color: white;
  background: var(--blue);
  text-decoration: none;
}

.advanced-link span {
  opacity: 0.85;
}

.advanced-link b {
  font-size: 20px;
}

.advanced-link:hover b {
  text-decoration: underline;
}

.source-card a {
  display: block;
  margin-top: 8px;
}

.source-caveat {
  margin-top: 28px;
  color: var(--muted);
  font-size: 14px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px clamp(24px, 6vw, 84px);
  /* --muted is tuned for the light surfaces and reads 2.7:1 on --ink. */
  color: rgba(247, 245, 239, 0.72);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

.footer a {
  color: white;
}

@media (max-width: 860px) {
  .hero,
  .chapter-head {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 64px;
  }

  .hero-summary {
    align-self: auto;
  }

  .calculator-fields,
  .calculator-results,
  .glossary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pay-layer {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .pay-layer em {
    grid-column: 2;
    justify-self: start;
  }
}

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

  .site-bar {
    padding: 0 16px;
  }

  .site-bar span {
    display: none;
  }

  h1 {
    font-size: clamp(50px, 17vw, 76px);
  }

  .plain-grid,
  .document-grid,
  .country-grid,
  .example-grid,
  .source-grid,
  .calculator-fields,
  .calculator-results,
  .glossary-grid,
  .glossary-tools {
    grid-template-columns: 1fr;
  }

  .calculator-head,
  .checklist-actions,
  .footer {
    display: block;
  }

  .calculator-head select {
    margin-top: 14px;
  }

  .pay-layer {
    display: block;
  }

  .pay-layer span,
  .pay-layer em {
    display: block;
    margin-top: 6px;
  }

  .definition-list {
    grid-template-columns: 1fr;
  }

  .definition-list dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .definition-list dd {
    padding-top: 4px;
  }

  .example-lines li {
    display: block;
  }

  .example-lines b {
    display: block;
    margin-top: 4px;
  }

  .advanced-link {
    grid-template-columns: 1fr;
  }

  .checklist-actions button {
    margin-top: 12px;
  }

  .footer a {
    display: block;
    margin-top: 8px;
  }
}

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