/* Plank & Post. Phone first; wider layouts start at 600px, 720px and 1024px.
   The look comes from the job itself: an estimate worked out on a green engineering pad,
   blueprint blue, a yellow tape measure and pencil graphite. Headings use the DIN-style
   lettering found on tapes and site signs (Bahnschrift on Windows, DIN on Apple devices,
   Roboto Condensed on Android). In dark mode the page turns into a blueprint. */

:root {
  --paper: #edf1e7;      /* engineering pad */
  --card: #fbfcf8;       /* a clean sheet */
  --ink: #252a2e;        /* graphite */
  --ink-2: #4e565d;
  --ink-3: #626a71;
  --line: #d0d8c6;
  --edge: #252a2e;
  --tape: #ffc21a;       /* tape measure */
  --tape-hover: #ffd451;
  --tape-ink: #1d2226;
  --blue: #1d5fbf;       /* blueprint lines and links */
  --header: #1f3550;     /* blueprint */
  --header-ink: #f2f5f8;
  --head-row: #dfe6d5;
  --gutter: 16px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: Bahnschrift, "DIN Alternate", "DIN Condensed", "Roboto Condensed", sans-serif-condensed, "Arial Narrow", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10263d;
    --card: #163252;
    --ink: #eef3f8;
    --ink-2: #bfcddb;
    --ink-3: #93a7bc;
    --line: #2b4a6b;
    --edge: #8aa4bf;
    --blue: #a3c8ff;
    --header: #0a1b2d;
    --head-row: #1c3c60;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
a { color: var(--blue); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; letter-spacing: -0.005em; margin: 0; }
h1 { font-size: clamp(36px, 4.4vw + 18px, 60px); font-stretch: 87.5%; line-height: 1.02; }
h2 { font-size: clamp(25px, 1.4vw + 20px, 34px); }
h3 { font-size: 21px; font-weight: 600; }
p { margin: 0 0 14px; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.skip { position: absolute; left: -999px; top: 0; background: var(--tape); color: var(--tape-ink); padding: 10px 14px; z-index: 60; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- Header and the tape-measure strip ---------- */
/* The header stays with you: it tucks away while you scroll down and comes back as soon as you
   scroll up (site.js). On wide screens Fences, Decks and Guides open a list;
   on phones a Menu button opens everything. */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--header); color: var(--header-ink);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.site-header.is-scrolled { box-shadow: 0 6px 18px rgba(10, 27, 45, 0.3); }
.site-header.is-hidden { transform: translateY(-100%); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font: 700 20px var(--display); white-space: nowrap; }
.logo { width: 30px; height: 30px; flex: none; }

.main-nav { display: flex; align-items: center; }
.main-nav .top {
  position: relative;
  color: var(--header-ink);
  opacity: 0.85;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
/* A yellow bar under the link you point at, and under the section you are in */
.main-nav .top::after {
  content: ""; position: absolute; left: 7px; right: 7px; bottom: 6px; height: 3px;
  background: var(--tape); transform: scaleX(0); transform-origin: left; transition: transform 0.15s ease;
}
.main-nav .top:hover, .main-nav .top.is-active, .nav-item:hover > .top, .nav-item:focus-within > .top { opacity: 1; }
.main-nav .top:hover::after, .main-nav .top.is-active::after, .nav-item:hover > .top::after, .nav-item:focus-within > .top::after { transform: scaleX(1); }
.nav-optional { display: none !important; }
@media (max-width: 359px) {
  .main-nav > :nth-child(3) { display: none; }
}

/* Dropdown lists (wide screens only) */
.nav-item { position: relative; display: inline-flex; }
.nav-menu { display: none; }
.nav-menu a, .mobile-menu .mm-grid a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 6px;
  color: var(--ink); text-decoration: none; font: 600 15px/1.25 var(--sans);
}
.nav-menu a:hover, .nav-menu a:focus-visible, .mobile-menu .mm-grid a:hover { background: rgba(255, 194, 26, 0.22); }
.nav-menu a[aria-current], .mobile-menu .mm-grid a[aria-current] { background: rgba(255, 194, 26, 0.32); }
.nav-ico { flex: none; display: inline-flex; width: 28px; height: 28px; }
.nav-ico svg { width: 100%; height: 100%; }
.nav-badge {
  margin-left: auto; padding: 1px 7px; border-radius: 4px; background: var(--tape); color: var(--tape-ink);
  font: 700 12px/1.5 var(--sans); font-style: normal; white-space: nowrap;
}
.nav-menu .nav-all { grid-column: 1 / -1; margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; color: var(--blue); }

/* The quote checker button */
.nav-cta {
  display: none; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 6px;
  background: var(--tape); color: var(--tape-ink); text-decoration: none; font: 700 15px var(--sans); white-space: nowrap;
}
.nav-cta:hover { background: var(--tape-hover); }

/* The Menu button and the panel it opens (phones and tablets, only when scripts run) */
.menu-btn { display: none; }
.js .menu-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 6px;
  border: 1.5px solid rgba(242, 245, 248, 0.4); background: transparent; color: var(--header-ink); font: 700 15px var(--sans); cursor: pointer;
}
.js .menu-btn[aria-expanded="true"] { background: var(--tape); color: var(--tape-ink); border-color: var(--tape); }
.menu-bars, .menu-bars::before, .menu-bars::after {
  display: block; width: 16px; height: 2px; background: currentColor; transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-bars { position: relative; }
.menu-bars::before, .menu-bars::after { content: ""; position: absolute; left: 0; }
.menu-bars::before { top: -5px; }
.menu-bars::after { top: 5px; }
.menu-btn[aria-expanded="true"] .menu-bars { background: transparent; }
.menu-btn[aria-expanded="true"] .menu-bars::before { transform: translateY(5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-bars::after { transform: translateY(-5px) rotate(-45deg); }
.js .main-nav { display: none; }
.mobile-menu {
  background: var(--card); color: var(--ink); border-bottom: 1.5px solid var(--edge);
  max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain;
}
.site-header .mobile-menu .wrap { display: block; min-height: 0; padding-top: 16px; padding-bottom: 22px; }
.mobile-menu .nav-cta { display: flex; justify-content: center; margin-bottom: 6px; }
.mobile-menu h2 { font: 700 15px var(--sans); color: var(--ink-3); margin: 18px 0 6px; }
.mm-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
@media (min-width: 520px) { .mm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Wide screens: the full navigation with its dropdowns, and the quote button */
@media (min-width: 900px) {
  .js .menu-btn, .mobile-menu { display: none !important; }
  .js .main-nav, .main-nav { display: flex; margin-left: auto; }
  .nav-cta { display: inline-flex; margin-left: 12px; }
  .nav-menu {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px;
    position: absolute; top: 100%; right: max(var(--gutter), env(safe-area-inset-right)); min-width: 300px; padding: 10px;
    background: var(--card); border: 1.5px solid var(--edge); border-radius: 8px; box-shadow: 0 18px 40px rgba(10, 27, 45, 0.28);
    opacity: 0; visibility: hidden; transition: opacity 0.12s ease, visibility 0.12s;
    z-index: 40;
  }
  .nav-menu.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 560px; }
  /* Menus line up with the right edge of the header, under the links, so they never run off the screen.
     The invisible strip on top bridges the gap from the link, so the menu stays open on the way down. */
  .site-header .wrap { position: relative; }
  .nav-item { position: static; }
  .nav-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -24px; height: 24px; }
  .nav-item:hover .nav-menu, .nav-item:focus-within .nav-menu { opacity: 1; visibility: visible; }
}

.tape {
  height: 14px;
  background:
    repeating-linear-gradient(90deg, var(--tape-ink) 0 2px, transparent 2px 60px) 0 0 / 100% 10px no-repeat,
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 12px) 0 0 / 100% 5px no-repeat,
    var(--tape);
  transform-origin: left center;
}
/* The one moving thing nobody asked for: the tape pulls out across the page when it loads */
@media (prefers-reduced-motion: no-preference) {
  .tape { animation: tape-out 0.6s ease-out both; }
}
@keyframes tape-out { from { transform: scaleX(0); } to { transform: none; } }
h2[id], h3[id] { scroll-margin-top: 96px; }

/* ---------- Page heading ---------- */
.crumbs { font-size: 14px; color: var(--ink-3); margin: 20px 0 10px; }
.crumbs a { color: inherit; }
.lead { font-size: clamp(17px, 1vw + 14px, 20px); color: var(--ink-2); max-width: 60ch; margin: 14px 0 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border: 1.5px solid var(--edge);
  border-radius: 6px;
  background: var(--tape);
  color: var(--tape-ink);
  font: 700 16px var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--tape-hover); }
.btn:active { background: #f0b400; }
.btn.quiet { background: transparent; color: var(--ink); font-weight: 600; }
.btn.quiet:hover { background: rgba(127, 127, 127, 0.12); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 15px; }

/* ---------- Ad placeholders ---------- */
.ad {
  border: 1.5px dashed var(--ink-3);
  border-radius: 6px;
  color: var(--ink-3);
  font: 600 13px var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  margin-left: auto;
  margin-right: auto;
}
/* Real ad units, once AdSense is set up in site.json */
.ad-unit { margin: 20px auto; text-align: center; max-width: 970px; }
.ad-unit.ad-side { margin: 0; }
/* Room held for each ad before it loads, so the page doesn't jump when it arrives */
.ad-unit.ad-top { min-height: 116px; }
.ad-unit.ad-mid { min-height: 296px; }
.ad-unit.ad-side { min-height: 266px; }
.ad-label { display: block; font: 500 12px var(--sans); color: var(--ink-3); margin-bottom: 4px; }
.ad-top { height: 100px; max-width: 320px; margin-top: 16px; }
.ad-mid { height: 250px; max-width: 300px; margin-top: 28px; margin-bottom: 8px; }
.ad-side { height: 250px; max-width: 300px; width: 100%; }

/* ---------- Calculator ---------- */
.calc { margin-top: 4px; }
/* The drawing sits on blue graph paper, in light and dark mode alike */
.stage {
  background-color: #eef3fa;
  background-image:
    linear-gradient(rgba(29, 95, 191, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 95, 191, 0.13) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1.5px solid var(--edge);
  border-radius: 4px;
  padding: 10px 8px 4px;
  overflow: hidden;
}
.stage svg { display: block; width: 100%; height: auto; max-height: 280px; }
/* Hold the drawing's space before the script draws it, so the page does not jump */
#art { min-height: 190px; display: flex; align-items: center; }
.stage-cap { font: 500 14px/1.45 var(--sans); color: #34495e; margin: 2px 6px 8px; text-align: center; }
.stage text { font: 700 13px var(--mono); }
.stage .dim { fill: #1d5fbf; }
.stage .soft { fill: #5b6673; font-weight: 600; font-size: 12px; }
.stage .plot { fill: #18212b; font: 800 16px var(--sans); }
.stage .warn { fill: #b3261e; }

.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 18px; }
.panel {
  background: var(--card);
  border: 1.5px solid var(--edge);
  border-radius: 8px;
  padding: 18px 16px;
}
.field { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > legend, .field > label:not(.check) { display: block; padding: 0; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.hint { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; }

.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.chips.wide { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.chip { position: relative; display: block; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 48px;
  height: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  text-align: center;
}
.chip small { font-weight: 500; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.chip input:hover + span { border-color: var(--edge); }
.chip input:checked + span { background: var(--tape); color: var(--tape-ink); border-color: var(--edge); }
.chip input:checked + span small { color: var(--tape-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.chip input:disabled { cursor: not-allowed; }
.chip input:disabled + span { opacity: 0.38; text-decoration: line-through; }

.length { display: flex; align-items: center; gap: 12px; }
.unit-input { position: relative; flex: none; width: 128px; }
.unit-input input, .money-input input {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--edge);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: 700 18px var(--sans);
  font-variant-numeric: tabular-nums;
  padding: 0 38px 0 12px;
}
.unit-input i, .money-input i { position: absolute; top: 0; height: 48px; display: flex; align-items: center; font: 600 15px var(--sans); font-style: normal; color: var(--ink-2); pointer-events: none; }
.unit-input i { right: 12px; }
.money-input { position: relative; }
.money-input input { padding: 0 10px 0 26px; font-size: 16px; }
.money-input i { left: 11px; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Sliders are drawn as a tape measure */
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 44px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track {
  height: 12px;
  border: 1.5px solid var(--edge);
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 10px) 0 0 / 100% 5px no-repeat, var(--tape);
}
input[type=range]::-moz-range-track {
  height: 10px;
  border: 1.5px solid var(--edge);
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 10px) 0 0 / 100% 5px no-repeat, var(--tape);
}
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 32px; margin-top: -12px; border-radius: 4px; background: var(--card); border: 1.5px solid var(--edge); }
input[type=range]::-moz-range-thumb { width: 20px; height: 30px; border-radius: 4px; background: var(--card); border: 1.5px solid var(--edge); }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.stepper { display: flex; align-items: stretch; border: 1.5px solid var(--edge); border-radius: 6px; overflow: hidden; background: var(--paper); height: 48px; }
.stepper button { flex: none; width: 48px; border: 0; background: transparent; color: var(--ink); font: 700 22px var(--sans); cursor: pointer; }
.stepper button:hover { background: var(--tape); color: var(--tape-ink); }
.stepper input { flex: 1; min-width: 0; border: 0; border-left: 1.5px solid var(--edge); border-right: 1.5px solid var(--edge); background: transparent; color: var(--ink); text-align: center; font: 700 18px var(--sans); font-variant-numeric: tabular-nums; }
.sub-label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); flex: none; }

details.prices { border-top: 1.5px dashed var(--line); margin-top: 20px; padding-top: 6px; }
details.prices summary { min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; cursor: pointer; color: var(--blue); list-style: none; }
details.prices summary::-webkit-details-marker { display: none; }
details.prices summary::before { content: "+"; font: 700 20px var(--sans); width: 16px; }
details.prices[open] summary::before { content: "\2212"; }
.price-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }

/* The estimate slip: a printed receipt, paper-coloured in light and dark mode */
.slip-wrap { filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.16)); }
.slip {
  --ink: #1f2428;
  --ink-2: #4e565d;
  --edge: #1f2428;
  --rule: #cdc5b0;
  --hole: 6px;
  background: #fffdf6;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  padding: 26px 18px 28px;
  -webkit-mask:
    radial-gradient(var(--hole) at 50% 0, #0000 98%, #000) 50% 0 / calc(var(--hole) * 3) 51% repeat-x,
    radial-gradient(var(--hole) at 50% 100%, #0000 98%, #000) 50% 100% / calc(var(--hole) * 3) 51% repeat-x;
  mask:
    radial-gradient(var(--hole) at 50% 0, #0000 98%, #000) 50% 0 / calc(var(--hole) * 3) 51% repeat-x,
    radial-gradient(var(--hole) at 50% 100%, #0000 98%, #000) 50% 100% / calc(var(--hole) * 3) 51% repeat-x;
}
.slip p { margin: 0; }
.slip-kicker { font-size: 14px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.slip-title { font: 700 22px/1.15 var(--display); margin-top: 6px !important; }
.slip-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px !important; }
.slip-lines { margin-top: 14px; border-top: 1.5px dashed var(--rule); }
.slip-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1.5px dashed var(--rule); }
.slip-line span:last-child { white-space: nowrap; font-weight: 700; }
.slip-line small { display: block; font-size: 12px; color: var(--ink-2); }
.slip-sum { font-weight: 700; border-bottom: 0; }
.slip-total { background: var(--tape); margin: 16px -18px 0; padding: 14px 18px 16px; }
.slip-total-label { display: block; font-size: 14px; font-weight: 700; }
.slip-total strong { display: block; font: 700 clamp(30px, 7vw, 40px)/1.1 var(--display); margin: 2px 0; font-variant-numeric: tabular-nums; }
.slip-perft { font-size: 13px; }
.slip-needs { margin: 16px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.slip-needs li { border: 1.5px solid var(--rule); border-radius: 4px; padding: 8px 10px; font-size: 12px; color: var(--ink-2); }
.slip-needs b { display: block; font: 700 21px/1.2 var(--display); color: var(--ink); }
.slip-custom { margin-top: 12px !important; font-size: 13px; }
.slip-custom button { background: none; border: 0; padding: 0; color: #1d5fbf; font: inherit; text-decoration: underline; cursor: pointer; }
.slip-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.slip .btn { font-family: var(--sans); }
.slip .btn.quiet { border-color: var(--rule); }
.slip-note { margin-top: 14px !important; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.slip-note a { color: #1d5fbf; }
[hidden] { display: none !important; }

/* ---------- Guide text ---------- */
.content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 36px; }
.prose > h2 { margin: 38px 0 10px; }
.prose > h2:first-child { margin-top: 0; }
.prose > h3 { margin: 24px 0 6px; }
.prose p, .prose li { color: var(--ink-2); max-width: 68ch; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--ink); }
.reviewed { font-size: 14px; color: var(--ink-3); margin: -10px 0 20px; }
.reviewed a { color: inherit; }
.sources { font-size: 15px; }
.sources li { margin-bottom: 8px; }
.callout { border-left: 5px solid var(--tape); background: var(--card); padding: 12px 14px; margin: 0 0 16px; max-width: 68ch; }
.callout p { margin: 0; color: var(--ink); }

.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1.5px solid var(--edge); border-radius: 4px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 150px; }
thead th { background: var(--head-row); color: var(--ink); font: 700 14px var(--sans); border-bottom: 1.5px solid var(--edge); }
tbody th { font-weight: 600; }
tbody td { font-variant-numeric: tabular-nums; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 194, 26, 0.12); }
/* Tables of words rather than numbers: left-aligned and free to wrap */
.table-wrap.text td, .table-wrap.text thead th { text-align: left; white-space: normal; }
.table-wrap.text tbody td { color: var(--ink-2); }
.table-wrap.text tbody th { min-width: 110px; }
@media (max-width: 599px) { .table-wrap.text table { min-width: 560px; } }
/* The first column stays put while a wide table scrolls sideways on a phone */
th:first-child { position: sticky; left: 0; }
tbody th:first-child { background: var(--card); }

/* Quote checker: the advice that follows the estimate */
.quote-advice { margin-top: 16px; padding: 18px 20px; background: var(--card); border: 1.5px solid var(--edge); border-left: 6px solid #e0a020; border-radius: 6px; }
.quote-advice:empty { display: none; }
.quote-advice[data-band="within"] { border-left-color: #4f8a4a; }
.quote-advice h2 { margin: 0 0 8px; font-size: 24px; }
.quote-advice p { margin: 0 0 10px; color: var(--ink-2); max-width: 74ch; }
.quote-advice .quote-ask { margin-bottom: 6px; font-weight: 700; color: var(--ink); }
.quote-advice ul { margin: 0; padding-left: 22px; }
.quote-advice li { color: var(--ink-2); margin-bottom: 4px; max-width: 74ch; }

/* ---------- Things that answer a click (site.js, home.js) ---------- */
/* Back to top */
.to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 25; width: 48px; height: 48px; border-radius: 6px;
  border: 1.5px solid var(--edge); background: var(--tape); color: var(--tape-ink); font: 700 22px var(--sans); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { background: var(--tape-hover); }
@media (max-width: 1023px) { .has-calc .to-top { bottom: 84px; } }

/* Fair questions open one at a time */
.faq { border-top: 1.5px solid var(--edge); margin: 0; max-width: 72ch; }
.faq:last-of-type { border-bottom: 1.5px solid var(--edge); margin-bottom: 18px; }
.faq > summary { list-style: none; cursor: pointer; position: relative; padding: 14px 44px 14px 0; }
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary h3 { margin: 0; font-size: 20px; }
.faq > summary:hover h3 { color: var(--blue); }
.faq > summary::after {
  content: "+"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font: 700 26px var(--sans); color: var(--ink); transition: transform 0.2s ease;
}
.faq[open] > summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-body { padding: 0 0 6px; }

/* Guides: the contents box and the reading bar */
.toc { margin: 0 0 26px; border: 1.5px solid var(--edge); border-radius: 6px; background: var(--card); max-width: 72ch; }
.toc > summary { cursor: pointer; padding: 12px 16px; font: 700 16px var(--sans); display: flex; justify-content: space-between; gap: 10px; }
.toc-count { font: 500 14px var(--sans); color: var(--ink-3); align-self: center; }
.toc ol { margin: 0; padding: 0 16px 14px 36px; }
.toc li { margin: 4px 0; }
.toc a { color: var(--ink); text-decoration: none; border-bottom: 1px dashed var(--line); }
.toc a:hover { color: var(--blue); border-bottom-color: var(--blue); }
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 35; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--tape); transform: scaleX(0); transform-origin: left; }

/* Home: the example estimate you can play with */
.try-controls { max-width: 360px; margin: 18px auto 0; display: grid; gap: 12px; }
.try-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.try-chips button {
  min-height: 40px; padding: 0 14px; border-radius: 6px; border: 1.5px solid var(--edge);
  background: var(--card); color: var(--ink); font: 700 14px var(--sans); cursor: pointer;
}
.try-chips button:hover { background: rgba(255, 194, 26, 0.2); }
.try-chips button[aria-pressed="true"] { background: var(--tape); color: var(--tape-ink); }
.try-len { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; font: 700 15px var(--sans); }
.try-len output { font: 700 15px var(--sans); font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; }
.try-go { justify-self: center; font: 700 15px var(--sans); color: var(--blue); }

/* The city finder: a search box that opens the fence rules table at your city */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.city-finder {
  margin-top: 48px; padding: 22px; border: 1.5px solid var(--edge); border-radius: 4px;
  background:
    linear-gradient(rgba(29, 95, 191, 0.10) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(90deg, rgba(29, 95, 191, 0.10) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--card);
}
.city-finder h2 { margin: 0 0 8px; }
.city-finder-text p:last-child { color: var(--ink-2); margin-bottom: 14px; }
.city-finder-form { display: flex; flex-wrap: wrap; gap: 10px; }
/* the search box and its own list of cities (no browser dropdown) */
.cf-box { position: relative; flex: 1 1 220px; min-width: 0; }
.cf-icon { position: absolute; left: 15px; top: 50%; width: 20px; height: 20px; margin-top: -10px; fill: none; stroke: var(--ink-3); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.cf-box input {
  width: 100%; height: 52px; padding: 0 16px 0 44px; font: 500 17px var(--sans); color: var(--ink);
  background: var(--card); border: 1.5px solid var(--edge); border-radius: 6px; transition: box-shadow .15s;
}
.cf-box input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255, 194, 26, .55); }
.cf-box input::-webkit-search-cancel-button { cursor: pointer; }
.cf-box input[aria-expanded="true"] { border-radius: 6px 6px 0 0; }
.cf-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: -1.5px 0 0; padding: 4px 0; list-style: none;
  max-height: 332px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border: 1.5px solid var(--edge); border-top-color: var(--line); border-radius: 0 0 8px 8px;
  box-shadow: 0 14px 28px rgba(16, 24, 32, .18);
}
.cf-list li[role="option"] {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 14px 9px 16px; border-left: 4px solid transparent; cursor: pointer;
}
.cf-list li[role="option"]:hover, .cf-list li[aria-selected="true"] { background: rgba(255, 194, 26, .18); border-left-color: var(--tape); }
.cf-name { font-weight: 700; color: var(--ink); line-height: 1.25; min-width: 0; }
.cf-name small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-3); }
.cf-name mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--tape); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.cf-limits { flex: 0 0 auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.cf-limits b { font: 700 14px var(--display); color: var(--ink); margin-left: 6px; }
.cf-limits b:first-child { margin-left: 0; }
.cf-more, .cf-none { padding: 10px 16px; font-size: 14px; color: var(--ink-3); }
.cf-more { border-top: 1px dashed var(--line); }
/* the answer card */
.cf-result { margin-top: 16px; }
.cf-card { border: 1.5px solid var(--edge); border-radius: 6px; background: var(--card); padding: 18px; animation: cf-in .22s ease-out; }
@keyframes cf-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cf-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 12px; }
.cf-card-head h3 { font-size: 26px; font-stretch: 87.5%; }
.cf-badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font: 700 13px var(--sans); border: 1.5px solid currentColor; }
.cf-badge.is-free { color: #1d7a3c; background: rgba(46, 160, 87, .12); }
.cf-badge.is-need { color: #9a5b00; background: rgba(255, 194, 26, .22); }
.cf-badge.is-some { color: var(--blue); background: rgba(29, 95, 191, .10); }
.cf-card-body { display: grid; gap: 16px; }
.cf-draw { width: 100%; max-width: 280px; height: auto; justify-self: center; }
.cf-draw text { font: 700 10px var(--sans); fill: var(--ink-2); text-anchor: middle; }
.cf-draw .cf-tick { font-weight: 500; font-size: 8px; fill: var(--ink-3); text-anchor: end; }
.cf-draw .cf-na { font-weight: 500; fill: var(--ink-3); }
.cf-draw .cf-grid { stroke: var(--line); stroke-dasharray: 2 3; }
.cf-draw .cf-ground { stroke: var(--edge); stroke-width: 2; }
.cf-draw .cf-front rect { fill: var(--tape); stroke: var(--edge); stroke-width: 1; }
.cf-draw .cf-back rect { fill: #c9a26b; stroke: var(--edge); stroke-width: 1; }
.cf-draw .cf-person { fill: none; stroke: var(--ink-2); stroke-width: 2.4; stroke-linecap: round; }
.cf-draw .cf-person circle { fill: var(--ink-2); }
.cf-yards { margin: 0; display: grid; gap: 10px; }
.cf-yards > div { padding: 10px 12px; border-radius: 4px; background: rgba(29, 95, 191, .06); }
.cf-yards dt { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 15px; }
.cf-yards dt b { font: 700 22px var(--display); }
.cf-yards dd { margin: 2px 0 0; font-size: 15px; color: var(--ink-2); line-height: 1.45; }
.cf-foot { margin: 14px 0 0; font-size: 14px; color: var(--ink-3); }
.cf-foot a { font-weight: 600; }
.city-finder-form .btn { flex: 0 0 auto; min-height: 52px; }
.city-popular { margin: 12px 0 0; font-size: 15px; color: var(--ink-3); }
.city-popular a { display: inline-block; margin: 4px 4px 0 0; padding: 3px 11px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; transition: border-color .15s, background .15s; }
.city-popular a:hover { border-color: var(--edge); background: rgba(255, 194, 26, .18); }
.city-popular .city-all { border-color: transparent; background: none; color: var(--blue); text-decoration: underline; }
.city-popular .city-all:hover { background: none; border-color: transparent; }
@media (min-width: 640px) {
  .cf-card-body { grid-template-columns: minmax(0, 240px) minmax(0, 1fr); align-items: center; }
}
@media (min-width: 900px) {
  .city-finder { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 8px 28px; align-items: center; padding: 28px 30px; }
  .city-finder-text p:last-child { margin-bottom: 0; }
  .cf-result, .city-popular { grid-column: 1 / -1; }
}
@media (prefers-color-scheme: dark) {
  .cf-badge.is-free { color: #7fe0a0; }
  .cf-badge.is-need { color: var(--tape); }
  .cf-yards > div { background: rgba(163, 200, 255, .08); }
  .cf-list { box-shadow: 0 14px 28px rgba(0, 0, 0, .45); }
}

/* City rules table: a searchable list that turns into stacked entries on a phone */
.prose.wide { max-width: none; }
.rules-search { margin: 0 0 14px; max-width: 420px; }
.rules-search label { display: block; font: 700 15px var(--sans); color: var(--ink); margin-bottom: 6px; }
.rules-search input { width: 100%; height: 48px; padding: 0 14px; font: 500 16px var(--sans); color: var(--ink); background: var(--card); border: 1.5px solid var(--edge); border-radius: 6px; }
.rules-search .hint { margin: 6px 0 0; }
.rules-table tr[hidden] { display: none; }
.rules-table tbody td { vertical-align: top; font-size: 15px; line-height: 1.45; }
.table-wrap.rules-table tbody th { vertical-align: top; font: 700 18px/1.2 var(--display); min-width: 170px; }
.rules-table td a { overflow-wrap: anywhere; }
.rules-table .checked { display: block; margin-top: 4px; font: 400 13px var(--sans); color: var(--ink-3); }
@media (max-width: 759px) {
  .table-wrap.rules-table table { min-width: 0; width: 100%; }
  .rules-table thead { display: none; }
  .rules-table tbody, .rules-table tr, .rules-table tbody th, .rules-table tbody td { display: block; width: 100%; }
  .rules-table tr { padding: 12px 14px; border-top: 1.5px solid var(--edge); }
  .rules-table tr:first-child { border-top: 0; }
  .rules-table tr[hidden] { display: none; }
  .table-wrap.rules-table tbody th { padding: 0 0 6px; font-size: 21px; min-width: 0; border: 0; }
  .rules-table tbody td { padding: 4px 0; border: 0; }
  .rules-table tbody td::before { content: attr(data-label); display: block; font: 700 13px var(--sans); color: var(--ink-3); }
}

/* City table: the height check marks each city */
.rules-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 24px; margin: 0 0 16px; scroll-margin-top: 16px; }
.rules-tools .rules-search { margin: 0; }
.rules-tools > .hint { grid-column: 1 / -1; margin: 6px 0 0; }
.rules-height > label:first-child { display: block; font: 700 15px var(--sans); color: var(--ink); margin-bottom: 6px; }
.rules-height-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rules-height .check { min-height: 40px; margin-top: 4px; }
select {
  height: 48px; padding: 0 36px 0 12px; font: 500 16px var(--sans); color: var(--ink); background-color: var(--card);
  border: 1.5px solid var(--edge); border-radius: 6px; -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 18px center, right 12px center; background-size: 6px 6px; background-repeat: no-repeat;
}
@media (min-width: 760px) { .rules-tools { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; } }
.rules-table .fit { display: block; width: fit-content; margin-top: 6px; padding: 2px 8px; border-radius: 4px; font: 600 13px/1.4 var(--sans); }
.rules-table .fit[data-fit="yes"] { background: rgba(79, 138, 74, 0.16); }
.rules-table .fit[data-fit="yes"]::before { content: "\2713  "; color: #3f7a3a; font-weight: 800; }
.rules-table .fit[data-fit="no"] { background: rgba(224, 160, 32, 0.24); }
.rules-table .fit[data-fit="no"]::before { content: "\2717  "; font-weight: 800; }
.rules-table .fit[data-fit="unknown"] { color: var(--ink-3); padding-left: 0; }
@media (prefers-color-scheme: dark) { .rules-table .fit[data-fit="yes"]::before { color: #8fd18a; } }

/* ---------- Worksheets inside the guides (tools.js) ---------- */
/* Each one carries a strip of tape along the top: the mark of something you can work with. */
.tool { margin: 30px 0 34px; max-width: 920px; background: var(--card); border: 1.5px solid var(--edge); border-radius: 4px; overflow: hidden; }
.tool::before {
  content: ""; display: block; height: 12px; border-bottom: 1.5px solid var(--edge);
  background:
    repeating-linear-gradient(90deg, var(--tape-ink) 0 2px, transparent 2px 60px) 0 0 / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 12px) 0 0 / 100% 4px no-repeat,
    var(--tape);
}
.tool-head { padding: 16px 18px 0; }
.prose .tool-head h2 { margin: 0 0 4px; font-size: clamp(23px, 1vw + 18px, 28px); }
.prose .tool-head p { margin: 0; color: var(--ink-2); }
.tool-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 26px; padding: 16px 18px 20px; }
.tool-form .field { margin-bottom: 16px; }
.tool-form .field:last-child { margin-bottom: 0; }
.tool-form .pair { margin-bottom: 16px; }
.tool-form .pair:last-child { margin-bottom: 0; }
.tool-form .pair .field { margin-bottom: 0; }
.tool-form .unit-input { width: 100%; max-width: 160px; }
.tool-form .pair .unit-input { max-width: none; }
.prose .tool-form .hint { max-width: none; }
.tool-range { display: flex; align-items: center; gap: 12px; }
.tool-range output { min-width: 62px; text-align: right; font: 700 18px var(--sans); font-variant-numeric: tabular-nums; }
.tool-result { min-height: 120px; }
.prose .tool-verdict { margin: 0 0 12px; padding: 10px 12px; border-left: 6px solid var(--blue); background: var(--paper); color: var(--ink); max-width: none; }
.tool-verdict strong { display: block; font: 700 21px/1.2 var(--display); margin-bottom: 2px; }
.tool-verdict[data-ok="yes"] { border-left-color: #4f8a4a; }
.tool-verdict[data-ok="no"] { border-left-color: #e0a020; }
.tool-checks { list-style: none; padding: 0 !important; margin: 0 0 12px !important; }
.prose .tool-checks li { position: relative; padding: 6px 0 6px 28px; margin: 0; border-bottom: 1px dashed var(--line); color: var(--ink); max-width: none; }
.tool-checks li::before { position: absolute; left: 2px; top: 6px; font-weight: 800; }
.tool-checks li[data-pass="yes"]::before { content: "\2713"; color: #3f7a3a; }
.tool-checks li[data-pass="no"]::before { content: "\2717"; color: #b3261e; }
@media (prefers-color-scheme: dark) {
  .tool-checks li[data-pass="yes"]::before { color: #8fd18a; }
  .tool-checks li[data-pass="no"]::before { color: #ff9b8f; }
}
.tool-figures { margin: 0 0 12px; }
.tool-figures div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.tool-figures dt { color: var(--ink-2); font-size: 15px; }
.tool-figures dd { margin: 0; font-weight: 600; font-size: 15px; }
.prose .tool-note { font-size: 14px; color: var(--ink-3); margin: 0; max-width: none; }
.tool-note a { font-weight: 600; }
.tool-figure { margin: 14px 0 0; }
.tool-figure .stage:empty { display: none; }
.tool-cap { font-size: 14px; color: var(--ink-3); margin-top: 6px; }
@media (min-width: 760px) {
  .tool-body { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
}

/* Fence post calculator: the fence entered side by side */
.layouts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.layouts button {
  min-height: 40px; padding: 0 12px; border: 1.5px solid var(--edge); border-radius: 6px; background: var(--card);
  color: var(--ink); font: 600 14px var(--sans); cursor: pointer;
}
.layouts button:hover { background: rgba(255, 194, 26, 0.2); }
.runs { display: grid; gap: 8px; margin-bottom: 10px; }
.run-row { display: grid; grid-template-columns: 58px 112px minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.run-row .sub-label { margin: 0; color: var(--ink); font-weight: 700; }
.run-row .unit-input { width: auto; }
.run-row select { width: 100%; min-width: 0; padding-right: 30px; font-size: 15px; }
.run-remove {
  width: 44px; height: 44px; border: 1.5px solid var(--rule); border-radius: 6px; background: transparent;
  color: var(--ink-2); font: 700 20px var(--sans); cursor: pointer;
}
.run-remove:hover { border-color: var(--edge); color: var(--ink); background: rgba(127, 127, 127, 0.12); }
#add-run { margin-bottom: 4px; border: 1.5px dashed var(--edge); }
@media (max-width: 420px) {
  .run-row { grid-template-columns: 54px minmax(0, 1fr) 44px; row-gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--rule); }
  .run-row .unit-input { grid-column: 2 / -1; }
  .run-row select { grid-column: 1 / 3; }
}

/* A link on to the next calculator for the same job, with the measurements carried over */
.calc-next {
  margin: 18px 0 0; padding: 12px 14px; border: 1.5px solid var(--edge); border-left: 8px solid var(--tape);
  border-radius: 6px; background: var(--card); font-size: 16px;
}
.calc-next a { font-weight: 700; }
.slip-total strong.is-warn { color: #b3261e; }
@media (prefers-color-scheme: dark) { .slip-total strong.is-warn { color: #ff9b8f; } }

/* Fence cost calculator: every material side by side, as lengths of tape */
.compare { margin-top: 26px; padding-top: 14px; border-top: 2px solid var(--edge); }
.compare h2 { font-size: clamp(22px, 1vw + 18px, 27px); margin-bottom: 4px; }
.compare-note { color: var(--ink-2); font-size: 15px; margin-bottom: 10px; }
.compare-rows { display: grid; gap: 4px; }
.compare-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name amt" "bar bar"; gap: 6px 12px; align-items: center;
  width: 100%; min-height: 48px; padding: 8px 10px; border: 1.5px solid transparent; border-radius: 6px;
  background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.compare-row:hover { background: rgba(255, 194, 26, 0.14); }
.compare-row[aria-pressed="true"] { border-color: var(--edge); background: var(--card); }
.compare-row[data-best="true"] { border-color: var(--edge); background: var(--card); }
.compare-row[data-best="false"] .compare-bar i { opacity: 0.6; }
.tool .compare-rows { margin: 4px 0 12px; }
.tool div.compare-row { cursor: default; }
.compare-name { grid-area: name; font-weight: 700; font-size: 15px; }
.compare-name small { font-weight: 500; color: var(--ink-3); }
.compare-amt { grid-area: amt; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare-bar { grid-area: bar; display: block; height: 14px; }
.compare-bar i {
  display: block; height: 100%; border: 1px solid var(--tape-ink); border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 10px) 0 0 / 100% 5px no-repeat, var(--tape);
  transition: width 0.25s ease;
}
.compare-row[aria-pressed="false"] .compare-bar i { opacity: 0.6; }
@media (min-width: 720px) {
  .compare-row { grid-template-columns: minmax(180px, 0.9fr) minmax(0, 1.4fr) minmax(150px, auto); grid-template-areas: "name bar amt"; }
  .compare-amt { text-align: right; }
}

/* ---------- Calculator lists ---------- */
/* Each calculator is a sheet from a set of plans: the drawing on top and a title block below,
   with one real figure from the calculator. Pointing at a sheet pulls a tape out along its top
   edge and turns its "Open calculator" tab yellow. */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); color: var(--ink); text-decoration: none;
  border: 1.5px solid var(--edge); border-radius: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; z-index: 2;
  background:
    repeating-linear-gradient(90deg, var(--tape-ink) 0 2px, transparent 2px 60px) 0 0 / 100% 7px no-repeat,
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 12px) 0 0 / 100% 4px no-repeat,
    var(--tape);
  border-bottom: 1px solid var(--tape-ink);
  transform: scaleX(0); transform-origin: left; transition: transform 0.35s ease-out;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(10, 27, 45, 0.18); }
.card:hover::before, .card:focus-visible::before { transform: scaleX(1); }
.card:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
/* The drawing, on the same graph paper as the calculator's own */
.card-art {
  display: block; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1.5px solid var(--edge);
  background-color: #eef3fa;
  background-image:
    linear-gradient(rgba(29, 95, 191, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 95, 191, 0.13) 1px, transparent 1px);
  background-size: 16px 16px;
}
.card-art img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 8px 10px 4px; transition: transform 0.3s ease; }
.card:hover .card-art img { transform: scale(1.04); }
.card-ico { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; border-bottom: 1.5px solid var(--edge); }
.card-ico svg { width: 56px; height: 56px; display: block; }
/* The title block */
.card-block { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 14px 16px 16px; }
.card strong { font: 700 21px/1.15 var(--display); }
.card-text { font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.card-stat { margin-top: 4px; padding-top: 10px; border-top: 1.5px dashed var(--line); font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.card-stat b { display: block; font: 700 25px/1.1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.card-open {
  align-self: flex-start; margin-top: auto; padding: 6px 12px; border: 1.5px solid var(--edge); border-radius: 6px;
  font: 700 14px var(--sans); color: var(--ink); transition: background-color 0.2s ease;
}
.card-stat + .card-open { margin-top: 10px; }
.card:hover .card-open, .card:focus-visible .card-open { background: var(--tape); color: var(--tape-ink); border-color: var(--tape-ink); }
/* Phones: a shorter drawing across the top, and no tab (the whole sheet is the link) */
@media (max-width: 599px) {
  .card-art, .card-ico { aspect-ratio: 2 / 1; }
  .card-art img { padding: 6px 8px 2px; }
  .card-block { padding: 12px 14px 14px; gap: 4px; }
  .card strong { font-size: 19px; }
  .card-text { font-size: 14px; }
  .card-stat { padding-top: 8px; font-size: 13px; }
  .card-stat b { font-size: 21px; }
  .card-open { display: none; }
}
/* Where the page says "start with the first one", the first sheet is twice as wide */
@media (min-width: 600px) {
  .cards.first-wide:not(.is-filtered) > .card:first-child { grid-column: span 2; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .cards.first-wide:not(.is-filtered) > .card:first-child .card-art { aspect-ratio: auto; min-height: 240px; border-bottom: 0; border-right: 1.5px solid var(--edge); }
  .cards.first-wide:not(.is-filtered) > .card:first-child .card-block { justify-content: center; padding: 22px 24px; }
  .cards.first-wide:not(.is-filtered) > .card:first-child strong { font-size: 30px; }
  .cards.first-wide:not(.is-filtered) > .card:first-child .card-text { font-size: 17px; }
  .cards.first-wide:not(.is-filtered) > .card:first-child .card-stat b { font-size: 34px; }
  .cards.first-wide:not(.is-filtered) > .card:first-child .card-open { margin-top: 14px; background: var(--tape); color: var(--tape-ink); border-color: var(--tape-ink); }
}
/* The filter over a full list of calculators (site.js) */
.card-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.card-filter button {
  min-height: 44px; padding: 0 14px; border: 1.5px solid var(--edge); border-radius: 6px; background: var(--card);
  color: var(--ink); font: 700 15px var(--sans); cursor: pointer;
}
.card-filter button span { margin-left: 4px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.card-filter button:hover { background: rgba(255, 194, 26, 0.2); }
.card-filter button[aria-pressed="true"] { background: var(--tape); color: var(--tape-ink); border-color: var(--tape-ink); }
.card-filter button[aria-pressed="true"] span { color: var(--tape-ink); }
/* On phones the filter is one row you can swipe along */
@media (max-width: 599px) {
  .card-filter { flex-wrap: nowrap; overflow-x: auto; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter));
    padding: 2px var(--gutter) 6px; scrollbar-width: none; }
  .card-filter::-webkit-scrollbar { display: none; }
  .card-filter button { flex: none; white-space: nowrap; }
}
/* Sheets that come back after a filter change slide in, so you see what changed */
@media (prefers-reduced-motion: no-preference) {
  .card.is-arriving { animation: sheet-in 0.3s ease-out both; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.i-ink { fill: var(--ink); }
.i-tape { fill: var(--tape); }
.i-line { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.i-thick { stroke-width: 3; }
.related { margin-top: 48px; }
.related h2 { margin-bottom: 16px; }
.related + .related { margin-top: 36px; }

/* ---------- Guides ---------- */
/* Guides are listed like a contents page: a ruled list, two columns on wide screens */
.guide-list { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 40px; border-top: 2px solid var(--edge); }
.guide-item { display: grid; align-content: start; gap: 4px; padding: 14px 0 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.guide-item strong { font: 600 21px/1.2 var(--display); }
.guide-item span { font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.guide-item small { font-size: 14px; color: var(--ink-3); }
/* Guides with a worksheet in them say so */
.tool-tag { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 3px; background: var(--tape); color: var(--tape-ink); font: 700 12px/1.7 var(--sans); vertical-align: 1px; }
.guide-item:hover strong { color: var(--blue); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
@media (min-width: 900px) { .guide-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.guide-list + .prose { margin-top: 40px; }
.byline { font-size: 14px; color: var(--ink-3); margin: -8px 0 8px; }
/* To-scale drawings inside the guides, on the same graph paper as the calculators */
.drawing { margin: 22px 0 26px; max-width: 760px; }
.drawing img {
  /* width comes from the tag (the drawing's own size), so every drawing keeps the same
     scale (20 px to the foot) and its space is held before it loads */
  display: block; box-sizing: content-box; max-width: calc(100% - 23px); height: auto; padding: 8px 10px 4px;
  border: 1.5px solid var(--edge); border-radius: 4px;
  background-color: #eef3fa;
  background-image:
    linear-gradient(rgba(29, 95, 191, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 95, 191, 0.13) 1px, transparent 1px);
  background-size: 16px 16px;
}
.drawing figcaption { font-size: 14px; line-height: 1.5; color: var(--ink-3); margin-top: 8px; max-width: 68ch; }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px; align-items: center; padding: 34px 0 10px; }
.hero h1 { max-width: 13em; }
.hero .lead { margin-bottom: 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-note { margin: 18px 0 0; font-size: 15px; color: var(--ink-3); max-width: 52ch; }
.slip-wrap.sample { position: static; width: 100%; max-width: 360px; margin: 0 auto; transform: rotate(1.6deg); }
.sample-cap { font-size: 14px; color: var(--ink-3); text-align: center; margin: 14px 0 0; }
.section { margin-top: 56px; }
.section > h2 { margin-bottom: 6px; }
.section > h2 a { color: inherit; text-decoration: none; }
.section > h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.section > .lead { margin-top: 6px; }
/* How it works: a real sequence, so it keeps its numbers */
.steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; counter-reset: step; }
.steps li { counter-increment: step; border-top: 2px solid var(--edge); padding-top: 12px; }
.steps h3 { margin-bottom: 6px; }
.steps h3::before { content: counter(step) ". "; }
.steps p { margin: 0; color: var(--ink-2); font-size: 16px; }
.page { padding-top: 8px; }
.page .prose { margin-top: 20px; }

/* ---------- Footer ---------- */
.site-footer { position: relative; background: var(--header); color: var(--header-ink); margin-top: 72px; padding: 40px 0 26px; font-size: 15px; }
/* The header tape's marks again, chalked onto the blueprint along the top edge. */
.site-footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.34) 0 1px, transparent 1px 60px) 0 0 / 100% 10px no-repeat,
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 12px) 0 0 / 100% 5px no-repeat;
}
.foot-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.site-footer p { color: #c3cfdb; margin: 10px 0 0; max-width: 40ch; }
.foot-brand { padding-bottom: 24px; }
.site-footer .social { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.site-footer .social span { font-size: 13px; color: #9fb1c4; margin-right: 2px; }
.site-footer .social a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border: 1px solid rgba(255, 194, 26, 0.6); border-radius: 999px;
  color: var(--tape); font-weight: 700; font-size: 14px; text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.site-footer .social a:hover { background: var(--tape); color: var(--tape-ink); }
.site-footer .reviewed { font-size: 13px; color: #9fb1c4; margin-top: 16px; }
.site-footer .reviewed a { color: var(--header-ink); text-underline-offset: 3px; white-space: nowrap; }
.site-footer .reviewed a:hover { color: var(--tape); }

/* Each link group folds on phones and stands open from 760px (site.js keeps it open there). */
.foot-col { border-top: 1px solid rgba(255, 255, 255, 0.14); }
.foot-fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 54px; cursor: pointer; }
.foot-fold > summary::-webkit-details-marker { display: none; }
.foot-fold > summary::after {
  content: ""; flex: none; width: 9px; height: 9px; margin: -4px 6px 0 0;
  border-right: 2px solid var(--tape); border-bottom: 2px solid var(--tape);
  transform: rotate(45deg); transition: transform 0.2s ease;
}
.foot-fold[open] > summary::after { transform: translateY(5px) rotate(225deg); }
.site-footer h2 { display: flex; align-items: center; gap: 8px; font: 700 17px var(--display); color: var(--header-ink); }
.site-footer h2 .count { font: 700 12px/1.3 var(--sans); color: var(--tape-ink); background: var(--tape); border-radius: 3px; padding: 1px 6px; }
.foot-links { list-style: none; margin: 0; padding: 0; }
.foot-links li { break-inside: avoid; }
.foot-links a, .foot-all {
  display: flex; align-items: center; min-height: 44px; color: #d5dee8;
  text-decoration: underline 2px transparent; text-underline-offset: 5px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.foot-links a:hover { color: #fff; text-decoration-color: var(--tape); }
.site-footer .foot-all { color: var(--tape); font-weight: 700; margin-bottom: 10px; text-decoration-color: rgba(255, 194, 26, 0.35); }
.site-footer .foot-all:hover { text-decoration-color: var(--tape); }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; border-top: 1px solid rgba(255, 255, 255, 0.16); padding-top: 16px; }
.site-footer .fine { font-size: 13px; color: #9fb1c4; margin: 0; max-width: none; }
body.has-calc .site-footer { padding-bottom: 86px; }
@media (min-width: 520px) { .foot-fence .foot-links { columns: 2; column-gap: 28px; } }
@media (min-width: 760px) {
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 40px; }
  .foot-brand { padding-bottom: 0; }
  .foot-col { border-top: 0; }
  .foot-fold > summary { min-height: 0; margin-bottom: 10px; cursor: default; }
  .foot-fold > summary::after { display: none; }
  .foot-links a, .foot-all { min-height: 34px; }
  .site-footer .foot-all { margin: 6px 0 0; }
  .foot-base { margin-top: 40px; }
}
@media (min-width: 1024px) {
  .foot-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 0.85fr); }
}

/* ---------- Sticky total (phones only) ---------- */
.sticky-total {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(var(--gutter), env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: var(--tape);
  color: var(--tape-ink);
  border-top: 2px solid #1d2226;
  font: 700 14px var(--sans);
  transform: translateY(110%);
  transition: transform 0.2s ease;
}
.sticky-total.show { transform: translateY(0); }
.sticky-total strong { font: 700 21px var(--display); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 600px and up ---------- */
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  .site-header .wrap { min-height: 66px; }
  .brand { font-size: 23px; gap: 10px; }
  .main-nav .top { padding: 0 14px; font-size: 16px; }
  .main-nav .top::after { left: 14px; right: 14px; }
  .nav-optional { display: inline-flex !important; }
  .ad-top { height: 90px; max-width: 728px; margin-top: 20px; }
  .ad-mid { height: 90px; max-width: 728px; }
  .panel { padding: 22px; }
  .slip { padding: 28px 22px 30px; }
  .slip-total { margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
}

/* ---------- 720px and up: inputs and slip side by side ---------- */
@media (min-width: 720px) {
  .calc-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); gap: 26px; }
  .slip-wrap { position: sticky; top: calc(var(--head-space, 0px) + 16px); align-self: start; transition: top 0.25s ease; }
  .sticky-total { display: none; }
  body.has-calc .site-footer { padding-bottom: 26px; }
  .hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); padding-top: 48px; }
}

/* ---------- 1024px and up ---------- */
@media (min-width: 1024px) {
  :root { --gutter: 32px; }
  .ad-top { max-width: 970px; }
  .ad-mid { max-width: 970px; height: 120px; }
  .content:has(> .side) { grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; }
  .side { position: sticky; top: calc(var(--head-space, 0px) + 16px); transition: top 0.25s ease; }
  .ad-side { height: 600px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .related .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Print: just the drawing and the estimate ---------- */
/* ---------- The shopping list (app.js) ---------- */
/* The estimate's materials as a list to take to the store: tick, note the price, print or copy. */
.shop-open {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 48px; margin-top: 16px;
  border: 1.5px solid var(--tape-ink); border-radius: 6px; background: var(--tape); color: var(--tape-ink);
  font: 700 16px var(--sans); cursor: pointer;
}
.shop-open[hidden] { display: none; }
.shop-open span { font-weight: 500; }
.shop-open:hover { background: var(--tape-hover); }
.shop-open:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.shop {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1.5px solid var(--edge); border-radius: 6px; background: var(--card); color: var(--ink);
}
.shop::backdrop { background: rgba(10, 27, 45, 0.6); }
.shop-sheet { padding: 18px 18px 16px; }
.shop-kicker { display: flex; justify-content: space-between; gap: 8px; margin: 0; font: 700 13px var(--mono); color: var(--ink-2); }
.shop-title { margin: 8px 0 2px; font: 700 24px/1.15 var(--display); }
.shop-sub { margin: 0 0 12px; font-size: 15px; color: var(--ink-2); }
.shop-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.shop-table thead th { padding: 6px; border-bottom: 1.5px solid var(--edge); text-align: left; font: 600 13px var(--sans); color: var(--ink-2); }
.shop-table td { padding: 8px 6px; border-bottom: 1px dashed var(--line); vertical-align: middle; text-align: left; white-space: normal; }
.shop-table td.shop-qty { text-align: right; }
.shop-table td:first-child { width: 30px; }
.shop-table input[type="checkbox"] { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.shop-table label { cursor: pointer; }
.shop-qty { font: 700 19px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.shop-table .money-input { width: 104px; }
.shop-table .money-input input { height: 40px; }
.shop-table .money-input i { height: 40px; }
.shop-table tr.is-got .shop-qty, .shop-table tr.is-got label { text-decoration: line-through; color: var(--ink-3); }
.shop-table tfoot td { padding-top: 10px; border-bottom: 0; font-size: 14px; color: var(--ink-2); }
.shop-spent { text-align: right; white-space: nowrap; }
.shop-spent b { font: 700 19px var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.shop-note { margin: 12px 0; font-size: 13px; color: var(--ink-3); }
.shop-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 520px) {
  .shop-sheet { padding: 14px 12px; }
  .shop-table, .shop-table tbody, .shop-table tfoot { display: block; }
  .shop-table thead { display: none; }
  .shop-table tbody tr { display: grid; grid-template-columns: 30px auto minmax(0, 1fr); gap: 6px 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
  .shop-table tbody td { display: block; padding: 0; border: 0; }
  .shop-table tbody td:last-child { grid-column: 3; }
  .shop-table .money-input { width: 120px; }
  .shop-table tfoot tr { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  .shop-table tfoot td { display: block; }
}
#print-sheet { display: none; }

@media print {
  .site-header nav, .nav-cta, .menu-btn, .mobile-menu, .tape, .ad, .side, .panel, .related, .site-footer nav, .sticky-total, .slip-actions, .skip, .content, .to-top, .read-progress, .compare { display: none !important; }
  body { background: #fff; color: #000; }
  .site-header, .site-footer { background: none; color: #000; position: static; box-shadow: none; }
  .slip-wrap { filter: none; position: static; }
  .slip { -webkit-mask: none; mask: none; border: 1px solid #000; }
  .calc-grid { display: block; }
}

/* Printing the shopping list: only the list, on a page of its own */
@media print {
  html.print-shop body > *:not(#print-sheet) { display: none !important; }
  html.print-shop #print-sheet { display: block; color: #000; }
  #print-sheet .shop-sheet { padding: 0; }
  #print-sheet .shop-title { font-size: 22pt; }
  #print-sheet .shop-table td, #print-sheet .shop-table th { border-color: #000; color: #000; }
  #print-sheet .shop-box { display: inline-block; width: 14px; height: 14px; border: 1.5px solid #000; text-align: center; line-height: 13px; font-size: 12px; }
  #print-sheet .shop-table td:last-child { width: 110px; border-bottom: 1px solid #000; }
  #print-sheet .shop-link { margin-top: 10px; font-size: 10pt; word-break: break-all; }
}
