:root {
  --bg: #f3efe6;
  --bg-elev: #fffdf8;
  --ink: #1c1915;
  --muted: #3e392f;
  --line: #ddd4c4;
  --pine: #1c4a38;
  --pine-deep: #123528;
  --gold: #8a6230;
  --focus: #0b4f9c;
  --danger: #8d1d1d;
  --ad: #ebe4d6;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img { max-width: 100%; }

a {
  color: var(--pine-deep);
  text-underline-offset: 0.16em;
}

a:hover { color: var(--pine); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-150%);
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 0.8rem;
  z-index: 10;
}

.skip:focus { transform: none; }

.wrap {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  background: var(--pine-deep);
  color: #f6f3ec;
}

.site-header a { color: #f6f3ec; }

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand svg { width: 1.8rem; height: 1.8rem; flex: none; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.nav a {
  text-decoration: none;
  font-size: 0.95rem;
}

.nav a[aria-current="page"] { text-decoration: underline; }

.page {
  padding: 1.5rem 0 3rem;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 4vw, 3.1rem); margin: 0.2rem 0 0.6rem; }

h2 { font-size: 1.55rem; margin: 2rem 0 0.6rem; }

h3 { font-size: 1.15rem; margin: 1.2rem 0 0.4rem; }

.lede, .prose p { max-width: 42rem; }

.lede { font-size: 1.15rem; color: var(--muted); margin-top: 0; }

.crumb {
  margin: 0;
  font-size: 0.92rem;
}

.crumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.crumb li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--gold);
}

.calc-layout {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0 0.5rem;
}

.result-card,
.form-card,
.panel,
.card,
.affiliate,
.flag {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.form-card,
.result-card,
.affiliate,
.flag { padding: 1rem 1rem 1.15rem; }

.field { margin-bottom: 0.9rem; }

label,
.field-label {
  display: block;
  font-weight: 650;
  margin-bottom: 0.25rem;
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

input,
select,
button {
  font: inherit;
  color: inherit;
}

input,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #b7ad9c;
  border-radius: 8px;
  background: #fff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

button,
.button {
  min-height: 2.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.45rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.primary {
  background: var(--pine);
  color: #f6f3ec;
}

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

.result-card h2 { margin-top: 0; }

.hero-number {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.8rem);
  margin: 0.2rem 0;
  font-variant-numeric: tabular-nums;
}

.positive { color: var(--pine-deep); }
.negative { color: var(--danger); }

dl.figures { margin: 0; }
dl.figures div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
dl.figures dt { color: var(--muted); }
dl.figures dd { margin: 0; font-weight: 650; text-align: right; }

.table-scroll { overflow-x: auto; margin: 0.8rem 0 1rem; }

table:empty,
#province-note:empty { display: none; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev);
}

th, td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { font-size: 0.88rem; color: var(--muted); font-weight: 650; }

.note, .error, .assumptions {
  font-size: 0.95rem;
}

.error {
  color: var(--danger);
  font-weight: 650;
  min-height: 1.4em;
}

.assumptions summary { cursor: pointer; font-weight: 650; }
.assumptions p { margin: 0.4rem 0; }

.ad-slot {
  margin: 1rem 0;
  min-height: 5.5rem;
  border: 1px dashed #b7ad9c;
  background: var(--ad);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.ad-slot__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.affiliate h2 { margin-top: 0; }

.card-grid {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.8rem;
}

.card {
  display: block;
  padding: 1rem 1.05rem 1.1rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.card h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.card p { margin: 0; color: var(--muted); }

.card:hover { border-color: var(--pine); }

.other-list { padding-left: 1.1rem; }

.flag { margin: 0.7rem 0; }
.flag h3 { margin-top: 0; }

.prose a { font-weight: 650; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
}

@media (min-width: 720px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .calc-layout { grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr); align-items: start; }
  .result-card { position: sticky; top: 1rem; }
  .card-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media print {
  .site-header, .ad-slot, .affiliate, .actions, .site-footer { display: none; }
  body { background: #fff; }
  .form-card, .result-card { box-shadow: none; }
}
