@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Lexend";
  src: url("/assets/fonts/lexend.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #f3f6f3;
  --mint: #e2ede7;
  --sheet: #ffffff;
  --ink: #0e2b27;
  --muted: #47605b;
  --green: #0f6b5c;
  --green-deep: #0a4a40;
  --forest: #0a3a32;
  --forest-2: #072b25;
  --on-forest: #f3f6f3;
  --on-forest-soft: #bcd3cb;
  --amber: #f2b33d;
  --amber-ink: #2b1f00;
  --line: #c9d6cf;
  --error: #a4262c;
  --lift: 0 1px 2px rgba(10, 58, 50, 0.08), 0 18px 44px -18px rgba(10, 58, 50, 0.38);
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Lexend", "Segoe UI", system-ui, sans-serif;
  --wrap: 72rem;
  --measure: 66ch;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1e1b;
    --mint: #15302b;
    --sheet: #122925;
    --ink: #e7f0eb;
    --muted: #a9c0b9;
    --green: #74d3bf;
    --green-deep: #9be3d2;
    --forest: #072620;
    --forest-2: #041a16;
    --line: #2b4741;
    --error: #ff9a9e;
    --lift: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px -18px rgba(0, 0, 0, 0.7);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 350;
  line-height: 1.65;
}
strong,
b,
th {
  font-weight: 600;
}
img,
svg {
  max-width: 100%;
  height: auto;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--green);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--green-deep);
}
:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
  border-radius: 3px;
}
.skip {
  position: absolute;
  left: -999rem;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--sheet);
  padding: 0.6rem 1rem;
}
.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-head {
  background: var(--forest-2);
  color: var(--on-forest);
}
.site-head .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 2.2rem;
  padding-block: 0.85rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.32rem;
  letter-spacing: -0.02em;
  color: var(--on-forest);
  text-decoration: none;
}
.brand:hover {
  color: var(--on-forest);
}
.brand svg {
  width: 2.15rem;
  height: 2.15rem;
  flex: none;
}
.brand b {
  font-weight: 700;
  color: var(--amber);
}
.site-nav {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  max-width: 100%;
  padding-block: 0.3rem;
  scrollbar-width: none;
}
.site-nav a {
  white-space: nowrap;
  color: var(--on-forest-soft);
  text-decoration: none;
  padding-block: 0.35rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover {
  color: var(--on-forest);
}
.site-nav a[aria-current="page"] {
  color: var(--on-forest);
  border-bottom-color: var(--amber);
}

/* ---------- Hero band ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--forest);
  color: var(--on-forest);
  padding-bottom: 2.6rem;
}
.hero::before {
  content: "";
  position: absolute;
  width: 22rem;
  aspect-ratio: 1;
  right: -12.5rem;
  top: -12rem;
  background: url("/assets/rosette.svg") center / contain no-repeat;
  opacity: 0.45;
  pointer-events: none;
}
@media (min-width: 56rem) {
  .hero::before {
    width: 46rem;
    right: -19rem;
    top: -17rem;
  }
}
.hero > * {
  position: relative;
}
.hero-tool {
  padding-bottom: 8.5rem;
}
.hero a {
  color: var(--on-forest-soft);
}
.hero a:hover {
  color: var(--on-forest);
}

/* ---------- Type ---------- */
h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.1rem, 1.1rem + 4.2vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 17ch;
}
.hero-tool h1 {
  max-width: 22ch;
}
h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.05rem);
  font-weight: 650;
  margin-top: 3.2rem;
}
h3 {
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-top: 1.9rem;
}
p,
ul,
ol {
  margin: 0.9rem 0 0;
}
li + li {
  margin-top: 0.35rem;
}

.crumbs {
  font-size: 0.88rem;
  padding-top: 1.1rem;
  color: var(--on-forest-soft);
}
.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}
.crumbs li + li {
  margin-top: 0;
}
.crumbs li + li::before {
  content: "/";
  margin-right: 0.4rem;
  opacity: 0.5;
}

.page-head {
  padding-top: 1.6rem;
}
.hero > .page-head:first-child {
  padding-top: 2.8rem;
}
.answer {
  max-width: 60ch;
  font-size: 1.05rem;
  margin-top: 1.1rem;
  color: var(--on-forest-soft);
}
@media (min-width: 46rem) {
  .answer {
    font-size: 1.17rem;
  }
}
.checked {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-forest-soft);
  font-size: 0.88rem;
  margin-top: 1.1rem;
}
.checked::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--amber);
}

