/* RemodelMath — base stylesheet
   Keep it dependency-free: fast load = better SEO. */

:root {
  --bg: #ffffff;
  --surface: #f5f7f6;
  --surface-2: #eaf0ed;
  --text: #101a16;
  --muted: #566761;
  --brand: #0f7a5f;
  --brand-ink: #0a5a45;
  --brand-soft: #e4f3ed;
  --border: #dde5e2;
  --warn: #7a4d00;
  --warn-soft: #fff5dd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 26, .05), 0 10px 30px rgba(16, 32, 26, .06);
  --max: 1080px;
  --prose: 720px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --surface: #141d1a;
    --surface-2: #1b2723;
    --text: #e9f0ed;
    --muted: #9db0a9;
    --brand: #35c79c;
    --brand-ink: #7ee7c6;
    --brand-soft: #12261f;
    --border: #253430;
    --warn: #ffcf70;
    --warn-soft: #2a2113;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

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

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); margin-top: 2.2em; }
h3 { font-size: 1.15rem; margin-top: 1.6em; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; }
li { margin-bottom: .35em; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.prose { max-width: var(--prose); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 20px;
  min-height: 64px;
}
.logo {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.06rem; letter-spacing: -.03em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.logo-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: #fff;
  font-size: .82rem; font-weight: 800; letter-spacing: -.04em;
}
.site-nav { margin-left: auto; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--muted); text-decoration: none; font-size: .925rem; font-weight: 550;
  padding: 8px 11px; border-radius: 9px; white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-soft); }

/* ---------- Hero ---------- */
.hero { padding: clamp(38px, 6vw, 72px) 0 8px; }
.hero p.lede { font-size: clamp(1.05rem, 2vw, 1.22rem); color: var(--muted); max-width: 640px; }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--brand-ink);
  background: var(--brand-soft); padding: 5px 10px; border-radius: 999px; margin-bottom: 16px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 11px; border: 1px solid transparent;
  font: inherit; font-weight: 650; font-size: .97rem; text-decoration: none;
  cursor: pointer; transition: transform .12s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-block { width: 100%; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card {
  display: block; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; text-decoration: none; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
a.card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; font-size: 1.06rem; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; }
.card .tag {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--brand-ink); margin-bottom: 10px;
}

/* ---------- Calculator ---------- */
.calc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: clamp(18px, 3vw, 30px); margin: 28px 0 34px;
  box-shadow: var(--shadow);
}
.calc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.calc-head h2, .calc-head h3 { margin: 0; font-size: 1.16rem; }
.calc-sub { color: var(--muted); font-size: .9rem; margin: 0 0 20px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .88rem; font-weight: 600; }
.field .hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
.input-row { display: flex; align-items: stretch; }
.input-row input, .field select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
.input-row input { border-radius: 10px 0 0 10px; border-right: 0; }
.input-unit {
  display: grid; place-items: center; padding: 0 13px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 0 10px 10px 0; color: var(--muted); font-size: .87rem; white-space: nowrap;
}
.field select:focus, .input-row input:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 1px; border-color: var(--brand);
}
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }

.results { margin-top: 6px; padding-top: 22px; border-top: 1px dashed var(--border); }
.results[hidden] { display: none; }
.result-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.result-nums div {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 8px; text-align: center;
}
.result-nums .k { display: block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.result-nums .v { display: block; font-size: clamp(1.05rem, 2.6vw, 1.45rem); font-weight: 800; letter-spacing: -.03em; margin-top: 3px; }
.result-nums .typical { border-color: var(--brand); background: var(--brand-soft); }
.result-nums .typical .v { color: var(--brand-ink); }
.breakdown { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .92rem; }
.breakdown th, .breakdown td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--border); }
.breakdown th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.breakdown td:last-child, .breakdown th:last-child { text-align: right; white-space: nowrap; }
.calc-note { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 18px 0 26px; border: 1px solid var(--border); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.data th { background: var(--surface); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }
table.data td:last-child { white-space: nowrap; }

/* ---------- Callouts ---------- */
.callout {
  border-left: 3px solid var(--brand); background: var(--brand-soft);
  padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 24px 0; font-size: .95rem;
}
.callout.warn { border-color: var(--warn); background: var(--warn-soft); color: var(--text); }
.callout p:last-child { margin-bottom: 0; }

/* ---------- FAQ ---------- */
.faq details {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 10px; background: var(--bg);
}
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 14px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details[open] summary { margin-bottom: 10px; }
.faq p:last-child { margin-bottom: 0; }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--surface-2); border-radius: 18px; padding: clamp(24px, 4vw, 40px);
  margin: 48px 0; text-align: center;
}
.cta-band h2 { margin-top: 0; }
.cta-band p { max-width: 560px; margin-inline: auto; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 64px; padding: 40px 0 56px;
  font-size: .9rem; color: var(--muted);
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 28px; }
.footer-grid h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin: 0 0 10px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 7px; }
.footer-grid a { color: var(--muted); text-decoration: none; }
.footer-grid a:hover { color: var(--brand); }
.footer-bottom { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; font-size: .82rem; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: .85rem; color: var(--muted); margin: 22px 0 0; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }

/* ---------- Article bits ---------- */
.page-head { padding: 26px 0 6px; }
.page-head h1 { margin-bottom: .35em; }
.byline { font-size: .85rem; color: var(--muted); margin-bottom: 22px; }
.toc { border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin: 24px 0; background: var(--surface); font-size: .93rem; }
.toc strong { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 8px; }
.toc ul { margin: 0; padding-left: 18px; }

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 8px; font-size: .88rem; }
  .header-inner { flex-wrap: wrap; gap: 4px; padding-top: 10px; padding-bottom: 8px; }
  .site-nav { margin-left: 0; width: 100%; }
  .result-nums { grid-template-columns: 1fr; }
  .result-nums div { display: flex; align-items: center; justify-content: space-between; text-align: left; padding: 10px 14px; }
}
