/* =========================================================
   COMPONENT — Navbar (docs/sections/navbar.md)
   ========================================================= */

/* Sticky: fixed over the hero (it never took page space). After scrolling (.is-scrolled, js/main.js)
   it docks flush to the top edge (square top corners) with a shadow so it reads over light sections. */
.site-header {
  position: fixed;
  top: 35px;
  left: 0;
  right: 0;
  z-index: 1030;
  transition: top .3s ease;
}
.site-header.is-scrolled { top: 0; }

.main-nav {
  min-height: 61px;
  padding: 0 24px 0 27px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  transition: box-shadow .3s ease, border-radius .3s ease;
}
/* Docked: flush with the top edge, square top corners, rounded bottom */
.site-header.is-scrolled .main-nav {
  border-radius: 0 0 24px 24px;
  box-shadow: 0 10px 30px rgba(8, 26, 40, .22);
}

@media (prefers-reduced-motion: reduce) {
  .site-header, .main-nav { transition: none; }
}

.main-nav__brand { padding: 0; margin: 0; }
.main-nav__brand img {
  width: 160px;
  height: 60px;
  object-fit: contain;   /* 86×30 source keeps its proportions inside the 160×60 box */
}

/* Links */
.main-nav__links { gap: 8px; }

.main-nav .main-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  color: var(--color-white);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: background-color .2s ease, color .2s ease;
}
.main-nav .main-nav__link:hover,
.main-nav .main-nav__link:focus-visible { color: var(--color-gold); }
.main-nav .main-nav__link.active {
  background: var(--color-gold);
  color: var(--color-white);
  font-weight: 600;
}

/* ---------- Tours submenu (link → Tours page; list → category pages) ---------- */
.main-nav__has-submenu { position: relative; display: flex; align-items: center; }

.main-nav__chevron { width: 12px; height: 8px; flex: 0 0 auto; transition: transform .2s ease; }
.main-nav__link .main-nav__chevron { display: none; }   /* shown on hover-capable desktops only */

/* Arrow button: opens the list where there's no hover (mobile/touch) */
.main-nav__subtoggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-white);
  cursor: pointer;
}
.main-nav__subtoggle:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.main-nav__has-submenu.is-open .main-nav__subtoggle .main-nav__chevron { transform: rotate(180deg); }

.main-nav__submenu {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 10;
  min-width: 220px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border-radius: var(--radius-card);
  background: var(--color-white);
  box-shadow: 0 12px 32px rgba(8, 26, 40, 0.18);
}
.main-nav__has-submenu.is-open > .main-nav__submenu { display: block; }

.main-nav__sublink {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--color-navy);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}
.main-nav__sublink:hover,
.main-nav__sublink:focus-visible { background: var(--color-light); color: var(--color-primary); outline: none; }
.main-nav__sublink.active { background: var(--color-primary); color: var(--color-white); }

/* Desktop with a mouse: hover (or keyboard focus) opens the list; click on Tours opens the Tours page */
@media (min-width: 1200px) and (hover: hover) {
  .main-nav__link .main-nav__chevron { display: block; }
  .main-nav__subtoggle { display: none; }
  .main-nav__has-submenu:hover > .main-nav__submenu,
  .main-nav__has-submenu:focus-within > .main-nav__submenu { display: block; }
  .main-nav__has-submenu:hover .main-nav__chevron,
  .main-nav__has-submenu:focus-within .main-nav__chevron { transform: rotate(180deg); }
  .main-nav__has-submenu:hover > .main-nav__link:not(.active) { color: var(--color-gold); }
  /* Invisible bridge over the 12px gap so the list doesn't close on the way down */
  .main-nav__submenu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 14px;
  }
}

/* Right actions */
.main-nav__actions { gap: 16px; }

.main-nav__cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 16px;
  border-radius: 50%;
  background: var(--color-cream);
}
.main-nav__cart img { width: 24px; height: 24px; }
.main-nav__cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--color-gold);
  color: var(--color-white);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* Toggler */
.main-nav .navbar-toggler {
  border: 0;
  padding: 6px;
  margin-left: 12px;
  box-shadow: none;
}
.main-nav .navbar-toggler:focus-visible { outline: 2px solid var(--color-gold); }

/* ---------- Responsive ---------- */
/* Compact bar (menu button · logo · cart) below 1200px: the full menu needs ~1150px */
@media (max-width: 1199.98px) {
  .site-header { top: 16px; }
  .site-header.is-scrolled { top: 0; }

  .main-nav {
    padding: 8px 14px;
    border-radius: 30px;
  }

  /* Mobile bar: menu button (left) · logo (centre) · cart (right). The toggler and cart are
     both 44px wide, so the logo between them sits exactly in the middle. */
  .main-nav .navbar-toggler {
    order: -1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
  }
  .main-nav__brand { order: 0; margin: 0 auto; }
  .main-nav__brand img { width: 130px; height: 48px; }
  .main-nav__cart { order: 1; width: 44px; height: 44px; margin-left: 0; }
  .main-nav__menu { order: 2; }

  /* Open menu scrolls inside the fixed bar if it's taller than the screen */
  .main-nav__menu { padding: 12px 0 8px; }
  .main-nav__menu.show,
  .main-nav__menu.collapsing { max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); overflow-y: auto; }
  .main-nav__links { gap: 4px; margin-bottom: 16px; }
  .main-nav .main-nav__link { width: 100%; height: 42px; }

  /* Tours: link + arrow button on one row, list expands below inside the menu */
  .main-nav__has-submenu { flex-wrap: wrap; }
  .main-nav__has-submenu > .main-nav__link { flex: 1 1 0; width: auto; }
  .main-nav__subtoggle { width: 42px; height: 42px; margin-left: 4px; background: rgba(255, 255, 255, 0.12); }
  .main-nav__submenu { position: static; flex: 0 0 100%; margin-top: 4px; box-shadow: none; }
  .main-nav__actions .btn-ds { flex: 1 1 0; height: 42px; }
}

