:root {
  color-scheme: light;
  --bg: #d7e1dc;
  --surface: #fbfcfa;
  --surface-soft: #e6eee8;
  --ink: #172019;
  --muted: #5f6c63;
  --line: #cbd8cf;
  --primary: #184f37;
  --primary-2: #286a4b;
  --accent: #315f7d;
  --warn: #9b3d2d;
  --shadow: 0 14px 35px rgba(23, 33, 27, 0.1);
  --radius: 8px;
  --container: 940px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --heading-font: "Sora", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #ccd9d4 0%, #dce6e1 360px, #d1ded8 100%),
    var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  z-index: 20;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.site-header {
  background: #20382d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #eef5ef;
}

.nav,
.footer-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dce8df;
  color: #20382d;
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: rgba(238, 245, 239, 0.72);
  font-size: 0.95rem;
}

nav a,
.footer-inner a {
  text-decoration: none;
}

nav a:hover,
.footer-inner a:hover {
  color: #fff;
}

.hero {
  position: relative;
  padding: 1.4rem 0 1.7rem;
  background:
    linear-gradient(135deg, rgba(24, 79, 55, 0.022) 25%, transparent 25%) 0 0 / 32px 32px,
    linear-gradient(225deg, rgba(49, 95, 125, 0.02) 25%, transparent 25%) 0 0 / 32px 32px,
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.12) 46%, rgba(255, 255, 255, 0) 78%),
    linear-gradient(180deg, #d4e1da 0%, #c7d7d0 100%);
  border-bottom: 1px solid rgba(23, 32, 25, 0.11);
}

.page-shell {
  display: grid;
  gap: 0.75rem;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 1.25rem;
  align-items: start;
}

.hero-copy {
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}

.calculator-intro {
  padding: 0.65rem 0.7rem 0.35rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--primary-2);
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  font-family: var(--heading-font);
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  line-height: 1.02;
  margin: 0;
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1.12;
  margin: 0 0 0.8rem;
}

h3 {
  margin: 0 0 0.6rem;
  font-size: 1.08rem;
  line-height: 1.25;
}

.hero-lede,
.section-heading p,
.content-block p,
.prose p {
  color: var(--muted);
  font-size: 0.86rem;
  max-width: 720px;
}

.hero-lede {
  margin: 0.45rem auto 0;
  line-height: 1.45;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
}

.button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.button.ghost:hover,
.icon-button:hover {
  border-color: var(--primary);
}

.calculator-card,
.results-card,
.faq-list details {
  background: var(--surface);
  border: 1px solid rgba(212, 222, 214, 0.95);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(23, 33, 27, 0.07);
}

.section {
  padding: 3.25rem 0;
}

.section-heading {
  margin-bottom: 1.5rem;
}

.calculator-shell {
  max-width: 680px;
  margin-inline: auto;
  padding: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(252, 254, 252, 0.96), rgba(244, 248, 245, 0.94)),
    var(--surface);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.78) inset,
    0 22px 62px rgba(23, 33, 27, 0.13);
}

.calculator-card,
.results-card {
  padding: 0.62rem;
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}

.results-card h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.55rem;
}

label > span:not(.money-field) {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 750;
}

small {
  color: var(--muted);
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.42rem 0.62rem;
  background: #fff;
  color: var(--ink);
}

.money-field,
.percent-field {
  position: relative;
  display: block;
  margin-bottom: 0;
}

.money-field::before {
  content: "$";
  position: absolute;
  left: 0.68rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
  pointer-events: none;
}

.money-field input {
  padding-left: 1.45rem;
}

.percent-field::after {
  content: "%";
  position: absolute;
  right: 0.68rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
  pointer-events: none;
}

.percent-field input {
  padding-right: 1.5rem;
}

.help-tip {
  position: relative;
  width: 0.98rem;
  height: 0.98rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--primary);
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1;
  cursor: help;
}

.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  width: min(230px, 72vw);
  transform: translateX(-50%) translateY(0.25rem);
  border: 1px solid rgba(24, 34, 28, 0.1);
  border-radius: var(--radius);
  background: #17211b;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(43, 111, 159, 0.28);
  outline-offset: 2px;
}

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

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.check-row input {
  width: 1rem;
  height: 1rem;
  min-height: auto;
}

.check-row span {
  margin: 0;
}

.form-alert {
  min-height: 1.5rem;
  margin: 0.45rem 0 0;
  color: var(--warn);
  font-weight: 700;
}

.payment-total {
  display: block;
  color: var(--primary);
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  line-height: 1;
  font-weight: 850;
  margin: 0;
}

.payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.45rem 0 0.75rem;
}

.download-icon-button {
  min-width: 3.7rem;
  min-height: 2rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  padding: 0.25rem 0.48rem;
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1;
}

.download-icon-button small {
  color: inherit;
  font-size: 0.62rem;
  font-weight: 800;
}

