@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --green-900: #14541f;
  --green-800: #1c6428;
  --green-500: #50d800;
  --green-300: #96d159;
  --green-100: #ccf0c7;
  --green-050: #edf8eb;
  --ink: #182117;
  --muted: #6e7870;
  --line: #c7d3c5;
  --soft: #f6f7f5;
  --gray-panel: #eaece9;
  --purple: #634fe5;
  --white: #ffffff;
  --shadow: 0 16px 40px -12px rgba(20, 84, 31, 0.12);
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background: var(--white);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--white); }

body { margin: 0; min-width: 320px; background: var(--white); }

button, input { font: inherit; }

button { color: inherit; }

.shell { width: min(1200px, calc(100% - 40px)); margin-inline: auto; }

.site-header { background: var(--green-900); }

.header-inner {
  width: min(1200px, calc(100% - 40px));
  min-height: 88px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  width: 206px;
  display: block;
  text-decoration: none;
}

.brand img { width: 100%; height: auto; display: block; }

.context-pill {
  padding: 10px 14px;
  color: var(--green-100);
  border: 1px solid rgba(204, 240, 199, 0.35);
  background: rgba(204, 240, 199, 0.08);
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.intro { padding-block: 58px 34px; }

.partner-logo { width: 188px; height: 50px; object-fit: contain; object-position: left center; display: block; margin-bottom: 14px; }

.accent { width: 82px; height: 14px; margin-bottom: 14px; background: var(--green-500); border-radius: 14px 0 14px 0; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--purple);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, .breakdown summary strong { font-family: "Space Grotesk", sans-serif; }

h1 {
  max-width: 930px;
  margin: 0;
  color: var(--green-900);
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.03;
  letter-spacing: -.03em;
}

.intro-copy { max-width: 760px; margin: 20px 0 0; color: rgba(24, 33, 23, .7); font-size: 16px; line-height: 1.65; }

.calculator { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 24px; align-items: start; padding-bottom: 64px; }

.input-card, .results-card { background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }

.input-card { padding: 28px; display: flex; flex-direction: column; gap: 14px; }

h2 { margin: 0; color: var(--green-900); font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }

.section-copy { margin: 8px 0 0; color: rgba(24, 33, 23, .62); font-size: 13px; line-height: 1.55; }

.input-list, .constants-body { display: flex; flex-direction: column; gap: 10px; }

.field-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  background: var(--green-050);
  border: 1px solid var(--line);
}

.field-row.highlight { background: var(--green-100); border-color: var(--green-300); }

.field-row label { color: var(--green-900); font-size: 13px; line-height: 1.25; font-weight: 600; }

.input-control { position: relative; }

.input-control input {
  width: 100%; height: 38px; padding: 0 30px 0 10px;
  color: var(--green-900); background: var(--white);
  border: 2px solid var(--line); border-radius: 0;
  font-size: 15px; font-weight: 600; text-align: right;
  appearance: textfield;
}

.input-control input::-webkit-outer-spin-button, .input-control input::-webkit-inner-spin-button { appearance: none; margin: 0; }

.highlight .input-control input { border-color: var(--green-300); }

.input-control input:focus { outline: 3px solid rgba(80, 216, 0, .2); border-color: var(--green-800); }

.unit { position: absolute; right: 10px; top: 50%; translate: 0 -50%; pointer-events: none; color: var(--green-900); font-size: 13px; font-weight: 600; }