@media (max-width: 575.98px) {
  .main-nav { padding: 6px 10px; }
  .main-nav__brand img { width: 112px; height: 42px; }
  .main-nav .navbar-toggler,
  .main-nav__cart { width: 40px; height: 40px; }
}

/* Full menu on smaller desktops (1200–1319px): tighter spacing so everything stays on one line */
@media (min-width: 1200px) and (max-width: 1319.98px) {
  .main-nav { padding: 0 18px 0 22px; }
  .main-nav__brand img { width: 140px; height: 52px; }
  .main-nav__links { gap: 2px; }
  .main-nav .main-nav__link { padding: 0 12px; }
  .main-nav__actions { gap: 10px; }
  .main-nav__cart { margin-left: 12px; }
}
.main-nav .main-nav__link { white-space: nowrap; }

/* ---------- Tours mega menu (design: nav bar tour dropdown.png) ----------
   Left: categories (right-aligned, chevron; first one active). Right: #FAFAFA panel with that category's tours
   in 3 columns (52px rounded image, name #2F2F2F, price line #5F5F5F) + "View all" link. js/main.js switches panels. */
.mega__cats { margin: 0; padding: 0; list-style: none; }
.mega__chevron { flex: 0 0 auto; display: none; }
.mega__panels { display: none; }

@media (min-width: 1200px) {
  /* Anchor the panel to the whole navbar, not to the Tours item */
  .main-nav { position: relative; }
  .main-nav__has-submenu { position: static; }

  /* Attached directly under the bar (no gap), inset 20px so it tucks under the bar's rounded ends */
  .main-nav__mega {
    left: 20px;
    right: 20px;
    top: 100%;
    min-width: 0;
    grid-template-columns: 330px minmax(0, 1fr);
    padding: 0;
    overflow: visible;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 24px 60px rgba(8, 26, 40, .22);
  }
  .main-nav__has-submenu.is-open > .main-nav__mega { display: grid; }

  .main-nav__mega::before { height: 16px; }

  /* Left column: categories */
  .mega__cats {
    margin: 0;
    padding: 22px 0;
    list-style: none;
    background: var(--color-white);
    border-bottom-left-radius: 20px;
  }
  .main-nav .mega__cat {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 12px 28px 12px 20px;
    border-radius: 0;
    color: #2F2F2F; /* sampled */
    font-size: 17px;
    line-height: 22px;
    font-weight: 500;
    text-align: right;
    white-space: normal;
  }
  .mega__chevron { display: block; color: #5F5F5F; transition: transform .2s ease; }
  .main-nav .mega__cat:hover,
  .main-nav .mega__cat:focus-visible,
  .main-nav .mega__cat.is-active {
    background: #FAFAFA;
    color: var(--color-primary);
    box-shadow: inset -3px 0 0 var(--color-primary);
  }
  .main-nav .mega__cat.is-active .mega__chevron { color: var(--color-primary); transform: translateX(3px); }
  .main-nav .mega__cat.active { background: #FAFAFA; color: var(--color-primary); font-weight: 600; }

  /* Right: tours of the active category */
  .mega__panels { display: block; padding: 26px 32px 24px; background: #FAFAFA; /* sampled */ border-bottom-right-radius: 20px; }
  .mega__panel[hidden] { display: none; }
  .mega__title {
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #5F5F5F;
  }
  .mega__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .mega__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    border-radius: 14px;
    transition: background-color .2s ease;
  }
  .mega__item:hover,
  .mega__item:focus-visible { background: var(--color-white); outline: none; box-shadow: 0 6px 18px rgba(8, 26, 40, .08); }
  .mega__item img { flex: 0 0 auto; width: 52px; height: auto; aspect-ratio: 293 / 343; object-fit: cover; border-radius: 10px; }   /* product card image ratio, small */
  .mega__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .mega__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 16px;
    line-height: 20px;
    font-weight: 500;
    color: #2F2F2F;
  }
  .mega__item:hover .mega__name { color: var(--color-primary); }
  .mega__meta { font-size: 14px; line-height: 18px; color: #5F5F5F; }
  .mega__all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 0 10px;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 600;
  }
  .mega__all:hover { color: var(--color-navy); text-decoration: underline; }
}

@media (min-width: 1200px) and (hover: hover) {
  .main-nav__has-submenu:hover > .main-nav__mega,
  .main-nav__has-submenu:focus-within > .main-nav__mega { display: grid; }
}
