/* ============================================================
   CANADACALCULATOR.CA — Global Stylesheet
   Font: Plus Jakarta Sans (display) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:        #14120E;
  --ink-mid:    #47433C;
  --ink-light:  #968E82;
  --sand:       #F6F4EF;
  --sand-mid:   #EDEAE3;
  --sand-dark:  #E0DCD3;
  --white:      #FFFFFF;
  --border:     #E0DCD3;
  --red:        #C8310A;
  --red-dim:    rgba(200,49,10,0.15);
  --green:      #1E6B35;
  --green-bg:   #E8F5EE;
  --amber:      #965500;
  --amber-bg:   #FEF3E2;
  --r:          14px;
  --r-sm:       10px;
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--sand);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-stretch: normal;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 28px; }

/* ── LOGO SVG ──────────────────────────────── */
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800;
  font-size: 17px; color: var(--ink); letter-spacing: -0.02em;
  text-decoration: none; line-height: 1;
}
.logo-mark {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: var(--red);
  border-radius: 9px; flex-shrink: 0;
}
.logo-mark svg { width: 20px; height: 20px; }
.logo-ca { color: var(--red); }

/* ── HEADER ────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.header-nav { display: flex; gap: 28px; }
.header-nav a {
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  color: var(--ink-light); transition: color 0.15s;
  font-family: var(--font-body);
}
.header-nav a:hover { color: var(--ink); }

/* ── HERO (mortgage page) ──────────────────── */
.hero {
  background: var(--ink);
  padding: 72px 0 64px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; right: -100px; top: -100px;
  width: 520px; height: 520px; border-radius: 50%;
  border: 1px solid rgba(200,49,10,0.12); pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 300px; height: 300px; border-radius: 50%;
  border: 1px solid rgba(200,49,10,0.07); pointer-events: none;
}
.hero-eyebrow { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red-dim); border: 1px solid rgba(200,49,10,0.3);
  color: #F09070; font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px;
}
.hero-pill::before { content: ''; width: 6px; height: 6px; background: #F09070; border-radius: 50%; }
.hero-year { font-size: 12px; color: rgba(255,255,255,0.22); letter-spacing: 0.03em; }

.hero-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 1.0; letter-spacing: -0.03em;
  color: #fff; margin-bottom: 20px;
}
.hero-title em { color: var(--red); font-style: italic; }

.hero-sub {
  color: rgba(255,255,255,0.38); font-size: 16px; font-weight: 400;
  max-width: 500px; margin-bottom: 52px; line-height: 1.75;
}
.hero-stats {
  display: flex; align-items: stretch;
  border-top: 1px solid rgba(255,255,255,0.07); padding-top: 32px;
}
.hstat { padding-right: 40px; display: flex; flex-direction: column; gap: 6px; }
.hstat + .hstat { padding-left: 40px; border-left: 1px solid rgba(255,255,255,0.08); }
.hstat-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: 28px; color: #fff; letter-spacing: -0.02em; line-height: 1;
}
.hstat-label {
  font-size: 11px; color: rgba(255,255,255,0.28);
  text-transform: uppercase; letter-spacing: 0.07em;
}

/* ── AD SLOTS ──────────────────────────────── */
.ad-slot {
  min-height: 90px; background: var(--white);
  border: 1px dashed var(--border); border-radius: var(--r);
  margin: 20px auto; display: flex; align-items: center;
  justify-content: center; color: var(--ink-light); font-size: 12px;
}

/* ── SECTION TYPOGRAPHY ────────────────────── */
.section-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: 24px; color: var(--ink); letter-spacing: -0.025em;
  margin-bottom: 6px; line-height: 1.2;
}
.section-desc {
  color: var(--ink-light); font-size: 14px; line-height: 1.7;
  margin-bottom: 28px;
}

/* ── CALCULATOR SECTION ────────────────────── */
.calculator-section { padding: 48px 0; }
.calc-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; align-items: start;
}

