:root {
  --blue: #123f73;
  --blue-2: #0b2f5b;
  --red: #c9152f;
  --ink: #243247;
  --muted: #64748b;
  --line: #d9e2ee;
  --paper: #f6f8fb;
  --white: #fff;
  --shadow: 0 18px 45px rgba(18, 63, 115, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background: var(--white);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid rgba(18, 63, 115, 0.1);
  box-shadow: 0 10px 30px rgba(18, 63, 115, 0.08);
  backdrop-filter: blur(16px);
}

.site-header::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--blue) 0 42%, var(--red) 42% 66%, #29a4d6 66% 100%);
}

.main-nav {
  position: relative;
  width: min(1160px, calc(100% - 36px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 34px;
}

.brand {
  position: relative;
  flex: 0 0 184px;
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 8px 18px;
  background: var(--white);
  border-left: 1px solid rgba(18, 63, 115, 0.1);
  border-right: 1px solid rgba(18, 63, 115, 0.1);
}

.brand img {
  width: 142px;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: 1;
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-links > li {
  position: relative;
}

.nav-links > li > a,
.nav-dropdown > summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 13px;
  color: var(--blue-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
  cursor: pointer;
  list-style: none;
}

.mobile-nav-link {
  display: none !important;
}

.nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown > summary {
  padding-right: 28px;
}

.nav-dropdown > summary::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-62%) rotate(45deg);
  transition: transform 0.18s ease;
}

.nav-dropdown[open] > summary::before {
  transform: translateY(-36%) rotate(-135deg);
}

.nav-links > li > a::after,
.nav-dropdown > summary::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
  transform: translateX(-50%) scale(0);
  transition: transform 0.18s ease;
}

.nav-links > li > a.active,
.nav-dropdown > summary.active,
.nav-links > li > a.mobile-nav-link.active,
.nav-links > li > a:hover,
.nav-dropdown[open] > summary,
.nav-dropdown > summary:hover {
  color: var(--blue);
  background: #edf4fb;
}

.nav-links > li > a.active::after,
.nav-dropdown > summary.active::after,
.nav-links > li > a:hover::after,
.nav-dropdown[open] > summary::after,
.nav-dropdown > summary:hover::after {
  transform: translateX(-50%) scale(1);
}

.contact-link {
  color: var(--white) !important;
  background: var(--red);
  box-shadow: 0 10px 20px rgba(201, 21, 47, 0.16);
}

.contact-link::after {
  display: none;
}

.contact-link:hover {
  color: var(--white);
  background: #a90f25;
}

.submenu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 40;
  min-width: 250px;
  margin: 0;
  padding: 10px;
  list-style: none;
  border: 1px solid rgba(18, 63, 115, 0.12);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.wide-dropdown .submenu {
  width: 440px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.loans-dropdown .submenu {
  left: 50%;
  width: min(920px, calc(100vw - 44px));
  transform: translateX(-50%);
}

.mega-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mega-menu section {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.mega-menu h3 {
  margin: 0 0 7px;
  padding: 0 10px 8px;
  color: var(--red);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.1;
  font-weight: 900;
  text-transform: uppercase;
}

.submenu::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 26px;
  width: 14px;
  height: 14px;
  background: var(--white);
  border-left: 1px solid rgba(18, 63, 115, 0.12);
  border-top: 1px solid rgba(18, 63, 115, 0.12);
  transform: rotate(45deg);
}

.loans-dropdown .submenu::before {
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.submenu a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--blue-2);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 800;
  text-transform: none;
  white-space: normal;
}

.mega-menu a {
  white-space: nowrap;
}

.submenu a:hover {
  color: var(--blue);
  background: #edf4fb;
}

.nav-check {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.nav-toggle {
  display: none;
  position: relative;
  width: 50px;
  height: 50px;
  margin-left: auto;
  border: 1px solid rgba(18, 63, 115, 0.18);
  border-radius: 999px;
  background: #f6f9fc;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.nav-overlay {
  display: none;
}

.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  display: block;
  width: 22px;
  height: 2px;
  background: var(--blue);
  border-radius: 999px;
  transform: translateX(-50%);
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.nav-toggle span {
  top: 24px;
}

.nav-toggle::before {
  top: 17px;
}

.nav-toggle::after {
  top: 31px;
}

.nav-check:checked + .nav-toggle {
  background: var(--blue);
  border-color: var(--blue);
}

.nav-check:checked + .nav-toggle span,
.nav-check:checked + .nav-toggle::before,
.nav-check:checked + .nav-toggle::after {
  background: var(--white);
}

.nav-check:checked + .nav-toggle span {
  opacity: 0;
}

.nav-check:checked + .nav-toggle::before {
  top: 24px;
  transform: translateX(-50%) rotate(45deg);
}

.nav-check:checked + .nav-toggle::after {
  top: 24px;
  transform: translateX(-50%) rotate(-45deg);
}

@media (max-width: 1024px) {
  .main-nav {
    width: min(100% - 28px, 720px);
    min-height: 86px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .nav-toggle {
    display: block;
    order: 3;
    margin: 0 0 0 auto;
    z-index: 80;
  }

  .brand {
    flex: 0 0 auto;
    align-self: center;
    min-height: 76px;
    padding: 10px 0;
    border: 0;
  }

  .brand img {
    width: 150px;
  }

  .nav-links {
    display: none;
    order: 4;
    position: fixed;
    top: 92px;
    left: 50%;
    z-index: 70;
    width: calc(100% - 36px);
    max-width: 360px;
    max-height: calc(100vh - 116px);
    margin: 0;
    padding: 10px;
    overflow-y: auto;
    border-top: 1px solid var(--line);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--white);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
  }

  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(11, 47, 91, 0.62);
    backdrop-filter: blur(3px);
  }

  .nav-check:checked ~ .nav-overlay {
    display: block;
  }

  .nav-check:checked + .nav-toggle {
    position: fixed;
    top: 22px;
    left: 50%;
    margin: 0;
    transform: translateX(-50%);
  }

  .nav-check:checked ~ .nav-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .nav-links > li > a,
  .nav-dropdown > summary {
    justify-content: center;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 8px;
    background: #f7fafd;
    text-align: center;
    white-space: normal;
  }

  .nav-dropdown {
    display: none;
  }

  .mobile-nav-link {
    display: flex !important;
  }

  .nav-dropdown > summary {
    padding-right: 34px;
  }

  .nav-dropdown > summary::before {
    right: 18px;
  }

  .nav-links > li > a::after,
  .nav-dropdown > summary::after {
    display: none;
  }

  .submenu,
  .wide-dropdown .submenu,
  .loans-dropdown .submenu {
    position: static;
    width: auto;
    min-width: 0;
    transform: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 8px 0 0;
    padding: 8px;
    border-radius: 10px;
    background: #f6f9fc;
    box-shadow: none;
  }

  .submenu::before {
    display: none;
  }

  .submenu a {
    white-space: normal;
    justify-content: center;
    min-height: 42px;
    background: var(--white);
    text-align: center;
  }

  .mega-menu {
    grid-template-columns: 1fr;
  }

  .contact-link,
  .contact-link:hover {
    color: var(--white) !important;
    background: var(--red) !important;
    box-shadow: 0 10px 20px rgba(201, 21, 47, 0.16);
  }
}

@media (max-width: 560px) {
  .nav-check:checked ~ .nav-links {
    grid-template-columns: 1fr;
  }
}
