:root {
  --bg: #F9F8F4;
  --paper: #FFFFFF;
  --ink: #1A1A1A;
  --muted: #5F5F5F;
  --rule: #E5E5E5;
  --track: #D4D4D4;
  --quote: #F3F2EE;
  --accent: #2563EB;
  --below: #B91C1C;
  --above: #15803D;
  --max: 1080px;
  --header-h: 58px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

button,
input,
textarea {
  font: inherit;
}

input,
button,
.button,
.sticky-action {
  min-height: 44px;
}

.num,
.money,
.cpt,
.stat-value,
.result-number,
.tick-label,
.ledger-grid,
.pdf-mock {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 20;
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
}

.skip-link:focus {
  top: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(249, 248, 244, 0.96);
  border-bottom: 1px solid var(--rule);
}

.nav {
  max-width: var(--max);
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  width: 25px;
  height: 25px;
  border: 1px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 18px;
}

.hero {
  min-height: calc(844px - var(--header-h));
  display: grid;
  align-items: start;
  padding: clamp(52px, 9vh, 76px) 0 30px;
  border-bottom: 1px solid var(--rule);
}

.hero-inner {
  display: grid;
  gap: 22px;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
.display-font {
  font-family: "Newsreader", Georgia, serif;
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(42px, 10.2vw, 78px);
  line-height: 0.98;
  font-weight: 650;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(30px, 7vw, 48px);
  line-height: 1.04;
  font-weight: 650;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.22;
  font-weight: 700;
}

.lead {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}

.copy,
.fine-print {
  color: var(--muted);
}

.fine-print {
  font-size: 13px;
}

.rate-widget {
  --user-pct: 0%;
  --gap-left: 0%;
  --gap-width: 0%;
  --gap-color: var(--below);
  display: grid;
  gap: 18px;
}

.rate-form {
  display: grid;
  gap: 12px;
}

.field-label {
  display: block;
  font-weight: 700;
}

.field-row {
  display: grid;
  gap: 10px;
}

.input-shell {
  position: relative;
}

.currency-prefix {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
}

.rate-input {
  width: 100%;
  height: 54px;
  padding: 10px 12px 10px 30px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.rate-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rate-input[aria-invalid="true"] {
  border-color: var(--below);
}

.rate-error {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--below);
  font-size: 13px;
  font-weight: 700;
}

.rate-error[hidden] {
  display: none;
}

.button,
button.button {
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button:hover,
.button:focus {
  background: #1d4ed8;
  color: #fff;
}

.button-secondary {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

.button-secondary:hover,
.button-secondary:focus {
  background: var(--ink);
  color: #fff;
}

.reveal {
  display: none;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}

.has-result .reveal {
  display: grid;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.result-cell {
  min-height: 74px;
  padding: 12px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: #fff;
}

.result-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.result-number {
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
}

.is-below {
  color: var(--below);
}

.is-above {
  color: var(--above);
}

.is-neutral {
  color: var(--ink);
}

.distribution {
  display: grid;
  gap: 12px;
  padding: 22px 0 4px;
}

.track-wrap {
  position: relative;
  height: 48px;
}

.track-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 20px;
  height: 2px;
  background: var(--track);
}

.gap-stripe {
  position: absolute;
  left: var(--gap-left);
  top: 16px;
  width: var(--gap-width);
  height: 10px;
  background: repeating-linear-gradient(45deg, var(--gap-color) 0 2px, transparent 2px 6px);
  opacity: 0.32;
}

.tick {
  position: absolute;
  top: 13px;
  width: 1px;
  height: 16px;
  background: var(--ink);
}

.tick.p25 {
  left: 25%;
}

.tick.median {
  left: 50%;
}

.tick.p75 {
  left: 75%;
}

.user-marker {
  position: absolute;
  left: var(--user-pct);
  top: 0;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 13px solid var(--accent);
  transform: translateX(-8px);
  transition: left 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tick-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  color: var(--muted);
  font-size: 12px;
}

.tick-labels span:nth-child(2),
.tick-labels span:nth-child(3) {
  text-align: center;
}

.tick-labels span:last-child {
  text-align: right;
}

.source-quote,
.authority-strip {
  border-left: 4px solid var(--ink);
  background: var(--quote);
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 600;
}

sup a,
.footnote-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.bridge {
  display: none;
  gap: 18px;
  padding-top: 26px;
}

.has-result .bridge {
  display: grid;
}

.bridge-note {
  border: 1px solid var(--ink);
  padding: 14px;
  background: #fff;
}

.bridge-note strong {
  display: block;
  margin-bottom: 4px;
}

.locked-ledger {
  display: grid;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.locked-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 11px 12px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: #fff;
}

.locked-row span:first-child {
  filter: blur(3px);
  opacity: 0.7;
}

.locked-row strong {
  color: var(--accent);
  font-size: 13px;
}

.post-calc {
  display: block;
}

.section {
  padding: 44px 0;
  border-bottom: 1px solid var(--rule);
}

.section-tight {
  padding-top: 30px;
}

.dossier-layout {
  display: grid;
  gap: 28px;
  align-items: start;
}

.pdf-dossier {
  display: grid;
  gap: 12px;
}

.pdf-stack {
  position: relative;
  min-height: 430px;
  border: 1px solid var(--ink);
  background: #fff;
}

.pdf-sheet {
  position: absolute;
  inset: 18px;
  border: 1px solid var(--rule);
  background: #fff;
}

.pdf-sheet.back {
  inset: 28px 8px 8px 28px;
}

.pdf-sheet.mid {
  inset: 22px 14px 14px 22px;
}

.pdf-sheet.front {
  position: relative;
  inset: auto;
  min-height: 390px;
  margin: 18px;
  padding: 18px;
}

.pdf-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  font-weight: 700;
}

.pdf-top small {
  color: var(--muted);
  font-weight: 500;
}

.pdf-metrics,
.ledger-grid {
  display: grid;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.pdf-metrics {
  grid-template-columns: repeat(3, 1fr);
  margin: 14px 0;
}

.pdf-metric,
.ledger-cell {
  padding: 10px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: #fff;
}

.pdf-metric small,
.ledger-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pdf-metric strong {
  display: block;
  margin-top: 4px;
}

.pdf-bars {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.pdf-bar {
  height: 10px;
  background: #E5E5E5;
}

.pdf-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.pdf-table {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.pdf-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px;
}

.pdf-row span {
  min-height: 28px;
  padding: 6px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: 12px;
}

.pdf-row.is-blurred span {
  filter: blur(3px);
  color: var(--muted);
}

.steps {
  display: grid;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.step {
  padding: 16px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: #fff;
}

.square-bullet,
.step-num {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-bottom: 12px;
  place-items: center;
  border: 1px solid var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.policy-grid,
.faq-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.policy-item,
.faq-item {
  padding: 14px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: #fff;
}

.policy-item p,
.faq-item p {
  margin-bottom: 0;
}

.faq-item summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.method-note {
  display: grid;
  gap: 10px;
  border-left: 4px solid var(--ink);
  background: var(--quote);
  padding: 16px;
}

.cta-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--ink);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 18px 90px;
  display: grid;
  gap: 18px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: var(--ink);
}

.legal-lines {
  margin: 0;
  padding: 0;
  list-style: square;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.sticky-action {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 30;
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.sticky-action.is-paid {
  background: var(--ink);
  border-color: var(--ink);
}

.sample-hero {
  padding: 42px 0;
  border-bottom: 1px solid var(--rule);
}

.sample-layout,
.template-shell {
  display: grid;
  gap: 20px;
}

.sample-sheet,
.print-page {
  background: #fff;
  border: 1px solid var(--ink);
  padding: 18px;
}

.sample-cover {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.report-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--ink);
}

.report-row:first-child {
  border-top: 1px solid var(--ink);
}

.comparison-bars {
  display: grid;
  gap: 10px;
}

.comparison-line {
  display: grid;
  gap: 5px;
}

.comparison-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  background: var(--track);
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.template-body {
  background: var(--bg);
}

.template-toolbar {
  max-width: 860px;
  margin: 0 auto;
  padding: 18px;
}

.print-page {
  width: min(100%, 860px);
  min-height: 1050px;
  margin: 18px auto;
}

.print-cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.template-kicker {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.template-title {
  font-family: "Newsreader", Georgia, serif;
  font-size: 44px;
  line-height: 1.02;
}

.template-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.template-table th,
.template-table td {
  padding: 9px;
  border: 1px solid var(--ink);
  text-align: left;
  vertical-align: top;
}

.template-table th {
  background: var(--quote);
}

.template-table .is-buyer,
.position-row {
  color: var(--accent);
  font-weight: 700;
}

.note-box,
.letter-preview {
  border: 1px solid var(--ink);
  padding: 14px;
  background: #fff;
}

.letter-preview {
  white-space: pre-wrap;
  font-family: "Newsreader", Georgia, serif;
  font-size: 15px;
}

[contenteditable="true"] {
  outline-color: var(--accent);
}

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

  .user-marker {
    transition: none;
  }
}

@media (min-width: 720px) {
  .nav {
    padding: 0 24px;
  }

  .nav-links {
    display: flex;
  }

  .page {
    padding: 0 24px;
  }

  .hero {
    min-height: 650px;
    align-items: center;
    padding: 52px 0;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.74fr);
    align-items: center;
    gap: 48px;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .button {
    min-width: 230px;
  }

  .result-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .bridge {
    grid-template-columns: 1fr 1fr;
  }

  .dossier-layout,
  .sample-layout,
  .template-shell {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  }

  .steps,
  .policy-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cta-row {
    flex-direction: row;
  }

  .sticky-action {
    display: none;
  }

  .footer-inner {
    grid-template-columns: 1fr 1.4fr;
    padding: 32px 24px;
  }
}

@media (max-width: 430px) {
  .hero {
    min-height: calc(844px - var(--header-h));
  }

  h1 {
    font-size: 44px;
  }

  .lead {
    font-size: 16px;
  }

  .result-number {
    font-size: 25px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .site-header,
  .site-footer,
  .sticky-action,
  .template-toolbar,
  .no-print {
    display: none !important;
  }

  .print-page {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0.55in;
    border: 0;
    page-break-after: always;
  }

  .print-page:last-child {
    page-break-after: auto;
  }
}
