/* EstimateMix — shared styles
   Industrial / job-site aesthetic: warm concrete tones, one hazard-yellow
   accent spent carefully, condensed stencil-style display type paired with
   a utilitarian grotesk for everything else.

   Tokens
   ink       #17140f   text, strong borders, near-black charcoal
   concrete  #56524a   secondary text, rules — warm aggregate grey
   dust      #e6e1d5   table stripes, input borders — warm concrete-dust grey
   paper     #f7f4ee   background — warm spec-sheet paper, not clinical white
   tape      #ffcb05   the one accent (hazard yellow) — hero rule, focus ring, stripes
*/

/* Self-hosted fonts (Oswald + Archivo, SIL Open Font License — see /assets/fonts/) */
@font-face {
  font-family: 'Oswald'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('./fonts/oswald-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Oswald'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('./fonts/oswald-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('./fonts/oswald-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Oswald'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('./fonts/oswald-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('./fonts/archivo-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('./fonts/archivo-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('./fonts/archivo-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('./fonts/archivo-latin-700-normal.woff2') format('woff2');
}

:root {
  --ink: #17140f;
  --concrete: #56524a;
  --dust: #e6e1d5;
  --paper: #f7f4ee;
  --tape: #ffcb05;
  --measure: 42rem;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --stripe: repeating-linear-gradient(
    -45deg,
    var(--ink), var(--ink) 10px,
    var(--tape) 10px, var(--tape) 20px
  );
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--tape); }

/* ----- Header / footer ----- */
.site-header { border-top: 8px solid var(--ink); position: relative; }
.site-header::after {
  content: ""; display: block; height: 5px; background: var(--stripe);
}
.site-header .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1.1rem 0 0.9rem; flex-wrap: wrap; }
@media (max-width: 639px) { .site-header .wrap { padding-bottom: 0.6rem; } .site-nav { width: 100%; display: flex; gap: 1.1rem; overflow-x: auto; padding-bottom: 0.5rem; } .site-nav a { margin-left: 0; white-space: nowrap; } }
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; text-decoration: none;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.site-nav a { margin-left: 1.4rem; font-size: 0.92rem; font-weight: 500; text-decoration: none; color: var(--concrete); }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.site-footer { margin-top: 4rem; border-top: 5px solid var(--ink); color: var(--concrete); font-size: 0.9rem; position: relative; }
.site-footer::before { content: ""; display: block; height: 5px; background: var(--stripe); margin-top: -5px; }
.site-footer .wrap { padding: 1.6rem 0; }
.site-footer a { color: var(--concrete); margin-right: 1.1rem; font-weight: 500; }
.site-footer a:hover { color: var(--ink); }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }

/* ----- Type ----- */
h1 {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(1.65rem, 4.5vw, 2.4rem); line-height: 1.1; letter-spacing: 0.005em;
  margin: 1.6rem 0 0.85rem;
}
h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; line-height: 1.25; margin: 2.6rem 0 0.75rem; letter-spacing: 0.005em; }
h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; margin: 1.8rem 0 0.5rem; }
p, li { max-width: 68ch; }
.lede { font-size: 1.2rem; line-height: 1.45; color: var(--ink); margin: 0 0 1.5rem; }
.lede strong { font-weight: 700; }
.breadcrumb {
  font-size: 0.78rem; font-weight: 600; color: var(--concrete); margin-top: 1.3rem;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.breadcrumb a { color: var(--concrete); }
.breadcrumb span { margin: 0 0.5rem; }
.byline { font-size: 0.9rem; color: var(--concrete); margin: 0 0 1.5rem; }

/* ----- Calculator ----- */
.calc-form { border: 2px solid var(--ink); padding: 1.25rem; margin: 1.5rem 0 2rem; }
@media (min-width: 640px) {
  .calc-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 2rem; }
  .calc-actions { grid-column: 1 / -1; }
}
.calc-fields { display: grid; gap: 0.9rem; align-content: start; }
.calc-field { display: grid; gap: 0.3rem; font-size: 0.92rem; font-weight: 500; }
.calc-field input, .calc-field select {
  font: inherit; font-size: 1.05rem; padding: 0.55rem 0.7rem; border: 2px solid var(--concrete);
  border-radius: 0; background: var(--paper); color: var(--ink); width: 100%; min-height: 44px;
}
.calc-field input:focus, .calc-field select:focus { border-color: var(--ink); }
.calc-input-group { display: flex; align-items: stretch; }
.calc-input-group input { border-right: 0; }
.calc-unit { display: inline-flex; align-items: center; padding: 0 0.7rem; border: 2px solid var(--concrete); border-left: 0; color: var(--concrete); font-size: 0.85rem; font-weight: 600; white-space: nowrap; }

