/* TFSA Guide (Canada) — shared stylesheet.
   New look, Nov 2026: deep navy + warm gold on warm paper. Fraunces for
   headings, Inter for body (Google Fonts, system fallbacks). Plain, fast,
   no other external libraries. Mobile-first: single column, sticky answer
   bar; desktop: inputs left, results sticky on the right. */

* { box-sizing: border-box; }

:root {
  --navy-900: #0c1f33;
  --navy-800: #102a44;
  --navy-700: #16395c;
  --navy-600: #1d4a75;
  --gold: #eda415;
  --gold-dark: #cf8d0c;
  --gold-soft: #fdf3dd;
  --teal: #0e7490;
  --ink: #1a2b3c;
  --muted: #5c6d7e;
  --line: #e7e0d3;
  --bg: #faf8f3;
  --card: #ffffff;
  --amber-bg: #fdf6e3;
  --amber-line: #e8a317;
  --red: #b3261e;
  --red-bg: #fdecea;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.05), 0 12px 32px rgba(20, 30, 45, 0.08);
  --radius: 20px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--navy-600); }
a:hover { color: var(--teal); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- header & nav ---------- */

header.site {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #fff;
  border-bottom: 2px solid var(--gold);
  padding: 14px 0 10px;
}

header.site .site-title {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

header.site .site-title a { color: var(--navy-800); text-decoration: none; }

header.site .tagline {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

nav.main {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
nav.main::-webkit-scrollbar { display: none; }

nav.main a {
  flex: 0 0 auto;
  color: var(--navy-800);
  background: #f1ede4;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  white-space: nowrap;
}
nav.main a:hover { background: #e6dfcd; color: var(--navy-800); }
nav.main a.current { background: var(--navy-800); color: #fff; }

/* ---------- hero & headings ---------- */

main { padding: 20px 0 64px; }

/* ---------- hero ---------- */

.hero {
  background: linear-gradient(135deg, #0c1f33 0%, #123252 55%, #16406b 100%);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 36px 32px;
  margin-top: 4px;
}

.page-hero {
  background: linear-gradient(135deg, #0c1f33 0%, #123252 60%, #16406b 100%);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 32px 28px;
  margin-top: 4px;
}
.page-hero h1 { margin-bottom: 10px; color: #fff; }
.page-hero .lede { margin-bottom: 0; color: #c9d8e6; }

@media (max-width: 640px) {
  .hero { padding: 28px 22px; }
  .page-hero { padding: 26px 20px; }
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.hero h1 { color: #fff; }
h2 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 44px 0 10px;
  color: var(--ink);
}
h3 { font-size: 1.12rem; margin: 28px 0 8px; }
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 14px; padding-left: 24px; }
li { margin-bottom: 8px; }

.lede { font-size: 1.12rem; line-height: 1.55; color: #33473a; max-width: 62ch; }
.hero .lede { color: #c9d8e6; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
  padding: 0;
  list-style: none;
}
.chips li {
  margin: 0;
  background: var(--gold-soft);
  color: var(--navy-800);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
}
.hero .chips li {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #eef4f9;
}

/* ---------- calculator ---------- */

.calc-layout { margin-top: 24px; }

.calc-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.calc-box h2 { margin: 0 0 4px; }
.calc-box > p.sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 0.98rem; margin-bottom: 6px; }
.field .hint { display: block; font-size: 0.86rem; font-weight: 400; color: var(--muted); margin-top: 6px; line-height: 1.45; }

.field input[type="number"],
.field select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.3;
  border: 1.5px solid #d8d2c2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input[type="number"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(29, 74, 117, 0.18);
}

.money-input { position: relative; display: block; }
.money-input > span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
}
.money-input input[type="number"] { padding-left: 30px; }

.field-row { display: flex; flex-wrap: wrap; gap: 0 20px; }
.field-row .field { flex: 1 1 240px; }

.check { font-weight: 700; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--navy-700);
  cursor: pointer;
}

button.cta-btn {
  background: var(--gold);
  color: var(--navy-900);
  border: none;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(237, 164, 21, 0.35);
}
button.cta-btn:hover { background: var(--gold-dark); color: #fff; }

button.example-btn {
  background: #fff;
  color: var(--navy-700);
  border: 1.5px solid var(--navy-700);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
button.example-btn:hover { background: #eef3f8; }

.calc-actions { text-align: center; margin-top: 6px; }
.calc-actions button { display: block; margin: 0 auto 12px; }
.calc-actions button:last-child { margin-bottom: 0; }

/* ---------- results (dark navy panel) ---------- */

.results {
  background: linear-gradient(160deg, #0c1f33 0%, #123252 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px;
}

.results .big-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9db8d0;
}

.results .big {
  margin: 4px 0 4px;
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: clamp(2.6rem, 8vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #f5b81e;
}

.results .big-sub {
  margin: 0 0 8px;
  color: #c9d8e6;
  font-size: 0.98rem;
}

.results dl { margin: 10px 0 0; }
.results .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.results .row dt { font-weight: 600; color: #dbe7f1; }
.results .row dd { margin: 0; text-align: right; font-weight: 700; white-space: nowrap; }
.results .row.total-row dt,
.results .row.total-row dd {
  font-size: 1.08rem;
  font-weight: 800;
  color: #fff;
}

.results h3 {
  margin: 22px 0 2px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 1.05rem;
}

.results .note {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 4px solid var(--gold);
  color: #eef7f0;
  margin-top: 18px;
}

.no-result {
  background: var(--red-bg);
  border: 1px solid #e0a9a4;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-top: 18px;
}
.no-result p { color: #6d1a15; }

/* ---------- sticky answer bar (mobile only) ---------- */

.sticky-bar {
  position: sticky;
  bottom: 12px;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 16px;
  background: var(--navy-900);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(12, 31, 51, 0.35);
  padding: 13px 20px;
}
.sticky-bar span { font-size: 0.9rem; color: #9db8d0; font-weight: 600; }
.sticky-bar strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; color: #f5b81e; }

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; margin: 0 0 16px; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.95rem;
  border-radius: 12px;
  overflow: hidden;
}
th, td { padding: 11px 12px 11px 0; text-align: left; vertical-align: top; }
th:first-child, td:first-child { padding-left: 12px; }
th {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
}
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: #fbf9f5; }
td.num, th.num { text-align: right; }

/* ---------- example & explainer cards ---------- */

.example {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin: 24px 0;
}
.example h2, .example h3 { margin-top: 0; }
.example dl {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 0 16px;
  margin: 12px 0 0;
}
.example dl dt, .example dl dd { padding: 9px 0; border-top: 1px solid var(--line); }
.example dl dt:first-of-type, .example dl dd:first-of-type { border-top: none; }
.example dt { font-weight: 600; }
.example dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; }

.note {
  background: var(--amber-bg);
  border: 1px solid #f0e2b0;
  border-left: 4px solid var(--amber-line);
  padding: 12px 16px;
  border-radius: 0 12px 12px 0;
  font-size: 0.95rem;
}

/* ---------- ad slots (hidden until AdSense is approved) ---------- */

.ad-slot { display: none; }

/* ---------- footer ---------- */

footer.site {
  background: var(--navy-900);
  color: #b9c9d8;
  padding: 32px 0 40px;
  font-size: 0.9rem;
}
footer.site nav { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 16px; }
footer.site nav a {
  color: #dff0e6;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}
footer.site nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
footer.site p { margin: 0; }

/* ---------- desktop layout ---------- */

@media (min-width: 960px) {
  nav.main { flex-wrap: wrap; overflow-x: visible; }

  .calc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    gap: 24px;
    align-items: start;
  }

  .calc-layout .results-col { position: sticky; top: 132px; }

  .sticky-bar { display: none !important; }

  .field-row .field { flex-basis: 0; }
}

/* ---------- social security extras ---------- */

.mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.mode-toggle label {
  flex: 1 1 200px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--gold-soft);
  border: 1.5px solid #eadfc2;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.mode-toggle label:has(input:checked) {
  border-color: var(--navy-600);
  background: #e4edf5;
}
.mode-toggle input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--navy-700);
  cursor: pointer;
}
.mode-toggle .hint {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 2px;
}

.claim-table td.hl, .claim-table th.hl { font-weight: 800; color: var(--navy-800); }
.claim-table tr.best td { background: var(--gold-soft); }

/* TFSA site additions */
.origin {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 20px 20px 0;
  box-shadow: var(--shadow);
}
.origin h2 { margin-top: 0; }
.stats { margin: 2rem 0; }
.faq { margin: 2rem 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.faq h3 { margin-bottom: 0.25rem; }
.faq p { margin-top: 0; }

/* Date of birth as three plain fields so the year is just typed in */
.dob-fields { display: flex; flex-wrap: wrap; gap: 12px; }
.dob-fields span { display: flex; flex-direction: column; flex: 1 1 90px; }
.dob-fields span:last-child { flex: 2 1 110px; }
.dob-fields span label { font-size: 0.86rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

/* Phones: stack the big-picture stats so long values never run off the card */
@media (max-width: 640px) {
  .calc-box { padding: 20px; }
  .example { padding: 16px; }
  .example dl { grid-template-columns: 1fr; gap: 0; }
  .example dl dt { padding-bottom: 0; }
  .example dl dd { border-top: none; text-align: left; white-space: normal; padding-top: 2px; }
  .table-scroll table { font-size: 0.9rem; }
  .table-scroll th, .table-scroll td { padding: 9px 8px 9px 0; }
  .table-scroll th:first-child, .table-scroll td:first-child { padding-left: 8px; }
}
