/* ===========================================================
   Project Estimator — shared styles for all calculator pages
   Edit colors here once and every page updates.
   =========================================================== */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #ea580c;
  --accent-dark: #c2410c;
  --accent-light: #fff7ed;
  --panel: #0f172a;
  --panel-text: #f8fafc;
  --good: #16a34a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --maxw: 760px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff; font-size: 17px;
}
.nav-links { display: flex; gap: 20px; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--accent-dark); text-decoration: none; }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.wide { max-width: 1080px; }
main { padding: 32px 0 56px; }

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }

h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.025em; margin: 0 0 10px; }
h2 { font-size: 22px; letter-spacing: -0.02em; margin: 36px 0 14px; }
.lede { font-size: 17px; color: var(--muted); margin: 0 0 26px; max-width: 60ch; }

/* ---------- Calculator card ---------- */
.calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.calc-inputs { padding: 22px; }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input[type="number"], select {
  width: 100%;
  padding: 11px 13px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}
.input-unit { position: relative; }
.input-unit .unit {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.input-unit input { padding-right: 46px; }

/* ---------- Result panel ---------- */
.result {
  background: var(--panel);
  color: var(--panel-text);
  padding: 24px 22px;
}
.result-label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; margin: 0 0 4px; }
.result-main { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; color: #fff; }
.result-main .u { font-size: 20px; font-weight: 600; color: #fb923c; margin-left: 6px; }
.result-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.12);
}
.result-grid .stat .v { font-size: 22px; font-weight: 700; color: #fff; }
.result-grid .stat .k { font-size: 12px; color: #94a3b8; }

/* ---------- Ad slot ---------- */
.ad-slot {
  margin: 28px 0;
  min-height: 100px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: #cbd5e1;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  background: #fff;
}

/* ---------- Explainer / SEO content ---------- */
.prose { font-size: 16px; color: #334155; }
.prose p { margin: 0 0 14px; }
.prose ul { margin: 0 0 14px; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.formula {
  background: var(--accent-light);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  color: #7c2d12;
  margin: 0 0 16px;
}
.faq { border-top: 1px solid var(--border); padding-top: 8px; }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq summary { font-weight: 600; cursor: pointer; font-size: 16px; }
.faq summary::-webkit-details-marker { color: var(--accent); }
.faq p { margin: 10px 0 0; color: #475569; }

/* ---------- Related / grid of tools ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  display: block;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: #fdba74;
  box-shadow: 0 6px 18px rgba(15,23,42,0.07);
  text-decoration: none;
}
.tool-card .ico { font-size: 26px; margin-bottom: 10px; }
.tool-card h3 { margin: 0 0 4px; font-size: 17px; color: var(--text); }
.tool-card p { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- Hero (homepage) ---------- */
.hero { text-align: center; padding: 20px 0 8px; }
.hero h1 { font-size: 40px; }
.hero .lede { margin: 0 auto 8px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 28px 20px;
  color: var(--muted);
  font-size: 14px;
}
.site-footer .wide { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--muted); }
.disclaimer { font-size: 12px; color: #94a3b8; max-width: 60ch; margin-top: 6px; }

/* ---------- Multi-room (paint calculator) ---------- */
.room { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; background: #fff; }
.room-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.room-title { font-weight: 700; font-size: 15px; }
.room-remove { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 6px; font-family: inherit; }
.room-remove:hover { color: var(--accent-dark); background: var(--accent-light); }
.btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-light); color: var(--accent-dark);
  border: 1px dashed #fdba74; border-radius: var(--radius-sm);
  padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn-add:hover { background: #ffedd5; }
.mode-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 16px; }
.mode-btn { border: none; background: none; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted); border-radius: 7px; cursor: pointer; font-family: inherit; }
.mode-btn.active { background: #fff; color: var(--accent-dark); box-shadow: var(--shadow); }

/* ---------- Tile layout visualizer ---------- */
.visualizer { margin: 8px 0 4px; }
.viz-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.viz-controls .field { margin: 0; }
.viz-stage { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #6b7280; min-height: 120px; }
.viz-stage svg { display: block; width: 100%; height: auto; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 16px; font-size: 13px; color: var(--muted); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend .sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #334155; }
.sw-full { background: #e7e5e4; }
.sw-cut { background: #fdba74; }
.sw-corner { background: #f97316; }
.sw-grout { background: #6b7280; }
.sw-overlap { background: repeating-linear-gradient(45deg, #94a3b8, #94a3b8 2px, #475569 2px, #475569 4px); }
.viz-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.viz-stats .s { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.viz-stats .s .v { font-size: 17px; font-weight: 700; color: var(--text); }
.viz-stats .s .k { font-size: 12px; color: var(--muted); }
.viz-reco { background: var(--accent-light); border: 1px solid #fed7aa; border-radius: var(--radius-sm); padding: 6px 16px; font-size: 14px; color: #7c2d12; }
.viz-reco p { margin: 10px 0; }
.viz-reco strong { color: #9a3412; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .hero h1 { font-size: 30px; }
  .row { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .result-main { font-size: 36px; }
  .nav-links { gap: 14px; }
}