.calc-results { align-self: start; }
@media (max-width: 639px) { .calc-form { display: flex; flex-direction: column; } .calc-results { order: -1; margin-bottom: 1.25rem; } }
.calc-hero { padding-bottom: 0.6rem; margin-bottom: 1.1rem; }
.calc-hero-num {
  font-family: var(--font-display); font-size: clamp(2.75rem, 8vw, 4rem); font-weight: 700;
  line-height: 1; letter-spacing: -0.01em;
}
.calc-hero-label { font-size: 1.05rem; color: var(--concrete); margin-left: 0.5rem; }
.calc-hero::after { content: ""; display: block; height: 6px; background: var(--stripe); margin-top: 0.7rem; }
.calc-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; margin: 0; font-size: 0.98rem; }
.calc-list dt { color: var(--concrete); }
.calc-list dd { margin: 0; text-align: right; font-weight: 600; }

.calc-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.calc-btn {
  font-family: var(--font-display); font-weight: 500; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.55rem 1rem; border: 2px solid var(--ink); background: var(--paper);
  color: var(--ink); cursor: pointer; border-radius: 0; min-height: 40px;
}
.calc-btn:hover { background: var(--ink); color: var(--paper); }

#calc-summary { font-weight: 600; }

/* ----- Reference tables ----- */
table { border-collapse: collapse; width: 100%; margin: 1rem 0 1.5rem; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--dust); vertical-align: top; }
th {
  font-family: var(--font-display); font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em;
  font-size: 0.82rem; border-bottom: 3px solid var(--ink); padding-bottom: 0.7rem;
}
td.num, th.num { text-align: right; }
tbody tr:nth-child(even) { background: var(--dust); }
.table-note { font-size: 0.85rem; color: var(--concrete); margin-top: -0.75rem; }

/* ----- Formula block ----- */
.formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92rem;
  background: var(--ink); color: var(--paper); padding: 0.9rem 1.1rem; margin: 0.75rem 0 1.25rem;
  overflow-x: auto; border-left: 5px solid var(--tape);
}

/* ----- Callout (a specific failure mode, correction, or worked number) ----- */
.callout { border: 2px solid var(--ink); border-left: 6px solid var(--tape); padding: 1rem 1.25rem; margin: 1.25rem 0; background: var(--paper); }
.callout p { margin: 0.4rem 0; }
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout-label {
  font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  font-size: 0.82rem; color: var(--concrete); display: block; margin-bottom: 0.5rem;
}

/* ----- FAQ ----- */
.faq details { border-top: 1px solid var(--dust); padding: 0.6rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--dust); }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; padding: 0.25rem 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--concrete); }
.faq details[open] summary::after { content: "–"; }
.faq p { margin: 0.5rem 0 0.25rem; }

/* ----- Related ----- */
.related ul { padding-left: 1.1rem; }
.related li { margin: 0.35rem 0; }

/* ----- Hub / homepage ----- */
.hub-hero { margin: 1.5rem 0 2rem; }
.hub-hero .lede { margin-bottom: 0; }
.hub-hero h1 { margin-top: 0.5rem; }
.hub-grid { display: flex; flex-wrap: wrap; gap: 2px; background: var(--paper); border: 2px solid var(--ink); margin: 1.5rem 0 2.5rem; }
.hub-card { background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink); flex: 1 1 260px; padding: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
@media (max-width: 639px) { .hub-card { flex-basis: 100%; } }
.hub-card a.hub-card-title { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; text-decoration: none; }
.hub-card a.hub-card-title:hover { text-decoration: underline; }
.hub-card p { margin: 0; color: var(--concrete); font-size: 0.95rem; max-width: none; }
.hub-sections { display: flex; flex-wrap: wrap; gap: 2px; background: var(--paper); border: 2px solid var(--ink); margin: 1.5rem 0 2.5rem; }
.hub-section-card { background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink); flex: 1 1 240px; padding: 1.5rem 1.25rem; }
@media (max-width: 639px) { .hub-section-card { flex-basis: 100%; } }
.hub-section-card h3 { margin-top: 0; }
.hub-section-card a.hub-section-link { text-decoration: none; }
.hub-section-card a.hub-section-link:hover { text-decoration: underline; }
.hub-section-card p { color: var(--concrete); font-size: 0.95rem; }
.hub-section-card ul { padding-left: 1.1rem; margin: 0.5rem 0 0; font-size: 0.95rem; }
.hub-section-card li { margin: 0.3rem 0; }

/* ----- Print ----- */
@media print {
  .site-header, .site-footer, .calc-actions, .related, .faq, .breadcrumb { display: none; }
  .calc-form { border: 1px solid #000; page-break-inside: avoid; }
  a { text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
