:root {
  --ink: #26362f;
  --ink-soft: #626d64;
  --paper: #f7f2e7;
  --surface: #fffdf7;
  --panel: #2b4b3e;
  --panel-strong: #243f34;
  --white: #fffdf7;
  --line: #ddd5c3;
  --green: #397358;
  --green-dark: #2f6049;
  --green-pale: #e4ecdf;
  --orange: #c06a43;
  --orange-pale: #f1dfd1;
  --red: #a84838;
  --shadow: 0 18px 50px rgba(45, 54, 47, 0.10);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f4eddf;
    --ink-soft: #c9c1b1;
    --paper: #171d19;
    --surface: #222922;
    --panel: #2b3d32;
    --panel-strong: #111713;
    --line: #465448;
    --green: #9bc69e;
    --green-dark: #b1d5b1;
    --green-pale: #304238;
    --orange-pale: #49372a;
    --red: #ffb0a9;
    --shadow: 0 18px 50px rgba(0, 0, 0, .32);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--green-dark);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--green);
}

:focus-visible {
  outline: 3px solid #f2a65a;
  outline-offset: 3px;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.site-header .container {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo b {
  color: var(--green);
  font-weight: 800;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 13px;
  flex: 0 0 auto;
}

.main-nav {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 24px;
}

.main-nav a {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.main-nav a:hover {
  color: var(--green);
}

.header-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.header-action:hover {
  background: var(--panel-strong);
  color: var(--white);
}

main {
  padding: 34px 0 72px;
}

.hero {
  min-height: 430px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  align-items: stretch;
  gap: 36px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 54px;
  padding: 54px 0 64px;
}

.hero > div:first-child {
  align-self: center;
  max-width: 650px;
}

.hero h1 {
  max-width: 650px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 6vw, 82px);
  line-height: .98;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.hero h1 span {
  display: block;
  color: var(--green);
  font-style: italic;
  font-weight: 700;
}

.hero-summary {
  max-width: 590px;
  margin-top: 24px;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.55;
}

.hero-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 30px;
}

.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  background: var(--green);
  color: var(--white);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(22,120,74,.16);
}

.btn:hover {
  background: var(--green-dark);
  color: var(--white);
  transform: translateY(-1px);
}

.text-link {
  font-weight: 800;
}

.hero-tools {
  align-self: center;
  border-top: 1px solid var(--ink);
}

.hero-tools a {
  min-height: 104px;
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: end;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: background .18s ease;
}

.hero-tools a:hover {
  background: var(--surface);
  color: var(--ink);
}

.hero-tools span {
  grid-row: 1 / 3;
  align-self: center;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 800;
}

.hero-tools b {
  align-self: end;
  font-size: 20px;
  line-height: 1.15;
}

.hero-tools small {
  align-self: start;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 13px;
}

#calculators,
.guides,
#faq {
  scroll-margin-top: 100px;
}

#calculators {
  padding: 10px 0 58px;
}

#calculators h2,
.section-heading h2,
#faq h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 28px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: var(--surface);
}

.tab-btn {
  min-height: 56px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.tab-btn:last-child {
  border-right: 0;
}

.tab-btn.active {
  background: var(--panel-strong);
  color: var(--white);
  box-shadow: inset 0 -4px 0 var(--green);
}

.tab-panel {
  display: none;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tab-panel.active {
  display: grid;
}

.calc-form {
  display: grid;
  align-content: start;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 32px;
  border-right: 1px solid var(--line);
}

.calc-form h3 {
  grid-column: 1 / -1;
  margin-bottom: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.15;
}

.calc-form label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.calc-form select,
.calc-form input,
.calc-form textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bfc7c0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 12px;
}

.calc-form textarea {
  min-height: 140px;
  resize: vertical;
}

.calc-form select:focus,
.calc-form input:focus,
.calc-form textarea:focus {
  border-color: var(--green);
  outline: 3px solid rgba(57,115,88,.16);
}

.calc-note {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.calc-form .btn {
  grid-column: 1 / -1;
  width: fit-content;
  margin-top: 4px;
}

.result {
  min-width: 0;
  min-height: 100%;
  padding: 32px;
  background: var(--panel-strong);
  color: var(--white);
}

.result-label {
  color: #bdc8d7;
  font-size: 13px;
  font-weight: 800;
}

.result-value {
  margin: 6px 0 24px;
  color: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums lining-nums;
}

.result-breakdown {
  display: grid;
  gap: 0;
  border-top: 1px solid #536174;
}

.result-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #536174;
  padding: 10px 0;
  font-size: 13px;
}

.result-breakdown dt {
  color: #bdc8d7;
}

.result-breakdown dd {
  font-weight: 800;
  text-align: right;
}

.error {
  color: #ffb0a9;
}

.projection {
  margin-top: 16px;
  border-top: 1px solid #536174;
  padding-top: 12px;
  color: var(--white);
}

.projection summary {
  cursor: pointer;
  font-weight: 800;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin-top: 12px;
}

.table-wrap table,
.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums lining-nums;
}

.table-wrap caption {
  margin-bottom: 8px;
  text-align: left;
  font-weight: 800;
}

