/* Matches the CleaningPhp palette: navy, ice, sky, and lime. */
:root {
  --cqp-primary: #022345;
  --cqp-primary-80: #033566;
  --cqp-accent: #A4DFF5;
  --cqp-light-bg: #E4F1F5;
  --cqp-border: #d1e7f0;
  --cqp-text: #1a202c;
  --cqp-muted: #6b7280;
  --cqp-text-soft: #3d5470;
  --navy: var(--cqp-primary);
  --navy-2: var(--cqp-primary-80);
  --sky: var(--cqp-accent);
  --ice: var(--cqp-light-bg);
  --lime: #D0FF4B;
  --text: var(--cqp-text);
  --muted: var(--cqp-text-soft);
  --max: 1180px;
  --narrow: 820px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: Lato, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
}
img { max-width: 100%; height: auto; }
a { color: var(--navy); }
a:hover { color: var(--navy-2); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
h1, h2, h3, h4 {
  font-family: Inter, system-ui, sans-serif;
  color: var(--navy);
  line-height: 1.25;
  margin: 1.6em 0 0.6em;
}
h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
.skip {
  position: absolute; left: 0.5rem; top: -3rem; background: var(--navy); color: #fff;
  padding: 0.4rem 0.7rem; z-index: 6; border-radius: 8px;
}
.skip:focus { top: 0.5rem; color: #fff; }
.wrap { width: min(100% - 40px, var(--max)); margin-inline: auto; }
@media (max-width: 600px) {
  .wrap { width: min(100% - 28px, var(--max)); }
  body { font-size: 16px; }
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--cqp-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 68px; padding: 0; }
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: Inter, system-ui, sans-serif; font-weight: 800; font-size: 1.02rem;
  color: var(--navy); letter-spacing: 0.2px; line-height: 1.2;
}
.brand img { width: 44px; height: 44px; object-fit: contain; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav > a {
  text-decoration: none; font-weight: 600; font-size: 0.92rem; color: var(--navy);
  padding: 8px 12px; border-radius: 8px; letter-spacing: 0.4px;
}
.site-nav > a:hover { background: var(--ice); color: var(--navy); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; width: 42px; height: 42px; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: var(--navy); margin: 5px 0; border-radius: 2px; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-header { position: sticky; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; flex-direction: column; align-items: stretch;
    padding: 10px 20px 18px; border-bottom: 1px solid var(--cqp-border);
    box-shadow: 0 10px 20px rgba(2, 35, 69, 0.08);
  }
  .site-nav.open { display: flex; }
}

.hero {
  margin: 0 0 8px;
  padding: 64px 20px 52px;
  /* full-bleed background without 100vw layout overflow */
  border-image: linear-gradient(var(--ice) 0 0) fill 0 / 0 / 0 100vw;
  text-align: center;
  background: var(--ice);
  position: relative;
}
.hero-inner { position: relative; max-width: 760px; margin: 0 auto; }
.hero h1 { margin: 0 0 0.3em; }
.hero-sub { font-size: 1.15rem; color: var(--navy); font-weight: 700; margin: 0; }

main { padding: 8px 0 2.5rem; }
.page-grid { display: block; }
.cards { display: grid; gap: 18px; margin: 28px 0; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex; flex-direction: column; gap: 8px; color: var(--text); background: #fff;
  border: 1px solid var(--cqp-border); border-radius: 12px; padding: 22px 20px;
  box-shadow: 0 1px 2px rgba(2, 35, 69, 0.05);
}
.card h2 { margin: 0; }
.card p { margin: 0; color: var(--cqp-text-soft); flex: 1; }
.card:hover { border-color: var(--navy); box-shadow: 0 12px 28px rgba(2, 35, 69, 0.12); }

.button, button, .calc button[type="submit"] {
  display: inline-block; width: fit-content; background: var(--navy); color: #fff;
  text-decoration: none; padding: 10px 22px; border-radius: 22px; border: 0;
  cursor: pointer; font: inherit; font-weight: 700;
}
.button:hover, button:hover, .calc button[type="submit"]:hover { background: var(--navy-2); color: #fff; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button { background: var(--ice); color: var(--navy); border-radius: 20px; }
.quick button:hover { background: var(--sky); color: var(--navy); }

.state-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.2rem 1rem; padding: 10px; margin: 0; list-style: none; background: var(--ice); border: 2px solid #fff; border-radius: 10px; }
.state-index a { text-decoration: none; font-weight: 600; }
.state-index a:hover { text-decoration: underline; text-decoration-color: var(--sky); text-underline-offset: 4px; text-decoration-thickness: 3px; }

.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; padding: 0; margin: 0 0 0.5rem; color: var(--muted); font-size: 0.85rem; }
.crumbs a { color: var(--navy); font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: 0.35rem; color: var(--cqp-muted); }

.calc, .prose, section { margin: 0 0 1.5rem; }
.calc {
  background: #fff; border: 1px solid var(--cqp-border); border-top: 4px solid var(--navy);
  border-radius: 10px; padding: 14px 16px; box-shadow: 0 4px 20px rgba(2, 35, 69, 0.1);
}
.calc-grid { display: grid; gap: 8px 12px; align-items: start; }
@media (min-width: 720px) {
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .calc-grid > .field-note,
  .calc-grid > .check { grid-column: 1 / -1; }
}
.calc-grid > label, .calc-grid > fieldset { min-width: 0; }
.calc-grid > fieldset {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 12px;
  align-items: end;
  padding: 8px 12px 10px;
}
@media (min-width: 720px) { .calc-grid > fieldset { grid-template-columns: 1fr 1fr; } }
.calc-grid > fieldset > legend,
.calc-grid > fieldset > .field-note { grid-column: 1 / -1; }
.calc > button[type="submit"] { margin-top: 10px; }
label, legend { font-family: Inter, system-ui, sans-serif; font-weight: 700; font-size: 0.82rem; color: var(--navy); }
legend { margin: 0; padding: 0 4px; }
.calc-grid > label, fieldset label { display: block; }
fieldset label { margin: 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 6px 10px; min-height: 34px;
  font: inherit; font-size: 0.95rem; color: var(--text); background: #fff;
  border: 1px solid var(--cqp-border); border-radius: 7px;
}
input[type="radio"], input[type="checkbox"] { display: inline-block; width: auto; min-height: 0; margin: 0 8px 0 0; accent-color: var(--navy); vertical-align: middle; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(2, 35, 69, 0.1); }
fieldset { border: 1px solid var(--cqp-border); border-radius: 10px; margin: 0; padding: 12px 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; padding: 8px 10px; border: 1px solid var(--cqp-border); border-radius: 8px; background: #fff; }
.check:has(input:checked) { border-color: var(--navy); background: var(--ice); color: var(--navy); }
.check input { width: auto; margin-top: 0.25rem; accent-color: var(--navy); }
.field-note, .source-line { color: var(--muted); font-size: 0.88rem; margin: 0; }
label .field-note { display: block; margin-top: 4px; font-weight: 400; }
.quick { margin-top: 8px; }
.footer-brand { font-family: Inter, system-ui, sans-serif; font-weight: 800; color: #fff; font-size: 1.1rem; margin: 0 0 6px; }
.estimate-tag {
  display: inline-block; background: var(--lime); color: var(--navy); border-radius: 20px;
  padding: 2px 10px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em;
}
.result-kicker { margin: 0 0 2px; color: var(--muted); font-size: 0.85rem; }
.result-band { font-family: Inter, system-ui, sans-serif; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; color: var(--navy); margin: 0.15rem 0; letter-spacing: -0.03em; }
.result-typical { margin-top: 0; }
#roof-results, #add-results { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--cqp-border); }
.notice, .disagree { background: var(--ice); border-left: 4px solid var(--sky); padding: 10px 14px; border-radius: 0 10px 10px 0; }
.disagree { background: #fffbeb; border-left-color: #f59e0b; }

table { width: 100%; border-collapse: collapse; font-size: 0.93rem; margin: 1.2em 0; }
th, td { text-align: left; padding: 9px 12px; border: 1px solid var(--cqp-border); vertical-align: top; }
thead th, table > thead th { background: var(--navy); color: #fff; }
tbody tr:nth-child(even) { background: #f3f9fb; }
.table-scroll { overflow-x: auto; margin: 0 0 1.25rem; }
table.sortable button { background: transparent; color: #fff; padding: 0; border-radius: 0; font-weight: 700; }
table.sortable button:hover { background: transparent; color: var(--sky); }
.prose { max-width: var(--narrow); }
.prose h1 { margin-top: 0.2em; }
details { margin: 8px 0 0; background: #fff; border: 1px solid var(--cqp-border); border-radius: 10px; padding: 0 12px 0; }
summary { cursor: pointer; font-family: Inter, system-ui, sans-serif; font-weight: 700; color: var(--navy); padding: 10px 0; }
details[open] > .calc-grid { padding-bottom: 12px; }
details[open] { background: var(--ice); }

.ad-slot { background: var(--ice); min-height: 280px; margin: 1rem 0; border-radius: 12px; }
.ad-slot-sidebar { display: none; }
@media (min-width: 1024px) {
  body.ads-on .page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
  body.ads-on .ad-slot-sidebar { display: block; min-height: 600px; }
}
.hp { position: absolute; left: -9999px; height: 1px; width: 1px; overflow: hidden; }
.quote-box { margin: 2rem 0; border: 2px solid var(--navy); background: #fff; border-radius: 12px; padding: 1.1rem 1.15rem 1.25rem; }
.quote-kicker { display: inline-block; margin: 0 0 0.35rem; padding: 0.15rem 0.5rem; background: var(--lime); color: var(--navy); font-family: Inter, system-ui, sans-serif; font-weight: 700; font-size: 0.78rem; letter-spacing: 0.02em; }
.quote-box h2 { margin-top: 0; }
.quote-error { min-height: 1.25rem; margin: 0 0 0.6rem; color: #8a1f1f; }
.quote-consent { align-items: flex-start; }
.quote-fine, .call-note { font-size: 0.82rem; color: var(--ink, #243140); margin: 0.4rem 0 0; }
.quote-follow { height: 0; margin: 0; padding: 0; }
.quote-box + .ad-slot, .ad-slot + .quote-box { margin-top: 2.5rem; }
.local-cta { margin: 1rem 0 0.4rem; }
.call-btn { display: inline-block; margin-top: 0.75rem; background: var(--navy); color: #fff; text-decoration: none; padding: 0.65rem 1rem; border-radius: 999px; font-family: Inter, system-ui, sans-serif; font-weight: 700; }
.call-btn:hover { background: var(--cqp-primary-80, #033566); color: #fff; }
.call-bar { display: none; }
body.has-call-bar { padding-bottom: 64px; }
@media (max-width: 719px) {
  body.has-call-bar .call-bar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 2px solid var(--navy); padding: 8px 12px 10px; min-height: 64px; }
  body.has-call-bar .call-inline { display: none; }
  .call-bar .call-btn { margin-top: 0; }
}
@media (min-width: 720px) {
  body.has-call-bar { padding-bottom: 0; }
}
.admin-tabs { display: flex; gap: 0.75rem; margin: 0 0 1rem; }
.admin-tabs a { font-weight: 700; }

.site-footer { background: var(--navy); color: rgba(255, 255, 255, 0.82); margin-top: 40px; font-size: 0.92rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; padding-top: 40px; padding-bottom: 26px; }
.footer-h { color: #fff; font-family: Inter, system-ui, sans-serif; font-weight: 700; margin: 0 0 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 4px; }
.site-footer a { color: var(--sky); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: var(--sky); }
.footer-base { border-top: 1px solid rgba(164, 223, 245, 0.22); padding-top: 14px; padding-bottom: 20px; font-size: 0.82rem; color: rgba(255, 255, 255, 0.66); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

@media print {
  .site-header, .site-footer, .calc button, .ad-slot, .nav-toggle, .quote-box, .quote-follow, .call-bar, .call-inline, .call-btn { display: none !important; }
  body { background: #fff; }
  .calc { box-shadow: none; }
}

/* Overflow guards */
.header-inner, .brand { min-width: 0; }
.brand span { min-width: 0; overflow-wrap: anywhere; }
main a, .site-footer a, p, li { overflow-wrap: anywhere; }
.table-scroll { max-width: 100%; }
html, body { overflow-x: clip; } /* safety net only */