/* ---------- Calculator panel ---------- */
.tool {
  position: relative;
  display: grid;
  align-items: start;
  background: var(--sheet);
  border-radius: 18px;
  box-shadow: var(--lift);
  margin-top: -6.4rem;
  overflow: hidden;
}
@media (min-width: 56rem) {
  .tool {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  }
}
.tool form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.15rem;
  min-width: 0;
  padding: 1.5rem 1.25rem;
}
@media (min-width: 40rem) {
  .tool form {
    padding: 2.1rem 2.2rem;
  }
}
.field label,
.field .label {
  display: block;
  font-weight: 600;
}
.field .hint {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.1rem;
}
.control {
  display: flex;
  align-items: stretch;
  margin-top: 0.45rem;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  transition: border-color 0.12s, background-color 0.12s;
}
.control:hover {
  border-color: var(--muted);
}
.control:focus-within {
  border-color: var(--green);
  background: var(--sheet);
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
.control .unit {
  display: flex;
  align-items: center;
  padding-inline: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}
.control .unit:first-child {
  border-right: 1.5px solid var(--line);
}
.control input,
.control select {
  flex: 1;
  min-width: 0;
  min-height: 3.2rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: 1.15rem;
  padding: 0.4rem 0.85rem;
  font-variant-numeric: tabular-nums;
}
.control select {
  font-size: 1rem;
}
.control input:focus,
.control select:focus {
  outline: none;
}
.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.15rem;
}
@media (min-width: 30rem) {
  .pair {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
  }
}
.form-error {
  color: var(--error);
  font-weight: 600;
  margin: 0;
}
details.estimator {
  border: 1.5px dashed var(--line);
  border-radius: 11px;
  padding: 0.85rem 1rem;
}
details.estimator summary {
  cursor: pointer;
  font-weight: 600;
}
details.estimator .pair {
  margin-top: 0.9rem;
}

/* The settlement slip: the loud element */
.slip {
  position: relative;
  align-self: stretch;
  background: var(--mint);
  padding: 2.3rem 1.25rem 1.5rem;
}
@media (min-width: 40rem) {
  .slip {
    padding: 2.6rem 2.2rem 2rem;
  }
}
.slip::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12px;
  background: radial-gradient(circle at 9px 0, var(--sheet) 6px, transparent 6.5px) 0 0 / 18px 12px
    repeat-x;
}
@media (min-width: 56rem) {
  .slip::before {
    inset: 0 auto 0 0;
    width: 12px;
    height: auto;
    background: radial-gradient(circle at 0 9px, var(--sheet) 6px, transparent 6.5px) 0 0 / 12px
      18px repeat-y;
  }
}
.slip.is-stale > :not(.slip-title) {
  opacity: 0.4;
}
.slip-title {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}
.slip-total {
  display: inline-block;
  margin: 0.55rem 0 0;
  padding: 0.35rem 0.9rem 0.45rem;
  background: var(--amber);
  color: var(--amber-ink);
  border-radius: 10px;
  font-family: var(--display);
  font-weight: 750;
  font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  transform: rotate(-1.2deg);
  transform-origin: left center;
  box-shadow: 0 10px 22px -12px rgba(120, 80, 0, 0.7);
}
.is-ready .slip-total {
  animation: stamp 0.42s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-5deg) scale(1.12);
  }
}
.slip-lines {
  margin: 1.4rem 0 0;
}
.slip-lines div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.2rem;
  padding: 0.6rem 0;
  border-bottom: 1.5px dotted color-mix(in srgb, var(--muted) 45%, transparent);
}
.slip-lines dt,
.slip-lines dd {
  margin: 0;
}
.slip-lines dd {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.slip-note {
  font-size: 0.96rem;
}
.slip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.2rem;
}
.slip-foot {
  color: var(--muted);
  font-size: 0.84rem;
}
button {
  font: inherit;
  font-weight: 600;
  min-height: 2.9rem;
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  border: 1.5px solid var(--green);
  background: transparent;
  color: var(--green);
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
button:hover {
  background: var(--green);
  color: var(--sheet);
}
.slip-actions button:first-child {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--on-forest);
}
.slip-actions button:first-child:hover {
  background: var(--green);
  border-color: var(--green);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.noscript {
  border-left: 4px solid var(--amber);
  background: var(--paper);
  padding: 0.8rem 1rem;
}

/* ---------- Reading column ---------- */
.prose {
  max-width: none;
  padding-bottom: 4rem;
}
.prose > * {
  max-width: 43rem;
}
.prose > :first-child {
  margin-top: 3rem;
}
.prose h2 {
  padding-top: 0.9rem;
  border-top: 3px solid var(--ink);
}
.prose ol {
  padding-left: 1.3rem;
}
.prose ol li::marker {
  font-family: var(--display);
  font-weight: 700;
  color: var(--green);
}
.table-scroll {
  overflow-x: auto;
  margin-top: 1.1rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
caption {
  text-align: left;
  color: var(--muted);
  padding: 0.75rem 1rem 0.6rem;
  font-size: 0.92rem;
}
th,
td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:last-child td {
  border-bottom: 0;
}
thead th {
  background: var(--mint);
  border-bottom: 0;
  font-size: 0.93rem;
}
td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}
.formula {
  background: var(--forest);
  color: var(--on-forest);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  font-weight: 500;
  border-left: 6px solid var(--amber);
}
.sources li {
  overflow-wrap: anywhere;
}

/* ---------- Tool board ---------- */
.board-title {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  font-size: 1.05rem;
  font-family: var(--body);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 2.2rem;
}
.board-title::after {
  content: "";
  flex: 1;
  border-top: 1.5px solid var(--line);
  transform: translateY(-0.3rem);
}
.board {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
  gap: 0.9rem;
}
.board li {
  margin: 0;
}
.board a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.25rem 1.3rem 1.35rem;
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
}
.board a:hover {
  border-color: var(--forest);
  transform: translateY(-3px);
  box-shadow: 0 14px 26px -18px rgba(10, 58, 50, 0.55);
}
.board .fig {
  font-family: var(--display);
  font-weight: 750;
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--green);
}
.board .fig small {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 0.3rem;
}
.board .cat {
  align-self: flex-start;
  margin-top: auto;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
}
.board .blurb + .cat {
  transform: translateY(0.35rem);
}
.board a.lead .cat {
  color: var(--on-forest-soft);
  border-color: color-mix(in srgb, var(--on-forest-soft) 40%, transparent);
}
.board .name {
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin-top: 1.1rem;
}
.board .blurb {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
  margin: 0.3rem 0 0.9rem;
}
.board .fig {
  white-space: nowrap;
}
.board a.lead {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--on-forest);
}
.board a.lead .fig {
  color: var(--amber);
}
.board a.lead .fig small,
.board a.lead .blurb {
  color: var(--on-forest-soft);
}

