/* ============================================================
   ФАЙЛ: assets/css/shapka/shapka_fragment.css
   Шапка сайта SnapFit.
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background:
    linear-gradient(180deg, rgba(4, 19, 31, .95), rgba(4, 19, 31, .84));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(83, 137, 170, .16);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .12);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: min(92%, 1100px);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 225, 255, .12),
    rgba(156, 255, 0, .10),
    transparent
  );
  pointer-events: none;
}

.nav {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0;
  line-height: 0;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: clamp(150px, 12vw, 205px);
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0 12px rgba(0, 225, 255, .14))
    drop-shadow(0 0 16px rgba(156, 255, 0, .08));
}

.header-right {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}

.nav-link {
  position: relative;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: rgba(205, 224, 235, .68);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.nav-link:hover {
  color: #f4fbff;
  background: rgba(15, 41, 57, .58);
  border-color: rgba(112, 167, 198, .12);
  transform: translateY(-1px);
}

.nav-link.active {
  color: #88f1ca;
  background: rgba(20, 72, 60, .35);
  border-color: rgba(58, 214, 164, .14);
}

.header-downloads {
  position: relative;
}

.header-downloads-toggle {
  display: none;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(118, 255, 97, .18);
  border-radius: 13px;
  background:
    linear-gradient(145deg, rgba(41, 80, 45, .56), rgba(12, 42, 38, .52));
  color: #b6ff82;
  font: inherit;
  font-size: .9rem;
  font-weight: 800;
  cursor: pointer;
}

.header-downloads-chevron {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.header-downloads-toggle[aria-expanded="true"] .header-downloads-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.header-store-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.header-store-link {
  position: relative;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(147, 196, 220, .10);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(6, 24, 35, .72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .035),
    0 8px 22px rgba(0, 0, 0, .12);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.header-store-link:hover {
  transform: translateY(-2px);
  border-color: rgba(152, 255, 111, .22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .05),
    0 11px 26px rgba(0, 0, 0, .18),
    0 0 18px rgba(117, 255, 85, .04);
}

.header-store-link img {
  display: block;
  width: auto;
  height: 100%;
  max-width: 106px;
  object-fit: contain;
}

@media (max-width: 1180px) {
  .nav {
    gap: 16px;
  }

  .header-right {
    gap: 10px;
  }

  .header-store-link {
    height: 33px;
  }

  .header-store-link img {
    max-width: 94px;
  }
}

@media (max-width: 980px) {
  .nav {
    min-height: 68px;
  }

  .brand-logo {
    width: 150px;
  }

  .header-downloads-toggle {
    display: inline-flex;
  }

  .header-store-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 12px;
    border: 1px solid rgba(108, 157, 187, .18);
    border-radius: 18px;
    background: rgba(5, 23, 35, .97);
    box-shadow: 0 22px 50px rgba(0, 0, 0, .34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-7px) scale(.985);
    transform-origin: top right;
    transition:
      opacity 160ms ease,
      visibility 160ms ease,
      transform 160ms ease;
  }

  .header-downloads.is-open .header-store-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
  }

  .header-store-link {
    height: 44px;
    border-radius: 12px;
  }

  .header-store-link img {
    max-width: 132px;
  }
}

@media (max-width: 620px) {
  .nav {
    min-height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "logo download"
      "links links";
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
    padding-top: 6px;
    padding-bottom: 7px;
  }

  .brand-logo-link {
    grid-area: logo;
    min-width: 0;
    justify-self: start;
  }

  .brand-logo {
    width: 118px;
    max-width: 100%;
  }

  .header-right {
    display: contents;
  }

  .header-downloads {
    grid-area: download;
    justify-self: end;
  }

  .header-downloads-toggle {
    min-height: 36px;
    padding: 6px 10px;
    font-size: .79rem;
  }

  .nav-links {
    grid-area: links;
    width: 100%;
    min-width: 0;
    justify-content: center;
    gap: 4px;
    padding-top: 3px;
    border-top: 1px solid rgba(83, 137, 170, .10);
  }

  .nav-link {
    min-height: 34px;
    flex: 1 1 0;
    max-width: 150px;
    padding: 5px 8px;
    font-size: .79rem;
    text-align: center;
  }

  .header-store-panel {
    right: 0;
    width: min(340px, calc(100vw - 20px));
  }
}

@media (max-width: 430px) {
  .nav {
    column-gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand-logo {
    width: 108px;
  }

  .header-downloads-toggle {
    min-height: 34px;
    padding: 5px 8px;
    font-size: .76rem;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-link {
    min-height: 32px;
    padding: 4px 6px;
    font-size: .75rem;
  }

  .header-store-panel {
    grid-template-columns: 1fr 1fr;
    width: min(320px, calc(100vw - 20px));
  }
}

@media (max-width: 360px) {
  .brand-logo { width: 100px; }
  .header-downloads-toggle { padding-inline: 7px; font-size: .73rem; }
  .nav-link { font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header *,
  .site-header *::before,
  .site-header *::after {
    transition-duration: .001ms !important;
  }
}
