/* ============================================================
   CANADA FINANCE TOOLS — Main Stylesheet
   ============================================================ */

/* ===== 1. Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ===== 2. CSS Reset + Custom Properties ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --navy:        #0f2b5b;
  --navy-dark:   #091e42;
  --navy-light:  #1a3a7a;
  --green:       #2ecc71;
  --green-dark:  #27ae60;
  --green-light: #d4f5e4;
  --red:         #e74c3c;
  --yellow:      #f39c12;

  /* Light mode surfaces */
  --bg:          #f8fafc;
  --bg-alt:      #f1f5f9;
  --card:        #ffffff;
  --text:        #1a202c;
  --text-muted:  #64748b;
  --border:      #e2e8f0;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-md: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 25px rgba(0,0,0,.1),  0 10px 10px rgba(0,0,0,.04);

  /* Misc */
  --font:       'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  20px;
  --transition: .2s ease;
  --header-h:   68px;
}

[data-theme="dark"] {
  --bg:         #0d1117;
  --bg-alt:     #161b22;
  --card:       #1c2333;
  --text:       #e6edf3;
  --text-muted: #8b949e;
  --border:     #30363d;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow:     0 4px 6px rgba(0,0,0,.35);
  --shadow-md:  0 10px 15px rgba(0,0,0,.4);
  --shadow-lg:  0 20px 25px rgba(0,0,0,.5);
  --green-light: rgba(46,204,113,.15);
}

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ===== 3. Typography ===== */
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800; line-height: 1.15; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem);    font-weight: 700; line-height: 1.25; }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem);  font-weight: 600; line-height: 1.3; }
h4 { font-size: 1rem; font-weight: 600; }

.text-muted { color: var(--text-muted); }
.text-green  { color: var(--green-dark); }
.text-navy   { color: var(--navy); }
[data-theme="dark"] .text-green  { color: var(--green); }
[data-theme="dark"] .text-navy   { color: #7aadff; }

/* ===== 4. Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.section { padding: 5rem 0; }
.section--alt { background: var(--bg-alt); }

/* ===== 5. Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition), background var(--transition);
}
.header.scrolled { box-shadow: var(--shadow-md); }

.header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 1.5rem;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--navy);
  flex-shrink: 0;
  transition: opacity var(--transition);
}
[data-theme="dark"] .header__logo { color: #7aadff; }
.header__logo:hover { opacity: .8; }
.logo-icon { width: 32px; height: 32px; flex-shrink: 0; }

.nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}
.nav__link {
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.nav__link:hover,
.nav__link.active { color: var(--navy); background: var(--bg-alt); }
[data-theme="dark"] .nav__link:hover,
[data-theme="dark"] .nav__link.active { color: #7aadff; background: var(--bg-alt); }

.header__actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  color: var(--text-muted);
}
.theme-toggle:hover { background: var(--border); }
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== 6. Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero__inner {
  position: relative;
  max-width: 700px;
  text-align: center;
  margin: 0 auto;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  padding: .3rem .9rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255,255,255,.2);
}
.hero h1 { color: #ffffff; margin-bottom: 1rem; }
.hero__sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: rgba(255,255,255,.75);
  margin-bottom: 2rem;
  max-width: 520px;
  margin-left: auto; margin-right: auto;
}
.hero__cta {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--green);
  color: #fff;
  padding: .85rem 2rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1rem;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 15px rgba(46,204,113,.4);
}
.hero__cta:hover { background: var(--green-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(46,204,113,.5); }
.hero__stats {
  display: flex; justify-content: center; gap: 2.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,.15);
}
.hero__stat { text-align: center; }
.hero__stat-num { font-size: 1.75rem; font-weight: 800; color: #fff; }
.hero__stat-label { font-size: .8rem; color: rgba(255,255,255,.6); margin-top: .15rem; }

/* ===== 7. AdSense Placeholders ===== */
.ad-slot {
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  overflow: hidden;
}
.ad-leaderboard { width: 100%; max-width: 728px; height: 90px; margin: 0 auto; }
.ad-rectangle  { width: 300px; height: 250px; flex-shrink: 0; }
.ad-mobile     { width: 100%; height: 50px; }
.ad-wrapper    { text-align: center; padding: 1rem 0; }

/* ===== 8. Tool Cards ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex; flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: var(--green);
}
.tool-card__icon {
  width: 52px; height: 52px;
  background: var(--green-light);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  color: var(--green-dark);
}
[data-theme="dark"] .tool-card__icon { color: var(--green); }
.tool-card h3 { margin-bottom: .5rem; }
.tool-card p  { color: var(--text-muted); font-size: .92rem; flex: 1; margin-bottom: 1.25rem; }
.tool-card__link {
  display: inline-flex; align-items: center; gap: .35rem;
  color: var(--navy);
  font-weight: 600; font-size: .9rem;
  transition: gap var(--transition), color var(--transition);
}
[data-theme="dark"] .tool-card__link { color: #7aadff; }
.tool-card__link:hover { gap: .6rem; }

/* ===== 9. Trust Section ===== */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: center;
}
.trust-item__icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  color: var(--green-dark);
}
[data-theme="dark"] .trust-item__icon { color: var(--green); }
.trust-item h3 { margin-bottom: .35rem; }
.trust-item p  { color: var(--text-muted); font-size: .9rem; }

