/* ============================================================
   myconstructioncalc.com
   Design notes:
   - Palette taken from the site itself: concrete dust, graphite,
     steel blue, and a surveyor's keel-crayon red used ONLY for
     the result rule and warnings. One accent, spent in one place.
   - System fonts only. Tabular numerals everywhere a quantity
     appears, because numbers are the product.
   - Touch targets sized for gloved hands in daylight.
   ============================================================ */

:root {
  --ink: #16191c;
  --ink-soft: #4a5157;
  --ink-faint: #6f767c;
  --paper: #ffffff;
  --ground: #f0eee9;
  --ground-deep: #e4e1d9;
  --rule: #d8d4cb;
  --steel: #2f5468;
  --steel-bright: #3d6d88;
  --keel: #ac431c;
  --keel-wash: #fbf1ec;
  --ok: #2f6b46;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  --measure: 68ch;
  --tap: 48px;
  --radius: 4px;
}

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

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

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

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.011em;
  font-weight: 650;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: 1.85rem;
}
h2 {
  font-size: 1.3rem;
  margin-top: 2.2rem;
}
h3 {
  font-size: 1.05rem;
  margin-top: 1.6rem;
}

p,
li {
  max-width: var(--measure);
}

a {
  color: var(--steel);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--keel);
}

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

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 50;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
}

/* ---------- header ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 60px;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.brand .tick {
  width: 13px;
  height: 19px;
  margin-right: 0.45rem;
  background: var(--keel);
  display: inline-block;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
}

.brand span.rest {
  color: var(--ink-soft);
  font-weight: 500;
}

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: 1.1rem;
  font-size: 0.94rem;
}

.masthead nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.masthead nav a:hover {
  color: var(--keel);
  text-decoration: underline;
}

/* ---------- search ---------- */

.finder {
  position: relative;
  margin: 0;
}

.finder input {
  width: 100%;
  min-height: var(--tap);
  font: inherit;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}
.finder input:focus {
  border-color: var(--steel);
}

.finder-results {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  max-height: 22rem;
  overflow-y: auto;
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(22, 25, 28, 0.08);
}
.finder-results.open {
  display: block;
}
.finder-results li {
  max-width: none;
}
.finder-results a {
  display: block;
  padding: 0.65rem 0.85rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--ground);
}
.finder-results a:hover,
.finder-results a:focus,
.finder-results li.active a {
  background: var(--ground);
}
.finder-results .fr-name {
  font-weight: 600;
}
.finder-results .fr-cat {
  color: var(--ink-faint);
  font-size: 0.85rem;
}
.finder-empty {
  padding: 0.75rem 0.85rem;
  color: var(--ink-faint);
}

/* ---------- home ---------- */

.lede {
  padding: 1.6rem 0 0.4rem;
}
.lede h1 {
  font-size: 1.95rem;
  margin-bottom: 0.35rem;
}
.lede p {
  color: var(--ink-soft);
  margin-top: 0;
}
.lede .finder {
  margin-top: 1.1rem;
  max-width: 34rem;
}

.grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  padding: 0;
  list-style: none;
  margin: 1rem 0 0;
}
.grid li {
  max-width: none;
}