.table-wrap th,
.table-wrap td {
  border: 1px solid #536174;
  padding: 8px;
  text-align: left;
  white-space: nowrap;
}

.composition {
  height: 10px;
  margin-top: 16px;
  border-radius: 999px;
  background: #536174;
  overflow: hidden;
}

.composition span {
  display: block;
  height: 100%;
  background: #74c695;
  border-radius: 999px;
}

.guides {
  margin-top: 24px;
  border-top: 1px solid var(--ink);
  padding-top: 38px;
}

.section-heading {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: end;
  gap: 40px;
  margin-bottom: 28px;
}

.section-heading p {
  max-width: 430px;
  color: var(--ink-soft);
  font-size: 16px;
}

.guides article {
  max-width: 850px;
  margin: 0 0 64px;
  padding: 34px 0 12px;
  border-top: 1px solid var(--line);
}

.guides article h2 {
  max-width: 760px;
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.guides article h3 {
  margin: 26px 0 8px;
  font-size: 20px;
  line-height: 1.25;
}

.guides article p {
  max-width: 72ch;
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 17px;
}

.table-wrap table.compare th,
.table-wrap table.compare td {
  border-color: var(--line);
  color: var(--ink);
  white-space: normal;
}

.table-wrap table.compare th {
  background: var(--green-pale);
}

#faq {
  max-width: 850px;
  border-top: 1px solid var(--ink);
  padding-top: 38px;
  margin-top: 22px;
}

#faq h2 {
  margin-bottom: 24px;
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item:first-of-type {
  border-top: 1px solid var(--line);
}

.faq-q {
  width: 100%;
  min-height: 68px;
  border: 0;
  background: transparent;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  text-align: left;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.faq-q::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--green);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}

.faq-item.open .faq-q::after {
  content: "−";
}

.faq-a {
  display: none;
  max-width: 72ch;
  padding: 0 48px 20px 0;
  color: var(--ink-soft);
}

.faq-item.open .faq-a {
  display: block;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
  color: #cbd4df;
  padding: 32px 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 20px;
}

.footer-nav a,
.site-footer a {
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.footer-nav a:hover,
.site-footer a:hover {
  text-decoration: underline;
}

.footer-settings {
  border: 0;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.footer-settings:hover {
  text-decoration: underline;
}

.consent-banner {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  left: 20px;
  width: min(940px, calc(100% - 40px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

.consent-banner[hidden] {
  display: none;
}

.consent-copy h2 {
  margin-bottom: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.2;
}

.consent-copy p {
  max-width: 70ch;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.consent-copy a {
  font-size: 13px;
  font-weight: 800;
}

.consent-copy .consent-storage-status {
  color: var(--red);
  font-weight: 700;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.consent-actions .btn {
  min-height: 44px;
  white-space: nowrap;
}

.consent-actions .btn-secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.consent-actions .btn-secondary:hover {
  border-color: var(--green);
  background: var(--green-pale);
  color: var(--ink);
}

.disclaimer {
  max-width: 900px;
  color: #bdc8d7;
  font-size: 12px;
  margin-top: 8px;
}

body > .container > main > h1,
.container > main > h1 {
  max-width: 780px;
  margin: 22px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 7vw, 72px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.container > main > h2 {
  margin: 38px 0 10px;
  font-size: 27px;
  line-height: 1.2;
}

.container > main > p {
  max-width: 72ch;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 16px;
}

@media (max-width: 900px) {
  .container {
    width: min(100% - 32px, 1120px);
  }

  .site-header .container {
    grid-template-columns: auto 1fr;
  }

  .main-nav {
    display: none;
  }

  .header-action {
    justify-self: end;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .tab-panel.active {
    grid-template-columns: 1fr;
  }

  .calc-form {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 24px, 1120px);
  }

  .site-header .container {
    min-height: 68px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .logo {
    font-size: 17px;
  }

  .header-action {
    min-height: 38px;
    padding-inline: 12px;
  }

  main {
    padding-top: 18px;
  }

  .hero {
    min-height: auto;
    gap: 34px;
    margin-bottom: 36px;
    padding: 34px 0 44px;
  }

  .hero h1 {
    font-size: clamp(43px, 14vw, 64px);
  }

  .hero-summary {
    font-size: 16px;
  }

  .hero-links {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-tools a {
    min-height: 88px;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tab-btn {
    min-height: 52px;
    padding-inline: 4px;
    font-size: 12px;
    white-space: normal;
  }

  .calc-form {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .calc-form h3,
  .calc-note,
  .calc-form .btn {
    grid-column: 1;
  }

  .result {
    padding: 24px 18px;
  }

  .result-value {
    font-size: 44px;
  }

  .guides article {
    padding-top: 24px;
  }

  .guides article p {
    font-size: 16px;
  }

  .consent-banner {
    grid-template-columns: 1fr;
    gap: 10px;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: calc(100% - 24px);
    padding: 14px 16px;
  }

  .consent-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .consent-actions .btn {
    min-width: 0;
    padding: 8px;
    font-size: 12px;
    white-space: normal;
  }

  .footer-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .hero-tools a {
    transition: none;
  }
}