/* ===== 10. Section Headings ===== */
.section-label {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  padding: .25rem .75rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: .75rem;
}
[data-theme="dark"] .section-label { color: var(--green); }
.section-title { margin-bottom: .75rem; }
.section-desc  { color: var(--text-muted); font-size: 1.05rem; max-width: 520px; }

/* ===== 11. Calculator Page Layout ===== */
.calc-page { padding-top: calc(var(--header-h) + 2rem); }
.calc-hero {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  padding: 3rem 0 2.5rem;
  text-align: center;
}
.calc-hero h1 { color: #fff; margin-bottom: .6rem; }
.calc-hero p  { color: rgba(255,255,255,.7); font-size: 1.05rem; }

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
  padding: 2.5rem 0;
}

.calc-main   { min-width: 0; }
.calc-sidebar { /* sticky sidebar handled by JS */ }

/* ===== 12. Calculator Form ===== */
.calc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.calc-card h2 { font-size: 1.25rem; margin-bottom: 1.5rem; color: var(--navy); }
[data-theme="dark"] .calc-card h2 { color: #7aadff; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex; align-items: center; gap: .35rem;
}
.tooltip-btn {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 700;
  border: none;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
}
.tooltip-btn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: var(--navy-dark);
  color: #fff;
  font-size: .75rem;
  font-weight: 400;
  padding: .4rem .7rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 10;
  line-height: 1.4;
}
.tooltip-btn:hover::after { opacity: 1; }

.form-input, .form-select {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,43,91,.12);
}
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus {
  border-color: #7aadff;
  box-shadow: 0 0 0 3px rgba(122,173,255,.15);
}
.form-prefix {
  position: relative;
}
.form-prefix::before {
  content: attr(data-prefix);
  position: absolute;
  left: 1rem;
  top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .95rem;
  pointer-events: none;
  z-index: 1;
}
.form-prefix .form-input { padding-left: 1.75rem; }

.input-with-unit { position: relative; }
.input-unit {
  position: absolute;
  right: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .9rem;
  pointer-events: none;
}

