:root {
  --green: #81c241;
  --green-dark: #3d7412;
  --forest: #1c2619;
  --moss: #2b3827;
  --paper: #f4efe3;
  --paper-2: #ebe4d3;
  --ink: #1d241b;
  --muted: #555c4e;
  --rule: #1d241b;
  --hair: #cfc7b3;
  --rust: #b4511b;
  --amber: #d9a441;
  --white: #fffdf8;
  --header-h: 76px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
}

img, svg { max-width: 100%; display: block; }
h1, h2, h3, p, ul, ol, dl, dd, figure, address { margin: 0; padding: 0; }
ul, ol { list-style: none; }
address { font-style: normal; }
a { color: var(--green-dark); text-underline-offset: 3px; }

h1, h2, .big, .chapter-num, .stats dt, .element-sym {
  font-family: var(--serif); font-weight: 700; line-height: 1.05; letter-spacing: -0.015em;
}
h1 { font-size: clamp(2.6rem, 7vw, 5rem); }
h1 em { font-style: italic; font-weight: 500; color: var(--green-dark); }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h3 { font-size: 1.05rem; font-weight: 900; line-height: 1.3; }
.big { font-size: clamp(1.6rem, 3vw, 2.1rem); }

:focus-visible { outline: 3px solid var(--green-dark); outline-offset: 3px; }

.container { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--white); color: var(--ink); padding: .6rem 1rem;
}
.skip-link:focus { top: 1rem; }

.kicker {
  font-size: .78rem; font-weight: 900; letter-spacing: .2em; text-transform: uppercase;
  color: var(--green-dark); margin-bottom: 1.1rem;
}
.lead { font-size: 1.2rem; line-height: 1.6; }

/* Buttons: square, with a hard offset shadow */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .95rem 1.6rem; border: 2px solid var(--ink);
  font: 900 .85rem/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-solid { background: var(--green); color: var(--ink); }
.btn-line { background: var(--white); color: var(--ink); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* Top bar + header */
.topbar { background: var(--forest); color: rgba(255, 255, 255, .8); font-size: .82rem; }
.topbar-inner { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; }
.topbar-links { display: flex; gap: 1.5rem; }
.topbar a { color: var(--green); font-weight: 700; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper); border-bottom: 2px solid var(--rule);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand img { width: 40px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; text-transform: uppercase; }
.brand-name { font-weight: 900; letter-spacing: .22em; font-size: 1.05rem; }
.brand-sub { font-size: .6rem; letter-spacing: .3em; margin-top: .25rem; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: 1.6rem; margin-left: auto; }
.site-nav a {
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: .92rem;
  padding: .3rem 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--green); }
.site-nav .nav-cta {
  background: var(--ink); color: var(--paper); padding: .6rem 1.1rem; border: 0;
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
}
.site-nav .nav-cta:hover { background: var(--green-dark); }
.menu-toggle {
  display: none; margin-left: auto; background: none; border: 2px solid var(--ink);
  padding: .5rem .9rem; font: 900 .8rem var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); cursor: pointer;
}

/* Hero: paper with contour lines, ridge line along the bottom */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(8rem, 16vw, 12rem);
  background:
    repeating-radial-gradient(ellipse 60% 80% at 88% 18%, transparent 0 34px, rgba(61, 116, 18, .13) 34px 35.5px),
    repeating-radial-gradient(ellipse 70% 50% at 4% 96%, transparent 0 42px, rgba(61, 116, 18, .09) 42px 43.5px),
    var(--paper);
}
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: clamp(2rem, 6vw, 5rem); }
.hero h1 { max-width: 12ch; }
.hero-lead { margin-top: 1.6rem; font-size: 1.2rem; max-width: 50ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: 2.2rem; }

