@font-face {
  font-family: "Bricolage Grotesque";
  src: url("polices/bricolage-grotesque.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("polices/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #f7f4ed;
  --ink: #121e33;
  --muted: #4b5866;
  --coral: #fc6e50;
  --coral-dark: #ab3826;
  --sage: #e7eee5;
  --rule: #aeb7ad;
  --heading-font: "Bricolage Grotesque", system-ui, sans-serif;
  --bs-body-font-family: "DM Sans", system-ui, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-link-color-rgb: 18, 30, 51;
  --bs-link-hover-color-rgb: 158, 49, 32;
  --bs-border-color: var(--rule);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 1.0625rem;
}

main { flex: 1; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 1.25rem; }
::selection { background: #f7ae98; color: var(--ink); }

h1, h2, h3, .brand {
  font-family: var(--heading-font);
  font-weight: 780;
  letter-spacing: -.032em;
}

h1 { margin: 0; font-size: clamp(2.85rem, 6vw, 5.65rem); line-height: .98; }
h2 { font-size: clamp(1.85rem, 4vw, 3.2rem); line-height: 1.08; }
h3 { font-size: 1.55rem; line-height: 1.15; }
p { margin-block: 0 1rem; }
a { text-underline-offset: .23em; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
.btn-check:focus-visible + .btn {
  outline: 3px solid #146852;
  outline-offset: 3px;
}

.shell { width: min(1184px, calc(100% - 4rem)); margin-inline: auto; }
.skip-link { position: absolute; z-index: 2; top: .5rem; left: .5rem; padding: .6rem 1rem; background: white; }
.skip-link:not(:focus) { clip-path: inset(50%); }
.site-header { border-bottom: 1px solid var(--rule); }

.site-nav, .footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 2rem;
  min-height: 74px;
}

.site-nav nav, .footer-top nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .15rem clamp(.8rem, 3.6vw, 3.1rem);
}

.site-nav nav a, .footer-top nav a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.site-nav nav a:hover, .footer-top nav a:hover { text-decoration: underline; }
.site-nav nav a[aria-current] { text-decoration: underline; text-decoration-color: var(--coral-dark); text-decoration-thickness: 2px; }

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: .68rem;
  font-size: 1.7rem;
  line-height: 1;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover { color: inherit; }
.brand-mark {
  position: relative;
  flex: 0 0 32px;
  height: 32px;
  overflow: hidden;
  background: var(--coral);
}

.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.brand-mark::before {
  inset: 12px -2px -2px 7px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  transform: skewY(-14deg);
}

.brand-mark::after {
  width: 21px;
  height: 21px;
  top: -1px;
  right: -1px;
  border: 2px solid white;
  border-top: 0;
  border-right: 0;
  border-bottom-left-radius: 100%;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, .98fr) minmax(0, 1.02fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.75rem);
  padding-block: clamp(2.5rem, 5.2vw, 4.75rem);
}

.home-main { display: flex; flex-direction: column; }
.home-hero h1 { font-size: clamp(2.85rem, 6vw, 5.1rem); }
.home-hero h1 span { display: block; }
.intro { max-width: 60ch; margin-top: 1.25rem; font-size: clamp(1.125rem, 1.9vw, 1.42rem); line-height: 1.45; }
.home-hero .intro { max-width: 34ch; margin-bottom: 1.8rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.4rem; }
.text-link { color: inherit; font-weight: 700; }
.text-link span, .guide-links span { white-space: nowrap; }
.hero-photo { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; object-position: 45% center; background: var(--ink); }

.btn-primary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--coral);
  --bs-btn-border-color: var(--coral);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: #ff8b70;
  --bs-btn-hover-border-color: #ff8b70;
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: #f88c73;
  --bs-btn-active-border-color: #f88c73;
  --bs-btn-focus-shadow-rgb: 20, 104, 82;
  --bs-btn-padding-x: 1.15rem;
  --bs-btn-padding-y: .75rem;
  --bs-btn-font-weight: 700;
  --bs-btn-border-radius: .38rem;
  min-height: 46px;
}

.home-clauses { border-top: 1px solid var(--ink); padding-block: 2.65rem 3.5rem; }
.home-clauses h2, .guide-band h2 { margin-bottom: 1.9rem; }
.clause-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.clause-grid section { padding-inline: clamp(1rem, 3vw, 2rem); }
.clause-grid section:first-child { padding-inline-start: 0; }
.clause-grid section:last-child { padding-inline-end: 0; }
.clause-grid section + section { border-inline-start: 1px solid var(--rule); }
.clause-grid h3 { margin: .55rem 0 .45rem; }
.clause-grid p { max-width: 34ch; margin: 0; color: var(--muted); }

