/* HomeBackupSizer.com — Clean, Fast, Mobile-First Stylesheet (v3) */
:root {
  --navy: #0f172a;
  --navy-soft: #1e293b;
  --amber: #d97706;
  --amber-hover: #b45309;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --slate-text: #334155;
  --slate-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --white: #ffffff;
  --green-bg: #ecfdf5;
  --green-text: #065f46;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: clip;
}
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--navy);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.content-narrow {
  max-width: 860px;
}

/* Header */
.site-header {
  background: var(--navy);
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  text-decoration: none;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(245, 158, 11, 0.16);
  font-size: 1rem;
}
.site-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.site-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.site-nav a:hover { color: var(--white); }

/* Hero */
.hero {
  background: linear-gradient(180deg, #0f172a 0%, #172554 100%);
  color: var(--white);
  padding: 44px 0 38px;
  width: 100%;
}
.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  max-width: 100%;
  line-height: 1.35;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.55rem, 4vw, 2.5rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}
.hero-sub {
  margin: 0 0 22px;
  max-width: 720px;
  color: #cbd5e1;
  font-size: 1.02rem;
  overflow-wrap: break-word;
}

.presets-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.presets-label {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 600;
  margin-right: 4px;
}
.preset-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  max-width: 100%;
}
.preset-btn:hover { background: rgba(255, 255, 255, 0.15); }
.preset-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--white);
}

/* Main Calculator Grid */
.calc-section { padding: 30px 0 48px; }
.calc-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 24px;
  align-items: start;
}
.calc-grid > *,
.calc-inputs,
.calc-results,
.card,
.setting-group,
.stat-box,
.formula-card,
.rec-box {
  min-width: 0;
  max-width: 100%;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0;
  font-size: 1.15rem;
}
.step-pill {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #f1f5f9;
  color: var(--slate-muted);
  padding: 3px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}
.card-helper {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--slate-muted);
}

/* Settings Controls */
.setting-group { margin-bottom: 16px; }
.setting-group:last-child { margin-bottom: 0; }
.setting-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}
.duration-pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.dur-btn {
  padding: 9px 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--navy);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.dur-btn:hover { border-color: #94a3b8; }
.dur-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.setting-row-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.form-select, .form-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  background: var(--white);
  color: var(--navy);
}
.form-select:disabled { background: #f1f5f9; color: #94a3b8; }

/* Warning Banner */
.alert-warning {
  display: flex;
  gap: 12px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #78350f;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.alert-icon { font-size: 1.25rem; line-height: 1.2; flex-shrink: 0; }
.hidden { display: none !important; }

/* Appliance Rows */
.appliance-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
  width: 100%;
  min-width: 0;
}
.app-row.is-active {
  background: var(--white);
  border-color: #94a3b8;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}
.app-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.app-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--amber);
  cursor: pointer;
  flex-shrink: 0;
}
.app-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-name {
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1.3;
  overflow-wrap: break-word;
}
.app-note {
  font-size: 0.78rem;
  color: var(--slate-muted);
  overflow-wrap: break-word;
}

.app-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ctrl-field {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.ctrl-lbl {
  font-size: 0.7rem;
  color: var(--slate-muted);
  text-transform: uppercase;
  font-weight: 600;
}
.hrs-input {
  width: 64px;
  padding: 5px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.88rem;
  text-align: right;
}
.hrs-input:disabled { background: #e2e8f0; color: #94a3b8; }
.app-wh {
  min-width: 74px;
  text-align: right;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--navy);
}

/* Custom Device Adder */
.custom-adder {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed #cbd5e1;
}
.custom-adder h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--slate-text);
}
.custom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 0.7fr) auto;
  gap: 8px;
}