/* ---------- Guide list ---------- */
.ledger {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  border-top: 3px solid var(--ink);
}
.ledger li {
  margin: 0;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.2rem 2rem;
}
@media (min-width: 46rem) {
  .ledger li {
    grid-template-columns: 21rem 1fr;
    align-items: baseline;
  }
}
.ledger a {
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}
.ledger p {
  margin: 0;
  color: var(--muted);
}
.home-section {
  padding-bottom: 1rem;
}
.home-section > h2:first-child {
  margin-top: 3.4rem;
}
.home-note {
  padding-bottom: 4rem;
}
.home-note > * {
  max-width: var(--measure);
}

.ad-slot {
  min-height: 280px;
  margin-block: 2rem;
}

/* ---------- Footer ---------- */
.site-foot {
  position: relative;
  overflow: hidden;
  background: var(--forest-2);
  color: var(--on-forest-soft);
  padding-block: 3rem 3.2rem;
  font-size: 0.96rem;
}
.site-foot::before {
  content: "";
  position: absolute;
  width: 34rem;
  aspect-ratio: 1;
  left: -14rem;
  bottom: -20rem;
  background: url("/assets/rosette.svg") center / contain no-repeat;
  opacity: 0.3;
  pointer-events: none;
}
.site-foot .wrap {
  position: relative;
}
.site-foot a {
  color: var(--on-forest-soft);
  text-decoration-color: color-mix(in srgb, var(--on-forest-soft) 40%, transparent);
}
.site-foot a:hover {
  color: var(--on-forest);
}
.foot-grid {
  display: grid;
  gap: 1.8rem 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.site-foot h2 {
  font-size: 1.05rem;
  margin: 0;
  color: var(--on-forest);
}
.site-foot ul {
  list-style: none;
  padding: 0;
  margin: 0.7rem 0 0;
}
.independent {
  max-width: var(--measure);
  margin-top: 2.2rem;
  padding-top: 1.4rem;
  border-top: 1px solid color-mix(in srgb, var(--on-forest-soft) 30%, transparent);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .is-ready .slip-total {
    animation: none;
  }
  .board a,
  .control,
  button {
    transition: none;
  }
  .board a:hover {
    transform: none;
  }
}

@media print {
  .site-head,
  .site-foot,
  .crumbs,
  .tool form,
  .prose,
  .slip-actions,
  .ad-slot,
  .answer,
  .checked,
  .home-section,
  .home-note,
  .hero::before {
    display: none !important;
  }
  body,
  .hero {
    background: #fff;
    color: #000;
  }
  .hero {
    padding-bottom: 1rem;
  }
  .tool {
    display: block;
    margin-top: 0;
    box-shadow: none;
    border: 1px solid #000;
  }
  .slip {
    background: #fff;
  }
  .slip::before {
    display: none;
  }
  .slip-total {
    transform: none;
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