/* Input panel */
.calc-inputs {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 28px;
}
.calc-inputs .section-title { margin-bottom: 24px; }

.input-group { margin-bottom: 20px; }
.input-group label {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-light); margin-bottom: 8px;
  font-family: var(--font-body);
}
.input-wrap {
  display: flex; align-items: center;
  background: var(--sand); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); overflow: hidden; transition: border-color 0.15s;
}
.input-wrap:focus-within { border-color: var(--ink); background: var(--white); }
.input-wrap.narrow { width: 90px; flex-shrink: 0; }
.input-prefix, .input-suffix {
  padding: 0 12px; font-size: 13px; font-weight: 500;
  color: var(--ink-light); height: 44px;
  display: flex; align-items: center;
  background: var(--sand-mid); white-space: nowrap; flex-shrink: 0;
  font-family: var(--font-body);
}
.input-prefix { border-right: 1px solid var(--border); }
.input-suffix { border-left: 1px solid var(--border); }
.input-wrap input {
  flex: 1; border: none; background: transparent;
  padding: 0 14px; height: 44px;
  font-size: 15px; font-weight: 500;
  font-family: var(--font-body); color: var(--ink);
  outline: none; min-width: 0;
}
.input-row { display: flex; gap: 8px; }
.input-row .input-wrap { flex: 1; }

input[type="range"] {
  -webkit-appearance: none; width: 100%;
  height: 3px; border-radius: 2px;
  background: var(--sand-dark); outline: none;
  margin-top: 10px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--white); border: 2.5px solid var(--red);
  box-shadow: 0 1px 6px rgba(200,49,10,0.3);
  cursor: pointer; transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
.slider-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-light); margin-top: 5px;
}

.dp-hint {
  font-size: 12px; margin-top: 7px; padding: 7px 11px;
  border-radius: 7px; font-weight: 500; line-height: 1.5;
}
.dp-hint.warning { background: var(--amber-bg); color: var(--amber); }
.dp-hint.good    { background: var(--green-bg); color: var(--green); }
.dp-hint.error   { background: #FEE8E8; color: #B91C1C; }

.freq-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.freq-btn {
  padding: 8px 15px; border: 1.5px solid var(--border);
  border-radius: 20px; background: var(--sand);
  color: var(--ink-mid); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; font-family: var(--font-body);
}
.freq-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--white); }
.freq-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

select {
  width: 100%; padding: 0 36px 0 14px; height: 44px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--sand); font-size: 15px; font-weight: 500;
  font-family: var(--font-body); color: var(--ink);
  outline: none; cursor: pointer; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23968E82' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  transition: border-color 0.15s;
}
select:focus { border-color: var(--ink); }

.toggle-row { display: flex; align-items: center; gap: 12px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--sand-dark); border-radius: 24px;
  transition: background 0.2s; border: 1px solid var(--border);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 2px; top: 2px;
  background: var(--white); border-radius: 50%;
  transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input:checked + .toggle-slider { background: var(--green); border-color: var(--green); }
input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: 13px; color: var(--ink-mid); }

/* Result panel */
.calc-results {
  background: var(--ink); border-radius: var(--r);
  padding: 28px; position: sticky; top: 76px;
}
.calc-results .section-title { color: #fff; margin-bottom: 24px; }

.result-hero-card {
  margin-bottom: 22px; padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.rhc-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3); margin-bottom: 8px;
}
.rhc-amount {
  font-family: var(--font-display); font-weight: 800;
  font-size: 52px; color: #fff; letter-spacing: -0.03em; line-height: 1;
}
.rhc-sub { font-size: 12px; color: rgba(255,255,255,0.28); margin-top: 8px; }
.rhc-sub span { color: #F09070; }

.result-cards {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 18px;
}
.rcard {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--r-sm); padding: 14px;
}
.rcard-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
  color: rgba(255,255,255,0.28); margin-bottom: 6px;
}
.rcard-val {
  font-family: var(--font-display); font-weight: 700;
  font-size: 16px; color: #fff; letter-spacing: -0.01em;
}

