/* BMO Bank — rounded / strict design system
   Palette: deep slate navy + teal accent + soft paper */

:root {
  --navy-950: #0a1a2e;
  --navy-900: #0f2744;
  --navy-800: #163557;
  --navy-700: #1e4a73;
  --navy-100: #e8f0f8;
  --navy-50: #f2f7fc;

  --teal-700: #0f7a70;
  --teal-600: #149184;
  --teal-500: #1aa396;
  --teal-100: #e6f6f4;

  --white: #ffffff;
  --paper: #f4f7fb;
  --ink: #142033;
  --ink-soft: #3a4a5c;
  --gray-100: #e8eef5;
  --gray-200: #d5dee9;
  --gray-300: #b7c4d4;
  --gray-500: #6b7c90;
  --gray-600: #516174;

  --shadow-sm: 0 2px 8px rgba(15, 39, 68, 0.06);
  --shadow-md: 0 10px 28px rgba(15, 39, 68, 0.10);
  --shadow-lg: 0 22px 50px rgba(15, 39, 68, 0.14);

  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --maxw: 1160px;

  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.72;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy-700); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--teal-600); text-decoration: underline; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.container--wide { max-width: 1280px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--teal-600); color: #fff; padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--teal-500); outline-offset: 2px; border-radius: 6px; }

/* Reveal animation — only sidebar cards hide until visible (never the article) */
.card.reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(18px);
}
.card.reveal {
  transition: opacity .7s var(--ease), transform .7s var(--ease), box-shadow .25s var(--ease);
}
.card.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: stretch;
  gap: 16px;
  height: 72px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  height: 44px;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--navy-800), var(--navy-900));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px; letter-spacing: .04em;
  box-shadow: 0 6px 16px rgba(15, 39, 68, 0.22);
  position: relative;
}
.brand__mark::after {
  content: "";
  position: absolute; right: -3px; bottom: -3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--teal-500);
  border: 2px solid #fff;
}
.brand__text { display: flex; flex-direction: column; gap: 2px; line-height: 1.05; }
.brand__text b {
  color: var(--navy-900);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}
.brand__text span {
  color: var(--gray-500);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.main-nav {
  margin-left: auto;
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  align-items: stretch;
}
.nav-list {
  list-style: none;
  display: flex;
  align-items: stretch;
  margin: 0; padding: 0;
  height: 100%;
}
.nav-item { position: relative; display: flex; align-items: stretch; height: 100%; }
.nav-link, .nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 100%;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  padding: 0 11px;
  white-space: nowrap;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.nav-link:hover, .nav-toggle:hover {
  color: var(--navy-900);
  text-decoration: none;
  border-bottom-color: var(--teal-500);
  background: transparent;
}
.nav-link[aria-current="page"] {
  color: var(--navy-900);
  border-bottom-color: var(--navy-900);
}
.nav-toggle .chev {
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -2px;
  transition: transform .25s var(--ease);
}
.nav-item.open .nav-toggle .chev { transform: rotate(-135deg); margin-top: 2px; }

.submenu {
  list-style: none; margin: 0; padding: 8px;
  position: absolute; top: 100%; left: 0; min-width: 250px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden;
  transform: translateY(6px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
  z-index: 50;
}
.nav-item:hover .submenu,
.nav-item.open .submenu {
  opacity: 1; visibility: visible; transform: none;
}
.submenu a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 500;
  font-size: 14.5px;
  line-height: 1.3;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.submenu a:hover {
  background: var(--navy-50);
  color: var(--navy-800);
  text-decoration: none;
}
.submenu a[aria-current="page"] {
  color: var(--teal-700);
  background: var(--teal-100);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 14px;
  border-left: 1px solid var(--gray-200);
  flex-shrink: 0;
  height: 40px;
}
.header-cta .btn {
  height: 38px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: var(--radius-pill);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary {
  background: var(--navy-900);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 39, 68, 0.22);
}
.btn--primary:hover { background: var(--navy-800); color: #fff; }
.btn--outline {
  background: #fff;
  color: var(--navy-900);
  border-color: var(--gray-300);
}
.btn--outline:hover {
  border-color: var(--navy-700);
  background: var(--navy-50);
  color: var(--navy-900);
}
.btn--ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.45);
}
.btn--ghost:hover { background: rgba(255,255,255,.22); color: #fff; }
.btn--lg { padding: 14px 26px; font-size: 15px; }

.nav-burger {
  display: none;
  margin-left: auto;
  align-self: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.nav-burger span, .nav-burger span::before, .nav-burger span::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 2px;
  background: var(--navy-900); border-radius: 2px;
  transform: translate(-50%, -50%); transition: .2s var(--ease);
}
.nav-burger span::before { top: -6px; }
.nav-burger span::after { top: 6px; }
.nav-open .nav-burger span { background: transparent; }
.nav-open .nav-burger span::before { top: 0; transform: translate(-50%, -50%) rotate(45deg); }
.nav-open .nav-burger span::after { top: 0; transform: translate(-50%, -50%) rotate(-45deg); }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 44px 0 58px;
  background:
    radial-gradient(ellipse 70% 80% at 90% 10%, rgba(26, 163, 150, 0.28), transparent 55%),
    linear-gradient(135deg, var(--navy-950) 0%, var(--navy-900) 48%, var(--navy-800) 100%);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: .55;
  pointer-events: none;
  animation: gridDrift 28s linear infinite;
}
@keyframes gridDrift {
  from { background-position: 0 0; }
  to { background-position: 24px 24px; }
}
.hero .container { position: relative; z-index: 1; }

.breadcrumbs {
  font-size: 13px;
  margin: 0 0 20px;
  color: rgba(255,255,255,.72);
}
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumbs li:not(:last-child)::after { content: "/"; color: rgba(255,255,255,.4); }
.breadcrumbs a { color: #fff; opacity: .85; }
.breadcrumbs a:hover { opacity: 1; }
.breadcrumbs [aria-current="page"] { color: #fff; opacity: 1; font-weight: 600; }

.hero .hero__tag {
  display: inline-flex;
  align-items: center;
  margin: 0 0 14px;
  padding: 6px 14px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  animation: fadeUp .7s var(--ease) both;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1.12;
  margin: 0;
  max-width: 18ch;
  font-weight: 700;
  letter-spacing: -.02em;
  animation: fadeUp .75s .08s var(--ease) both;
}
.hero h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin-top: 18px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--teal-500), transparent);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* Layout */
.page-wrap { padding: 40px 0 64px; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 36px;
  align-items: start;
}

.article {
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 34px 36px 42px;
  box-shadow: var(--shadow-sm);
}
.article > *:first-child { margin-top: 0; }
.article p { margin: 0 0 16px; color: var(--ink-soft); }
.article h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.25;
  margin: 40px 0 14px;
  color: var(--navy-900);
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-200);
  scroll-margin-top: 96px;
}
.article h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 10px;
  border-radius: 3px;
  background: var(--teal-500);
}
.article h3 {
  font-family: var(--font-display);
  font-size: clamp(17px, 1.9vw, 20px);
  line-height: 1.3;
  margin: 26px 0 10px;
  color: var(--navy-800);
  font-weight: 700;
  scroll-margin-top: 96px;
}
.article ul, .article ol { margin: 0 0 18px; padding-left: 1.2em; }
.article ul li, .article ol li { margin: 0 0 8px; }
.article a {
  color: var(--navy-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article a:hover { color: var(--teal-600); }

.table-wrap {
  overflow-x: auto;
  margin: 0 0 22px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}
table { width: 100%; border-collapse: collapse; min-width: 460px; background: #fff; }
thead th {
  background: var(--navy-900);
  color: #fff;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 13px 14px;
}
tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--gray-200);
  font-size: 15px;
  vertical-align: top;
}
tbody tr:nth-child(even) td { background: var(--navy-50); }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card__head {
  padding: 13px 16px;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--navy-900);
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(180deg, #fff, var(--navy-50));
}
.card__body { padding: 6px 8px; }

.toc-list, .related-list { list-style: none; margin: 0; padding: 0; }
.toc-list a {
  display: block;
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  transition: background .15s, color .15s, border-color .15s;
}
.toc-list a:hover,
.toc-list a.is-active {
  background: var(--navy-50);
  color: var(--navy-800);
  text-decoration: none;
  border-left-color: var(--teal-500);
}
.related-list a {
  display: block;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-900);
  border-radius: 8px;
  transition: background .15s;
}
.related-list a:hover {
  background: var(--navy-50);
  color: var(--navy-800);
  text-decoration: none;
}