.element {
  width: clamp(210px, 24vw, 290px); aspect-ratio: 1 / 1.08;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto auto;
  padding: 1.2rem 1.4rem; background: var(--forest); color: var(--paper);
  border: 2px solid var(--ink); box-shadow: 10px 10px 0 var(--green);
  transform: rotate(3deg);
}
.element-num { font-weight: 900; font-size: 1.5rem; }
.element-mass { text-align: right; font-size: .95rem; opacity: .7; padding-top: .35rem; }
.element-sym { grid-column: 1 / -1; align-self: center; font-size: clamp(5rem, 10vw, 7.5rem); color: var(--green); line-height: .9; }
.element-name { grid-column: 1 / -1; font-weight: 900; letter-spacing: .25em; text-transform: uppercase; }
.element-note { grid-column: 1 / -1; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin-top: .3rem; }

.ridge { position: absolute; left: 0; bottom: -1px; width: 100%; height: clamp(80px, 12vw, 160px); }
.ridge-far { fill: #7b8c70; }
.ridge-near { fill: var(--forest); }

/* Stats band */
.band { background: var(--forest); color: var(--paper); padding: 1rem 0 clamp(3rem, 6vw, 4.5rem); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.stats > div { padding: .5rem 1.75rem; border-left: 1px solid rgba(255, 255, 255, .22); }
.stats > div:first-child { padding-left: 0; border-left: 0; }
.stats dt { font-size: clamp(2.2rem, 4vw, 3.2rem); color: var(--green); }
.stats dd { font-size: .95rem; line-height: 1.5; margin-top: .6rem; color: rgba(255, 255, 255, .82); }

/* Chapters: numbered label on the left, reading column on the right */
.chapter { padding: clamp(3.5rem, 8vw, 6.5rem) 0; border-top: 2px solid var(--rule); }
.band + .chapter { border-top: 0; }
.chapter-alt { background: var(--paper-2); }
.chapter-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(2rem, 6vw, 5.5rem); }
.chapter-head { position: sticky; top: calc(var(--header-h) + 2rem); align-self: start; }
.chapter-num {
  display: block; font-size: 5.5rem; line-height: .9; color: transparent;
  -webkit-text-stroke: 2px var(--green-dark); margin-bottom: .8rem;
}
.chapter-head h2 { font-size: 2rem; }
.chapter-head p { color: var(--muted); margin-top: .5rem; font-size: .98rem; line-height: 1.5; }
.chapter-body { max-width: 760px; }
.chapter-body > * + * { margin-top: 1.2rem; }
.chapter-body > h3 { margin-top: 2.6rem; padding-top: 1.4rem; border-top: 1px solid var(--hair); text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; }
.chapter-body > .big { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-top: 0; padding: 0; border: 0; text-transform: none; letter-spacing: -0.015em; }

.entry { counter-reset: entry; columns: 2; column-gap: 2.5rem; }
.entry li {
  counter-increment: entry; break-inside: avoid;
  display: flex; gap: .9rem; padding: .7rem 0; border-bottom: 1px solid var(--hair);
}
.entry li::before { content: counter(entry, decimal-leading-zero); font-weight: 900; color: var(--green-dark); font-size: .85rem; padding-top: .15rem; }

/* Result scale */
.scale { margin-top: 2.6rem; }
.scale h3, .callout h3 { text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; }
.scale-bar { display: grid; grid-template-columns: 1fr 1fr 1.3fr; margin-top: 1rem; border: 2px solid var(--rule); }
.zone { padding: 1.1rem 1.2rem 1.3rem; border-top: 12px solid; background: var(--white); }
.zone + .zone { border-left: 2px solid var(--rule); }
.zone strong { display: block; font-family: var(--serif); font-size: 1.3rem; line-height: 1.2; }
.zone span { display: block; font-size: .92rem; line-height: 1.5; margin-top: .4rem; color: var(--muted); }
.zone-low { border-top-color: var(--green); }
.zone-mid { border-top-color: var(--amber); }
.zone-high { border-top-color: var(--rust); }
.scale-note { font-size: .92rem; color: var(--muted); margin-top: .8rem; }

.callout {
  margin-top: 2.6rem; padding: 1.6rem 1.8rem; background: var(--forest); color: var(--paper);
  border-left: 10px solid var(--green);
}
.callout h3 { color: var(--green); margin-bottom: .6rem; }

.pair { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--rule); margin-top: 2rem; background: var(--white); }
.pair > div { padding: 1.5rem 1.6rem; }
.pair > div + div { border-left: 2px solid var(--rule); }
.pair h3 { font-family: var(--serif); font-size: 1.35rem; margin-bottom: .5rem; }

