/* Square & Pitch — shared styles
   Palette: galvanized paper, slate ink, chalk-line blue. One accent only. */
:root {
  --paper: #eef1f3;
  --panel: #ffffff;
  --ink: #18242b;
  --slate: #4b5a63;
  --rule: #c5cfd5;
  --chalk: #1f5fbf;
  --chalk-soft: #dfe8f6;
  --warn: #8a4b00;
  --focus: #1f5fbf;
  --radius-s: 4px;
  --radius-m: 10px;
  --measure: 68ch;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--chalk); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

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

/* Header */
.site-head { border-bottom: 1px solid var(--rule); background: var(--paper); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; padding-block: .5rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 760; font-variation-settings: "wdth" 115; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand svg { width: 34px; height: 22px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem 1.25rem; flex-wrap: wrap; }
.site-nav a { color: var(--slate); text-decoration: none; font-size: .95rem; padding: .35rem 0; display: inline-block; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--chalk); }

/* Type */
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); font-weight: 780; font-variation-settings: "wdth" 112; max-width: 22ch; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); font-weight: 720; font-variation-settings: "wdth" 108; margin-top: 2.2em; }
h3 { font-size: 1.15rem; font-weight: 700; margin-top: 1.6em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.2rem; color: var(--slate); max-width: 56ch; }
.num { font-variant-numeric: tabular-nums; }

/* Page intro */
.intro { padding-block: clamp(2rem, 5vw, 3.5rem) 1.5rem; }

/* Tool */
.tool { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.5rem; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: clamp(1rem, 2.5vw, 1.75rem); }
.panel h2 { margin-top: 0; font-size: 1.2rem; font-variation-settings: "wdth" 100; }

