:root {
  --ink: #1c1914;
  --muted: #4e473e;
  --paper: #f3efe6;
  --card: #fffdf8;
  --line: #ddd4c3;
  --pine: #1b3a2f;
  --pine-deep: #13281f;
  --mist: #e7f2eb;
  --cedar: #8a3f12;
  --focus: #8a3f12;
  --warn-bg: #fbf6ea;
  --warn-ink: #4e380f;
  --warn-bar: #a56b12;
  --serif: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

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

@media (max-width: 959px) {
  body {
    padding-bottom: 5rem;
  }
}

img,
svg {
  display: block;
}

p,
h1,
h2,
h3,
ul,
ol,
dl,
figure {
  margin: 0;
}

h1,
h2,
h3,
.results-count output,
.stats dd,
.logo {
  font-family: var(--serif);
}

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

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 50;
  background: white;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.skip:focus {
  top: 0.75rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 239, 230, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
  padding: 0.4rem 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 2rem;
  height: 2rem;
  flex: none;
}

.nav {
  display: flex;
  gap: 0.25rem 1rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  padding: 0.35rem 0.1rem;
}

.nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.hero {
  padding: 1.25rem 0 0.85rem;
}

.eyebrow,
.results-kicker {
  color: var(--cedar);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin-top: 0.35rem;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
  max-width: 20ch;
}

.lede {
  margin-top: 0.8rem;
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  padding: 0;
  margin-top: 1rem;
  list-style: none;
  color: var(--pine);
  font-weight: 700;
}

.trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.trust li::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--cedar);
}

#calculator,
#math,
#faq,
#shopping-list {
  scroll-margin-top: 5.2rem;
}

.calc-layout {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.calc-form,
.math-card,
.faq-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 1px 0 rgba(28, 25, 20, 0.04), 0 12px 32px rgba(28, 25, 20, 0.05);
}

.calc-form {
  padding: 1rem 1rem 0.4rem;
}

fieldset {
  border: 0;
  margin: 0 0 1.15rem;
  padding: 0;
  min-inline-size: 0;
}

legend {
  font-weight: 700;
  padding: 0;
  margin-bottom: 0.35rem;
}

.help {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.dims {
  display: grid;
  gap: 0.85rem;
}

.dim {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.92rem;
  font-weight: 600;
}

label.field[for] {
  margin-bottom: 0.35rem;
}

.field span,
.choice span {
  font-weight: 600;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  font-variant-numeric: tabular-nums;
}

input[aria-invalid="true"] {
  border-color: #8d2a2a;
  background: #fff7f5;
}

.choices {
  display: grid;
  gap: 0.5rem;
}

.choice {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--pine);
  background: var(--mist);
}

.choice input {
  margin-top: 0.2rem;
  accent-color: var(--pine);
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
}

.choice small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 0.3rem 0.75rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--pine);
  border-color: var(--pine);
  color: white;
}

.stocks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.2rem 0 0.85rem;
  padding: 0;
  border: 0;
}

.stocks legend {
  grid-column: 1 / -1;
}

.stock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  font-weight: 700;
  cursor: pointer;
}

.stock:has(input:checked) {
  border-color: var(--pine);
  background: var(--mist);
}

.stock input {
  accent-color: var(--pine);
}

.waste-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  align-items: center;
}

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

.spacing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.checkline {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin-top: 0.75rem;
  font-weight: 600;
}

.checkline input {
  margin-top: 0.25rem;
  accent-color: var(--pine);
  width: 1.05rem;
  height: 1.05rem;
}

.price-grid {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .price-grid.board-prices {
    grid-template-columns: 1fr 1fr;
  }
}

.results {
  background: var(--pine);
  color: #f4f0e6;
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 16px 40px rgba(27, 58, 47, 0.18);
}

.results-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}

.results-kicker {
  color: #f0d2bf;
}

.results-size,
.results-label {
  color: #e7f2eb;
}