.download-icon-button:hover {
  border-color: var(--primary);
  background: var(--surface-soft);
}

.calculate-button,
.edit-button {
  width: 100%;
  margin-top: 0.45rem;
}

.is-hidden {
  display: none !important;
}

.result-list {
  display: grid;
  gap: 0.42rem;
  margin: 0;
}

.result-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.42rem;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

dd {
  margin: 0;
  font-weight: 800;
  font-size: 0.86rem;
  text-align: right;
}

.result-tip {
  width: 0.9rem;
  height: 0.9rem;
  font-size: 0.58rem;
}

.stacked-bar {
  display: flex;
  height: 28px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.result-breakdown {
  width: 100%;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

#principalBar {
  width: 75%;
  background: var(--primary);
}

#interestBar {
  width: 25%;
  background: var(--accent);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
}

.principal-dot {
  background: var(--primary);
}

.interest-dot {
  background: var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap.is-collapsed {
  display: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

caption {
  text-align: left;
  color: var(--muted);
  padding: 0 0 0.7rem;
}

th,
td {
  padding: 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.faq-list p {
  color: var(--muted);
}

.prose {
  max-width: 760px;
}

.content-section {
  padding-top: 4rem;
  background:
    linear-gradient(180deg, rgba(32, 56, 45, 0.06), rgba(32, 56, 45, 0) 210px);
}

.content-panel {
  max-width: 820px;
  margin-inline: auto;
  padding: clamp(1.35rem, 4vw, 3rem);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 248, 0.94)),
    var(--surface);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 24px 70px rgba(23, 32, 25, 0.14);
}

.content-panel h2 {
  max-width: 680px;
  margin-top: 2.45rem;
  margin-bottom: 0.65rem;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
}

.content-panel h2:first-of-type {
  margin-top: 0;
}

.content-panel p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.02rem;
}

.content-panel p + p {
  margin-top: 0.85rem;
}

.content-panel .eyebrow {
  color: var(--primary);
}

.faq-list {
  margin-top: 2.75rem;
  padding-top: 2.1rem;
  border-top: 1px solid rgba(24, 79, 55, 0.16);
}

.faq-list details {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(24, 79, 55, 0.13);
  background: transparent;
  box-shadow: none;
}

summary {
  cursor: pointer;
  color: #20382d;
  font-size: 1.02rem;
  font-weight: 820;
  line-height: 1.35;
}

.faq-list p {
  margin-bottom: 0.2rem;
  font-size: 0.98rem;
}

.site-footer {
  border-top: 1px solid rgba(235, 229, 215, 0.18);
  color: rgba(250, 247, 239, 0.76);
  background: #123f30;
}

.footer-inner {
  min-height: auto;
  display: block;
  padding: clamp(2rem, 5vw, 3.5rem) 0 1.25rem;
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid rgba(250, 247, 239, 0.16);
}

.footer-top p {
  max-width: 580px;
  margin: 0.4rem 0 0;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  font-weight: 800;
}

.footer-directory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: clamp(1.2rem, 3vw, 2rem);
  padding: 1.6rem 0;
}

.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.42rem;
}

.footer-column a {
  color: rgba(250, 247, 239, 0.76);
  font-size: 0.9rem;
  line-height: 1.35;
}

.footer-column a:hover {
  color: #fff;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(250, 247, 239, 0.16);
}

.footer-links a {
  color: rgba(250, 247, 239, 0.78);
  font-size: 0.92rem;
}

.footer-links a:hover {
  color: #fff;
}

.page-shell {
  padding: clamp(2.5rem, 7vw, 5rem) 0;
}

.page-panel {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(1.4rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.92);
  box-shadow: 0 24px 70px rgba(26, 45, 40, 0.12);
}

.page-panel h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.page-panel h2 {
  margin-top: 2rem;
}

.page-panel p,
.page-panel li {
  color: var(--text);
  line-height: 1.75;
}

.page-panel a {
  color: var(--accent-strong);
}

@media (max-width: 900px) {
  .two-column {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .container {
    width: min(100% - 1rem, var(--container));
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.75rem 0;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .hero {
    padding: 2rem 0 1.75rem;
  }

  .section {
    padding: 2.35rem 0;
  }

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

  .calculator-card,
  .results-card {
    padding: 0.95rem;
  }

  .calculator-shell {
    padding: 0.35rem;
  }

  .calculator-intro {
    padding: 1rem 0.8rem 0.55rem;
  }

  .icon-button {
    width: 100%;
  }

  .footer-inner {
    padding: 1rem 0;
  }

  .footer-top {
    flex-direction: column;
  }

  .footer-directory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .footer-directory {
    grid-template-columns: 1fr;
  }
}

@media print {
  .site-header,
  .hero,
  .calculator-section,
  .guide-section,
  .faq,
  .site-footer {
    display: none !important;
  }

  .section {
    padding: 0;
  }

  .table-wrap.is-collapsed {
    display: block;
  }
}
