/* ==========================================================================
   YardCubic — visual system
   A surveyor's field book, not a SaaS dashboard. Paper background, pine
   green ink, surveyor-orange accent (marking paint), serif display type
   with monospaced figures. Motifs: blueprint grid, measuring-tape ticks,
   the cubic-yard cube. No gradients, no glass, no stock photos.
   ========================================================================== */

:root {
  --paper: #f5f2ea;
  --paper-2: #efeadd;
  --card: #fffdf7;
  --ink: #23281f;
  --ink-soft: #3c443a;
  --muted: #5f6a5c;
  --pine-900: #1d2f23;
  --pine-800: #24382b;
  --pine-700: #2e4a33;
  --pine-600: #3f6b47;
  --pine-100: #e3eadf;
  --pine-50: #eef2ea;
  --orange: #c75b16;
  --orange-dark: #a84a10;
  --orange-soft: #f7e8db;
  --rule: #d5cfbd;
  --rule-dark: #b9b29c;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --shadow-hard: 5px 5px 0 rgba(35, 40, 31, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
}

::selection { background: var(--orange); color: #fff; }

a { color: var(--pine-600); text-underline-offset: 2px; }
a:hover { color: var(--orange-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.18;
  color: var(--pine-900);
  font-weight: 700;
}
h1 { font-size: 2.35rem; margin: 0.2em 0 0.45em; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; margin: 2em 0 0.6em; }
h3 { font-size: 1.18rem; margin: 1.5em 0 0.5em; }
p { margin: 0.65em 0; }
ul, ol { margin: 0.65em 0; padding-left: 1.35em; }
li { margin: 0.32em 0; }
li::marker { color: var(--orange); }
strong { color: var(--pine-900); }

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
main .wrap { padding-top: 0.4rem; padding-bottom: 3rem; }
.lede { font-size: 1.13rem; color: var(--ink-soft); max-width: 44em; }
.narrow { max-width: 46em; }

/* Measuring-tape strip: a repeated tick motif used at the header and
   footer edges. Hard-stop pattern, not a colour wash. */
.tape {
  height: 12px;
  background-color: var(--orange);
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0 2px, transparent 2px 20px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 1px, transparent 1px 10px);
  background-size: 100% 7px, 100% 4px;
  background-position: bottom left, bottom left;
  background-repeat: repeat-x;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */
.site-header { background: var(--pine-900); color: #ece9dc; }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 2rem;
  padding-top: 0.85rem; padding-bottom: 0.85rem;
}
.brand {
  display: flex; align-items: center; gap: 0.65rem;
  color: #f2efe4; text-decoration: none; line-height: 1.1;
}
.brand-mark { flex: none; display: block; }
.brand-word {
  font-family: var(--serif); font-weight: 700; font-size: 1.45rem; letter-spacing: 0.01em;
}
.brand-word em { font-style: normal; color: #e07830; }
.brand-sub {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em;
  color: #b9c4ae; border: 1px solid #4a5c4c; border-radius: 4px;
  padding: 0.28rem 0.45rem; margin-left: 0.35rem; white-space: nowrap;
}
.main-nav { display: flex; flex-wrap: wrap; gap: 0.15rem 0.25rem; margin-left: auto; }
.main-nav a {
  color: #d8dfcd; text-decoration: none; font-size: 0.98rem; font-weight: 600;
  padding: 0.45rem 0.7rem; border-radius: 6px;
}
.main-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.main-nav a[aria-current="page"] { color: #fff; background: var(--pine-600); box-shadow: inset 0 -3px 0 var(--orange); }

/* Breadcrumb (guide pages) */
.crumbs {
  font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
  padding-top: 1rem; padding-bottom: 0;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--orange-dark); text-decoration: underline; }
.crumbs span[aria-hidden="true"] { margin: 0 0.45rem; color: var(--rule-dark); }
.crumbs span[aria-current="page"] { color: var(--ink); }

/* ------------------------------------------------------------------ */
/* Homepage hero                                                       */
/* ------------------------------------------------------------------ */
.hero {
  /* Full-bleed dark band over the paper background. */
  margin: 1.1rem calc(50% - 50vw) 0;
  padding: 2.6rem calc(50vw - 50% + 1.25rem) 2.4rem;
  background-color: var(--pine-900);
  color: #ece9dc;
  /* Faint blueprint grid: two hard-stop line patterns, one colour. */
  background-image:
    linear-gradient(rgba(232, 228, 216, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 228, 216, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(232, 228, 216, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 228, 216, 0.11) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px, 140px 140px, 140px 140px;
  position: relative;
}
.hero h1 { color: #f5f2e8; font-size: 2.7rem; max-width: 16em; margin-top: 0; }
.hero .lede { color: #c9d2bd; font-size: 1.18rem; max-width: 38em; }
.hero .lede strong { color: #f5f2e8; }
.hero-figure { margin: 1.6rem 0 0; max-width: 640px; }
.hero-figure svg { display: block; width: 100%; height: auto; }
.hero::after {
  /* Tape edge along the bottom of the hero. */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background-color: var(--orange);
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0 2px, transparent 2px 20px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 1px, transparent 1px 10px);
  background-size: 100% 7px, 100% 4px;
  background-position: bottom left, bottom left;
  background-repeat: repeat-x;
}

/* ------------------------------------------------------------------ */
/* Homepage calculator cards                                           */
/* ------------------------------------------------------------------ */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.25rem; margin: 2rem 0 0.5rem;
}
.card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.3rem 1.35rem 1.4rem;
  box-shadow: var(--shadow-hard);
  display: flex; flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 rgba(35, 40, 31, 0.16); }
.card-icon {
  width: 52px; height: 52px; flex: none;
  border: 1.5px solid var(--ink); border-radius: 8px;
  background-color: var(--pine-50);
  /* Gravel speckle: a dot texture, drawn with the material in mind. */
  background-image: radial-gradient(rgba(35, 40, 31, 0.22) 1.1px, transparent 1.3px);
  background-size: 9px 9px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.9rem;
}
.card-icon svg { display: block; }
.card h2, .card h3 { margin: 0 0 0.45rem; font-size: 1.35rem; }
.card p { color: var(--muted); margin: 0.3em 0 0.9rem; flex: 1; }
.card .btn { margin-top: auto; align-self: flex-start; }
.btn {
  display: inline-block; background: var(--orange); color: #fff; text-decoration: none;
  padding: 0.62rem 1.25rem; border-radius: 7px; font-weight: 700; font-size: 1rem;
  border: 1.5px solid var(--orange-dark);
  box-shadow: 3px 3px 0 rgba(35, 40, 31, 0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { background: var(--orange-dark); color: #fff; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(35, 40, 31, 0.22); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(35, 40, 31, 0.2); }

/* Homepage sections */
.page-home h2:not(.card h2) {
  font-size: 1.65rem;
  padding-top: 0.4rem;
  border-top: 2px solid var(--ink);
  margin-top: 2.6rem;
}
.page-home .how {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 1.5rem 1.3rem;
  margin-top: 2.2rem;
  box-shadow: var(--shadow-hard);
}
.page-home .how h2 { border-top: 0; margin-top: 1rem; }
.page-home .how p { max-width: 62em; }
.page-home .how p:first-of-type::first-letter { font-family: var(--serif); font-size: 1.6em; line-height: 1; }

/* Homepage guide list as a grid of ruled entries */
.page-home .guide-list, .page-guides .guide-list {
  list-style: none; padding-left: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 2rem;
}
.page-home .guide-list li, .page-guides .guide-list li {
  margin: 0; padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.page-home .guide-list a, .page-guides .guide-list a {
  font-family: var(--serif); font-weight: 700; font-size: 1.08rem;
  color: var(--pine-900); text-decoration: none;
}
.page-home .guide-list a:hover, .page-guides .guide-list a:hover {
  color: var(--orange-dark); text-decoration: underline;
  text-decoration-color: var(--orange);
}
.page-home .guide-list li { font-size: 0.95rem; color: var(--muted); }

/* ------------------------------------------------------------------ */
/* Calculator pages                                                    */
/* ------------------------------------------------------------------ */
.page-calc h1 { font-size: 2.1rem; }
.calc {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.6rem;
  margin: 1.4rem 0;
  box-shadow: var(--shadow-hard);
  position: relative;
}
.calc::before {
  /* Tape edge across the top of the form. */
  content: "";
  position: absolute; top: -1.5px; left: -1.5px; right: -1.5px; height: 10px;
  border-radius: 10px 10px 0 0;
  background-color: var(--orange);
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0 2px, transparent 2px 20px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 1px, transparent 1px 10px);
  background-size: 100% 6px, 100% 3px;
  background-position: bottom left, bottom left;
  background-repeat: repeat-x;
}
.calc fieldset {
  border: 1px solid var(--rule-dark); border-radius: 8px;
  padding: 0.9rem 1.1rem 1.1rem; margin: 0 0 1.1rem;
  background: var(--paper);
}
.calc legend {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--pine-700);
  padding: 0 0.5rem;
}
.field { margin: 0.75rem 0; }
.field label { display: block; font-weight: 700; margin-bottom: 0.3rem; color: var(--pine-900); }
.field label span[data-unit-label] { font-family: var(--mono); font-weight: 400; }
.field input[type="number"], .field select {
  width: 100%; max-width: 24rem; padding: 0.65rem 0.7rem; font-size: 1.02rem;
  font-family: var(--mono);
  border: 1.5px solid var(--rule-dark); border-radius: 7px; background: #fff; color: var(--ink);
}
.field input[type="number"]:focus, .field select:focus {
  border-color: var(--orange); outline: 3px solid rgba(199, 91, 22, 0.25); outline-offset: 0;
}
.field .hint { font-size: 0.88rem; color: var(--muted); margin-top: 0.3rem; }
.field-row { display: flex; flex-wrap: wrap; gap: 0 1.1rem; }
.field-row .field { flex: 1 1 11rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.radio-row label { font-weight: 600; display: flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.radio-row input[type="radio"] { accent-color: var(--orange); width: 1.1rem; height: 1.1rem; }
.unit-toggle {
  display: inline-flex; border: 1.5px solid var(--ink); border-radius: 7px; overflow: hidden;
  background: #fff;
}
.unit-toggle button {
  border: 0; background: #fff; padding: 0.55rem 1rem; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; color: var(--pine-900); font-family: var(--sans);
}
.unit-toggle button + button { border-left: 1.5px solid var(--ink); }
.unit-toggle button[aria-pressed="true"] { background: var(--pine-800); color: #fff; }
button.calculate {
  background: var(--orange); color: #fff; border: 1.5px solid var(--orange-dark);
  border-radius: 7px; padding: 0.8rem 1.7rem; font-size: 1.08rem; font-weight: 700;
  cursor: pointer; box-shadow: 3px 3px 0 rgba(35, 40, 31, 0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  width: 100%;
}
button.calculate:hover { background: var(--orange-dark); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(35, 40, 31, 0.22); }
button.calculate:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(35, 40, 31, 0.2); }
.error { color: #9b2c2c; font-weight: 700; margin: 0.7rem 0; }
.error:empty { display: none; }

/* Results: a dark field ticket — the answer is the biggest thing on the page. */
.results {
  background: var(--pine-900); color: #ece9dc;
  border: 1.5px solid var(--ink); border-radius: 8px;
  padding: 1.2rem 1.3rem 1.3rem; margin-top: 1.3rem;
}
.results[hidden] { display: none; }
.results h2 { margin: 0 0 0.4rem; color: #f5f2e8; font-size: 1.3rem; }
.results h2::before {
  content: ""; display: inline-block; width: 0.55em; height: 0.55em;
  background: var(--orange); margin-right: 0.5em; border-radius: 2px;
}
.results p { color: #c9d2bd; }
.results table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; }
.results th, .results td {
  text-align: left; padding: 0.55rem 0.4rem;
  border-bottom: 1px solid rgba(236, 233, 220, 0.22);
}
.results th { width: 55%; font-weight: 600; color: #d8dfcd; }
.results td { font-family: var(--mono); font-size: 1rem; color: #f5f2e8; }
.results .big { font-size: 1.45rem; font-weight: 700; color: #ffb37a; }
.results a { color: #ffb37a; }
.results a:hover { color: #fff; }
.working { font-size: 0.9rem; color: #aebaa4; }
.working a { color: #c9d2bd; }

/* Fact box under the calculator */
.note {
  background: var(--orange-soft);
  border: 1.5px solid var(--ink); border-left: 8px solid var(--orange);
  border-radius: 8px; padding: 0.85rem 1.15rem; margin: 1.3rem 0;
}
.note p { margin: 0.3em 0; }
.note strong { font-family: var(--mono); font-size: 0.92rem; letter-spacing: 0.02em; }

/* Related guides list on calculator pages */
.page-calc main ul:last-of-type { list-style: none; padding-left: 0; }
.page-calc main ul:last-of-type li { padding: 0.4rem 0; border-bottom: 1px solid var(--rule); }
.page-calc main ul:last-of-type a { font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Guide articles                                                      */
/* ------------------------------------------------------------------ */
.page-guide main .wrap { max-width: 780px; }
.page-guide h1 { font-size: 2.15rem; }
/* The answer-first lede is the callout: ruled, tinted, unmistakable. */
.page-guide .lede {
  background: var(--card);
  border: 1.5px solid var(--ink); border-left: 8px solid var(--orange);
  border-radius: 8px; padding: 1rem 1.25rem; margin: 1.2rem 0 1.6rem;
  color: var(--ink); font-size: 1.12rem; max-width: none;
  box-shadow: var(--shadow-hard);
}
/* Field-manual numbering on section headings, via CSS counters. */
.page-guide main { counter-reset: guide-h2; }
.page-guide main h2 { counter-increment: guide-h2; font-size: 1.45rem; margin-top: 2.2em; }
.page-guide main h2::before {
  content: counter(guide-h2, decimal-leading-zero);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.05em; color: var(--orange-dark);
  border: 1.5px solid var(--orange); border-radius: 4px;
  padding: 0.18rem 0.4rem; margin-right: 0.65rem;
  vertical-align: 0.35em;
}
.page-guide main h3 { font-size: 1.15rem; }
.page-guide main table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: 0.98rem; display: block; overflow-x: auto;
  border: 1.5px solid var(--ink); border-radius: 8px; background: var(--card);
}
.page-guide main th, .page-guide main td {
  text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule);
}
.page-guide main th {
  background: var(--pine-800); color: #ece9dc;
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.03em;
}
.page-guide main tr:nth-child(even) td { background: var(--paper-2); }
.page-guide main td { font-family: var(--mono); font-size: 0.92rem; }
.page-guide main td:first-child { font-family: var(--sans); font-weight: 600; }
/* A paragraph that points at a calculator is a callout, not body text. */
.page-guide main p:has(> a[href*="calculator"]) {
  background: var(--pine-50);
  border: 1.5px solid var(--pine-600); border-radius: 8px;
  padding: 0.85rem 1.1rem;
}
.page-guide main p:has(> a[href*="calculator"]) a { font-weight: 700; }
.page-guide main ul li::marker, .page-guide main ol li::marker { color: var(--orange-dark); }

/* Related guides band (rendered by the layout, after the article) */
.related {
  background: var(--pine-50);
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  padding: 1.6rem 0 1.9rem; margin-bottom: 0;
}
.related h2 {
  font-size: 1.25rem; margin: 0 0 0.7rem;
  font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
}
.related ul { list-style: none; padding-left: 0; margin: 0; display: grid; gap: 0.55rem; }
.related li { margin: 0; }
.related a { font-family: var(--serif); font-weight: 700; font-size: 1.08rem; color: var(--pine-900); text-decoration: none; }
.related a:hover { color: var(--orange-dark); text-decoration: underline; text-decoration-color: var(--orange); }

/* ------------------------------------------------------------------ */
/* Standard pages (about / contact / privacy / terms / guides hub)     */
/* ------------------------------------------------------------------ */
.page-standard main .wrap, .page-guides main .wrap { max-width: 780px; }
.page-standard main h2 { font-size: 1.4rem; border-top: 2px solid var(--ink); padding-top: 0.9rem; margin-top: 2.2em; }
.page-standard main li strong { font-family: var(--mono); font-size: 0.92rem; }
.page-guides h1 { font-size: 2.1rem; }

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */
.site-footer { background: var(--pine-900); color: #c9d2bd; margin-top: 0; }
.site-footer .tape { background-color: var(--orange); }
.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2rem;
  padding-top: 2.4rem; padding-bottom: 2.2rem;
}
.footer-brand .brand { margin-bottom: 0.8rem; }
.footer-brand p { font-size: 0.92rem; margin: 0.5em 0; max-width: 34em; }
.footer-col h2 {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: #e07830;
  margin: 0 0 0.8rem;
}
.footer-col ul { list-style: none; padding-left: 0; margin: 0; }
.footer-col li { margin: 0.42em 0; }
.footer-col a { color: #d8dfcd; text-decoration: none; font-size: 0.95rem; }
.footer-col a:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--orange); }

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.6rem; }
  .hero h1 { font-size: 2.2rem; }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 1.85rem; }
  .hero { padding-top: 2rem; padding-bottom: 2rem; }
  .hero h1 { font-size: 1.95rem; }
  .header-inner { gap: 0.4rem 1rem; }
  .main-nav { margin-left: 0; }
  .main-nav a { padding: 0.4rem 0.55rem; font-size: 0.92rem; }
  .calc { padding: 1.1rem 1rem 1.3rem; }
  .card { padding: 1.1rem 1.1rem 1.2rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .page-guide main h2::before { display: inline-block; margin-bottom: 0.2rem; }
  button.calculate { padding: 0.85rem 1.2rem; }
}

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