.ticks li { position: relative; padding: .7rem 0 .7rem 2rem; border-bottom: 1px solid var(--hair); }
.ticks li::before {
  content: ""; position: absolute; left: .2rem; top: 1.15rem;
  width: .8rem; height: .45rem; border-left: 3px solid var(--green-dark); border-bottom: 3px solid var(--green-dark);
  transform: rotate(-45deg);
}

/* Mitigation (dark chapter) */
.chapter-dark { background: var(--forest); color: var(--paper); border-top: 0; }
.chapter-dark .chapter-num { -webkit-text-stroke-color: var(--green); }
.chapter-dark .chapter-head p { color: rgba(255, 255, 255, .7); }
.how { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; margin-top: 2.4rem; }
.steps { counter-reset: step; }
.steps li {
  counter-increment: step; position: relative;
  padding: 0 0 1.6rem 3.4rem; border-left: 2px solid rgba(255, 255, 255, .25); margin-left: 1.1rem;
}
.steps li:last-child { padding-bottom: 0; border-left-color: transparent; }
.steps li::before {
  content: counter(step); position: absolute; left: -1.2rem; top: -.2rem;
  width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  background: var(--green); color: var(--ink); font-weight: 900;
}
.steps h3 { font-family: var(--serif); font-size: 1.3rem; }
.steps p { color: rgba(255, 255, 255, .78); margin-top: .25rem; font-size: 1rem; line-height: 1.55; }

