/* ==========================================================================
   homeenergysums - a calculation sheet, not a landing page.
   Mobile first. The heat loss table is the one element given real
   typographic weight; everything else stays quiet so it can land.
   ========================================================================== */

:root {
  --paper:      #F7F7F4;   /* cool off-white, printed-document stock */
  --paper-sunk: #F1F1ED;   /* form fields, recessed rows */
  --ink:        #1A2330;   /* deep blue-grey, printed ink */
  --ink-soft:   #55616F;
  --ink-faint:  #8A94A0;
  --rule:       #CFD4D1;
  --rule-firm:  #A9B0AC;
  --signal:     #0F5C54;   /* instrument teal, the primary accent */
  --signal-ink: #0A3F39;
  --signal-wash:#E4EEEB;
  --good:       #1F6B52;
  --marginal:   #8A6A1F;
  --bad:        #8C2F2F;

  /* Heat is warm. The second accent is the subject, not decoration:
     it marks escaping heat in the illustrations and nothing else. */
  --heat:       #C2581F;
  --heat-soft:  #E8955A;
  --heat-wash:  #F7E6DA;

  --card:       #FFFFFF;
  --shadow-sm:  0 1px 2px rgba(26, 35, 48, .05), 0 2px 8px rgba(26, 35, 48, .045);
  --shadow-md:  0 2px 4px rgba(26, 35, 48, .05), 0 10px 26px rgba(26, 35, 48, .07);

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --measure: 66ch;
  --gutter: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

/* A class with its own `display` beats the hidden attribute's UA style,
   which silently breaks every conditionally shown block. Settle it once. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

/* The hero wash bleeds past the content column on purpose; it must never
   create a horizontal scrollbar. */
html, body { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(900px 360px at 82% -60px, rgba(232, 149, 90, .10), transparent 70%),
    radial-gradient(760px 320px at 6% 120px, rgba(15, 92, 84, .07), transparent 68%);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  font-feature-settings: "kern" 1;
}

.wrap {
  max-width: 54rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--rule-firm);
  background: var(--paper);
}
.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 18px;
  padding-top: 13px;
  padding-bottom: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: block;
}
.brand-name {
  font: 600 1.0625rem/1 var(--sans);
  letter-spacing: -0.016em;
}
.brand-name b { font-weight: 600; color: var(--signal); }
.brand:hover .brand-name { color: var(--signal-ink); }

.freshness {
  margin: 0;
  font: 400 0.8125rem/1.4 var(--mono);
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------- nav */

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 22px;
  padding-top: 11px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--rule);
}
.nav a {
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 3px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--signal);
}

/* ------------------------------------------------------------------- intro */

/* --------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding: 34px 0 10px;
}
.hero-grid { display: grid; gap: 18px; align-items: center; }

.hero-art {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  margin: 0 auto;
}

/* Warm plumes leaving the house. They drift, slowly, and stop entirely
   for anyone who has asked for reduced motion. */
