/* =========================================================
   THANH ĐIỀU HƯỚNG — cố định trên đỉnh trang

   Hero đã bỏ logo riêng nên thanh này là nơi duy nhất hiển thị
   logo iSMART → hiện ngay từ đầu, không chờ cuộn.
   Khi cuộn xuống (class .is-stuck do JS gắn) chỉ đậm thêm nền
   và đổ bóng để tách khỏi nội dung phía sau.
   ========================================================= */

.nav{
  --nav-h: 72px;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(8px);
  transition: background-color .25s ease, box-shadow .25s ease;
}

.nav.is-stuck{
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 6px 24px rgba(20, 60, 120, .10);
}

.nav__inner{
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 32px);
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--page-pad));
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

/* --- logo: hiện ngay từ đầu, khoá chiều cao cho lọt trong thanh -------
   Logo gốc khá cao (tỉ lệ ~140×98) nên nếu chỉ đặt width thì nó tràn ra
   ngoài thanh 72px. Khoá bằng max-height và để width tự co theo.      */

.nav__logo{
  flex: none;
  display: flex;
  align-items: center;
  height: 100%;
}

.nav__logo img{
  width: auto;
  max-height: clamp(36px, 3.4vw, 46px);   /* luôn nhỏ hơn chiều cao thanh */
  object-fit: contain;
}

/* --- danh sách liên kết ----------------------------------------------- */

.nav__list{
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 26px);
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.nav__link{
  position: relative;
  padding-block: 6px;
  font-size: clamp(13px, 1vw, 14.5px);
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ipass-navy-deep);
  white-space: nowrap;
  transition: color .18s ease;
}

.nav__link:hover{ color: var(--ipass-orange); }

/* gạch chân chạy ra khi hover / khi đang ở đúng section đó */
.nav__link::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--ipass-orange);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .22s ease;
}

.nav__link:hover::after,
.nav__link.is-active::after{ transform: scaleX(1); }

.nav__link.is-active{ color: var(--ipass-orange); }

/* --- nút CTA ----------------------------------------------------------- */

.nav__cta{
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding-inline: 20px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ipass-orange) 0%, var(--ipass-orange-2) 100%);
  color: #fff;
  font-size: clamp(13px, 1vw, 14.5px);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(240, 78, 35, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}

.nav__cta:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(240, 78, 35, .38);
}

/* --- nút mở menu trên mobile ------------------------------------------ */

.nav__toggle{
  display: none;
  flex: none;
  width: 42px;
  height: 42px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .8);
  color: var(--ipass-navy-deep);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 60, 120, .14);
}

.nav__toggle svg{ width: 22px; height: 22px; margin-inline: auto; }
.nav__toggle .nav__icon-close{ display: none; }
.nav__toggle[aria-expanded="true"] .nav__icon-open { display: none; }
.nav__toggle[aria-expanded="true"] .nav__icon-close{ display: block; }

/* Bấm liên kết neo thì chừa sẵn chiều cao thanh nav, tránh tiêu đề
   section bị nav che mất. Chỉ áp cho section/footer — không dùng
   selector [id] chung vì sẽ đụng cả các ô input trong form. */
section[id],
footer[id]{ scroll-margin-top: 80px; }

@media (max-width: 599px){
  section[id],
  footer[id]{ scroll-margin-top: 72px; }
}


/* =========================================================
   RESPONSIVE — dưới 1023px chuyển sang menu xổ xuống
   ========================================================= */

@media (max-width: 1023px){
  .nav__toggle{ display: flex; align-items: center; justify-content: center; }

  /* Menu xổ: mặc định đóng, mở khi <nav> có class .is-open.
     Không dùng thủ thuật grid-template-rows 0fr→1fr vì ở đây list có
     nhiều <li>, chỉ hàng đầu tiên bị co lại. Dùng opacity + trượt nhẹ +
     visibility: list đang position:absolute nên không ảnh hưởng bố cục. */
  .nav__list{
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    margin: 0;
    padding: 10px var(--page-pad) 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 28px rgba(20, 60, 120, .14);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
  }

  .nav.is-open .nav__list{
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    transition: opacity .22s ease, transform .22s ease, visibility 0s;
  }

  .nav__link{
    display: block;
    padding: 12px 4px;
    font-size: 15px;
    border-bottom: 1px solid rgba(20, 34, 107, .08);
  }

  .nav__link::after{ display: none; }

  /* nút CTA nằm cạnh nút mở menu, không chui vào trong menu */
  .nav__cta{ margin-left: auto; height: 38px; padding-inline: 16px; }
  .nav__toggle{ margin-left: 10px; }

}

@media (max-width: 599px){
  .nav{ --nav-h: 62px; }
  .nav__cta{ font-size: 12.5px; padding-inline: 13px; height: 36px; }
  .nav__logo img{ max-height: 32px; }
}

/* --- tôn trọng thiết lập giảm chuyển động ----------------------------- */

@media (prefers-reduced-motion: reduce){
  .nav, .nav__logo, .nav__list, .nav__link::after, .nav__cta{ transition: none; }
}
