/* ==========================================================================
   BMO Bank Guide — design system
   Palette: red / blue / white
   ========================================================================== */

:root {
  --blue-900: #0a2a5e;
  --blue-800: #0d3570;
  --blue-700: #124a8f;
  --blue-600: #135ba8;
  --blue-500: #1877c9;
  --blue-100: #e7f0fb;
  --blue-50:  #f2f7fd;

  --red-700: #a4141d;
  --red-600: #cf1a25;
  --red-500: #e4232f;
  --red-100: #fdeaec;

  --white: #ffffff;
  --gray-50: #f6f8fb;
  --gray-100: #eef2f7;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-600: #4b5866;
  --ink: #16202e;

  --shadow-sm: 0 1px 3px rgba(13, 53, 112, 0.08);
  --shadow-md: 0 6px 20px rgba(13, 53, 112, 0.12);
  --shadow-lg: 0 18px 45px rgba(10, 42, 94, 0.18);

  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1180px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--white);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

/* ==========================================================================
   Header / Navigation
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  height: 68px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  height: 40px;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--blue-700);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; letter-spacing: .4px;
  position: relative;
}
.brand__mark::after {
  content: ""; position: absolute; right: -2px; bottom: -2px;
  width: 11px; height: 11px; border-radius: 50%; background: var(--red-600);
  border: 2px solid #fff;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.05; justify-content: center; }
.brand__text b { color: var(--blue-800); font-size: 17px; }
.brand__text span { color: var(--gray-500); font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

/* nav — sits between brand and CTAs, never overflows */
.main-nav {
  margin-left: auto;
  margin-right: 0;
  min-width: 0;
  flex: 0 1 auto;
}
.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  height: 40px;
}
.nav-item { position: relative; display: flex; align-items: center; height: 100%; }
.nav-link, .nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1;
  color: var(--blue-900);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav-link:hover, .nav-toggle:hover { background: var(--blue-50); text-decoration: none; color: var(--blue-700); }
.nav-link[aria-current="page"] { color: var(--red-600); }
.nav-toggle .chev {
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform .2s;
}
.nav-item.open .nav-toggle .chev { transform: rotate(-135deg); margin-top: 2px; }

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

/* CTA buttons — same height as nav links, never clipped */
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  flex-shrink: 0;
  height: 40px;
}
.header-cta .btn {
  height: 40px;
  padding: 0 16px;
  font-size: 13.5px;
  line-height: 1;
  border-radius: 8px;
  box-shadow: none;
  transform: none;
}
.header-cta .btn:hover { transform: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--red-600); color: #fff; }
.btn--primary:hover { background: var(--red-700); color: #fff; }
.btn--outline {
  background: #fff;
  color: var(--blue-700);
  border: 2px solid var(--gray-300);
}
.btn--outline:hover { border-color: var(--blue-500); color: var(--blue-700); background: var(--blue-50); }
.btn--ghost { background: rgba(255,255,255,.14); color:#fff; border:2px solid rgba(255,255,255,.55); }
.btn--ghost:hover { background: rgba(255,255,255,.24); color:#fff; }
.btn--lg { padding: 14px 26px; font-size: 16px; }

/* hamburger */
.nav-burger {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  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: 20px; height: 2px;
  background: var(--blue-800); transform: translate(-50%,-50%); transition: .2s;
}
.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 + breadcrumbs
   ========================================================================== */
.hero {
  background:
    linear-gradient(115deg, var(--blue-900) 0%, var(--blue-800) 45%, var(--blue-600) 100%);
  color: #fff;
  padding: 30px 0 52px;
  position: relative; overflow: hidden;
  border-bottom: 4px solid var(--red-600);
}
/* faint diagonal line texture — subtle, not a generic glow blob */
.hero::before {
  content:""; position:absolute; inset:0;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 1px, transparent 1px 26px);
  opacity:.6; pointer-events:none;
}
/* angled red accent panel on the right */
.hero::after {
  content:""; position:absolute; top:0; bottom:0; right:0; width:38%;
  background: linear-gradient(115deg, transparent 0 46%, rgba(228,35,47,.16) 46% 58%, transparent 58%);
  pointer-events:none;
}
.hero .container { position: relative; z-index: 1; }

.breadcrumbs { font-size: 13.5px; margin: 0 0 22px; color: rgba(255,255,255,.82); }
.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,.55); }
.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; gap: 8px;
  margin: 0 0 16px; padding: 6px 14px 6px 10px;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.20);
  border-radius: 999px; font-size: 12.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: #fff;
}
.hero .hero__tag::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red-500); box-shadow: 0 0 0 3px rgba(228,35,47,.25);
}
.hero h1 {
  font-size: clamp(30px, 4.4vw, 46px); line-height: 1.1; margin: 0;
  max-width: 20ch; font-weight: 800; letter-spacing: -.02em;
}
.hero h1::after {
  content: ""; display: block; width: 68px; height: 4px; margin-top: 18px;
  background: var(--red-600); border-radius: 3px;
}

