/* =========================================================
   BuildCreditCanada — shared design tokens & utilities
   Pass 1: foundation only. Designed to be additive — existing
   per-page <style> blocks still win for any property they set.
   ========================================================= */

:root {
  /* ── Brand colors (match existing per-page vars) ─────── */
  --bg:        #f8fafb;
  --white:     #ffffff;
  --border:    #e8edf2;
  --text:      #0f172a;
  --sub:       #475569;
  --muted:     #94a3b8;

  --navy:      #0f172a;
  --teal:      #14b8a6;
  --teal-dk:   #0d9488;
  --teal-lt:   #f0fdfa;
  --teal-mid:  #ccfbf1;

  --amber:     #d97706;
  --amber-lt:  #fffbeb;
  --amber-mid: #fde68a;

  --green:     #059669;
  --green-lt:  #ecfdf5;
  --green-mid: #bbf7d0;

  --purple:    #7c3aed;
  --purple-lt: #f5f3ff;
  --purple-mid:#ddd6fe;

  --blue:      #2563eb;
  --blue-lt:   #eff6ff;
  --blue-mid:  #bfdbfe;

  --red:       #dc2626;
  --red-lt:    #fef2f2;
  --red-mid:   #fecaca;

  /* ── Radius scale (the single source of truth) ───────── */
  --r-pill:    100px;
  --r-tile:    12px;   /* small surfaces: inputs, icon tiles, info cards */
  --r-card:    20px;   /* default content cards */
  --r-hero:    24px;   /* hero / result / verdict cards */
  --radius:    20px;   /* legacy alias */

  /* ── Spacing scale (8-pt rhythm) ─────────────────────── */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;

  /* ── Hairline ring + Apple-style layered shadow ──────── */
  --ring:        inset 0 0 0 1px rgba(15,23,42,0.05);
  --ring-teal:   inset 0 0 0 1px rgba(13,148,136,0.14);
  --ring-amber:  inset 0 0 0 1px rgba(217,119,6,0.16);
  --ring-green:  inset 0 0 0 1px rgba(5,150,105,0.16);
  --ring-red:    inset 0 0 0 1px rgba(220,38,38,0.16);

  --shadow-sm:   0 1px 2px rgba(15,23,42,0.04);
  --shadow:      0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -8px rgba(15,23,42,0.08);
  --shadow-hero: 0 1px 2px rgba(15,23,42,0.05), 0 16px 40px -12px rgba(15,23,42,0.12);

  /* ── Motion ──────────────────────────────────────────── */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:    150ms;
  --dur-base:    240ms;
  --dur-slow:    360ms;
}

/* ── Base typography polish ────────────────────────────────
   Low-specificity rules; per-page styles override as needed. */