.plume {
  fill: none;
  stroke: url(#heatGrad);
  stroke-width: 7;
  stroke-linecap: round;
  animation: drift 4.2s ease-in-out infinite;
}
.plume-2 { animation-delay: .55s; }
.plume-3 { animation-delay: 1.1s; }
.plume-4 { animation-delay: 1.6s; }
.plume-5 { animation-delay: 2.1s; }
@keyframes drift {
  0%   { opacity: 0;   transform: translateY(6px)  scaleY(.92); }
  28%  { opacity: .95; }
  100% { opacity: 0;   transform: translateY(-20px) scaleY(1.08); }
}

.hero-band {
  position: absolute;
  inset: -26px calc(50% - 50vw) 36px;
  background:
    radial-gradient(70% 90% at 72% 30%, var(--heat-wash) 0%, transparent 62%),
    radial-gradient(60% 80% at 18% 70%, var(--signal-wash) 0%, transparent 58%);
  opacity: .62;
  z-index: -1;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .plume { animation: none; opacity: .85; }
}

.intro { padding: 40px 0 8px; }

h1 {
  margin: 0 0 18px;
  font: 600 2.125rem/1.12 var(--sans);
  letter-spacing: -0.028em;
  max-width: 24ch;
}
.lead {
  margin: 0 0 14px;
  font-size: 1.1875rem;
  line-height: 1.52;
  max-width: var(--measure);
}
.caveat-inline {
  margin: 0;
  max-width: var(--measure);
  font-size: 0.9375rem;
  line-height: 1.58;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ panels */

.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 26px 20px 30px;
  margin-top: 18px;
}
.panel:first-of-type { margin-top: 22px; }

/* The method panel is reference material, so it stays quieter than the
   panels carrying the reader's own answer. */
.panel.method { background: transparent; box-shadow: none; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 20px;
  font: 600 1.25rem/1.25 var(--sans);
  letter-spacing: -0.018em;
}
.num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--signal-wash);
  color: var(--signal-ink);
  font: 500 0.8125rem/1 var(--mono);
}
.notice .num { background: var(--heat-wash); color: var(--heat); }

h3.sub {
  margin: 30px 0 12px;
  font: 500 0.9375rem/1.3 var(--sans);
  letter-spacing: 0.005em;
  color: var(--ink-soft);
}

/* -------------------------------------------------------------------- form */

.grid { display: grid; gap: 20px; }

.field { margin: 0; display: flex; flex-direction: column; gap: 6px; }

label {
  font: 500 0.9375rem/1.3 var(--sans);
  color: var(--ink);
}
.hint {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-faint);
}
.hint-error { color: var(--bad); }

#postcode { font-family: var(--mono); text-transform: uppercase; }

input, select {
  width: 100%;
  font: 400 1rem/1.4 var(--sans);
  color: var(--ink);
  background: var(--paper-sunk);
  border: 1px solid var(--rule-firm);
  border-radius: 3px;
  padding: 10px 11px;
  min-height: 44px;
}
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
                    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.with-unit { position: relative; display: block; }
.with-unit .unit {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font: 400 0.9375rem/1 var(--mono);
  color: var(--ink-faint);
  pointer-events: none;
}
.with-unit .unit-left { right: auto; left: 12px; }
.with-unit .unit-left ~ input { padding-left: 28px; }

