@font-face {
  font-family: Roboto;
  src: url("./assets/fonts/roboto-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Light swatches from the Taler Wallet palette check in Penpot. */
  --paper: #fdfdff;
  --panel: #f5f7fc;
  --white: #ffffff;
  --ink: #1c1b1f;
  --muted: #45474f;
  --accent: #0042b3;
  --accent-light: #d3deff;
  --on-accent-light: #00134a;
  --rule: #c4c6d0;
  --rule-dark: #767880;
  --gutter: clamp(20px, 5vw, 64px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Roboto, Arial, sans-serif; font-size: 16px; line-height: 1.5; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2 { font-weight: 400; line-height: 1.25; text-wrap: balance; }
h2 { font-size: clamp(1.75rem, 3vw, 2rem); }
h3 { line-height: 1.28; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button, a, input, [tabindex="0"] { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); }
img { display: block; max-width: 100%; height: auto; }
section[id] { scroll-margin-top: 1.5rem; }

.wrap { width: min(1120px, calc(100% - 2 * var(--gutter))); margin-inline: auto; }
.skip { position: absolute; z-index: 2; top: .75rem; left: .75rem; padding: .65rem 1rem; color: var(--white); background: var(--accent); transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }
.topbar { border-bottom: 1px solid var(--rule); }
.nav, .footer { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; min-height: 66px; padding-block: 12px; }
.brand { color: var(--ink); font-size: 1.125rem; font-weight: 500; line-height: 1.3; text-decoration: none; }
.nav nav { display: flex; flex-wrap: wrap; flex-shrink: 0; gap: 5px clamp(15px, 3vw, 34px); font-size: .89rem; }
.nav nav a, .footer > a:last-child { color: var(--muted); text-decoration: none; }
.nav nav a:hover, .footer a:hover { color: var(--accent); text-decoration: underline; }

.hero { padding-block: clamp(45px, 6.5vw, 85px) clamp(48px, 6vw, 77px); }
.hero h1 { font-size: clamp(2.25rem, 5vw, 3.5625rem); line-height: 1.12; }
.hero-deck { max-width: 53ch; margin-top: 19px; color: var(--muted); font-size: clamp(1.06rem, 1.55vw, 1.25rem); line-height: 1.5; }
.reading { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(0, 3fr); margin-top: clamp(31px, 4.25vw, 54px); border-top: 1px solid var(--rule-dark); border-bottom: 1px solid var(--rule-dark); }
.reading-caption { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: clamp(18px, 2.6vw, 33px) clamp(16px, 2.5vw, 32px) 23px 0; }
.reading-caption h2 { font-size: 1rem; font-weight: 500; line-height: 1.5; }
.reading-caption p { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.reading-caption a { white-space: nowrap; }
.icon-button { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; min-width: 94px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--rule-dark); background: transparent; font-size: .875rem; font-weight: 500; }
.icon-button:hover:not(:disabled) { border-color: var(--accent); color: var(--on-accent-light); background: var(--accent-light); }
.reading-screen { min-width: 0; padding: clamp(22px, 3.2vw, 43px); background: var(--panel); border-left: 3px solid var(--accent); }
.reading-alert { margin-bottom: 11px; color: var(--accent); font-size: .875rem; font-weight: 500; }
.dense-message { max-width: 36ch; font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.33; text-wrap: pretty; }
.notice-amount, [data-swap] { white-space: nowrap; }
.notice-amount { font-variant-numeric: lining-nums; }
.shifting-letter { display: inline-block; }
.dense-message .sr-only { user-select: none; }

.context, .section-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); align-items: start; gap: clamp(24px, 6vw, 77px); }
.context { padding-bottom: clamp(48px, 6vw, 75px); }
.context h2, .section-intro h2 { max-width: 15ch; text-wrap: pretty; }
.context > div > p, .section-intro p, .sources p { max-width: 64ch; color: var(--muted); }
.definitions { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 24px; }
.definitions > div { border-top: 1px solid var(--rule); padding-top: 12px; }
.definitions h3 { margin-bottom: 5px; font-size: .99rem; }
.definitions p { color: var(--muted); font-size: .95rem; }

.examples, .field .wrap, .research .wrap, .sources { padding-block: clamp(47px, 6.3vw, 80px); }
.examples, .field .wrap { border-top: 1px solid var(--rule-dark); }
.section-intro { margin-bottom: clamp(22px, 3.4vw, 39px); }
.lab-grid { display: grid; grid-template-columns: minmax(175px, .9fr) minmax(0, 3fr); border-block: 1px solid var(--rule-dark); }
.lab-tabs { display: flex; flex-direction: column; align-items: stretch; padding-block: 14px; border-right: 1px solid var(--rule); }
.lab-tabs button { width: 100%; min-height: 44px; padding: 9px 12px; border: 0; border-left: 2px solid transparent; text-align: left; background: transparent; font-size: .94rem; line-height: 1.3; }
.lab-tabs button[aria-selected="true"] { border-left-color: var(--accent); background: var(--accent-light); color: var(--on-accent-light); font-weight: 500; }
.lab-tabs button:hover { text-decoration: underline; text-underline-offset: .2em; }
.lab-panel { min-width: 0; padding: clamp(20px, 3.1vw, 38px); padding-right: 0; }
.wallet-hypothesis { margin-bottom: 18px; padding-inline-start: 12px; border-inline-start: 2px solid var(--accent); }
.wallet-hypothesis dt { font-weight: 500; }
.wallet-hypothesis dt span { margin-inline-end: .3em; color: var(--accent); }
.wallet-hypothesis dd { margin-top: 3px; color: var(--muted); font-size: .95rem; }
.example-heading { margin-bottom: 21px; }
.example-heading h3 { font-size: clamp(1.375rem, 2.4vw, 1.75rem); font-weight: 400; }
.example-heading p { color: var(--muted); margin-top: 6px; font-size: .95rem; }
.wallet-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(10px, 2vw, 22px); }
.variant { display: flex; flex-direction: column; min-width: 0; }
.variant-tag { margin-bottom: 6px; color: var(--ink); font-size: .875rem; font-weight: 500; }
.wallet { flex: 1; min-height: 139px; padding: clamp(13px, 2vw, 22px); border-block: 1px solid var(--rule); background: var(--white); }
.wallet-small, .wallet-note { color: var(--muted); font-size: .88rem; }
.wallet-value { margin-block: 8px 4px; font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 500; line-height: 1.22; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.split .centimes { background: var(--accent-light); margin-left: 2px; padding-inline: .09em; }
.wallet-note { margin-top: 8px; }
.measure { margin-top: 15px; color: var(--muted); font-size: .89rem; }
.measure strong { color: var(--ink); margin-right: .4em; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 8px; padding-block: 5px; font-size: .94rem; }
.row dd { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.total { margin-top: 5px; border-top: 1px solid var(--rule); padding-top: 9px; }
.row.separate { border-left: 2px solid var(--accent); background: var(--accent-light); margin-top: 6px; padding: 6px 7px; }
.wallet label { display: block; color: var(--muted); font-weight: 700; font-size: .88rem; }
.wallet input { display: block; width: 100%; min-height: 44px; margin-top: 5px; padding: 6px 9px; font: inherit; font-weight: 600; color: var(--ink); background: var(--white); border: 1px solid var(--rule-dark); border-radius: 0; }
.control-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 12px; margin-top: 16px; }
.small-button { min-height: 42px; padding: 6px 11px; border: 1px solid var(--rule-dark); background: var(--white); font-size: .875rem; font-weight: 500; }
.small-button:hover { border-color: var(--accent); background: var(--accent-light); color: var(--on-accent-light); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; max-width: 245px; margin-top: 12px; }
.keypad button { padding: 4px 0; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; color: var(--muted); font-size: .88rem; }
.timeline li { display: flex; align-items: flex-start; gap: 8px; padding-top: 5px; }
.timeline .step-icon { width: 1em; flex-shrink: 0; color: var(--accent); }
.timeline [aria-current="step"] { color: var(--ink); font-weight: 700; }
.payment-status { margin-top: 8px; font-weight: 700; font-size: 1.2rem; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(18px, 3vw, 38px); }
.field figure { min-width: 0; }
.figure-image { display: block; position: relative; background: var(--panel); }
.figure-image img { aspect-ratio: 2.12; width: 100%; object-fit: contain; }
.figure-image span { display: grid; place-items: center; position: absolute; bottom: 0; right: 0; width: 35px; height: 35px; background: var(--paper); color: var(--accent); }
.figure-image:hover span { background: var(--accent); color: var(--white); }
.field figcaption { padding-top: 10px; }
.field figcaption strong, .field figcaption span { display: block; }
.field figcaption span { color: var(--muted); font-size: .9rem; }

.research { background: var(--panel); border-block: 1px solid var(--rule); }
.research h3 { font-size: 1.03rem; margin-bottom: 12px; }
.predictions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 5vw, 62px); border-top: 1px solid var(--rule-dark); }
.predictions > div { padding-block: 10px 12px; border-bottom: 1px solid var(--rule); }
.predictions dt { font-weight: 500; }
.predictions dt span { display: inline-block; min-width: 2.7rem; color: var(--accent); font-size: .875rem; }
.predictions dd { padding-left: 2.7rem; }
.predictions dd { color: var(--muted); }
.study-method p + p { margin-top: 12px; }
.other-hypotheses > p { margin-bottom: 14px; color: var(--muted); }