.help-card {
  background: linear-gradient(145deg, var(--navy-900), var(--navy-700));
  color: #fff;
  border: 0;
  padding: 20px;
}
.help-card:hover { transform: translateY(-2px); }
.help-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #fff;
  font-family: var(--font-display);
}
.help-card p { margin: 0 0 12px; font-size: 14px; color: rgba(255,255,255,.8); }
.help-card .phone {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  display: block;
  margin-bottom: 12px;
  font-family: var(--font-display);
}
.help-card .phone:hover { text-decoration: none; color: #fff; }

/* Footer */
.site-footer {
  background: var(--navy-950);
  color: rgba(255,255,255,.72);
  margin-top: 8px;
}
.footer-top { padding: 48px 0 30px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, 1fr);
  gap: 28px;
}
.footer-brand .brand__text b { color: #fff; }
.footer-brand .brand__text span { color: rgba(255,255,255,.5); }
.footer-brand p {
  font-size: 14px;
  margin: 14px 0 0;
  max-width: 34ch;
  color: rgba(255,255,255,.55);
}
.footer-col h4 {
  color: #fff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 0 0 12px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: rgba(255,255,255,.68); font-size: 14px; }
.footer-col a:hover { color: #fff; }
.footer-col a[aria-current="page"] { color: #fff; font-weight: 600; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 18px 0;
  font-size: 12.5px;
  color: rgba(255,255,255,.45);
}
.footer-bottom .container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar .card { flex: 1 1 260px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .article { padding: 24px 20px 32px; }
}

@media (max-width: 1240px) {
  .nav-burger { display: block; }
  .header-cta { display: none; }
  .main-nav {
    position: fixed;
    inset: 72px 0 auto 0;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s var(--ease);
    flex: none;
    display: block;
  }
  .nav-open .main-nav { max-height: calc(100vh - 72px); overflow-y: auto; }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 8px 12px 20px;
  }
  .nav-item {
    height: auto;
    border-bottom: 1px solid var(--gray-100);
    display: block;
  }
  .nav-link, .nav-toggle {
    width: 100%;
    height: auto;
    justify-content: space-between;
    padding: 14px 8px;
    font-size: 15px;
    border-bottom: 0;
  }
  .submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    padding: 0 0 8px 10px;
    min-width: 0;
    display: none;
  }
  .nav-item.open .submenu { display: block; }
  .mobile-cta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 8px 4px;
  }
  .mobile-cta .btn { width: 100%; height: 44px; }
}

@media (min-width: 1241px) {
  .mobile-cta { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .footer-grid { grid-template-columns: 1fr; }
  .sidebar .card { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .card.reveal:not(.is-visible),
  .card.reveal {
    opacity: 1;
    transform: none;
  }
}