/* Sticky Results Dashboard */
.sticky-stack {
  position: sticky;
  top: 78px;
}
.results-card {
  border-top: 4px solid var(--amber);
}
.results-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber-hover);
}
.big-metric {
  font-size: clamp(1.85rem, 6vw, 2.3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 4px 0;
}
.metric-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--slate-muted);
}
.action-icons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.icon-btn {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.icon-btn:hover { background: #e2e8f0; }

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.stat-label {
  display: block;
  font-size: 0.74rem;
  color: var(--slate-muted);
}
.stat-val {
  font-size: 1rem;
  color: var(--navy);
  overflow-wrap: break-word;
}

.solar-verdict {
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.83rem;
  margin-bottom: 16px;
}

/* Breakdown Chart */
.breakdown-wrap { margin-bottom: 18px; }
.breakdown-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-muted);
  margin-bottom: 8px;
}
.breakdown-bars { display: flex; flex-direction: column; gap: 8px; }
.bar-label-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 3px;
}
.bar-label-row span:first-child {
  min-width: 0;
  overflow-wrap: break-word;
}
.bar-label-row span:last-child {
  flex-shrink: 0;
}
.bar-track {
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0f172a, #d97706);
  border-radius: 999px;
}
.empty-msg { font-size: 0.86rem; color: var(--slate-muted); margin: 0; }

/* Recommendation Conversion Bridge */
.rec-box {
  background: var(--amber-bg);
  border: 1.5px solid var(--amber-border);
  border-radius: 10px;
  padding: 16px;
}
.rec-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--amber-hover);
  margin-bottom: 4px;
}
.rec-title {
  margin: 0 0 6px;
  font-size: 1.06rem;
  line-height: 1.3;
  overflow-wrap: break-word;
}
.rec-specs {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-text);
  overflow-wrap: break-word;
}
.rec-why {
  margin: 0 0 14px;
  font-size: 0.86rem;
  color: var(--slate-text);
  overflow-wrap: break-word;
}

.btn-primary, .btn-dark, .btn-secondary {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease;
}
.btn-primary {
  background: var(--amber);
  color: var(--white);
  padding: 12px 16px;
  font-size: 0.96rem;
}
.btn-primary:hover { background: var(--amber-hover); }
.btn-dark {
  background: var(--navy);
  color: var(--white);
  padding: 11px 16px;
  font-size: 0.94rem;
}
.btn-dark:hover { background: var(--navy-soft); }
.btn-secondary {
  background: #e2e8f0;
  color: var(--navy);
  padding: 10px 14px;
  font-size: 0.88rem;
}
.btn-secondary:hover { background: #cbd5e1; }
.btn-block { width: 100%; }

.rec-alt-row {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #fde68a;
  font-size: 0.82rem;
  overflow-wrap: break-word;
}
.alt-label { color: var(--slate-muted); margin-right: 4px; }
.alt-link { color: var(--navy); font-weight: 600; }

.solar-addon {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--amber-border);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}
.solar-addon strong { display: block; color: var(--navy); }
.solar-addon span { color: var(--slate-muted); font-size: 0.78rem; }
.solar-link {
  white-space: nowrap;
  font-weight: 700;
  color: var(--amber-hover);
  text-decoration: none;
}
.micro-disclosure {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: var(--slate-muted);
}
.micro-disclosure a { color: var(--slate-muted); }

/* Lead Capture Card */
.lead-card h3 { margin: 0 0 6px; font-size: 1.04rem; }
.lead-sub { margin: 0 0 12px; font-size: 0.86rem; color: var(--slate-muted); }
.lead-inputs {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 8px;
  margin-bottom: 10px;
}
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.lead-status {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.lead-status.is-success { color: #047857; }
.lead-status.is-error { color: #b91c1c; }

/* Editorial Sections */
.content-section { padding: 48px 0; }
.alt-bg { background: var(--white); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.content-section h2 { margin-top: 0; font-size: 1.5rem; }

.formula-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
}
.formula-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.formula-card h3 { margin: 0 0 8px; font-size: 1.02rem; }
.formula-card p { margin: 0; font-size: 0.92rem; color: var(--slate-text); }

/* Reference Table */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 18px;
}
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--white);
}
.ref-table th, .ref-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.ref-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: var(--navy);
}

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px 18px;
}
.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  font-size: 0.98rem;
}
.faq-item p {
  margin: 10px 0 0;
  font-size: 0.93rem;
  color: var(--slate-text);
}