.diagram { background: var(--paper); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--green); padding: 1rem; }
.diagram svg { width: 100%; height: auto; }
.d-soil { fill: #d9cdb2; }
.d-house { fill: var(--white); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.d-slab { fill: #a9ad9f; }
.d-window { fill: #dbe7cf; stroke: var(--ink); stroke-width: 3; }
.d-pipe { fill: none; stroke: var(--green-dark); stroke-width: 9; stroke-linejoin: round; }
.d-fan { fill: var(--green); stroke: var(--green-dark); stroke-width: 4; }
.d-gas circle { fill: var(--rust); opacity: .8; }
.d-arrow path { fill: none; stroke: var(--rust); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 7; }
.d-arrow path:last-child { stroke-dasharray: none; }
.d-label { font: 700 13px var(--sans); fill: var(--ink); }

/* FAQ */
.faq > details { margin: 0; border-bottom: 1px solid var(--rule); }
.faq > details:first-child { border-top: 2px solid var(--rule); }
.faq summary {
  list-style: none; cursor: pointer; position: relative;
  padding: 1.25rem 3rem 1.25rem 0; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; line-height: 1.3;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  font: 400 2rem/1 var(--sans); color: var(--green-dark);
}
.faq details[open] summary::after { content: "\2212"; }
.faq details p { padding: 0 3rem 1.5rem 0; }
.source { font-size: .9rem; color: var(--muted); margin-top: 2rem; }

/* About */
.about {
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(7rem, 14vw, 11rem);
  border-top: 2px solid var(--rule);
  background:
    repeating-radial-gradient(ellipse 70% 60% at 0% 10%, transparent 0 38px, rgba(61, 116, 18, .11) 38px 39.5px),
    var(--paper-2);
}
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.about h2 { max-width: 16ch; margin-bottom: 1.4rem; }
.creds { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 2.2rem; border-top: 2px solid var(--rule); }
.creds li { padding: 1rem 1rem 0 0; font-size: .9rem; color: var(--muted); }
.creds strong { display: block; font-family: var(--serif); font-size: 1.4rem; color: var(--ink); line-height: 1.2; }
.area { background: var(--white); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 1.8rem; }
.area h3 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: .5rem; }
.towns { columns: 2; margin-top: 1.2rem; }
.towns li { padding: .45rem 0 .45rem 1.4rem; position: relative; border-bottom: 1px dashed var(--hair); break-inside: avoid; }
.towns li::before {
  content: ""; position: absolute; left: 0; top: .85rem;
  border: 6px solid transparent; border-bottom: 10px solid var(--green); border-top: 0;
}

/* Contact */
.contact { position: relative; background: var(--forest); color: var(--paper); padding: 1rem 0 clamp(3.5rem, 8vw, 6rem); }
.ridge-top { bottom: auto; top: 0; transform: translateY(-99%); }
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.contact .kicker { color: var(--green); }
.contact h2 { max-width: 14ch; margin-bottom: 1rem; }
.contact .lead { color: rgba(255, 255, 255, .82); }
.contact-list { margin-top: 2rem; }
.contact-list li { display: grid; grid-template-columns: 7rem 1fr; align-items: baseline; padding: .8rem 0; border-top: 1px solid rgba(255, 255, 255, .2); }
.contact-label { font-size: .72rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.contact-list a { color: var(--green); font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.contact-list a:hover { text-decoration: underline; }

.form { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: 10px 10px 0 var(--green); padding: clamp(1.4rem, 3vw, 2.2rem); display: grid; gap: 1.1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.field label { display: block; font-weight: 900; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .4rem; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--white);
  border: 2px solid var(--ink); border-radius: 0; padding: .7rem .85rem;
}
.field textarea { resize: vertical; min-height: 8rem; display: block; }
.field input:focus, .field textarea:focus { outline: 3px solid var(--green); outline-offset: 0; }
.field-error { display: none; color: var(--rust); font-size: .85rem; font-weight: 700; margin-top: .3rem; }
.field.invalid .field-error { display: block; }
.field.invalid input, .field.invalid textarea { border-color: var(--rust); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .btn { justify-self: start; }
.form-status { font-weight: 700; }
.form-status:empty { display: none; }
.form-status.ok { color: var(--green-dark); }
.form-status.err { color: var(--rust); }

/* Footer */
.site-footer { background: var(--forest); color: rgba(255, 255, 255, .7); border-top: 1px solid rgba(255, 255, 255, .15); padding: 1.5rem 0; font-size: .88rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.social { display: flex; gap: 1.5rem; }
.social a { color: var(--paper); text-decoration: none; font-weight: 700; }
.social a:hover { color: var(--green); }

/* Responsive */
@media (max-width: 1020px) {
  .menu-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 2px solid var(--rule); padding: .5rem 1.25rem 1.25rem;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .85rem 0; border-bottom: 1px solid var(--hair); }
  .site-nav .nav-cta { margin-top: 1rem; text-align: center; padding: .9rem; }
  .chapter-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .chapter-head { position: static; display: grid; grid-template-columns: auto 1fr; column-gap: 1.2rem; align-items: end; }
  .chapter-num { grid-row: span 2; font-size: 4.5rem; margin: 0; }
  .how, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .diagram { max-width: 460px; }
}

@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; }
  .element { width: 190px; justify-self: start; margin-left: .5rem; }
  .element-sym { font-size: 4.5rem; }
  .stats { grid-template-columns: 1fr 1fr; row-gap: 2rem; }
  .stats > div { padding: 0 1rem 0 0; border: 0; }
  .scale-bar, .pair { grid-template-columns: 1fr; }
  .zone + .zone, .pair > div + div { border-left: 0; border-top: 2px solid var(--rule); }
  .zone + .zone { border-top-width: 12px; }
  .entry { columns: 1; }
  .topbar-inner > span:first-child { display: none; }
  .topbar-inner { justify-content: center; }
}

@media (max-width: 520px) {
  .header-inner { gap: .75rem; }
  .brand { gap: .55rem; min-width: 0; }
  .brand img { width: 32px; }
  .brand-name { font-size: .88rem; letter-spacing: .14em; }
  .brand-sub { font-size: .5rem; letter-spacing: .18em; white-space: nowrap; }
  .menu-toggle { padding: .45rem .7rem; flex-shrink: 0; }
  .field-row { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; }
  .creds { grid-template-columns: 1fr; }
  .contact-list li { grid-template-columns: 1fr; gap: .1rem; }
  .faq summary { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