@media (min-width: 34rem) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 56rem) {
  .grid.three {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tile {
  display: block;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  height: 100%;
}
.tile:hover {
  border-color: var(--steel);
  background: var(--ground);
  color: var(--ink);
}
.tile b {
  display: block;
  font-weight: 620;
  margin-bottom: 0.15rem;
}
.tile small {
  color: var(--ink-faint);
  font-size: 0.88rem;
  line-height: 1.45;
  display: block;
}

.chip {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 0.45rem;
  vertical-align: 1px;
  border-radius: 1px;
}
.chip-concrete { background: #8d8b84; }
.chip-road-asphalt { background: #2b2b2e; }
.chip-earthwork { background: #8a6a43; }
.chip-rebar-steel { background: #5d6f7a; }
.chip-masonry { background: #a2543a; }
.chip-finishing { background: #4b7f79; }
.chip-surveying { background: #b08a29; }

.why {
  background: var(--ground);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 2.5rem;
  padding: 1.6rem 0;
}
.why ul {
  margin: 0;
  padding-left: 1.1rem;
}
.why li {
  margin-bottom: 0.35rem;
}

/* ---------- breadcrumbs ---------- */

.crumbs {
  font-size: 0.88rem;
  color: var(--ink-faint);
  padding: 0.9rem 0 0;
}
.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}
.crumbs li {
  max-width: none;
}
.crumbs li + li::before {
  content: "/";
  margin-right: 0.35rem;
  color: var(--rule);
}

/* ---------- calculator ---------- */

.calc-head {
  padding-top: 0.6rem;
}
.calc-head p.purpose {
  color: var(--ink-soft);
  margin-top: 0;
  font-size: 1.02rem;
}

.calc {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  margin: 1.2rem 0 0;
}

.calc-body {
  padding: 1rem;
}

.units-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 1rem;
  background: var(--ground);
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.units-toggle .seg {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
}
.units-toggle button {
  font: inherit;
  border: 0;
  background: transparent;
  padding: 0.4rem 0.8rem;
  min-height: 38px;
  cursor: pointer;
  color: var(--ink-soft);
}
.units-toggle button[aria-pressed="true"] {
  background: var(--steel);
  color: #fff;
}

.field {
  margin-bottom: 0.9rem;
}
.field > label {
  display: block;
  font-weight: 560;
  margin-bottom: 0.3rem;
  font-size: 0.96rem;
}
.field .row {
  display: flex;
  gap: 0.4rem;
}
.field input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.field input[type="number"]:focus {
  border-color: var(--steel);
}
.field input.invalid {
  border-color: var(--keel);
  background: var(--keel-wash);
}
.field select {
  flex: 0 0 auto;
  min-height: var(--tap);
  font: inherit;
  padding: 0.5rem 0.5rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  background: var(--ground);
  color: var(--ink);
}
.field .help {
  font-size: 0.86rem;
  color: var(--ink-faint);
  margin: 0.3rem 0 0;
  line-height: 1.45;
  max-width: var(--measure);
}
.field .err {
  font-size: 0.86rem;
  color: var(--keel);
  margin: 0.3rem 0 0;
  font-weight: 550;
}

.field[hidden] {
  display: none;
}

.field select.choice {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.field select.choice:focus {
  border-color: var(--steel);
}

.form-err {
  margin: 0 0 0.8rem;
  padding: 0.7rem 0.9rem;
  border-left: 4px solid var(--keel);
  background: var(--keel-wash);
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 550;
  max-width: var(--measure);
}
.form-err[hidden] {
  display: none;
}

.actions {
  display: flex;
  gap: 0.6rem;
  padding-top: 0.3rem;
  flex-wrap: wrap;
}
.btn {
  font: inherit;
  font-weight: 600;
  min-height: var(--tap);
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--steel);
  background: var(--steel);
  color: #fff;
  cursor: pointer;
}
.btn:hover {
  background: var(--steel-bright);
  border-color: var(--steel-bright);
}
.btn.ghost {
  background: var(--paper);
  color: var(--steel);
}
.btn.ghost:hover {
  background: var(--ground);
  color: var(--steel);
}
.btn.small {
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 550;
}

/* the one loud element on the page */
.result {
  border-top: 1px solid var(--rule);
  background: var(--ground);
  padding: 1.1rem 1rem 1rem;
}
.result[hidden] {
  display: none;
}
.result .headline {
  border-left: 6px solid var(--keel);
  padding-left: 0.85rem;
}
.result .headline .label {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0;
}
.result .headline .value {
  font-size: clamp(2.1rem, 9vw, 3.1rem);
  font-weight: 680;
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  margin: 0.1rem 0 0;
  word-break: break-word;
}
.result .headline .value .u {
  font-size: 0.45em;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0;
  margin-left: 0.28em;
}

.result dl.secondary {
  margin: 1.1rem 0 0;
  display: grid;
  gap: 0 1.2rem;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--ground-deep);
  padding-top: 0.6rem;
}
@media (min-width: 34rem) {
  .result dl.secondary {
    grid-template-columns: repeat(2, 1fr);
  }
}
.result dl.secondary > div {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.32rem 0;
  border-bottom: 1px solid var(--ground-deep);
}
.result dt {
  color: var(--ink-soft);
  font-size: 0.93rem;
}
.result dd {
  margin: 0;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result .notes {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}
.result .notes li {
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding-left: 0.9rem;
  border-left: 2px solid var(--keel);
  margin-bottom: 0.45rem;
  line-height: 1.5;
}

.result .after {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.assume {
  border-left: 3px solid var(--rule);
  padding-left: 1rem;
  margin: 1rem 0;
}

.formula {
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0.8rem 0;
}
.formula ol {
  font-family: var(--mono);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
  padding-left: 1.3rem;
  line-height: 1.75;
}
.formula ol li {
  max-width: none;
}

.worked ol {
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.8;
  padding-left: 1.3rem;
}
.worked .outcome {
  font-family: var(--sans);
  font-weight: 600;
  border-left: 3px solid var(--keel);
  padding-left: 0.8rem;
  margin-top: 0.8rem;
}

.faq details {
  border-bottom: 1px solid var(--rule);
  padding: 0.7rem 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style-position: outside;
  min-height: 30px;
}
.faq details p {
  margin: 0.6rem 0 0.2rem;
  color: var(--ink-soft);
}

.disclaim {
  background: var(--keel-wash);
  border: 1px solid #e8d3c8;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 2rem 0 0;
}
.disclaim p {
  margin: 0;
}
.disclaim strong {
  color: var(--ink);
}

/* ---------- ads: reserved space so nothing shifts ---------- */

.adslot {
  margin: 1.6rem 0;
  display: block;
  max-width: 728px;
  min-height: 100px;
  background: repeating-linear-gradient(
    45deg,
    var(--ground),
    var(--ground) 10px,
    var(--ground-deep) 10px,
    var(--ground-deep) 20px
  );
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  color: var(--ink-faint);
  font-size: 0.75rem;
  text-align: center;
  line-height: 100px;
}
.adslot--placeholder::after {
  content: "Reserved ad space";
}

/* ---------- content pages ---------- */

.page {
  padding-bottom: 2rem;
}
.page ul,
.page ol {
  padding-left: 1.2rem;
}
.page li {
  margin-bottom: 0.4rem;
}

/* ---------- guides ---------- */

.guide h2 {
  margin-top: 2rem;
}
.guide h3 {
  margin-top: 1.4rem;
  font-size: 1.02rem;
}
.guide__dek {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0.2rem 0 1.2rem;
}
.guide__note {
  margin-top: 2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.88rem;
  color: var(--ink-faint);
  max-width: var(--measure);
}
.authorbox {
  background: var(--ground);
  border-left: 3px solid var(--keel);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1.6rem;
  max-width: var(--measure);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.authorbox p {
  margin: 0.25rem 0;
}
.authorbox__role {
  font-weight: 600;
  color: var(--ink);
}
.authorbox__cred {
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.related {
  margin-top: 2rem;
  padding: 1rem 1.1rem;
  background: var(--keel-wash);
  border-radius: var(--radius);
  max-width: var(--measure);
}
.related h2 {
  margin-top: 0;
  font-size: 1.02rem;
}
.related ul {
  margin-bottom: 0;
}
.guidelist {
  list-style: none;
  padding-left: 0;
  max-width: var(--measure);
}
.guidelist li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}
.guidelist a {
  font-weight: 600;
}
.guidelist p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1.6rem 0 2.4rem;
  background: var(--ground);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-bottom: 0.9rem;
}
.foot p {
  margin: 0.3rem 0;
  max-width: var(--measure);
}

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

@media print {
  .masthead nav,
  .adslot,
  .actions,
  .finder,
  .foot nav {
    display: none;
  }
  .result {
    border: 1px solid #000;
  }
}
