:root {
  --ink: #1d2a24;
  --muted: #5c6862;
  --green: #1f5b45;
  --green-dark: #174536;
  --green-pale: #eaf3ee;
  --gold: #c99a3b;
  --cream: #f7f4ec;
  --white: #ffffff;
  --border: #d8dfda;
  --danger: #a52828;
  --shadow: 0 18px 45px rgba(29, 42, 36, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--green);
  font-weight: 700;
}

a:hover,
a:focus-visible {
  color: var(--green-dark);
}

.wrap {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--green);
  color: var(--white);
}

.header-inner,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-inner {
  min-height: 72px;
}

.brand,
.site-header a {
  color: var(--white);
  font-size: 1.08rem;
  text-decoration: none;
}

.header-label {
  color: #dfece5;
  font-size: 0.9rem;
}

.intro {
  max-width: 790px;
  padding: 68px 0 38px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
legend {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.35rem, 6vw, 4.75rem);
  letter-spacing: -0.045em;
}

h2 {
  margin-top: 0;
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.standfirst {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
  gap: 28px;
  align-items: start;
}

.calculator-panel,
.results-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.calculator-panel {
  padding: clamp(22px, 4vw, 38px);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset + fieldset {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

legend {
  width: 100%;
  margin-bottom: 20px;
  color: var(--green-dark);
  font-size: 1.5rem;
  font-weight: 700;
}

.field-grid,
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.field.full-width {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 7px;
  font-weight: 750;
  line-height: 1.35;
}

.input-with-unit {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #bfc9c3;
  border-radius: 10px;
  background: var(--white);
}

.input-with-unit:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 91, 69, 0.13);
}

.input-with-unit input {
  min-width: 0;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 1rem;
}

.input-with-unit span {
  padding-right: 14px;
  color: var(--muted);
  font-weight: 700;
}

.input-with-unit.unit-before span {
  padding-right: 0;
  padding-left: 14px;
}

.field small,
.result-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

button {
  min-height: 48px;
  padding: 12px 20px;
  border: 2px solid var(--green);
  border-radius: 10px;
  background: var(--green);
  color: var(--white);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.secondary-button {
  background: transparent;
  color: var(--green);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  color: var(--white);
}

.form-error {
  margin: 16px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.results-panel {
  position: sticky;
  top: 24px;
  padding: clamp(22px, 4vw, 32px);
  background: var(--green-dark);
  color: var(--white);
}

.results-panel .eyebrow {
  color: #bcd6c9;
}

.result-grid {
  gap: 12px;
}

.result-card {
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.result-card span,
.result-card strong {
  display: block;
}

.result-card span {
  color: #d4e3db;
  font-size: 0.86rem;
  line-height: 1.35;
}

.result-card strong {
  margin-top: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  line-height: 1.1;
}

.result-card small {
  color: #d4e3db;
}

.featured-result {
  margin-bottom: 12px;
  border-color: rgba(201, 154, 59, 0.65);
  background: rgba(201, 154, 59, 0.16);
}

.featured-result strong {
  color: #f3d593;
  font-size: 2.45rem;
}

details {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

summary {
  font-weight: 800;
  cursor: pointer;
}

details p {
  margin-bottom: 0;
  color: #d4e3db;
  font-size: 0.92rem;
}

.guide-section {
  max-width: 820px;
  padding: 70px 0;
}

.guide-section p {
  color: var(--muted);
}

.notice {
  margin-top: 32px;
  padding: 24px;
  border-left: 5px solid var(--gold);
  border-radius: 4px 12px 12px 4px;
  background: var(--white);
}

.notice h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.notice p {
  margin: 0;
}

footer {
  padding: 28px 0;
  background: #132e24;
  color: #c8d6cf;
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

footer a {
  color: var(--white);
}

@media (max-width: 860px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .results-panel {
    position: static;
  }
}

@media (max-width: 600px) {
  .header-inner,
  .footer-inner,
  .field-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .header-inner,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-inner {
    justify-content: center;
    gap: 2px;
    padding: 14px 0;
  }

  .intro {
    padding-top: 48px;
  }

  .field.full-width {
    grid-column: auto;
  }
}

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