html { scrollbar-gutter: stable; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2 { letter-spacing: -0.02em; }
h3, h4 { letter-spacing: -0.015em; }

/* Numbers don't jitter when they update */
.num,
.tabular,
.util-big-num,
.combined-big,
.card-util-pct,
.ut-val,
.input-prefix,
input[type=number],
output,
/* Common output ID prefixes across calculators */
[id^="spAmt"], [id^="spBucket"], [id^="spBar"], [id^="spPct"],
[id^="fhsa"][id$="Amt"], [id^="fhsa"][id$="Total"], [id^="fhsa"][id$="Pct"],
[id^="rrsp"], [id^="tfsa"], [id^="celi"], [id^="reer"],
[id$="Amt"], [id$="Pct"], [id$="Total"], [id$="Balance"], [id$="Limit"], [id$="Payment"],
[class*="-big-num"], [class*="-pct-num"], [class*="big-num"], [class*="big-number"],
[data-tabular] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ── Focus: visible only when keyboard-navigated ──────── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   UTILITY CLASSES — opt-in. Adding any of these to markup is
   how we migrate pages over time without breaking what exists.
   ========================================================= */

/* ── Cards: ring + layered shadow, no heavy borders ───── */
.bcc-card {
  background: var(--white);
  border-radius: var(--r-card);
  box-shadow: var(--ring), var(--shadow);
}
.bcc-card-hero {
  background: var(--white);
  border-radius: var(--r-hero);
  box-shadow: var(--ring), var(--shadow-hero);
}
.bcc-card-flat {
  background: var(--white);
  border-radius: var(--r-tile);
  box-shadow: var(--ring), var(--shadow-sm);
}

/* ── Info cards (tinted bg + rounded-square icon tile) ──
   This is the lmiacheck pattern that REPLACES border-left:4px. */
.bcc-info {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r-tile);
  font-size: 13px;
  line-height: 1.55;
}
.bcc-info .ic-tile {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bcc-info .ic-body { flex: 1; min-width: 0; }
.bcc-info strong { font-weight: 700; }

/* Semantic variants — pair foreground + soft tinted bg */
.bcc-info-teal   { background: var(--teal-lt);   color: #0f766e; }
.bcc-info-teal   .ic-tile { background: var(--teal-mid);   color: var(--teal-dk); }
.bcc-info-teal   strong { color: #134e4a; }

.bcc-info-amber  { background: var(--amber-lt);  color: #92400e; }
.bcc-info-amber  .ic-tile { background: var(--amber-mid);  color: var(--amber); }
.bcc-info-amber  strong { color: #78350f; }

.bcc-info-green  { background: var(--green-lt);  color: #065f46; }
.bcc-info-green  .ic-tile { background: var(--green-mid);  color: var(--green); }
.bcc-info-green  strong { color: #064e3b; }

.bcc-info-red    { background: var(--red-lt);    color: #991b1b; }
.bcc-info-red    .ic-tile { background: var(--red-mid);    color: var(--red); }
.bcc-info-red    strong { color: #7f1d1d; }

.bcc-info-blue   { background: var(--blue-lt);   color: #1e40af; }
.bcc-info-blue   .ic-tile { background: var(--blue-mid);   color: var(--blue); }
.bcc-info-blue   strong { color: #1e3a8a; }

.bcc-info-purple { background: var(--purple-lt); color: #5b21b6; }
.bcc-info-purple .ic-tile { background: var(--purple-mid); color: var(--purple); }
.bcc-info-purple strong { color: #4c1d95; }

.bcc-info-navy   { background: #f1f5f9; color: #1e293b; }
.bcc-info-navy   .ic-tile { background: #e2e8f0; color: var(--navy); }
.bcc-info-navy   strong { color: var(--navy); }

/* ── Icon tile (standalone — when you don't want the full info card) */
.bcc-tile {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bcc-tile-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 14px; }
.bcc-tile-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }

/* ── Pill / chip ──────────────────────────────────────── */
.bcc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  text-decoration: none;
  line-height: 1.4;
}
.bcc-chip-teal   { background: var(--teal-lt);   color: var(--teal-dk); box-shadow: var(--ring-teal); }
.bcc-chip-amber  { background: var(--amber-lt);  color: var(--amber);   box-shadow: var(--ring-amber); }
.bcc-chip-green  { background: var(--green-lt);  color: var(--green);   box-shadow: var(--ring-green); }
.bcc-chip-red    { background: var(--red-lt);    color: var(--red);     box-shadow: var(--ring-red); }
.bcc-chip-blue   { background: var(--blue-lt);   color: var(--blue);    box-shadow: inset 0 0 0 1px rgba(37,99,235,0.16); }
.bcc-chip-purple { background: var(--purple-lt); color: var(--purple);  box-shadow: inset 0 0 0 1px rgba(124,58,237,0.16); }
.bcc-chip-navy   { background: #f1f5f9;          color: var(--navy);    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.08); }

/* ── Buttons (utility — opt in) ───────────────────────── */
.bcc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
}
.bcc-btn:active { transform: translateY(1px); }
.bcc-btn-primary { background: var(--teal); color: #fff; }
.bcc-btn-primary:hover { background: var(--teal-dk); }
.bcc-btn-ghost { background: transparent; color: var(--text); box-shadow: var(--ring); }
.bcc-btn-ghost:hover { background: var(--bg); }

/* ── Entry animation (opt-in via .bcc-animate-in) ─────── */
@media (prefers-reduced-motion: no-preference) {
  .bcc-animate-in {
    animation: bccFadeUp var(--dur-slow) var(--ease-out) both;
  }
}
@keyframes bccFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section / spacing helpers (opt-in) ───────────────── */
.bcc-section { padding: var(--space-16) var(--space-6); }
@media (max-width: 680px) { .bcc-section { padding: var(--space-10) var(--space-5); } }
.bcc-container { max-width: 1080px; margin: 0 auto; }
.bcc-container-narrow { max-width: 860px; margin: 0 auto; }
