/* ==========================================================================
   calc-tools — shared stylesheet
   Mobile-first, premium-clean, vanilla CSS. Used by hub + all 6 calculators.
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16202c;
  --ink-soft: #4a5763;
  --line: #e3e7ec;
  --brand: #137a5b;       /* deep landscaping green */
  --brand-dark: #0f5f47;
  --brand-soft: #e7f4ef;
  --accent: #c9881f;      /* warm amber for affiliate/CTA */
  --accent-dark: #a36c12;
  --shadow: 0 1px 2px rgba(16,32,44,.06), 0 8px 24px rgba(16,32,44,.06);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

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

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.9rem; margin: 0 0 .5rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.08rem; margin: 1.25rem 0 .5rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

/* ---- Header ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); display: inline-block; }
.site-nav a { color: var(--ink-soft); font-size: .92rem; margin-left: 1.1rem; }

/* ---- Breadcrumb ---- */
.crumbs { font-size: .85rem; color: var(--ink-soft); padding: .85rem 0 .25rem; }
.crumbs a { color: var(--ink-soft); }

/* ---- Hero / intro ---- */
.intro { padding: 1rem 0 .5rem; }
.intro p.lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 70ch; margin: .25rem 0 0; }

/* ---- Layout grid (tool + sidebar) ---- */
.layout { display: grid; grid-template-columns: 1fr; gap: 22px; padding: 1rem 0 3rem; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0,1fr) 300px; align-items: start; }
}

/* ---- Card / panel ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

/* ---- Calculator form ---- */
.calc h2 { margin-top: 0; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: .82rem; }

input[type="number"], select {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  appearance: none;
}
input[type="number"]:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a5763' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .row-3 { grid-template-columns: 1fr 1fr; } }

/* Shape selector */
.shape-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.shape-tabs button {
  flex: 1 1 auto; min-width: 84px;
  padding: 9px 6px; font-size: .85rem; font-weight: 600;
  background: #fff; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; font-family: inherit;
}
.shape-tabs button.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

/* Area rows (multi-area) */
.area-block { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; position: relative; }
.area-block .area-label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.area-block .remove-area {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: #b23b3b; cursor: pointer; font-size: .82rem; font-family: inherit;
}
.btn-add-area {
  width: 100%; padding: 10px; margin-bottom: 16px;
  background: #fff; border: 1px dashed var(--brand); color: var(--brand-dark);
  border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; font-family: inherit; font-size: .9rem;
}

/* Buttons */
.btn {
  display: inline-block; cursor: pointer; font-family: inherit;
  font-weight: 700; font-size: 1rem; border: none; border-radius: var(--radius-sm);
  padding: 13px 20px; background: var(--brand); color: #fff; width: 100%;
}
.btn:hover { background: var(--brand-dark); }