.result-bars { padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.07); }
.rbar-row { margin-bottom: 10px; }
.rbar-top {
  display: flex; justify-content: space-between;
  font-size: 11px; color: rgba(255,255,255,0.32);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 5px;
}
.rbar-track { height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.rbar-fill { height: 3px; border-radius: 2px; transition: width 0.5s ease; }

.chart-wrap {
  display: flex; align-items: center; gap: 16px;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
#pie-chart { width: 88px; height: 88px; flex-shrink: 0; }
.chart-legend { flex: 1; }
.legend-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; margin-bottom: 5px; color: rgba(255,255,255,0.4);
}
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-item strong { color: rgba(255,255,255,0.75); font-weight: 600; }

.cmhc-note {
  font-size: 12px; padding: 10px 13px; border-radius: 8px;
  background: rgba(200,49,10,0.12); color: #F09070;
  margin-top: 12px; line-height: 1.5;
  border: 1px solid rgba(200,49,10,0.2);
}
.cmhc-note:empty { display: none; }

/* ── STRESS TEST ────────────────────────────── */
.stress-section {
  background: var(--white); padding: 56px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.stress-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 12px; margin-bottom: 28px;
}
.stress-card {
  background: var(--sand); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px 18px;
}
.stress-card.accent { background: var(--ink); border-color: var(--ink); }
.sc-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-light); margin-bottom: 10px;
}
.stress-card.accent .sc-label { color: rgba(255,255,255,0.35); }
.sc-val {
  font-family: var(--font-display); font-weight: 700;
  font-size: 26px; color: var(--ink); letter-spacing: -0.02em;
}
.stress-card.accent .sc-val { color: #F09070; }
.sc-sub { font-size: 11px; color: var(--ink-light); margin-top: 5px; line-height: 1.4; }

.income-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.gds-tds-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }

.ratio-card {
  background: var(--sand); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 18px;
}
.ratio-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-mid); margin-bottom: 12px;
}
.ratio-bar-wrap {
  width: 100%; height: 6px; background: var(--sand-dark);
  border-radius: 3px; margin-bottom: 8px; overflow: hidden;
}
.ratio-bar {
  height: 100%; border-radius: 3px; background: var(--green);
  transition: width 0.4s ease, background 0.3s; width: 0%;
}
.ratio-nums { display: flex; justify-content: space-between; align-items: baseline; }
.ratio-nums span:first-child {
  font-size: 22px; font-weight: 700; color: var(--ink);
  font-family: var(--font-display); letter-spacing: -0.02em;
}
.ratio-limit { font-size: 11px; color: var(--ink-light); }
.ratio-status { font-size: 12px; margin-top: 7px; font-weight: 500; }
.ratio-note { font-size: 12px; color: var(--ink-light); line-height: 1.6; margin-top: 4px; }

/* ── AMORTIZATION ───────────────────────────── */
.amort-section { padding: 56px 0; }

.amort-chart-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px; margin-bottom: 20px;
  /* Fix: ensure canvas fills full width */
  width: 100%; overflow: hidden;
}
/* Fix: canvas stretches to fill container */
#amort-chart {
  display: block;
  width: 100% !important;
  height: 300px;
}

.amort-table-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--white);
}
.amort-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.amort-table th {
  background: var(--sand); padding: 12px 18px;
  text-align: right; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-light); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.amort-table th:first-child { text-align: left; }
.amort-table td {
  padding: 12px 18px; text-align: right;
  border-bottom: 1px solid var(--border); color: var(--ink-mid);
}
.amort-table td:first-child {
  text-align: left; font-weight: 600; color: var(--ink);
  font-family: var(--font-display); font-size: 14px;
}
.amort-table tr:last-child td { border-bottom: none; }
.amort-table tr:hover td { background: var(--sand); }