/* Static Legal / Info Pages */
.page-article {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 28px auto 44px;
  max-width: 820px;
}
.page-article h1 { margin-top: 0; }
.page-article h2 { margin-top: 26px; font-size: 1.2rem; }

/* Footer */
.site-footer {
  background: var(--navy);
  color: #cbd5e1;
  padding: 38px 0 26px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-brand { max-width: 420px; }
.footer-brand strong { color: var(--white); font-size: 1.08rem; }
.footer-brand p { margin: 8px 0 0; font-size: 0.86rem; color: #94a3b8; }
.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.footer-links a { color: #e2e8f0; text-decoration: none; font-size: 0.88rem; }
.footer-links a:hover { color: #fcd34d; }
.footer-bottom {
  padding-top: 18px;
  font-size: 0.78rem;
  color: #94a3b8;
  overflow-wrap: break-word;
}
.footer-bottom p { margin: 0; }

/* Responsive — Tablet */
@media (max-width: 920px) {
  html, body { overflow-x: hidden; }
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky-stack { position: static; }
  .formula-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Responsive — Mobile */
@media (max-width: 640px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  .site-header { position: static; }
  .header-inner {
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
    align-items: flex-start;
    gap: 8px;
  }
  .site-nav {
    gap: 8px 14px;
    width: 100%;
  }
  .site-nav a { font-size: 0.84rem; }
  .hero { padding: 26px 0 24px; }
  .hero-sub { font-size: 0.95rem; }
  .calc-section { padding: 18px 0 36px; }
  .card { padding: 16px; margin-bottom: 16px; }
  .duration-pills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .setting-row-2, .lead-inputs { grid-template-columns: minmax(0, 1fr); }
  .custom-grid { grid-template-columns: minmax(0, 1fr); }
  .stats-grid { gap: 8px; }
  .stat-box { padding: 8px 10px; }
  .stat-val { font-size: 0.92rem; }
  .app-row {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .app-controls {
    width: 100%;
    justify-content: space-between;
    padding-left: 28px;
  }
  .ctrl-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .solar-addon {
    flex-direction: column;
    align-items: flex-start;
  }
  .content-section { padding: 34px 0; }
  .content-section h2 { font-size: 1.32rem; }
  .page-article { padding: 20px 16px; }

  /* Convert Wattage Reference Table to Clean Stacked Mobile Cards (Zero Cutoff) */
  .table-wrap { overflow-x: visible; }
  .ref-table, .ref-table tbody, .ref-table tr, .ref-table td {
    display: block;
    width: 100%;
  }
  .ref-table thead { display: none; }
  .ref-table tr {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .ref-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
    text-align: right;
  }
  .ref-table td:last-child { border-bottom: none; padding-bottom: 0; }
  .ref-table td:first-child {
    display: block;
    text-align: left;
    font-weight: 700;
    font-size: 0.94rem;
    color: var(--navy);
    padding-top: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .ref-table td:first-child::before { display: none; }
  .ref-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--slate-muted);
    text-align: left;
    flex-shrink: 0;
  }
}

/* Print / Save PDF Styling */
@media print {
  .no-print, .site-header, .site-footer, .content-section, .custom-adder { display: none !important; }
  body { background: #fff; color: #000; }
  .hero { background: #fff; color: #000; padding: 10px 0; border-bottom: 2px solid #000; }
  .hero-badge, .hero-sub { color: #333; }
  .calc-grid { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .app-row:not(.is-active) { display: none !important; }
}