/* Sliders */
.slider-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.form-range {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.form-range::-webkit-slider-thumb {
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.form-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
[data-theme="dark"] .form-range::-webkit-slider-thumb { background: #7aadff; }
.slider-value {
  min-width: 70px;
  text-align: right;
  font-weight: 600;
  font-size: .9rem;
}

.calc-btn {
  width: 100%; padding: .9rem;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  margin-top: 1.25rem;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 12px rgba(15,43,91,.25);
}
.calc-btn:hover { background: var(--navy-light); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15,43,91,.3); }
[data-theme="dark"] .calc-btn { background: #7aadff; color: #0d1117; }
[data-theme="dark"] .calc-btn:hover { background: #5a9aff; }

/* ===== 13. Result Panel ===== */
.result-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: none;
  animation: slideUp .4s ease;
  margin-bottom: 1.5rem;
}
.result-panel.visible { display: block; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-panel h2 { font-size: 1.2rem; margin-bottom: 1.5rem; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.result-stat {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.result-stat__label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .3rem;
}
.result-stat__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
}
[data-theme="dark"] .result-stat__value { color: #7aadff; }
.result-stat__value.green { color: var(--green-dark); }
.result-stat__value.red   { color: var(--red); }
[data-theme="dark"] .result-stat__value.green { color: var(--green); }

.verdict-box {
  border-left: 4px solid var(--green);
  background: var(--green-light);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.25rem;
  font-size: .95rem;
  color: var(--text);
}
.verdict-box.warning { border-color: var(--yellow); background: rgba(243,156,18,.1); }
.verdict-box.danger  { border-color: var(--red);    background: rgba(231,76,60,.1); }

.share-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.share-btn:hover { background: var(--border); color: var(--text); }

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: var(--navy-dark);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== 14. Chart Container ===== */
.chart-wrap {
  position: relative;
  margin: 1.5rem 0;
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 1rem;
}

/* ===== 15. Affordability Gauge ===== */
.gauge-wrap {
  display: flex; flex-direction: column; align-items: center;
  margin: 1.25rem 0;
}
.gauge-svg { width: 200px; }
.gauge-label {
  font-size: 1.75rem; font-weight: 800; margin-top: .25rem;
  color: var(--text);
}
.gauge-sub { font-size: .85rem; color: var(--text-muted); }

/* ===== 16. FAQ Accordion ===== */
.faq { max-width: 760px; margin: 0 auto; }
.faq__item {
  border-bottom: 1px solid var(--border);
}
.faq__q {
  width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 0;
  background: none; border: none;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  gap: 1rem;
  cursor: pointer;
  transition: color var(--transition);
}
.faq__q:hover { color: var(--navy); }
[data-theme="dark"] .faq__q:hover { color: #7aadff; }
.faq__chevron {
  flex-shrink: 0;
  width: 20px; height: 20px;
  transition: transform var(--transition);
}
.faq__item.open .faq__chevron { transform: rotate(180deg); }
.faq__a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
  font-size: .95rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.faq__item.open .faq__a {
  max-height: 400px;
  padding-bottom: 1rem;
}

/* ===== 17. Comparison Table (TFSA vs RRSP) ===== */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  margin: 1.25rem 0;
}
.compare-table th, .compare-table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.compare-table th {
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg-alt);
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child { font-weight: 500; }
.highlight-green { color: var(--green-dark); font-weight: 700; }
[data-theme="dark"] .highlight-green { color: var(--green); }

/* ===== 18. GDS/TDS Bars ===== */
.ratio-bar { margin-bottom: 1rem; }
.ratio-bar__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .35rem;
}
.ratio-bar__label { font-size: .88rem; font-weight: 600; }
.ratio-bar__value { font-size: .88rem; font-weight: 700; }
.ratio-track {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.ratio-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .6s ease;
}
.ratio-fill.green  { background: var(--green); }
.ratio-fill.yellow { background: var(--yellow); }
.ratio-fill.red    { background: var(--red); }

/* ===== 19. Budget Sliders ===== */
.budget-category {
  display: grid;
  grid-template-columns: 130px 1fr 90px;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.budget-category:last-child { border-bottom: none; }
.budget-category__label {
  font-size: .88rem;
  font-weight: 600;
  display: flex; align-items: center; gap: .4rem;
}
.budget-category__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.budget-category__input {
  padding: .45rem .6rem;
  text-align: right;
  width: 100%;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
}
.budget-category__input:focus { outline: none; border-color: var(--navy); }

.rule-toggle {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition);
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.rule-toggle:hover { border-color: var(--navy); color: var(--navy); }
.rule-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--navy); }

/* ===== 20. Blog Cards ===== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.blog-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.blog-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.blog-card__img {
  height: 180px;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
.blog-card__body { padding: 1.5rem; }
.blog-badge {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  padding: .25rem .65rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
[data-theme="dark"] .blog-badge { color: var(--green); }
.blog-card h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.blog-card p  { font-size: .88rem; color: var(--text-muted); }

/* ===== 21. Footer ===== */
.footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,.7);
  padding: 3.5rem 0 0;
}
[data-theme="dark"] .footer { background: #050c1a; }
.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
}
.footer__brand .header__logo { color: #fff; margin-bottom: 1rem; }
.footer__disclaimer { font-size: .82rem; line-height: 1.6; max-width: 320px; }
.footer__links h4 { color: #fff; font-size: .85rem; margin-bottom: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.footer__links a {
  display: block;
  font-size: .88rem;
  padding: .3rem 0;
  transition: color var(--transition);
}
.footer__links a:hover { color: var(--green); }
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 1.25rem 0;
  text-align: center;
  font-size: .8rem;
  color: rgba(255,255,255,.4);
}

/* ===== 22. Province Selector ===== */
.form-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 d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ===== 23. Sticky sidebar ===== */
.sticky-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
}

/* ===== 24. Animations ===== */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes countUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-count { animation: countUp .5s ease forwards; }

/* Progress bar for page */
.page-progress {
  position: fixed; top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
  z-index: 9999;
  transition: width .1s linear;
}

/* ===== 25. Mobile Responsive ===== */
@media (max-width: 1024px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-sidebar .sticky-sidebar { position: static; }
  .calc-sidebar { display: contents; }
  .ad-rectangle { display: none; }
  .footer__inner { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  :root { --header-h: 60px; }

  .nav {
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .5rem 1rem 1rem;
    box-shadow: var(--shadow-md);
    transform: translateY(-110%);
    opacity: 0;
    transition: transform .3s ease, opacity .3s ease;
    z-index: 999;
  }
  .nav.open { transform: translateY(0); opacity: 1; }
  .nav__link { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .95rem; }
  .hamburger { display: flex; }

  .hero { padding: 3.5rem 0 2.5rem; }
  .hero__stats { gap: 1.5rem; flex-wrap: wrap; }

  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }

  .result-grid { grid-template-columns: 1fr 1fr; }

  .footer__inner { grid-template-columns: 1fr; gap: 2rem; }
  .footer__brand { grid-column: 1; }

  .ad-leaderboard { display: none; }
  .ad-mobile { display: flex; }

  .budget-category { grid-template-columns: 110px 1fr 80px; }
}

@media (max-width: 480px) {
  .result-grid { grid-template-columns: 1fr; }
  .hero__stats { justify-content: center; }
  .trust-grid  { grid-template-columns: 1fr; }
  .calc-card   { padding: 1.25rem; }
  .result-panel { padding: 1.25rem; }
}
