:root {
  --paper: #f7f3eb;
  --card: #fffdf8;
  --ink: #17130e;
  --ink-2: #453f36;
  --muted: #7b7264;
  --rule: #e5dccb;
  --rule-2: #cfc3ae;
  --accent: #17402f;
  --accent-2: #22593f;
  --accent-soft: #e9efe7;
  --fee: #b98a4b;
  --warn: #8a3b2e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 19, 14, .04), 0 8px 24px rgba(23, 19, 14, .05);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration-color: rgba(23, 64, 47, .35); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.012em; margin: 0; }
p { margin: 0; }

.skip {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--card);
  padding: 10px 14px; border-radius: 0 0 8px 0; z-index: 20;
}
.skip:focus { left: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.print-only { display: none; }

/* ---------------------------------------------------------------- header */

.topbar { border-bottom: 1px solid var(--rule); background: rgba(247, 243, 235, .9); }
.topbar-in {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.brand-name { font-family: var(--serif); font-size: 19px; letter-spacing: -0.01em; }
.topbar-note { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ hero */

.hero { padding-top: 40px; padding-bottom: 26px; }
.eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent); font-weight: 600; margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(32px, 6.8vw, 46px);
  line-height: 1.05;
  max-width: 18ch;
  text-wrap: balance;
}
.lede {
  margin-top: 16px; font-size: 16.5px; line-height: 1.6; color: var(--ink-2); max-width: 52ch;
}
.trust {
  list-style: none; padding: 0; margin: 22px 0 0;
  display: grid; gap: 8px;
}
.trust li {
  position: relative; padding-left: 22px; font-size: 13.5px; color: var(--muted);
}
.trust li::before {
  content: ""; position: absolute; left: 2px; top: 7px; width: 9px; height: 9px;
  border: 1.5px solid var(--accent); border-radius: 50%;
}

/* ------------------------------------------------------------------ form */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.formp, .form { padding: 22px 20px 20px; }
.form { display: grid; gap: 20px; }

.field { display: grid; gap: 7px; min-width: 0; }
.field-row { display: grid; gap: 18px; grid-template-columns: 1fr; }

label { font-size: 14px; font-weight: 600; color: var(--ink); }
.optional { font-weight: 400; color: var(--muted); font-size: 12.5px; }

input[type="text"], input[type="date"], select {
  width: 100%; min-height: 50px; padding: 12px 14px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--rule-2); border-radius: 10px;
  appearance: none;
}
input[type="date"] { padding-right: 10px; }
::placeholder { color: #a9a094; opacity: 1; }
input[type="date"]::-webkit-datetime-edit { color: var(--ink); }
input[type="date"]:invalid::-webkit-datetime-edit { color: #a9a094; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%237b7264' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[aria-invalid="true"] { border-color: var(--warn); }

.money-input { position: relative; display: flex; align-items: center; }
.money-input .currency {
  position: absolute; left: 14px; font-size: 20px; font-weight: 600; color: var(--ink-2);
  pointer-events: none;
}
.money-input input { padding-left: 38px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.money-input.suffix .currency { left: auto; right: 16px; font-size: 16px; }
.money-input.suffix input { padding-left: 14px; padding-right: 40px; }

.help { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.error { font-size: 12.5px; color: var(--warn); font-weight: 500; }

.more { border-top: 1px solid var(--rule); padding-top: 16px; }
.more > summary {
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent);
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+"; font-size: 18px; line-height: 1; width: 10px; }
.more[open] > summary::before { content: "–"; }
.more-body { display: grid; gap: 16px; padding-top: 6px; }

.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.check label { font-weight: 500; font-size: 14px; line-height: 1.4; padding-top: 1px; }

button { font: inherit; }

.primary {
  min-height: 54px; width: 100%; border: 0; border-radius: 11px;
  background: var(--accent); color: #f6f2e9; font-size: 16.5px; font-weight: 650; letter-spacing: .01em;
  cursor: pointer; transition: background .15s ease;
}
.primary:hover { background: var(--accent-2); }
.primary:active { transform: translateY(1px); }
.primary.compact { width: auto; min-height: 46px; padding: 0 20px; font-size: 15px; }

.secondary {
  min-height: 46px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font-size: 14.5px; font-weight: 600; cursor: pointer;
}
.secondary:hover { background: var(--accent-soft); }
.quiet {
  min-height: 46px; padding: 10px 4px; border: 0; background: none; color: var(--ink-2);
  font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

.fineprint { font-size: 12px; color: var(--muted); text-align: center; }
.sample-line { text-align: center; margin-top: -6px; }
.sample {
  min-height: 44px; padding: 8px 4px; border: 0; background: none; cursor: pointer;
  font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px;
}
.sample:hover { color: var(--accent); }

/* ---------------------------------------------------------------- result */

.result { padding-top: 36px; }
.result .eyebrow { margin-bottom: 6px; }
.big {
  font-size: clamp(48px, 13.5vw, 74px); line-height: 1; font-weight: 650;
  letter-spacing: -0.045em; font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.result-sub { margin-top: 12px; font-size: 15.5px; color: var(--ink-2); max-width: 46ch; }

.ledger {
  margin: 24px 0 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.led-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-top: 1px solid var(--rule);
}
.led-row:first-child { border-top: 0; }
.led-row dt { color: var(--ink-2); font-size: 14px; }
.led-row dd { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.led-total { border-top: 1px solid var(--rule-2); padding-top: 13px; padding-bottom: 13px; }
.led-total dt { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.led-total dd { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.perday { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.perday b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.basis, .ladder { margin-top: 30px; }
.basis h3, .ladder h3, .letters h3, .pro h3, .explain h3, .faq h2, .sources h2, .explain h2 {
  font-size: 21px; margin-bottom: 10px;
}
.basis p { font-size: 14.5px; color: var(--ink-2); margin-top: 6px; }
.basis-law { font-size: 13.5px; color: var(--muted); }
.basis-days { font-variant-numeric: tabular-nums; }
.caveat {
  margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--fee);
  background: #fbf3e4; font-size: 12.5px; line-height: 1.5; color: #6b4f2a;
}

.ladder-list { list-style: none; margin: 8px 0 0; padding: 0; }
.ladder-list li {
  position: relative; padding: 12px 0 12px 34px; border-top: 1px solid var(--rule);
  font-size: 14px; color: var(--muted);
}
.ladder-list li:last-child { border-bottom: 1px solid var(--rule); }
.ladder-list li::before {
  content: ""; position: absolute; left: 6px; top: 18px; width: 11px; height: 11px;
  border-radius: 50%; border: 1.5px solid var(--rule-2); background: var(--paper);
}
.ladder-list li.done::before { background: var(--rule-2); border-color: var(--rule-2); }
.ladder-list li.now { color: var(--ink); font-weight: 600; }
.ladder-list li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ladder-list li span { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------- letters */

.letters { margin-top: 34px; }
.letters-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; break-after: avoid; page-break-after: avoid; }
.letters-when { font-size: 12.5px; color: var(--muted); }
.tabs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  margin: 12px 0 0; padding: 4px; background: var(--accent-soft); border-radius: 11px;
}
.tab {
  min-height: 44px; padding: 8px 6px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; line-height: 1.2;
}
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.letter {
  margin-top: 12px; padding: 20px 18px; background: #fff;
  border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.letter-subject {
  font-size: 13px; font-weight: 650; color: var(--ink); padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid var(--rule); overflow-wrap: anywhere;
}
.letter-body {
  margin: 0; font-family: var(--sans); font-size: 14px; line-height: 1.62; color: var(--ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere; max-width: 62ch;
}
.letter-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.letter-actions .fineprint { text-align: left; margin: 0; }

/* ------------------------------------------------------------------- pro */

.pro {
  margin-top: 40px; padding: 24px 20px; border-radius: var(--radius);
  background: var(--ink); color: #f2ece0;
}
.pro .eyebrow { color: #a8c6b3; }
.pro h3 { color: #fbf7ee; font-size: 23px; }
.pro p { color: #cfc6b6; font-size: 14px; margin-top: 10px; }
.price-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.price {
  min-height: 56px; border-radius: 10px; border: 1px solid rgba(242, 236, 224, .35);
  background: transparent; color: #f6f2e9; font-size: 17px; font-weight: 650; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.price span { font-size: 11.5px; font-weight: 400; color: #cfc6b6; margin-top: 3px; }
.price:hover { border-color: #f6f2e9; }
.price[aria-pressed="true"] { background: #f6f2e9; color: var(--ink); border-color: #f6f2e9; }
.price[aria-pressed="true"] span { color: var(--ink-2); }
.pro .fineprint { text-align: left; color: #a89f8f; margin-top: 12px; }

.share {
  margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--rule);
  display: grid; gap: 12px; justify-items: start;
}
.share p { font-size: 14px; color: var(--ink-2); }

/* -------------------------------------------------------------- explainer */

.explain, .faq, .sources { padding-top: 44px; }
.explain h2, .faq h2, .sources h2 { font-size: clamp(24px, 5.5vw, 30px); margin-bottom: 18px; }
.steps { display: grid; gap: 18px; }
.steps article { padding: 18px; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; }
.step-n { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .08em; }
.steps h3 { font-size: 18px; margin: 4px 0 6px; }
.steps p { font-size: 14px; color: var(--ink-2); }

.faq details { border-top: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer; list-style: none; min-height: 52px; display: flex; align-items: center;
  justify-content: space-between; gap: 14px; font-size: 15px; font-weight: 600; padding: 12px 0;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 20px; color: var(--muted); line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 0 16px; font-size: 14px; color: var(--ink-2); max-width: 62ch; }

.sources ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.sources li { font-size: 13px; color: var(--muted); line-height: 1.5; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.sources a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid rgba(69, 63, 54, .25); }
.sources a:hover { border-bottom-color: var(--accent); }

.footer { margin-top: 46px; padding: 26px 0 40px; border-top: 1px solid var(--rule); }
.footer p { font-size: 12.5px; color: var(--muted); max-width: 60ch; }
.footer p + p { margin-top: 8px; }

/* -------------------------------------------------------------- responsive */

@media (min-width: 560px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .trust { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .form { padding: 28px 26px; }
  .letter { padding: 26px 26px; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar-note { font-size: 13px; }
  .hero { padding-top: 56px; }
}

@media (max-width: 379px) {
  .price-row { gap: 6px; }
  .price { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ----------------------------------------------------------------- print */

@media print {
  :root { --paper: #fff; --card: #fff; }
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .topbar, .hero, #calc, .explain, .faq, .sources, .pro, .share, .footer, .skip, .tabs, .letter-actions, #copy-note { display: none !important; }
  .print-only { display: block !important; font-size: 10pt; color: #444; margin-bottom: 12pt; border-bottom: 1px solid #bbb; padding-bottom: 6pt; }
  .result { padding: 0; }
  .big { font-size: 34pt; color: #000; }
  .letter, .card { box-shadow: none; border-color: #bbb; }
  .letter { page-break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
