/* Crypto Tax Estimate — editorial, print-briefing style */
:root {
  --paper: #f3eee4;
  --paper-deep: #e8e0d2;
  --paper-lift: #faf7f0;
  --ink: #1a1612;
  --ink-soft: #3d3830;
  --muted: #5e574c;
  --rule: #c9bfae;
  --rule-strong: #1a1612;
  --oxblood: #7a2e1f;
  --oxblood-hover: #5c1f14;
  --forest: #2c4a32;
  --ochre: #7a5a14;
  --ochre-bg: #f3e6c4;
  --forest-bg: #dce6dc;
  --danger: #7a2e1f;
  --focus: #7a2e1f;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Source Sans 3", "Source Sans Pro", "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "Source Serif 4", "Newsreader", ui-monospace, monospace;
  --measure: 42rem;
  --page: 72rem;
  --header-h: 0;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }
a { color: var(--oxblood); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--oxblood-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.75rem;
  z-index: 100;
}
.skip-link:focus { top: 0.75rem; }

/* Masthead */
.masthead {
  border-bottom: 1px solid var(--rule-strong);
  background: var(--paper);
}
.masthead-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.85rem 1.25rem 0.75rem;
}
.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.65rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
}
.wordmark:hover { color: var(--ink); }
.wordmark em { font-style: italic; font-weight: 500; }
.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  margin: 0.15rem 0 0.7rem;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.55rem;
}
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.nav a:hover, .nav a[aria-current="page"] {
  color: var(--oxblood);
  text-decoration: underline;
}

main { flex: 1; }
.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.5rem;
}
.measure { max-width: var(--measure); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}
h1 { font-size: clamp(1.85rem, 4vw, 2.6rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.55rem; margin: 2rem 0 0.65rem; }
h3 { font-size: 1.2rem; margin: 1.4rem 0 0.45rem; }
p { margin: 0 0 1rem; }
.lede {
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}
.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

hr.rule, .rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1.75rem 0;
}
.rule-double {
  border: 0;
  border-top: 3px double var(--ink);
  margin: 0.5rem 0 1.25rem;
}

/* Buttons */
.btn {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  border-radius: 0;
}
.btn:hover { background: #000; color: var(--paper); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-ghost:hover { background: var(--paper-deep); color: var(--ink); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Home layout */
.hero { max-width: 46rem; padding-bottom: 0.5rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.25rem 0 0.5rem; }

.how-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  counter-reset: steps;
}
.how-list li {
  counter-increment: steps;
  padding: 0.7rem 0 0.7rem 2.4rem;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.how-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.7rem;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
}

.country-index { margin-top: 0.5rem; }
.region { margin: 1.4rem 0; }
.region h3 {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.3rem;
  margin: 0 0 0.6rem;
}
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
  gap: 0.15rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.country-grid a { color: var(--ink); text-decoration: none; }
.country-grid a:hover { color: var(--oxblood); text-decoration: underline; }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.05rem 0.35rem;
  margin-left: 0.25rem;
  vertical-align: middle;
  font-weight: 600;
  font-family: var(--sans);
}
.badge-official { background: var(--forest-bg); color: var(--forest); }
.badge-approx { background: var(--ochre-bg); color: var(--ochre); }

.notice, .disclaimer-box, .callout {
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
}
.notice p:last-child, .disclaimer-box p:last-child, .callout p:last-child { margin-bottom: 0; }
.notice-warn { border-color: #b89a4a; background: #f7f0dc; }

/* Forms */
form, .form-block { margin: 0; }
.field { margin: 0 0 1rem; }
.field label, .label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.28rem;
}
.hint { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.85rem 1rem;
}
input[type="text"], input[type="number"], input[type="email"], input[type="search"],
input[type="date"], select, textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-lift);
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.45rem 0.4rem 0.35rem;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%231a1612' stroke-width='1.4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.6rem;
}
textarea { border: 1px solid var(--rule); min-height: 8rem; resize: vertical; }
.combobox { position: relative; }
.combobox-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--paper-lift);
  border: 1px solid var(--ink);
  max-height: 16rem;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  display: none;
}
.combobox-list.open { display: block; }
.combobox-list li button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0.45rem 0.6rem;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}
.combobox-list li button:hover, .combobox-list li button[aria-selected="true"] {
  background: var(--paper-deep);
}
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--ink);
  width: fit-content;
  max-width: 100%;
}
.segmented button {
  font: inherit;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--ink);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  color: var(--ink);
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"], .segmented button.active {
  background: var(--ink);
  color: var(--paper);
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
}
td input, td select { font-size: 0.95rem; padding: 0.25rem 0.3rem; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions button {
  background: none;
  border: 0;
  color: var(--oxblood);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

/* Results */
.results {
  border-top: 3px double var(--ink);
  margin-top: 2rem;
  padding-top: 1.25rem;
}
.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.result-figure {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 600;
  margin: 0.2rem 0 0.15rem;
  font-variant-numeric: tabular-nums;
}
.result-caption { color: var(--muted); margin-bottom: 1rem; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem 1.25rem;
  margin: 1rem 0;
}
.stat dt {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.15rem;
}
.stat dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.source-list { padding-left: 1.15rem; }
.source-list li { margin: 0.25rem 0; }
.assumptions { padding-left: 1.15rem; }

/* Footer */
.site-footer {
  border-top: 3px double var(--ink);
  background: var(--paper-deep);
  margin-top: auto;
}
.footer-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1.75rem;
  font-size: 0.9rem;
}
.footer-legal {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 0.75rem; }
.footer-nav a { color: var(--ink); }
.entity { color: var(--muted); font-size: 0.85rem; margin: 0; }

.error { color: var(--oxblood); font-size: 0.9rem; margin: 0.3rem 0 0; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

/* Country method page */
.meta-line { color: var(--muted); font-size: 0.95rem; margin-bottom: 1rem; }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .masthead-top { flex-direction: column; gap: 0.15rem; }
  .wordmark { font-size: 1.45rem; }
  .field-row { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .hero-actions { flex-direction: column; align-items: flex-start; }
  td, th { padding: 0.35rem 0.3rem; }
}

@media print {
  .masthead .nav, .btn, .site-footer .footer-nav { display: none; }
  body { background: #fff; }
}