.results-size {
  margin-top: 0.25rem;
  font-size: 0.98rem;
}

.results-count {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  margin-top: 0.15rem;
}

.results-count output {
  background: transparent;
  border: 0;
  padding: 0;
  color: white;
  font-size: clamp(2.8rem, 6vw, 3.6rem);
  line-height: 0.9;
  font-weight: 700;
}

.unit {
  padding-bottom: 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.plan {
  width: 7.5rem;
}

.plan-frame {
  width: 7.5rem;
  max-height: 5.5rem;
  aspect-ratio: var(--along) / var(--out);
  border: 2px solid #f4f0e6;
  border-radius: 4px;
  overflow: hidden;
  background: #c4a36a;
}

.plan-boards {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(to bottom, #f3e6cf 0 7px, #b8915a 7px 8px);
}

.plan-boards.is-across {
  background: repeating-linear-gradient(to right, #f3e6cf 0 7px, #b8915a 7px 8px);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.stats div {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
}

.stats dt {
  font-size: 0.82rem;
  color: #d7ebe0;
}

.stats dd {
  margin-top: 0.1rem;
  font-size: 1.35rem;
  color: white;
}

.sheet {
  background: var(--card);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.95rem 0.95rem 1rem;
  margin-top: 0.9rem;
}

.sheet h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.assumptions,
.cut-plan,
.shop-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.assumptions {
  margin-top: 0.35rem;
}

.cut-plan {
  margin-top: 0.45rem;
  color: var(--ink);
}

.warning,
.results-error {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-left: 4px solid var(--warn-bar);
  padding: 0.6rem 0.7rem;
  margin: 0.7rem 0 0;
  border-radius: 0 8px 8px 0;
}

.shop-group {
  margin-top: 0.85rem;
}

.shop-group h3 {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.shop-group ul {
  list-style: none;
  padding: 0;
}

.shop-group li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.qty,
.amt {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.qty {
  min-width: 1.5rem;
}

.item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.item-title {
  font-weight: 700;
}

.item-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.shop-total {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
}

.shop-note {
  margin-top: 0.55rem;
}

.results-actions {
  margin-top: 0.85rem;
}

.btn {
  appearance: none;
  border: 0;
  background: white;
  color: var(--pine);
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.section {
  padding: 1.5rem 0 0.25rem;
}

.math-card,
.faq-card {
  padding: 1.15rem 1.1rem 1.25rem;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.prose {
  max-width: 42rem;
  margin-top: 0.7rem;
}

.prose p + p,
.prose ol,
.answer p {
  margin-top: 0.7rem;
}

.prose ol {
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.subhead {
  margin-top: 1.3rem;
  font-size: 1.35rem;
}

.steps {
  list-style: none;
  padding: 0;
  margin-top: 0.4rem;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}

.steps li::before {
  content: counter(step);
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--pine);
  min-width: 1.4rem;
  line-height: 1.3;
}

details {
  border-top: 1px solid var(--line);
}

details:last-of-type {
  border-bottom: 1px solid var(--line);
}

summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.9rem 1.6rem 0.9rem 0;
  list-style: none;
  position: relative;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 0.85rem;
  color: var(--pine);
  font-size: 1.2rem;
  line-height: 1;
}

details[open] summary::after {
  content: "–";
}

.answer {
  padding: 0 0 0.95rem;
  max-width: 42rem;
  color: var(--ink);
}

.site-footer {
  margin-top: 2rem;
  background: var(--pine-deep);
  color: #e7f2eb;
  padding: 1.5rem 0 1.8rem;
}

.site-footer p + p {
  margin-top: 0.7rem;
}

.site-footer strong {
  color: white;
}

.footer-brand {
  margin-top: 1rem;
  font-family: var(--serif);
  color: white;
  font-size: 1.15rem;
}

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom));
  background: var(--pine);
  color: white;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.16);
}

.dock p {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dock strong {
  font-size: 1.05rem;
}

.dock span {
  color: #d7ebe0;
  font-variant-numeric: tabular-nums;
}

.dock a {
  color: var(--pine);
  background: white;
  text-decoration: none;
  border-radius: 999px;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.print-only {
  display: none;
}

/* Filled by ads.js only after a publisher ID is set. Hidden until then. */
.ad-slot {
  margin: 1.25rem 0 0;
}

.ad-slot[hidden] {
  display: none !important;
}

.ad-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ad-slot .adsbygoogle {
  display: block;
  min-height: 90px;
}

@media (min-width: 720px) {
  .dims {
    grid-template-columns: 1fr 1fr;
  }

  .choices.two {
    grid-template-columns: 1fr 1fr;
  }

  .calc-form {
    padding: 1.2rem 1.25rem 0.5rem;
  }
}

@media (min-width: 960px) {
  .hero {
    padding-top: 2.2rem;
  }

  .calc-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
    gap: 1.25rem;
  }

  .results {
    position: sticky;
    top: 5.2rem;
    max-height: calc(100vh - 6.2rem);
    overflow: auto;
  }

  .dock {
    display: none;
  }

  body {
    padding-bottom: 0;
  }
}

@media (max-width: 380px) {
  .stocks,
  .spacing {
    grid-template-columns: 1fr 1fr;
  }

  .waste-row {
    grid-template-columns: 1fr;
  }
}

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

@media (forced-colors: active) {
  .chip[aria-pressed="true"],
  .choice:has(input:checked),
  .stock:has(input:checked) {
    border: 2px solid ButtonText;
  }

  .results {
    border: 1px solid CanvasText;
  }
}

@media print {
  .no-print,
  .screen-only,
  .site-header,
  .hero,
  .calc-form,
  .dock,
  #faq,
  .plan,
  .results-actions,
  .results-kicker,
  .ad-slot,
  ins.adsbygoogle,
  .google-auto-placed,
  iframe[src*="googlesyndication"] {
    display: none !important;
  }

  body,
  .results,
  .sheet,
  .stats div,
  .site-footer {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }

  body {
    padding: 0;
    font-size: 11pt;
    line-height: 1.35;
  }

  .wrap {
    width: 100%;
  }

  .results {
    position: static !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0;
    border-radius: 0;
  }

  .results-size,
  .results-label,
  .unit,
  .results-count output,
  .stats dt,
  .stats dd,
  .item-note,
  .assumptions,
  .cut-plan,
  .print-math,
  .shop-note,
  .warning,
  .shop-group h3 {
    color: black !important;
  }

  .results-count output {
    font-size: 28pt;
  }

  .stats {
    margin-top: 0.4rem;
  }

  .stats div {
    background: white;
    border-bottom: 1px solid black;
    border-radius: 0;
    padding: 0.2rem 0;
  }

  .sheet {
    border: 0;
    padding: 0.6rem 0 0;
    margin-top: 0.4rem;
  }

  .sheet h2,
  .shop-group h3,
  .print-banner {
    break-after: avoid;
  }

  .print-banner {
    font-family: var(--serif);
    font-size: 16pt;
    font-weight: 700;
    margin: 0 0 0.15rem;
  }

  .print-math {
    margin-top: 0.45rem;
  }

  .shop-group,
  .shop-group li,
  .shop-total,
  .print-math,
  .cut-plan,
  .print-foot {
    break-inside: avoid;
  }

  .shop-group li {
    border-bottom: 1px solid black;
  }

  .warning {
    background: white;
    border-left: 3px solid black;
  }

  .print-only {
    display: block !important;
  }

  .print-foot {
    margin: 1.25rem 0 0;
    padding-top: 0.4rem;
    border-top: 1px solid black;
    font-size: 9pt;
  }

  a {
    color: black;
    text-decoration: none;
  }

  .site-footer {
    padding: 0;
  }

  @page {
    margin: 0.6in;
  }
}
