/* Responsive / H5 adaptation, shared by every page.
   Loaded after each page stylesheet so it can override the desktop rules.

   Breakpoints:
     <= 1279px  tablet and below - release the 1280px desktop floor
     <= 1023px  nav collapses into the drawer (the desktop nav needs ~1130px to fit)
     <=  768px  phone - single column
*/

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

/* Drawer chrome: hidden on desktop, revealed by the <= 1023px block below. */
.header__toggle,
.nav-backdrop {
  display: none;
}

/* ==========================================================================
   Tablet and below
   ========================================================================== */
@media (max-width: 1279px) {
  .page {
    min-width: 0;
  }

  .container {
    width: 100%;
    max-width: none;
    padding: 0 40px;
  }

  .header__inner {
    padding: 0 40px;
  }

  .footer {
    min-height: 0;
    padding: 42px 40px 33px;
  }
}

/* Compressed horizontal nav for the band where it still fits. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .header__nav {
    gap: 16px;
  }

  .header__nav-link {
    font-size: 15px;
  }

  .header__btn {
    padding: 8px 18px;
  }
}

/* ==========================================================================
   Nav drawer
   ========================================================================== */
@media (max-width: 1023px) {
  .header__toggle {
    display: flex;
    position: relative;
    z-index: 3;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0 9px;
    background: none;
    border: 0;
    cursor: pointer;
  }

  .header__toggle-bar {
    width: 22px;
    height: 2px;
    background: #002576;
    border-radius: 2px;
    transition: transform 0.28s ease, opacity 0.2s ease;
  }

  .header__nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 76%;
    max-width: 300px;
    padding: 84px 24px 32px;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.28s ease;
  }

  .header__nav-link {
    padding: 14px 4px;
    border-bottom: 1px solid #eff4ff;
    white-space: normal;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(2, 20, 48, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
  }

  .nav-open {
    overflow: hidden;
  }

  .nav-open .header__nav {
    transform: translateX(0);
  }

  .nav-open .nav-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .nav-open .header__toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-open .header__toggle-bar:nth-child(2) {
    opacity: 0;
  }

  .nav-open .header__toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ==========================================================================
   Phone
   ========================================================================== */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  /* Header */
  .header,
  .header__inner {
    height: 64px;
  }

  .header__inner {
    gap: 8px;
    padding: 0 16px;
  }

  .header__logo {
    min-width: 0;
    gap: 8px;
    font-size: 18px;
    line-height: 24px;
  }

  .header__logo-img {
    width: 36px;
    height: 36px;
  }

  .header__btn {
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 4px;
    padding: 6px 12px;
    font-size: 13px;
    line-height: 20px;
    white-space: nowrap;
  }

  .header__toggle {
    flex-shrink: 0;
  }

  /* Footer */
  .footer {
    padding: 32px 16px 24px;
  }

  .footer__top {
    flex-direction: column;
    gap: 24px;
    padding-bottom: 24px;
  }

  .footer__brand {
    max-width: none;
  }

  .footer__logo {
    font-size: 20px;
    line-height: 28px;
  }

  .footer__tagline {
    margin-bottom: 16px;
  }

  .footer__tagline,
  .footer__info,
  .footer__links-title,
  .footer__links a {
    font-size: 14px;
    line-height: 22px;
  }

  .footer__links-title {
    margin-bottom: 8px;
  }

  .footer__links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
  }

  .footer__links li {
    line-height: 30px;
  }

  .footer__bottom {
    padding-top: 20px;
  }

  .footer__copyright {
    font-size: 13px;
  }
}