.clause-icon { display: block; position: relative; height: 38px; width: 44px; color: var(--coral-dark); }
.clause-icon::before, .clause-icon::after { content: ""; position: absolute; }
.icon-coins::before, .icon-coins::after { border: 2px solid currentColor; border-radius: 50%; width: 25px; height: 15px; }
.icon-coins::before { top: 3px; left: 13px; box-shadow: 0 5px var(--paper), 0 7px currentColor; }
.icon-coins::after { top: 16px; left: 1px; background: var(--paper); box-shadow: 0 5px var(--paper), 0 7px currentColor; }
.icon-credit::before { inset: 8px 2px 3px 0; border: 2px solid currentColor; border-radius: 4px; }
.icon-credit::after { top: 9px; bottom: 4px; left: 15px; border-left: 2px dashed currentColor; }
.icon-wallet::before { inset: 9px 3px 3px 0; border: 2px solid currentColor; border-radius: 4px; }
.icon-wallet::after { right: 0; top: 16px; width: 16px; height: 12px; border: 2px solid currentColor; border-radius: 4px; background: var(--paper); }

.guide-band { flex: 1; display: grid; align-content: center; padding-block: 2.8rem 3.2rem; background: var(--sage); }
.guide-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.guide-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 62px;
  padding: 1rem 1.2rem;
  border: 1px solid var(--ink);
  border-radius: .34rem;
  color: inherit;
  font-family: var(--heading-font);
  font-size: clamp(1.18rem, 2vw, 1.48rem);
  font-weight: 750;
  text-decoration: none;
}

