/* ===================== NAVBAR ===================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid #eaeaea;
  transition: transform 0.25s ease;

  /* keep these for desktop performance */
  will-change: transform;
  backface-visibility: hidden;
}

/* IMPORTANT: avoid horizontal jump */
html, body {
  overflow-x: hidden;
}

.navbar--hidden {
  transform: translateY(-110%);
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.navbar__inner {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  align-items: center;
  padding: 14px 0;
  gap: 10px;
}

.navbar__logo img {
  height: 54px;
  width: auto;
  display: block;
}

/* ===================== DESKTOP LINKS ===================== */
.navbar__links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
}

.navlink {
  font-weight: 500;
  color: #111;
  position: relative;
  padding: 6px 2px;
  transition: opacity 0.2s ease;
  text-decoration: none;
}

.navlink:hover {
  opacity: 0.7;
}

.navlink.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  height: 2px;
  width: 100%;
  background: #000;
}

/* ===================== DROPDOWN (DESKTOP) ===================== */
.navdrop {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.navdrop__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #1f2937;

  background: #000;
  color: #fff;

  font-weight: 600;
  font-size: 13px;
  cursor: pointer;

  transition: opacity 0.15s ease, transform 0.15s ease;
}

.navdrop__btn:hover {
  opacity: 0.9;
}

.navdrop__chev {
  display: inline-flex;
  font-size: 18px;
  line-height: 1;
}

.navdrop__menu {
  position: absolute;
  top: calc(100% + 10px);

  left: 50%;
  translate: -50% 0;

  width: 220px;
  padding: 10px;

  border-radius: 14px;
  background: #fff;
  border: 1px solid #eaeaea;

  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  z-index: 200;

  will-change: transform, opacity;
}

.navdrop__item {
  display: block;
  padding: 10px 10px;
  border-radius: 10px;

  font-size: 13px;
  font-weight: 600;
  color: #111;
  text-decoration: none;

  transition: background 0.15s ease;
}

.navdrop__item:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ===================== SOCIAL (DESKTOP) ===================== */
.navbar__social {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.social {
  width: 36px;
  height: 36px;
  border: 1px solid #eaeaea;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.social:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
}

/* ===================== MOBILE TOGGLE BUTTON ===================== */
.navbar__toggle {
  display: none;
  background: transparent;
  border: 1px solid #eaeaea;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.navbar__toggle svg {
  width: 22px;
  height: 22px;
}

/* ===================== MOBILE DRAWER ===================== */
.mobile {
  display: none;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .navbar__inner {
    grid-template-columns: 160px 1fr;
  }

  .navbar__links,
  .navbar__social {
    display: none;
  }

  .navbar__toggle {
    display: inline-flex;
    justify-self: end;
  }

  /* CRITICAL: don't allow transform on navbar in mobile
     because it breaks fixed overlays inside it */
  .navbar {
    transform: none !important;
    will-change: auto;
  }

  .navbar--hidden {
    transform: none !important; /* hide/show on mobile should be handled in JS later */
  }

  .mobile {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 99999; /* win over everything */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .mobile--open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .mobile__backdrop {
    position: fixed; /* IMPORTANT */
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    border: none;
    z-index: 1;
  }

  .mobile__panel {
    position: fixed; /* IMPORTANT */
    top: 0;
    right: 0;
    height: 100dvh; /* better than 100% */
    width: min(360px, 90vw);
    background: #fff;
    border-left: 1px solid #eaeaea;
    padding: 18px;
    transform: translateX(110%);
    transition: transform 0.25s ease;
    z-index: 2;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile--open .mobile__panel {
    transform: translateX(0);
  }

  .mobile__links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
  }

  .m-link {
    font-weight: 600;
    color: #111;
    padding: 10px 10px;
    border-radius: 10px;
    text-decoration: none;
  }

  .m-link:hover {
    background: #f5f5f5;
  }

  .m-link.active {
    background: #000;
    color: #fff;
  }

  .m-details {
    border: 1px solid #eaeaea;
    border-radius: 12px;
    padding: 8px;
  }

  .m-summary {
    list-style: none;
    cursor: pointer;
    font-weight: 700;
    padding: 10px;
  }

  .m-summary::-webkit-details-marker {
    display: none;
  }

  .m-sub {
    display: grid;
    gap: 8px;
    padding: 6px 10px 10px;
  }

  .m-sublink {
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid #eaeaea;
    color: #111;
    display: block;
    text-decoration: none;
  }

  .m-sublink:hover {
    background: #f5f5f5;
  }

  .m-sublink.active {
    background: #000;
    color: #fff;
    border-color: #000;
  }

  .mobile__social {
    display: flex;
    gap: 10px;
    padding-top: 18px;
  }
}