/* ── FAQ ────────────────────────────────────── */
.faq-section { background: var(--ink); padding: 64px 0; }
.faq-section .section-title { color: #fff; margin-bottom: 6px; }
.faq-section .section-desc { color: rgba(255,255,255,0.3); margin-bottom: 36px; }
.faq-list { max-width: 740px; }
.faq-item { border-bottom: 1px solid rgba(255,255,255,0.07); }
.faq-item summary {
  padding: 20px 0; font-size: 15px; font-weight: 500;
  color: rgba(255,255,255,0.7); cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  transition: color 0.15s; font-family: var(--font-body);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 22px; color: var(--red); flex-shrink: 0; font-weight: 300; }
.faq-item[open] summary { color: #fff; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 0 20px; color: rgba(255,255,255,0.38); line-height: 1.75; font-size: 14px; }
.faq-item p strong { color: rgba(255,255,255,0.6); font-weight: 600; }

/* ── FOOTER ─────────────────────────────────── */
.site-footer { background: #0C0A07; padding: 40px 0; border-top: 1px solid rgba(255,255,255,0.05); }
.footer-inner { display: flex; flex-direction: column; gap: 12px; }
.footer-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 15px; color: rgba(255,255,255,0.55); letter-spacing: -0.01em;
}
.footer-logo .logo-mark { width: 28px; height: 28px; border-radius: 7px; opacity: 0.7; }
.footer-logo .logo-mark svg { width: 16px; height: 16px; }
.footer-disc { font-size: 12px; line-height: 1.75; color: rgba(255,255,255,0.2); max-width: 680px; }
.footer-copy { font-size: 12px; color: rgba(255,255,255,0.15); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 12px; color: rgba(255,255,255,0.3); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: rgba(255,255,255,0.6); }

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 900px) {
  .stress-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-results { position: static; }
  .header-nav { display: none; }
  .hero { padding: 52px 0 48px; }
  .income-row, .gds-tds-row { grid-template-columns: 1fr; }
  .hstat + .hstat { padding-left: 28px; }
  .hstat { padding-right: 28px; }
}
@media (max-width: 520px) {
  .stress-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; gap: 0; }
  .hstat { padding: 16px 0; border-left: none !important; }
  .hstat + .hstat { padding-left: 0; border-left: none; border-top: 1px solid rgba(255,255,255,0.08); }
  .rhc-amount { font-size: 40px; }
  .result-cards { grid-template-columns: 1fr 1fr; }
}

/* ── ANIMATIONS ──────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.calc-inputs  { animation: fadeUp 0.45s ease both; }
.calc-results { animation: fadeUp 0.45s ease 0.1s both; }
.rhc-amount, .rcard-val, .sc-val, .hstat-num { transition: all 0.2s ease; }

/* ── PRIVACY PAGE ────────────────────────────── */
.privacy-hero {
  background: var(--ink); padding: 56px 0;
}
.privacy-hero .hero-title { font-size: clamp(32px, 4vw, 48px); margin-bottom: 12px; }
.privacy-body { padding: 56px 0; max-width: 760px; }
.privacy-body h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px; color: var(--ink); margin: 36px 0 10px;
  letter-spacing: -0.01em;
}
.privacy-body h2:first-child { margin-top: 0; }
.privacy-body p { font-size: 14px; color: var(--ink-mid); line-height: 1.8; margin-bottom: 12px; }
.privacy-body ul { padding-left: 20px; margin-bottom: 12px; }
.privacy-body ul li { font-size: 14px; color: var(--ink-mid); line-height: 1.8; margin-bottom: 6px; }
.privacy-body a { color: var(--red); text-decoration: none; }
.privacy-body a:hover { text-decoration: underline; }
.privacy-last-updated {
  display: inline-block; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-light); margin-bottom: 32px;
  padding: 4px 12px; background: var(--sand-mid);
  border-radius: 20px; border: 1px solid var(--border);
}