.guide-links a:hover { background: #dbe7da; }
.site-footer { background: var(--ink); color: var(--paper); padding-block: 1.55rem 1.35rem; }
.footer-top { justify-content: flex-start; min-height: 44px; }
.footer-top nav { padding-left: 1.8rem; border-left: 1px solid #7d8997; }
.site-footer p { margin: .9rem 0 0; font-size: .87rem; color: #d6dee8; }
.site-footer p a { color: inherit; white-space: nowrap; }
.site-footer a:focus-visible { outline-color: #ace8d6; }

.page-body { padding-block: clamp(1.8rem, 4vw, 3.4rem) 3.5rem; }
.page-heading { margin-bottom: clamp(1.5rem, 3vw, 2.4rem); }
.page-heading h1 { font-size: clamp(2.65rem, 6.2vw, 5.4rem); }
.page-heading .intro { margin-bottom: 0; }
.article-page .page-heading h1 { font-size: clamp(2.45rem, 5.2vw, 4.35rem); }
.article-page .page-heading h1::after { content: ""; display: block; width: 2.9rem; height: .27rem; background: var(--coral); margin-top: .68rem; }
.breadcrumb { margin-bottom: .95rem; font-size: .9rem; --bs-breadcrumb-divider: "›"; }

.reading-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 29%); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.reading-layout article > section + section { margin-top: 2.2rem; }
.reading-layout article h2 { font-size: clamp(1.55rem, 3vw, 2.2rem); margin-bottom: .65rem; }
.reading-layout article h3 { margin-top: 1.6rem; }
.reading-layout article p { max-width: 72ch; }
.reading-layout article li + li { margin-top: .6rem; }
.reading-aside { background: var(--sage); padding: 1.35rem; border-top: 4px solid var(--coral); font-size: .97rem; }
.reading-aside h2 { font-size: 1.38rem; }
.reading-aside ul, .source-list { list-style: none; padding: 0; margin: 0; }
.reading-aside li + li { margin-top: .5rem; }
.reading-aside nav { padding-bottom: 1.3rem; margin-bottom: 1.15rem; border-bottom: 1px solid var(--rule); }
.reading-aside a { display: inline-block; padding-block: .25rem; }
.clause-table { --bs-table-bg: transparent; font-size: .98rem; margin-bottom: 0; }
.clause-table thead { --bs-table-bg: var(--sage); }
.clause-table th, .clause-table td { padding: .65rem .75rem; vertical-align: top; }
.clause-table tbody th { width: 31%; hyphens: auto; }
.example-table { margin-bottom: .9rem; }
.example-table thead { --bs-table-bg: #d8e4d8; }
.note, .assumptions { background: var(--sage); border-radius: .45rem; padding: clamp(1rem, 3vw, 1.6rem); }
.note p:last-child, .assumptions p:last-child { margin-bottom: 0; }
.method-steps { padding-left: 1.55rem; }
.source-list li { padding-block: .3rem .7rem; border-bottom: 1px solid var(--rule); }
.source-list a { font-weight: 700; }
.source-list p { margin: .3rem 0 0; color: var(--muted); }

.sim-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; }
.sim-form { padding: clamp(1rem, 2.7vw, 1.6rem); border: 1px solid #c2c9bf; border-radius: .65rem; background: #fffdfa; }
.scenario-choice { margin-bottom: 1.15rem; }
.scenario-choice legend, .form-label { font-size: .96rem; font-weight: 700; }
.scenario-options { display: grid; grid-template-columns: 1fr 1fr; gap: .18rem; padding: .24rem; border-radius: .5rem; background: var(--sage); }
.scenario-options .btn { display: flex; align-items: center; justify-content: center; min-height: 44px; line-height: 1.2; }
.scenario-options .btn-check:checked + .btn { background: #cbdccb; border-color: #91a491; font-weight: 700; }
.scenario-options .btn:hover { background: #d6e4d5; }
.sim-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.sim-fields .form-label { margin-bottom: .35rem; }
.sim-fields .form-control, .sim-fields .form-select, .sim-fields .input-group-text {
  min-height: 44px;
  border-color: #78857e;
  background-color: white;
  color: var(--ink);
}
.sim-fields .input-group-text { background-color: #f1f3ed; }
.sim-fields .form-control.is-invalid { border-color: var(--coral-dark); }
.invalid-feedback { color: #9e3120; }
.field-note { margin: .85rem 0; color: var(--muted); font-size: .92rem; }
.reset-button { min-height: 44px; font-weight: 700; text-decoration: underline; }

.result-panel { display: flex; flex-direction: column; background: var(--ink); color: #f8f7f3; border-radius: .65rem; padding: clamp(1rem, 2.6vw, 1.6rem); }
.result-panel h2 { display: flex; align-items: center; gap: .7rem; font-size: 1.38rem; letter-spacing: -.02em; color: #ff967c; }
.result-panel h2::after { content: ""; height: 1px; flex: 1; background: #697789; }
.result-panel h2:focus-visible { outline: 2px solid #ace8d6; outline-offset: 4px; }
.result-totals { margin: 1.2rem 0; display: grid; gap: .65rem; }
.result-totals div { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.result-totals dt { font-weight: 500; }
.result-totals dd, .outcome-net strong { font-family: var(--heading-font); font-size: 1.72rem; font-weight: 780; line-height: 1.05; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.result-totals dd { margin: 0; }
#result-values, .outcomes { display: flex; flex: 1; flex-direction: column; }
.outcomes { border: 1px solid #697789; border-radius: .45rem; }
.outcome { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: center; gap: .7rem 1rem; padding: .85rem; }
.outcome + .outcome { border-top: 1px solid #697789; }
.outcome h3 { font-size: 1.03rem; letter-spacing: 0; margin: 0 0 .28rem; }
.outcome p { font-size: .9rem; margin: 0; color: #dbe4ee; }
.outcome p + p { margin-top: .35rem; }
.outcome-net { border-left: 1px solid #697789; padding-left: .7rem; min-width: 5.4rem; text-align: right; }
.outcome-net strong { display: block; color: white; margin-top: .3rem; }
.assumptions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 1.2rem; align-items: center; margin-top: 1.4rem; }
.assumptions h2 { font-size: 1.4rem; margin: 0; }
.assumptions > div { border-left: 1px solid var(--rule); padding-left: 1.15rem; }
.assumptions p { margin-bottom: .4rem; font-size: .97rem; }

@media (max-width: 960px) {
  .home-hero h1 { font-size: clamp(2.5rem, 6vw, 3.95rem); }
  .sim-layout { grid-template-columns: 1fr 1fr; }
  .sim-fields { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .shell { width: calc(100% - 2rem); }
  .site-nav, .footer-top { flex-wrap: wrap; justify-content: flex-start; }
  .site-nav { padding-top: .38rem; gap: 0 1.45rem; }
  .site-nav nav a { font-size: .98rem; }
  .brand { font-size: 1.45rem; }
  .brand-mark { flex-basis: 29px; height: 29px; }
  .home-hero { grid-template-columns: minmax(0, 1fr); padding-block: 2rem 2.3rem; gap: 1.45rem; }
  .home-hero h1 { font-size: clamp(2.5rem, 11.8vw, 3.7rem); }
  .hero-photo { aspect-ratio: 5 / 3; object-position: center 62%; }
  .home-hero .intro { margin-top: .95rem; margin-bottom: 1.1rem; }
  .home-clauses { padding-block: 1.9rem 2.5rem; }
  .clause-grid, .guide-links, .reading-layout, .sim-layout, .assumptions { grid-template-columns: minmax(0, 1fr); }
  .clause-grid section { padding-inline: 0; padding-block: .65rem 1rem; }
  .clause-grid section + section { border-inline-start: 0; border-top: 1px solid var(--rule); padding-top: 1.05rem; }
  .clause-grid section:last-child { padding-bottom: 0; }
  .guide-band { padding-block: 2rem; }
  .home-clauses h2, .guide-band h2 { margin-bottom: 1.25rem; }
  .footer-top { gap: .25rem 1.1rem; }
  .footer-top nav { border: 0; padding-left: 0; }
  .reading-layout article p { max-width: 65ch; }
  .clause-table th, .clause-table td { padding: .52rem; overflow-wrap: break-word; }
  .assumptions { gap: .65rem; }
  .assumptions > div { border: 0; padding: 0; }
}

@media (max-width: 375px) {
  .outcome { grid-template-columns: minmax(0, 1fr); }
  .outcome-net { border-left: 0; padding: 0; text-align: left; }
  .outcome-net strong { display: inline; margin-left: .35rem; }
  .scenario-options .btn { font-size: .9rem; }
}

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