:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #5e6764;
  --line: #d8ddd8;
  --panel: #ffffff;
  --paper: #f5f3ee;
  --paper-strong: #ebe7de;
  --steel: #234e5d;
  --steel-ink: #eaf3f4;
  --safety: #d76723;
  --sage: #54705b;
  --warning: #8a4b12;
  --shadow: 0 16px 40px rgba(24, 32, 31, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 3vw, 40px);
  background: rgba(245, 243, 238, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--steel);
  border-radius: 6px;
  font-size: 0.86rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.site-nav a {
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
  background: var(--paper-strong);
}

.shell {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 36px);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(210px, 0.58fr) minmax(430px, 1.34fr) minmax(270px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.toolbox,
.calculator-panel,
.takeoff-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbox {
  position: sticky;
  top: 82px;
  overflow: hidden;
}

.toolbox-head,
.takeoff-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--safety);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolbox h2,
.takeoff-head h2 {
  margin: 0;
  font-size: 1rem;
}

.tool-nav {
  display: grid;
  padding: 8px;
  gap: 6px;
}

.tool-button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.tool-button:hover,
.tool-button:focus-visible,
.tool-button.is-active {
  background: #eef1ec;
}

.tool-button.is-active {
  box-shadow: inset 3px 0 0 var(--safety);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #fff;
  background: var(--steel);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.tool-button small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.calculator-panel {
  overflow: hidden;
}

.calc-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.42fr);
  gap: 20px;
  padding: clamp(20px, 3vw, 32px);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(24, 32, 31, 0.92), rgba(35, 78, 93, 0.74)),
    url("assets/jobsite-measurement.jpg") center / cover;
}

.calc-intro h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.85rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.calc-intro p {
  max-width: 740px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 1.4vw, 1.14rem);
}

.intro-stats {
  display: grid;
  align-content: end;
  gap: 10px;
}

.stat-pill {
  padding: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
}

.stat-pill strong {
  display: block;
  font-size: 1.2rem;
}

.stat-pill span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.calc-body {
  padding: clamp(18px, 3vw, 30px);
}

.calc-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.calc-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.15;
}

.calc-heading p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
}

.formula-tag {
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--steel);
  background: #e8f1f1;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 750;
}

.input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid #cfd6cf;
  border-radius: 6px;
}

.input-wrap:focus-within {
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(35, 78, 93, 0.14);
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  min-width: 0;
  padding: 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.input-wrap select {
  grid-column: 1 / -1;
  appearance: auto;
}

.suffix {
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.help {
  color: var(--muted);
  font-size: 0.82rem;
}

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: var(--safety);
}

.primary-btn:hover,
.primary-btn:focus-visible {
  background: #bd5519;
}

.ghost-btn {
  color: var(--steel);
  background: #fff;
  border-color: var(--line);
}

.ghost-btn:hover,
.ghost-btn:focus-visible {
  background: #edf2f2;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 14px;
  background: #f2f5f3;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.1;
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row span:first-child {
  color: var(--muted);
}

.detail-row strong {
  text-align: right;
}

.note-list {
  margin: 16px 0 0;
  padding: 12px 14px;
  color: #5d3a12;
  background: #fff4e4;
  border: 1px solid #ecd1aa;
  border-radius: 6px;
}

.note-list li {
  margin-left: 18px;
}

.takeoff-panel {
  position: sticky;
  top: 82px;
  overflow: hidden;
}

.takeoff-list {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.takeoff-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.takeoff-item span {
  color: var(--muted);
}

.takeoff-warning {
  margin: 0 16px 16px;
  padding: 12px;
  color: var(--warning);
  background: #fff8ec;
  border: 1px solid #ead2ac;
  border-radius: 6px;
  font-size: 0.88rem;
}

.site-photo-credit {
  padding: 0 16px 16px;
  color: var(--muted);
  font-size: 0.75rem;
}

.site-photo-credit a {
  color: var(--steel);
}

.tile-preview {
  display: grid;
  grid-template-columns: repeat(var(--preview-cols), minmax(10px, 1fr));
  gap: 3px;
  max-width: 520px;
  margin-top: 16px;
  padding: 10px;
  background: #303a38;
  border-radius: 6px;
}

.tile-cell {
  aspect-ratio: 1.35;
  background: #c9d6cd;
  border: 1px solid rgba(24, 32, 31, 0.18);
}

.tile-cell.is-cut {
  background: #e0b175;
}

.content-band {
  margin-top: 24px;
  padding: clamp(22px, 4vw, 42px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.content-band h2 {
  max-width: 850px;
  margin: 0 0 12px;
  font-size: clamp(1.45rem, 2.5vw, 2.35rem);
  line-height: 1.14;
}

.content-band p {
  max-width: 900px;
  color: var(--muted);
}

.opportunity-grid,
.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.opportunity,
.faq-item {
  padding: 16px;
  background: #f7f8f5;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.opportunity h3,
.faq-item h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.opportunity p,
.faq-item p {
  margin: 0;
  font-size: 0.94rem;
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.page-links a {
  padding: 10px 12px;
  color: var(--steel);
  text-decoration: none;
  background: #edf2f2;
  border-radius: 6px;
}

.site-footer {
  margin-top: 28px;
  padding: 24px clamp(16px, 3vw, 40px);
  color: var(--muted);
  background: #1f2826;
}

.site-footer a {
  color: #fff;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  width: min(1460px, 100%);
  margin: 0 auto;
}

@media (max-width: 1140px) {
  .workbench {
    grid-template-columns: 1fr;
  }

  .toolbox,
  .takeoff-panel {
    position: static;
  }

  .tool-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .takeoff-panel {
    order: 3;
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
  }

  .site-nav {
    display: none;
  }

  .shell {
    padding: 12px;
  }

  .calc-intro {
    grid-template-columns: 1fr;
  }

  .intro-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .field-grid,
  .result-grid,
  .opportunity-grid,
  .faq-grid,
  .tool-nav {
    grid-template-columns: 1fr;
  }

  .calc-heading {
    display: block;
  }

  .formula-tag {
    display: inline-block;
    margin-top: 12px;
  }

  .detail-row,
  .takeoff-item {
    align-items: flex-start;
  }
}

@media print {
  .site-header,
  .toolbox,
  .calc-actions,
  .content-band,
  .site-footer {
    display: none;
  }

  body {
    background: #fff;
  }

  .shell,
  .calc-body {
    padding: 0;
  }

  .workbench {
    display: block;
  }

  .calculator-panel,
  .takeoff-panel {
    box-shadow: none;
    border: 0;
  }
}
