/* ==========================================================================
   DeckBoardEstimator.com — site styles
   Mobile-first, no framework, no web fonts (system stack for fast loading).
   Shared by every page: keep page-specific rules out of this file.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --wood:        #7a4f2c;
  --wood-dark:   #5e3c20;
  --wood-light:  #f3ece4;
  --green:       #2f6b4a;
  --ink:         #23201d;
  --ink-muted:   #5c5750;
  --bg:          #ffffff;
  --bg-alt:      #f8f6f3;
  --border:      #e2ddd6;
  --error:       #b3261e;

  --radius:      10px;
  --shadow:      0 1px 3px rgba(35, 32, 29, .08), 0 6px 20px rgba(35, 32, 29, .05);
  --maxw:        1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.075rem; }
p  { margin: 0 0 1em; }

a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--wood-dark); }

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

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1rem;
}

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

/* ---------- Header ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.0625rem;
}
.brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 6px;
  background:
    linear-gradient(var(--wood) 0 0) 0 4px / 100% 5px no-repeat,
    linear-gradient(var(--wood-dark) 0 0) 0 12px / 100% 5px no-repeat,
    linear-gradient(var(--wood) 0 0) 0 20px / 100% 5px no-repeat,
    var(--green);
}
.brand-name { font-weight: 500; }
.brand-name strong { font-weight: 700; color: var(--wood); }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .9375rem;
}
.site-nav a { color: var(--ink-muted); text-decoration: none; }
.site-nav a:hover { color: var(--wood-dark); text-decoration: underline; }

/* ---------- Hero / calculator area ---------- */
.hero {
  background: var(--wood-light);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
}
.hero h1 { margin-bottom: .375rem; }
.lead {
  max-width: 62ch;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
}

.trust-line {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem .625rem;
  margin: -.5rem 0 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--wood-dark);
}
.trust-dot { color: #a8977f; }

.calc-grid {
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.125rem;
}
.card-title {
  font-size: 1.125rem;
  margin: 0 0 1rem;
  padding-bottom: .625rem;
  border-bottom: 1px solid var(--border);
}

/* ---------- Form ---------- */
.dim-group {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
}
.dim-group legend {
  padding: 0;
  font-weight: 600;
  font-size: .9375rem;
  margin-bottom: .375rem;
}
.dim-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem;
}

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: .9375rem;
  margin-bottom: .3125rem;
}
.dim-inputs .field { margin-bottom: 0; }
.dim-inputs label { font-weight: 500; color: var(--ink-muted); }

input[type="number"] {
  width: 100%;
  padding: .625rem .6875rem;
  font: inherit;
  font-size: 1rem; /* 16px keeps iOS from zooming on focus */
  color: var(--ink);
  background: var(--bg);
  border: 1px solid #c9c2b8;
  border-radius: 8px;
}
input[type="number"]:focus-visible { border-color: var(--green); }

.field-hint {
  margin: .3125rem 0 0;
  font-size: .8125rem;
  color: var(--ink-muted);
  line-height: 1.45;
}
.optional-tag {
  font-weight: 500;
  font-size: .75rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Invalid field feedback (set by JS alongside aria-invalid) */
input[type="number"].is-invalid { border-color: var(--error); border-width: 2px; }

/* Preset chips — real buttons, so they are tabbable and Enter/Space activated */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-top: .5rem;
}
.chip {
  font: inherit;
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--wood-dark);
  background: var(--bg);
  border: 1px solid #c9c2b8;
  border-radius: 999px;
  padding: .4375rem .6875rem;
  cursor: pointer;
}
.chip:hover { background: var(--wood-light); }
.chip[aria-pressed="true"] {
  background: var(--wood);
  border-color: var(--wood);
  color: #fff;
}
.chip-note { font-weight: 400; opacity: .75; }

/* Mode toggle — spacing calculator's "I know my gap" vs "I know my board
   count" choice. Plain radio inputs (natively accessible); the surrounding
   label just gets a highlight class kept in sync by JS, mirroring how the
   preset chips track state via aria-pressed. */