.sources p { margin-block: 10px 20px; font-size: .875rem; }
.source-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 5vw, 62px); list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-dark); font-size: .875rem; line-height: 1.5; }
.source-links li { padding-block: 10px; border-bottom: 1px solid var(--rule); }
.source-links cite { font-style: normal; }
.source-author, .source-venue { display: block; color: var(--muted); }
footer { border-top: 1px solid var(--rule); }
.footer { font-size: .9rem; }
.footer .brand { font-size: 1.1rem; }
.footer > a:last-child { white-space: nowrap; }

@media (max-width: 760px) {
  .nav { align-items: start; flex-direction: column; gap: 10px; }
  .reading, .context, .section-intro { grid-template-columns: 1fr; gap: 16px; }
  .reading { border-top: 0; gap: 0; }
  .reading-screen { grid-row: 1; border-top: 1px solid var(--rule); }
  .reading-caption { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: start; padding: 15px 0 17px; }
  .reading-caption p { grid-column: 1; }
  .reading-caption .icon-button { grid-column: 2; grid-row: 1 / span 2; }
  .lab-grid { grid-template-columns: 1fr; }
  .lab-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); border-right: 0; border-bottom: 1px solid var(--rule); padding: 7px 0; }
  .lab-panel { padding-inline: 0; }
  .predictions, .source-links { grid-template-columns: 1fr; }
}
@media (max-width: 485px) {
  .hero h1 { font-size: 2rem; line-height: 1.25; }
  .definitions, .field-grid { grid-template-columns: 1fr; gap: 15px; }
  .reading-screen { padding: 19px 16px; }
  .reading-caption .icon-button { min-width: 86px; }
  .wallet { padding: 11px; }
  .wallet-value { font-size: clamp(1.17rem, 5.15vw, 1.6rem); }
  .wallet-note, .wallet-small, .row { font-size: .83rem; }
  .row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