/* ---- Result panel ---- */
.result { background: var(--brand-soft); border: 1px solid var(--brand); border-radius: var(--radius); padding: 20px; margin: 18px 0; display: none; }
.result.show { display: block; }
.result .headline { font-size: 1.5rem; font-weight: 800; color: var(--brand-dark); margin: 0 0 .4rem; }
.result .subline { color: var(--ink); margin: 0 0 .8rem; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 520px) { .result-grid { grid-template-columns: 1fr; } }
.result-stat { background: #fff; border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--line); }
.result-stat .k { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.result-stat .v { font-size: 1.25rem; font-weight: 700; }
.result .note { font-size: .85rem; color: var(--ink-soft); margin-top: 12px; }

/* ---- Affiliate card ---- */
.buy-card { border: 1px solid var(--accent); border-left: 4px solid var(--accent); background: #fffaf0; border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.buy-card h3 { margin-top: 0; color: var(--accent-dark); }
.buy-list { list-style: none; margin: 0; padding: 0; }
.buy-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0e6d2; }
.buy-list li:last-child { border-bottom: none; }
.buy-list .item-name { font-weight: 600; }
.buy-list .item-desc { display: block; font-weight: 400; font-size: .82rem; color: var(--ink-soft); }
.buy-btn { white-space: nowrap; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 700; }
.buy-btn:hover { background: var(--accent-dark); text-decoration: none; }
.aff-disclosure { font-size: .76rem; color: var(--ink-soft); margin-top: 10px; }

/* ---- Ad slots ---- */
.ad-slot {
  background: repeating-linear-gradient(45deg, #f0f1f3, #f0f1f3 10px, #eaecef 10px, #eaecef 20px);
  border: 1px dashed #c8ccd2; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #9aa1aa; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  min-height: 100px; margin: 24px 0; text-align: center;
}
.ad-slot.in-content { min-height: 110px; }
.ad-sidebar { position: sticky; top: 76px; }
.ad-sidebar .ad-slot { min-height: 600px; margin: 0; }

/* ---- Collapsible "how the math works" ---- */
details.how { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
details.how > summary {
  cursor: pointer; list-style: none; padding: 18px 20px; font-weight: 700; font-size: 1.15rem;
  display: flex; align-items: center; justify-content: space-between;
}
details.how > summary::-webkit-details-marker { display: none; }
details.how > summary::after { content: "+"; font-size: 1.4rem; color: var(--brand); font-weight: 700; }
details.how[open] > summary::after { content: "\2212"; }
details.how .how-body { padding: 0 20px 20px; }
details.how .how-body p, details.how .how-body li { color: var(--ink-soft); }
.formula { background: #f3f5f7; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; color: var(--ink); margin: 10px 0; overflow-x: auto; }

/* ---- Tables ---- */
table.ref { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .9rem; }
table.ref th, table.ref td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.ref th { background: var(--brand-soft); color: var(--brand-dark); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
table.ref tbody tr:nth-child(even) { background: #fafbfc; }

/* ---- FAQ ---- */
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.faq details p { color: var(--ink-soft); margin: 0 0 14px; }

/* ---- Hub grid ---- */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 1rem 0 2rem; }
@media (min-width: 640px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .tool-grid { grid-template-columns: 1fr 1fr 1fr; } }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; transition: transform .12s ease, box-shadow .12s ease; }
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(16,32,44,.08), 0 14px 34px rgba(16,32,44,.10); text-decoration: none; }
.tool-card .ico { font-size: 1.8rem; margin-bottom: .4rem; }
.tool-card h3 { margin: 0 0 .35rem; color: var(--ink); }
.tool-card p { margin: 0; color: var(--ink-soft); font-size: .92rem; flex: 1; }
.tool-card .go { margin-top: .9rem; font-weight: 700; color: var(--brand); font-size: .9rem; }

/* ---- Footer ---- */
.site-footer { background: var(--ink); color: #c7d0d9; padding: 36px 0; font-size: .9rem; margin-top: 2rem; }
.site-footer a { color: #e4ebf1; }
.footer-cols { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 720px) { .footer-cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { color: #fff; font-size: .95rem; margin: 0 0 .6rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .35rem; }
.site-footer .legal { margin-top: 24px; border-top: 1px solid #2a3743; padding-top: 16px; color: #8b97a3; font-size: .82rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---- CPL "get free quotes" block ---- */
.cpl-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.cpl-card h3 { color: #fff; margin: 0 0 .25rem; }
.cpl-card p { margin: 0; color: #dff0e9; font-size: .92rem; max-width: 46ch; }
.cpl-btn {
  white-space: nowrap; background: #fff; color: var(--brand-dark);
  padding: 12px 20px; border-radius: var(--radius-sm); font-weight: 800; font-size: .95rem;
}
.cpl-btn:hover { background: #f0f6f3; text-decoration: none; }

/* ---- Embed widget ---- */
.embed .embed-box { display: flex; flex-direction: column; gap: 10px; }
.embed-code {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem; color: var(--ink); background: #f3f5f7;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px;
  resize: vertical; line-height: 1.5;
}
.embed-copy { width: auto; align-self: flex-start; padding: 10px 18px; font-size: .9rem; }
.embed-preview-note { font-size: .85rem; color: var(--ink-soft); margin-top: 12px; }
.embed-credit { background: #f3f5f7; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }

/* ---- Legal / info pages ---- */
.legal-page h1 { margin-top: .25rem; }
.legal-page h2 { font-size: 1.2rem; }
.legal-page p, .legal-page li { color: var(--ink-soft); max-width: 72ch; }
.legal-page .lede { font-size: 1.05rem; }
.legal-page ul { padding-left: 1.2rem; }
.contact-form { max-width: 480px; margin: 1rem 0 1.5rem; }
.contact-form textarea {
  width: 100%; padding: 11px 12px; font-size: 1rem; font-family: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.contact-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.contact-form .btn { width: auto; padding: 12px 24px; }