.constants { background: var(--gray-panel); border: 1px solid #b8bfb5; }

.constants summary, .breakdown summary { list-style: none; cursor: pointer; }
.constants summary::-webkit-details-marker, .breakdown summary::-webkit-details-marker { display: none; }

.constants summary { min-height: 58px; padding: 10px 14px 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.constants summary span:first-child, .breakdown summary span:first-child { display: flex; flex-direction: column; }

.constants summary strong { color: #404a3d; font-family: "Space Grotesk", sans-serif; font-size: 14px; }
.constants summary small { color: rgba(64, 74, 61, .65); font-size: 11px; line-height: 1.5; }
.summary-icon { font-size: 20px; transition: transform .2s ease; }
.constants[open] .summary-icon { transform: rotate(45deg); }
.constants-body { padding: 0 10px 10px; }
.constants-body .field-row { background: #f4f5f3; }

.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.button { min-height: 42px; padding: 10px 12px; border: 1px solid var(--green-900); cursor: pointer; font-size: 13px; font-weight: 600; }
.button-primary { color: var(--white); background: var(--green-900); }
.button-primary:hover { background: var(--green-800); }
.button-secondary { color: var(--green-900); background: var(--white); }
.button-secondary:hover { background: var(--green-050); }
.share-status { min-height: 18px; margin: -4px 0 0; color: var(--green-800); font-size: 12px; }

.results-card { min-width: 0; border: 0; }

.savings-hero { padding: 28px 32px; color: var(--white); background: var(--green-900); }
.hero-eyebrow { color: var(--green-300); margin-bottom: 8px; }

.formula-value { position: relative; appearance: none; padding: 0; color: inherit; background: transparent; border: 0; cursor: help; text-align: inherit; font-weight: inherit; }
.formula-value::after {
  content: attr(data-formula);
  position: absolute; z-index: 20; right: 0; bottom: calc(100% + 10px);
  width: min(330px, 82vw); padding: 12px 14px;
  color: var(--ink); background: var(--white); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(20, 84, 31, .18);
  font-size: 12px; line-height: 1.5; font-weight: 500; text-align: left; white-space: pre-line;
  opacity: 0; visibility: hidden; pointer-events: none; translate: 0 4px; transition: opacity .15s ease, translate .15s ease;
}
.formula-value:hover::after, .formula-value:focus-visible::after { opacity: 1; visibility: visible; translate: 0; }
.formula-value:focus-visible { outline: 2px solid var(--green-500); outline-offset: 4px; }

.hero-value { display: block; margin: 0; font-family: "Space Grotesk", sans-serif; font-size: clamp(46px, 6vw, 62px); line-height: 1; font-weight: 700; letter-spacing: -.035em; }
.hero-copy { margin: 10px 0; color: rgba(204, 240, 199, .78); font-size: 14px; line-height: 1.5; }
.hero-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.share-bar { height: 10px; margin-top: 14px; background: rgba(255, 255, 255, .16); }
.share-bar span { display: block; width: 75%; height: 100%; background: var(--green-500); }

.breakdown { border: 1px solid var(--line); border-top: 0; }
.breakdown > summary { min-height: 88px; padding: 20px 28px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.breakdown summary strong { color: var(--green-900); font-size: 24px; line-height: 1.2; }
.breakdown summary small { margin-top: 6px; color: rgba(24, 33, 23, .62); font-size: 12px; line-height: 1.5; }
.chevron { width: 10px; height: 10px; margin: 7px 2px 0 0; border-top: 2px solid var(--green-900); border-left: 2px solid var(--green-900); transform: rotate(45deg); transition: transform .2s ease; }
.breakdown:not([open]) .chevron { transform: rotate(225deg); margin-top: 2px; }

.table-scroll { padding: 0 28px 24px; overflow-x: auto; }
.cost-table { min-width: 700px; display: flex; flex-direction: column; gap: 10px; }
.cost-row { min-height: 56px; display: grid; grid-template-columns: minmax(178px, 1.2fr) repeat(3, minmax(160px, 1fr)); align-items: stretch; }
.cost-row:not(.cost-header) { background: var(--soft); }
.cost-row:nth-child(3) { background: var(--green-050); }
.cost-row.total-row { color: var(--green-900); background: var(--green-100); border: 1px solid var(--green-300); font-size: 14px; font-weight: 600; }
.cost-label { display: flex; align-items: center; padding: 0 12px; color: rgba(24, 33, 23, .78); font-size: 13px; font-weight: 500; }
.total-row .cost-label { color: var(--green-900); font-weight: 600; }
.cost-header { min-height: 58px; color: rgba(24, 33, 23, .52); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.cost-header .cost-label { align-items: flex-end; padding-bottom: 10px; color: inherit; font-size: 11px; }
.cost-group { min-width: 0; display: grid; grid-template-columns: minmax(82px, 1fr) 72px; align-items: stretch; }
.cost-group.is-collapsed { grid-template-columns: 1fr; }
.cost-group.is-collapsed [data-per-house] { display: none; }
.group-heading { display: flex; flex-direction: column; }
.group-toggle { min-height: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 8px; color: inherit; background: transparent; border: 0; cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.group-toggle::after { content: ''; width: 7px; height: 7px; border-top: 1.5px solid currentColor; border-left: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }
.group-heading.is-collapsed .group-toggle::after { transform: rotate(225deg); }
.subheadings { flex: 1; display: grid; grid-template-columns: minmax(82px, 1fr) 72px; }
.group-heading.is-collapsed .subheadings { grid-template-columns: 1fr; }
.group-heading.is-collapsed [data-per-house] { display: none; }
.subheading { display: flex; align-items: center; justify-content: flex-end; padding: 0 8px 6px; }
.subheading[data-per-house] { color: var(--muted); }
.value-cell { width: 100%; display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; color: rgba(24, 33, 23, .78); font-size: 13px; font-weight: 500; white-space: nowrap; }
.saving-cell { color: var(--green-900); font-weight: 600; }
.value-cell[data-per-house] { color: var(--muted); }
.total-row .value-cell { font-weight: 600; }
.value-cell::after { bottom: calc(100% + 4px); }

.site-footer { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .calculator { grid-template-columns: 1fr; }
  .input-card { width: 100%; }
}

@media (max-width: 640px) {
  .shell, .header-inner { width: min(100% - 24px, 1200px); }
  .header-inner { min-height: 72px; }
  .brand { width: 168px; }
  .context-pill { display: none; }
  .intro { padding-block: 36px 26px; }
  .partner-logo { width: 164px; height: 44px; }
  h1 { font-size: 38px; }
  .intro-copy { margin-top: 16px; font-size: 15px; }
  .calculator { gap: 16px; padding-bottom: 40px; }
  .input-card { padding: 20px 16px; }
  .field-row { grid-template-columns: minmax(0, 1fr) 104px; }
  .form-actions { grid-template-columns: 1fr; }
  .savings-hero { padding: 24px 20px; }
  .hero-value { font-size: 48px; }
  .hero-metrics { gap: 7px; }
  .breakdown > summary { padding: 18px 18px 14px; }
  .breakdown summary strong { font-size: 21px; }
  .table-scroll { padding: 0 16px 18px; }
  .site-footer { flex-direction: column; align-items: flex-start; justify-content: center; padding-block: 18px; }
}

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