.actions {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
.go {
  font: 500 1rem/1 var(--sans);
  color: #fff;
  background: var(--signal);
  border: 1px solid var(--signal-ink);
  border-radius: 3px;
  padding: 14px 26px;
  min-height: 48px;
  cursor: pointer;
}
.go:hover { background: var(--signal-ink); }
.no-email {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------- headline */

.headline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 10px;
}
.headline-figure {
  margin: 0;
  font: 400 3.5rem/0.95 var(--mono);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--signal);
}
.headline-unit {
  font-size: 1.5rem;
  letter-spacing: 0;
  margin-left: 6px;
  color: var(--ink-soft);
}
.headline-label {
  margin: 0;
  max-width: 40ch;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.headline-label strong { color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------- charts */

.chart-figure { margin: 0 0 6px; }
.chart-figure figcaption {
  margin: 0 0 14px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-faint);
  max-width: var(--measure);
}
.chart { display: block; overflow: visible; }

.chart-axis   { stroke: var(--rule-firm); stroke-width: 1; }
.chart-track  { fill: var(--paper-sunk); }
.chart-bar    { fill: var(--signal); }
.chart-bar-muted { fill: var(--signal); opacity: 0.42; }
.chart-bar-over  { fill: var(--bad); }
.chart-band   { fill: var(--signal); opacity: 0.17; }
.chart-median { stroke: var(--signal); stroke-width: 2; }

/* Text wears text colour, never the data colour. */
.chart text { font-family: var(--sans); }
.chart-label   { font-size: 12.5px; fill: var(--ink); }
.chart-value   { font-family: var(--mono); font-size: 12.5px; font-weight: 500; fill: var(--ink); }
.chart-caption { font-size: 11px; fill: var(--ink-faint); }

.chart-ref       { stroke: var(--ink); stroke-width: 2; }
.chart-ref-label { font-size: 11.5px; font-weight: 500; fill: var(--ink); }

.chart-pin line   { stroke: var(--ink); stroke-width: 2; }
.chart-pin circle { fill: var(--ink); stroke: var(--paper); stroke-width: 2.5; }
.chart-pin-label  { font-size: 12.5px; font-weight: 500; fill: var(--ink); }

.chart-pin-in { animation: pin-drop 520ms cubic-bezier(.22,.9,.3,1) 420ms both; }
@keyframes pin-drop {
  from { opacity: 0; transform: translateY(-9px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 29rem) {
  .chart-label { font-size: 11.5px; }
  .chart-value { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .chart-pin-in { animation: none; }
}

/* --------------------------------------------------- house diagram */

.house-diagram { display: block; width: 100%; height: auto; max-width: 460px; margin: 0 auto 2px; }
/* The house keeps a fixed viewBox, so on a narrow screen the whole
   drawing scales down. Bump the labels back to a readable size. */
.house-sm .house-label { font-size: 17px; }
.house-plume {
  fill: none;
  stroke: url(#heatGrad2);
  stroke-linecap: round;
  animation: drift 4.2s ease-in-out infinite;
}
.house-leader { stroke: var(--rule-firm); stroke-width: 1; }
.house-label  { font-size: 12px; fill: var(--ink); font-weight: 500; }

@media (prefers-reduced-motion: reduce) { .house-plume { animation: none; opacity: .8; } }

/* ------------------------------------------------- the calculation table */

.calc {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.calc caption {
  text-align: left;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-faint);
  padding-bottom: 10px;
  max-width: var(--measure);
}
.calc th, .calc td {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  font-weight: 400;
  font-size: 0.9375rem;
}
.calc thead th {
  font: 500 0.75rem/1.3 var(--sans);
  color: var(--ink-faint);
  border-bottom: 1px solid var(--rule-firm);
  padding-bottom: 7px;
}
.calc th:first-child, .calc td:first-child,
.calc tbody th[scope="row"] { text-align: left; }
.calc td, .calc tfoot th { font-family: var(--mono); }
.calc tbody th[scope="row"] { font-family: var(--sans); padding-right: 14px; }

.calc tfoot .total th {
  font: 500 0.875rem/1.4 var(--sans);
  text-align: left;
  border-bottom: none;
  border-top: 1px solid var(--rule-firm);
  padding-top: 11px;
}
.calc tfoot .total td {
  font-weight: 500;
  border-bottom: none;
  border-top: 1px solid var(--rule-firm);
  padding-top: 11px;
}
.calc tfoot .total:last-child th,
.calc tfoot .total:last-child td { color: var(--signal); }

.calc .num-cell { font-family: var(--mono); }
.calc .emph td, .calc .emph th { font-weight: 500; }
.calc .muted td, .calc .muted th { color: var(--ink-soft); }

.sources th:nth-child(2), .sources td:nth-child(2) { text-align: left; }
.sources td:last-child, .sources th:last-child { text-align: left; font-family: var(--sans); font-size: 0.8125rem; }

.source-note {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-faint);
  max-width: var(--measure);
}

/* -------------------------------------------------------------- break-even */

.breakeven {
  display: grid;
  gap: 14px;
  padding: 6px 0 4px;
  align-items: center;
}
.be-col { }
.be-figure {
  margin: 0 0 4px;
  font: 400 2.75rem/1 var(--mono);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.be-col:first-child .be-figure { color: var(--ink); }
.be-col:last-child .be-figure { color: var(--signal); }
.be-label {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.be-vs {
  font: 500 0.8125rem/1 var(--sans);
  color: var(--ink-faint);
  padding: 2px 0;
}

.verdict {
  margin: 18px 0 0;
  padding: 13px 15px;
  border-left: 3px solid var(--rule-firm);
  background: var(--paper-sunk);
  font-size: 0.9375rem;
  line-height: 1.55;
  max-width: var(--measure);
}
.verdict.is-good     { border-left-color: var(--good); }
.verdict.is-marginal { border-left-color: var(--marginal); }
.verdict.is-bad      { border-left-color: var(--bad); }

/* ------------------------------------------------------------- limits, cta */

.notice .num { color: var(--bad); }
.next-step { font-size: 0.9375rem; color: var(--ink-soft); }

.warnings, .limits-list {
  margin: 0 0 20px;
  padding-left: 20px;
  max-width: var(--measure);
}
.warnings li, .limits-list li {
  margin-bottom: 10px;
  font-size: 0.9375rem;
  line-height: 1.55;
}
.warnings li { color: var(--bad); }
.limits-list li { color: var(--ink-soft); }

.next {
  margin: 0 0 20px;
  max-width: var(--measure);
  font-size: 1rem;
}

.quote-cta {
  display: inline-block;
  font: 500 1rem/1 var(--sans);
  color: #fff;
  background: var(--signal);
  border: 1px solid var(--signal-ink);
  border-radius: 3px;
  padding: 14px 24px;
  text-decoration: none;
}
.cta-pending {
  margin: 0;
  padding: 13px 15px;
  background: var(--paper-sunk);
  border-left: 3px solid var(--rule-firm);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.method-steps {
  margin: 0 0 8px;
  padding-left: 22px;
  max-width: var(--measure);
}
.method-steps li { margin-bottom: 10px; font-size: 0.9375rem; line-height: 1.55; }

/* ------------------------------------------------------------------ footer */

.footer {
  border-top: 1px solid var(--rule-firm);
  margin-top: 46px;
  padding-top: 26px;
  padding-bottom: 54px;
}
.footer p {
  margin: 0 0 12px;
  max-width: var(--measure);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.footer .small { font-size: 0.8125rem; color: var(--ink-faint); }
.disclosure { color: var(--ink-soft); }

.footer-cols {
  display: grid;
  gap: 24px;
  margin-bottom: 26px;
}
.footer-cols h2 {
  margin: 0 0 9px;
  font: 500 0.8125rem/1.3 var(--sans);
  color: var(--ink);
}
.footer-cols ul { margin: 0; padding: 0; list-style: none; }
.footer-cols li { margin-bottom: 6px; }
.footer-cols a,
.footer a {
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.footer-cols a:hover,
.footer a:hover { color: var(--signal); border-bottom-color: var(--signal); }

.footer-legal {
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}

@media (min-width: 40rem) {
  .footer-cols { grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
}

/* ------------------------------------------------------------------ motion */

#results:not([hidden]) { animation: settle 0.34s ease-out both; }
@keyframes settle {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #results:not([hidden]) { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------- wider views */

@media (min-width: 40rem) {
  :root { --gutter: 32px; }
  h1 { font-size: 2.75rem; }
  .panel { padding: 30px 28px 34px; }
  .hero { padding-top: 48px; }
  .hero-grid { grid-template-columns: 1.08fr .92fr; gap: 36px; }
  .hero-art { max-width: 100%; }
  .grid { grid-template-columns: 1fr 1fr; gap: 22px 28px; }
  .field-wide { grid-column: 1 / -1; max-width: 22rem; }
  .intro { padding-top: 56px; }
  .headline { flex-direction: row; align-items: baseline; gap: 20px; }
  .headline-figure { font-size: 4.25rem; }
  .headline-label { padding-bottom: 7px; }
  .breakeven { grid-template-columns: auto auto auto; gap: 26px; justify-content: start; }
  .be-vs { align-self: center; padding-bottom: 18px; }
  .actions { flex-direction: row; align-items: center; gap: 20px; }
}

@media (min-width: 60rem) {
  h1 { font-size: 3rem; }
}