/* ==========================================================================
   Layout: article + sidebar  (plain bank layout — not “AI hero” styling)
   ========================================================================== */
.page-wrap { padding: 36px 0 56px; background: var(--white); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: start; }

.article { min-width: 0; }
.article > *:first-child { margin-top: 0; }
.article p { margin: 0 0 16px; }
.article h2 {
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.25;
  margin: 36px 0 14px;
  color: var(--blue-800);
  font-weight: 800;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--red-600);
  scroll-margin-top: 90px;
}
.article h3 {
  font-size: clamp(18px, 2vw, 20px);
  line-height: 1.3;
  margin: 26px 0 10px;
  color: var(--blue-700);
  font-weight: 700;
  scroll-margin-top: 90px;
}
.article ul, .article ol { margin: 0 0 18px; padding-left: 1.25em; }
.article ul li, .article ol li { margin: 0 0 8px; padding: 0; }
.article ul li::before,
.article ol li::before { content: none; }
.article a {
  color: var(--blue-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article a:hover { color: var(--red-600); }

/* tables — clean, no gradient chrome */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 22px;
  border: 1px solid var(--gray-200);
}
table { width: 100%; border-collapse: collapse; min-width: 460px; background: #fff; }
thead th {
  background: var(--blue-800);
  color: #fff;
  text-align: left;
  font-weight: 700;
  font-size: 14.5px;
  padding: 12px 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(--gray-50); }

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 18px; }
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card__head {
  padding: 12px 14px;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--blue-800);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.card__body { padding: 6px 8px; }

.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list a {
  display: block;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--gray-600);
  border-left: 2px solid transparent;
}
.toc-list a:hover {
  background: var(--blue-50);
  color: var(--blue-700);
  text-decoration: none;
  border-left-color: var(--blue-500);
}

.related-list { list-style: none; margin: 0; padding: 0; }
.related-list a {
  display: block;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--blue-800);
}
.related-list a:hover {
  background: var(--blue-50);
  color: var(--blue-700);
  text-decoration: none;
}

.help-card {
  background: var(--blue-800);
  color: #fff;
  border: 0;
  padding: 18px;
}
.help-card h3 { margin: 0 0 6px; font-size: 17px; color:#fff; }
.help-card p { margin: 0 0 12px; font-size: 14px; color: rgba(255,255,255,.86); }
.help-card .phone {
  font-size: 18px;
  font-weight: 800;
  color:#fff;
  display:block;
  margin-bottom: 12px;
}
.help-card .phone:hover { text-decoration: none; color: #fff; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--blue-900); color: rgba(255,255,255,.78); margin-top: 32px; }
.footer-top { padding: 44px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.3fr repeat(4, 1fr); gap: 28px; }
.footer-brand .brand__text b { color: #fff; }
.footer-brand .brand__text span { color: rgba(255,255,255,.6); }
.footer-brand p { font-size: 14px; margin: 14px 0 0; max-width: 34ch; color: rgba(255,255,255,.62); }
.footer-col h4 { color: #fff; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; 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,.72); 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,.12);
  padding: 18px 0;
  font-size: 13px;
  color: rgba(255,255,255,.55);
}
.footer-bottom .container { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@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; }
}

/* Collapse desktop nav before CTAs start to clip */
@media (max-width: 1240px) {
  .nav-burger { display: block; }
  .header-cta { display: none; }
  .main-nav {
    position: fixed;
    inset: 68px 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 .28s ease;
    flex: none;
  }
  .nav-open .main-nav { max-height: calc(100vh - 68px); overflow-y: auto; }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    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: 16px;
  }
  .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%; }
}