.mode-fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
.mode-fieldset legend { padding: 0; font-weight: 600; font-size: .9375rem; margin-bottom: .375rem; }
.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.mode-option {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .625rem .75rem;
  border: 1px solid #c9c2b8;
  border-radius: 8px;
  cursor: pointer;
}
.mode-option.is-selected {
  border-color: var(--wood);
  background: var(--wood-light);
}
.mode-option input { margin-top: .1875rem; flex: none; }
.mode-option-title { display: block; font-weight: 600; font-size: .9375rem; }
.mode-option-desc { display: block; font-size: .8125rem; color: var(--ink-muted); margin-top: .125rem; }

/* Breadcrumb — small wayfinding trail above the H1 on non-homepage pages */
.breadcrumb { font-size: .8125rem; color: var(--ink-muted); margin-bottom: .75rem; }
.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
}
.breadcrumb li:not(:last-child)::after { content: "/"; margin: 0 .375rem; color: #a89c8c; }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* Highlighted field — used for board gap / spacing */
.field-featured {
  background: var(--wood-light);
  border: 1px solid #e0d3c2;
  border-radius: var(--radius);
  padding: .875rem .875rem .9375rem;
}
.field-featured .chip { border-color: #d3c6b5; }
.field-featured .field-hint { color: #4f4941; }

.form-error {
  margin: 0 0 1rem;
  padding: .625rem .75rem;
  border-left: 4px solid var(--error);
  background: #fdf1f0;
  color: var(--error);
  font-size: .9375rem;
  border-radius: 4px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem;
}
.btn {
  font: inherit;
  font-weight: 600;
  padding: .75rem 1.125rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--wood);
  color: #fff;
  flex: 1 1 auto;
}
.btn-primary:hover { background: var(--wood-dark); }
.btn-secondary {
  background: var(--bg);
  color: var(--ink);
  border-color: #c9c2b8;
}
.btn-secondary:hover { background: var(--bg-alt); }

/* ---------- Results ---------- */
.results-card { align-self: start; }
.results-list { margin: 0; }
.result-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .25rem 1rem;
  padding: .6875rem 0;
  border-bottom: 1px solid var(--border);
}
.result-row dt { color: var(--ink-muted); font-size: .9375rem; }
.dt-note {
  display: block;
  font-size: .75rem;
  font-weight: 400;
  color: var(--ink-muted);
}
.result-row dd {
  margin: 0;
  font-weight: 700;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}
.result-highlight {
  background: var(--wood-light);
  border-radius: 8px;
  padding: .6875rem .75rem;
  margin: .25rem -.75rem;
  border-bottom: 0;
}
.result-highlight dt { color: var(--wood-dark); font-weight: 600; }
.result-highlight dd { color: var(--wood-dark); font-size: 1.25rem; }

/* Placeholder copy shown in place of a value (e.g. no price entered) */
.result-row dd.result-empty {
  font-weight: 400;
  font-size: .8125rem;
  color: var(--ink-muted);
  text-align: right;
  max-width: 24ch;
  line-height: 1.4;
}

/* Plain-language summary of the row/piece layout behind the numbers */
.results-layout {
  margin: .875rem 0 0;
  padding: .625rem .75rem;
  background: var(--bg-alt);
  border-left: 3px solid var(--green);
  border-radius: 6px;
  font-size: .8125rem;
  line-height: 1.5;
  color: #4f4941;
}
.results-layout:empty { display: none; }

/* Shown only when a row needs more than one piece */
.results-joint {
  margin: .5rem 0 0;
  padding: .625rem .75rem;
  background: var(--wood-light);
  border-left: 3px solid var(--wood);
  border-radius: 6px;
  font-size: .8125rem;
  line-height: 1.5;
  color: #4a3a2a;
}

.results-note {
  margin: 1rem 0 0;
  font-size: .8125rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* ---------- Content sections ---------- */
.section { padding: 2.25rem 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.prose { max-width: 72ch; }
.prose ol, .prose ul { padding-left: 1.25rem; margin: 0 0 1em; }
.prose li { margin-bottom: .5em; }

/* Light section-break rule under each content heading — subtle visual
   hierarchy without a heavier graphic treatment. */
.prose h2 {
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

/* Input explanations in the "How to use" section */
.input-guide { margin: 0 0 1em; }
.input-guide dt {
  font-weight: 700;
  margin-top: 1em;
}
.input-guide dd {
  margin: .25rem 0 0;
  color: var(--ink-muted);
}

.callout {
  background: var(--bg);
  border-left: 4px solid var(--green);
  border-radius: 4px;
  padding: .875rem 1rem;
  font-size: .9375rem;
}
.section-alt .callout { background: var(--bg); }
.callout p { margin: 0 0 .625em; }
.callout p:last-child { margin-bottom: 0; }

/* Formula box: keeps every step visible & crawlable as plain HTML, just
   styled as distinct reference material so it reads as a clean lookup
   block rather than another paragraph. */
.formula-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--wood);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem;
}
.formula-box h3 { margin-top: 0; }
.formula-box ol { margin-bottom: 0; }
.section-alt .formula-box { background: var(--bg); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 1.25rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
caption {
  caption-side: top;
  text-align: left;
  font-size: .8125rem;
  color: var(--ink-muted);
  padding-bottom: .5rem;
}
th, td {
  text-align: left;
  padding: .625rem .75rem;
  border-bottom: 1px solid var(--border);
}
thead th { background: var(--wood-light); font-size: .875rem; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

/* ---------- FAQ ---------- */
.faq-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: 0; padding-bottom: 0; }
.faq-item h3 { margin-bottom: .375rem; }
.faq-item p { margin: 0 0 .625em; color: var(--ink-muted); }
.faq-item p:last-child { margin-bottom: 0; }

/* ---------- Related calculators (placeholders) ---------- */
.related-grid {
  display: grid;
  gap: .75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.related-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  margin: 0;
}
.related-title {
  display: block;
  font-weight: 700;
  margin-bottom: .25rem;
}
.badge {
  display: inline-block;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--wood-dark);
  background: var(--wood-light);
  border-radius: 999px;
  padding: .125rem .5rem;
}
.related-card p {
  margin: .5rem 0 0;
  font-size: .875rem;
  color: var(--ink-muted);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #d8d3cc;
  padding: 2rem 0 1.5rem;
  font-size: .9375rem;
}
.site-footer .brand-name { color: #fff; }
.site-footer .brand-name strong { color: #d9a870; }
.footer-brand p { margin: .375rem 0 1.25rem; color: #b3aca3; }
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}
.footer-nav a { color: #d8d3cc; text-decoration: none; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.footer-legal {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid #3a352f;
  font-size: .8125rem;
  color: #b3aca3;
}
.site-footer :focus-visible { outline-color: #d9a870; }

/* ---------- Breakpoints ---------- */
@media (min-width: 40rem) {
  h1 { font-size: 2.125rem; }
  h2 { font-size: 1.625rem; }
  .hero { padding: 2.25rem 0 2.75rem; }
  .card { padding: 1.5rem; }
  .section { padding: 3rem 0; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 0 1.5rem; }

  .footer-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 2rem;
    align-items: start;
  }
  .footer-brand p { margin-bottom: 0; }
  .footer-nav ul { justify-content: flex-end; margin-bottom: 0; }
  .footer-legal { grid-column: 1 / -1; margin-top: 1.5rem; }
}

@media (min-width: 62rem) {
  h1 { font-size: 2.375rem; }
  .calc-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
  }
  .calc-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.25rem;
  }
  .calc-form .card-title,
  .calc-form .field-featured,
  .calc-form .mode-fieldset,
  .calc-form .form-error,
  .calc-form .form-actions { grid-column: 1 / -1; }
  .calc-form .field-featured { margin-bottom: 1rem; }
  .mode-toggle { flex-direction: row; }
  .mode-option { flex: 1 1 0; }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Contact page — the address is the page's primary content, so give it
   a little more presence than body copy. */
.contact-email {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 .75em;
}