fieldset { border: 0; margin: 0 0 1.1rem; padding: 0; min-width: 0; }
legend { font-weight: 650; margin-bottom: .5rem; padding: 0; }
.field { margin-bottom: 1rem; }
.field label, .label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.hint { display: block; color: var(--slate); font-size: .85rem; font-weight: 400; margin-top: .25rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.unit-input { display: flex; align-items: stretch; border: 1px solid var(--slate); border-radius: var(--radius-s); background: #fff; overflow: hidden; }
.unit-input:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.unit-input input, .unit-input select { border: 0; outline: 0; min-width: 0; width: 100%; padding: .6rem .7rem; font: inherit; font-variant-numeric: tabular-nums; background: transparent; color: var(--ink); }
.unit-input span { display: flex; align-items: center; padding: 0 .7rem; color: var(--slate); background: var(--paper); border-left: 1px solid var(--rule); font-size: .9rem; white-space: nowrap; }
select.plain, input.plain { width: 100%; font: inherit; padding: .6rem .7rem; border: 1px solid var(--slate); border-radius: var(--radius-s); background: #fff; color: var(--ink); }

.choices { display: flex; gap: .5rem; flex-wrap: wrap; }
.choices label { display: flex; align-items: center; gap: .45rem; border: 1px solid var(--slate); border-radius: var(--radius-s); padding: .5rem .8rem; cursor: pointer; font-weight: 500; background: #fff; }
.choices input { accent-color: var(--chalk); margin: 0; }
.choices label:has(input:checked) { border-color: var(--chalk); background: var(--chalk-soft); box-shadow: inset 0 0 0 1px var(--chalk); }

input[type="range"] { width: 100%; accent-color: var(--chalk); }

.error { color: var(--warn); font-size: .9rem; margin-top: .3rem; }

/* Results */
.results { position: sticky; top: 1rem; }
.answer { border-bottom: 1px solid var(--rule); padding-bottom: 1rem; margin-bottom: 1rem; }
.answer .big { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 780; font-variation-settings: "wdth" 115; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.answer .big small { font-size: .38em; font-weight: 600; color: var(--slate); font-variation-settings: "wdth" 100; letter-spacing: 0; margin-left: .3em; }
.answer p { margin: .5rem 0 0; color: var(--slate); }
.list { display: grid; grid-template-columns: 1fr auto; margin: 0; }
.list dt, .list dd { padding: .55rem 0; border-bottom: 1px dashed var(--rule); margin: 0; }
.list dd { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.list dt small { display: block; color: var(--slate); font-size: .82rem; }
.next { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .75rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; background: var(--ink); color: #fff; text-decoration: none; border: 0; border-radius: var(--radius-s); padding: .65rem 1rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--chalk); }
.btn.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--slate); }
.btn.quiet:hover { background: var(--chalk-soft); }

/* Roof diagram — the signature: a chalk-line profile with framing-square marks */
.diagram { margin: 0 0 1rem; }
.diagram svg { width: 100%; height: auto; }
.diagram figcaption { font-size: .85rem; color: var(--slate); }
.d-roof { fill: var(--chalk-soft); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.d-wall { fill: none; stroke: var(--slate); stroke-width: 1.5; }
.d-chalk { stroke: var(--chalk); stroke-width: 2; stroke-dasharray: 7 5; fill: none; }
.d-label { font: 600 15px var(--font); fill: var(--ink); }
.d-label.blue { fill: var(--chalk); }
.d-arc { fill: none; stroke: var(--chalk); stroke-width: 1.5; }

/* Article */
.article { max-width: var(--measure); padding-bottom: 3rem; }
.article ul, .article ol { padding-left: 1.25rem; }
.article li { margin-bottom: .4rem; }
.formula { background: var(--panel); border-left: 4px solid var(--chalk); padding: .8rem 1rem; font-variant-numeric: tabular-nums; margin: 0 0 1em; border-radius: 0 var(--radius-s) var(--radius-s) 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; margin: 0 0 1.25em; background: var(--panel); }
caption { text-align: left; font-weight: 650; padding-bottom: .4rem; }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 650; background: var(--paper); }
td.r, th.r { text-align: right; }
.table-scroll { overflow-x: auto; }
.sources { font-size: .9rem; color: var(--slate); }
details { border-bottom: 1px solid var(--rule); padding: .6rem 0; }
summary { cursor: pointer; font-weight: 650; }
details p { margin: .5rem 0 0; }

/* Home */
.hero { padding-block: clamp(2rem, 6vw, 4.5rem) 2rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); }
.pitch-readout { font-size: clamp(3rem, 9vw, 6rem); font-weight: 800; font-variation-settings: "wdth" 120; line-height: .95; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin: 0; }
.pitch-readout span { color: var(--chalk); }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--ink); margin-bottom: 3rem; }
.tools a { display: block; padding: 1.25rem 1.25rem 1.5rem 0; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.tools a + a { padding-left: 1.25rem; border-left: 1px solid var(--rule); }
.tools h2 { margin: 0 0 .35rem; font-size: 1.3rem; }
.tools p { margin: 0; color: var(--slate); font-size: .95rem; }
.tools a:hover h2 { color: var(--chalk); text-decoration: underline; text-underline-offset: .18em; }

/* Ad slots stay collapsed until AdSense is approved */
.ad-slot:empty { display: none; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); padding-block: 2rem; color: var(--slate); font-size: .9rem; }
.site-foot .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.site-foot ul { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; flex-wrap: wrap; }
.site-foot a { color: var(--slate); }

@media (max-width: 820px) {
  .tool, .hero { grid-template-columns: 1fr; }
  .results { position: static; }
  .tools { grid-template-columns: 1fr; }
  .tools a, .tools a + a { padding: 1.1rem 0; border-left: 0; }
}
@media (max-width: 600px) {
  .site-head .wrap { min-height: 0; }
  .site-nav ul { gap: 0 1rem; }
  .site-nav a { font-size: .88rem; padding: .2rem 0; }
}
@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media print {
  .site-head, .site-foot, .next, .ad-slot { display: none; }
  body { background: #fff; }
}
