/* ==========================================================================
   Himalayan Trails — announcement strip, header, navigation, mobile drawer
   ========================================================================== */

/* ---- Announcement strip -------------------------------------------------- */

.ht-announce {
  background: var(--ht-pine-950);
  color: var(--ht-text-inverse);
  font-size: var(--ht-text-sm);
}

.ht-announce__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ht-space-3);
  min-height: 2.5rem;
  padding-block: var(--ht-space-2);
  text-align: center;
}

.ht-announce__text {
  color: var(--ht-text-inverse-muted);
}

.ht-announce__link {
  font-weight: 600;
  color: var(--ht-clay-400);
  border-bottom: 1px solid currentColor;
  white-space: nowrap;
}

.ht-announce__link:hover {
  color: var(--ht-white);
}

.ht-announce__close {
  position: absolute;
  right: var(--ht-gutter);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--ht-radius-sm);
  color: var(--ht-text-inverse-muted);
}

.ht-announce__close:hover {
  background: rgb(255 255 255 / 0.1);
  color: var(--ht-white);
}

.ht-announce__inner {
  position: relative;
}

/*
 * On narrow screens the strip wraps to two lines and the close button was
 * landing on top of the link. Stack the content, keep it clear of the button,
 * and give the button its own reserved column.
 */
@media (max-width: 47.9375rem) {
  .ht-announce__inner {
    flex-direction: column;
    gap: var(--ht-space-1);
    padding-block: var(--ht-space-3);
    padding-inline-end: 2.75rem;
    font-size: var(--ht-text-xs);
    text-align: left;
    align-items: flex-start;
  }

  .ht-announce__close {
    top: var(--ht-space-2);
    right: var(--ht-space-2);
  }
}

/* ---- Header shell -------------------------------------------------------- */

.ht-header {
  position: sticky;
  top: 0;
  z-index: var(--ht-z-header);
  background: var(--ht-paper);
  border-bottom: 1px solid var(--ht-border-soft);
  transition: box-shadow var(--ht-duration-base) var(--ht-ease);
}

.ht-header[data-stuck="true"] {
  box-shadow: var(--ht-shadow-md);
}

/* Utility row collapses away once the page scrolls, so the sticky header stays
   compact instead of eating the viewport. */
.ht-header__utility {
  background: var(--ht-pine-900);
  color: var(--ht-text-inverse-muted);
  font-size: var(--ht-text-xs);
  overflow: hidden;
  max-height: var(--ht-header-utility-h);
  transition: max-height var(--ht-duration-base) var(--ht-ease);
}

.ht-header[data-stuck="true"] .ht-header__utility {
  max-height: 0;
}

.ht-header__utility-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ht-space-6);
  height: var(--ht-header-utility-h);
}

.ht-header__utility a:hover {
  color: var(--ht-white);
}

.ht-utility-list {
  display: flex;
  align-items: center;
  gap: var(--ht-space-5);
}

.ht-utility-list li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.ht-utility-list svg {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--ht-clay-400);
}

@media (max-width: 61.9375rem) {
  .ht-header__utility {
    display: none;
  }
}

.ht-header__main {
  /* Containing block for the full-width Treks mega panel. */
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--ht-space-6);
  height: var(--ht-header-main-h);
}

/* ---- Brand --------------------------------------------------------------- */

.ht-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--ht-space-3);
  flex: none;
}

.ht-brand__mark {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  color: var(--ht-pine-800);
}

.ht-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.ht-brand__name {
  font-family: var(--ht-font-display);
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ht-pine-900);
  white-space: nowrap;
}

.ht-brand__tagline {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: var(--ht-tracking-caps);
  text-transform: uppercase;
  color: var(--ht-text-muted);
  white-space: nowrap;
}

@media (max-width: 22.5rem) {
  .ht-brand__tagline {
    display: none;
  }
}

/* ---- Desktop navigation -------------------------------------------------- */

.ht-nav {
  margin-left: auto;
}

.ht-nav__list {
  display: flex;
  align-items: center;
  gap: var(--ht-space-1);
}

.ht-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.8125rem;
  border-radius: var(--ht-radius-sm);
  font-size: var(--ht-text-base);
  font-weight: 500;
  color: var(--ht-text-soft);
  white-space: nowrap;
  transition: color var(--ht-duration-fast) var(--ht-ease), background-color var(--ht-duration-fast) var(--ht-ease);
}

.ht-nav__link:hover,
.ht-nav__item[data-open="true"] > .ht-nav__link {
  color: var(--ht-pine-800);
  background: var(--ht-sand);
}

.ht-nav__link[aria-current="page"] {
  color: var(--ht-pine-900);
  font-weight: 600;
}

.ht-nav__caret {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform var(--ht-duration-fast) var(--ht-ease);
}

.ht-nav__item[data-open="true"] .ht-nav__caret {
  transform: rotate(180deg);
}

.ht-nav__item {
  position: relative;
}

/*
 * The wide Treks panel is anchored to the header shell rather than to its own
 * nav item: centring a 1100px panel on a nav link that sits off to one side
 * would push it past the viewport edge. Taking the item out of the positioning
 * chain lets the panel span the content width exactly.
 */
.ht-nav__item:has(> .ht-mega--wide) {
  position: static;
}

/* ---- Mega menu ----------------------------------------------------------- */

.ht-mega {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 50%;
  translate: -50% 0;
  width: min(26rem, calc(100vw - var(--ht-gutter) * 2));
  /*
   * A panel taller than the viewport is unreachable, so cap it and scroll
   * inside. The allowance covers the worst case — announcement strip, utility
   * row and main row all visible at scroll position zero — rather than the main
   * row alone, which let the panel run off the bottom of a laptop screen.
   */
  max-height: calc(100dvh - 11.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--ht-space-6);
  background: var(--ht-white);
  border: 1px solid var(--ht-border-soft);
  border-radius: var(--ht-radius-lg);
  box-shadow: var(--ht-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition:
    opacity var(--ht-duration-fast) var(--ht-ease),
    transform var(--ht-duration-fast) var(--ht-ease),
    visibility var(--ht-duration-fast) var(--ht-ease);
}

.ht-nav__item[data-open="true"] > .ht-mega {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ht-mega--wide {
  left: 0;
  right: 0;
  width: auto;
  translate: none;
  padding: var(--ht-space-8);
}

.ht-mega--medium {
  width: min(46rem, calc(100vw - var(--ht-gutter) * 2));
}

/*
 * A panel centred on its own nav item can hang past the viewport edge when the
 * item sits far right — at 1024px the medium panel overshot by 20px. Below the
 * width where there is comfortable room on both sides it spans the nav
 * instead, exactly like the wide panel.
 */
@media (max-width: 80rem) {
  .ht-mega--medium {
    left: 0;
    right: 0;
    width: auto;
    translate: none;
  }
}

.ht-mega--small {
  width: min(22rem, calc(100vw - var(--ht-gutter) * 2));
}

.ht-mega__cols {
  display: grid;
  gap: var(--ht-space-6) var(--ht-space-8);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.ht-mega--wide .ht-mega__cols {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr) 16rem;
}

@media (max-width: 74rem) {
  .ht-mega--wide .ht-mega__cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ht-mega__col--feature {
    display: none;
  }
}

.ht-mega__col {
  min-width: 0;
}

.ht-mega__label {
  margin-bottom: var(--ht-space-3);
  font-size: var(--ht-text-2xs);
  font-weight: 600;
  letter-spacing: var(--ht-tracking-caps);
  text-transform: uppercase;
  color: var(--ht-text-muted);
}

.ht-mega__col ul + .ht-mega__label {
  margin-top: var(--ht-space-6);
}

/* A compact label/value row — used for every "browse by …" facet. */
.ht-mega__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ht-space-3);
  padding: 0.4375rem var(--ht-space-3);
  border-radius: var(--ht-radius-sm);
  font-size: var(--ht-text-base);
  color: var(--ht-text-soft);
  transition: background-color var(--ht-duration-fast) var(--ht-ease), color var(--ht-duration-fast) var(--ht-ease);
}

.ht-mega__row:hover {
  background: var(--ht-paper-warm);
  color: var(--ht-pine-900);
}

.ht-mega__row--departure {
  align-items: flex-start;
  padding-block: var(--ht-space-3);
}

.ht-mega__count {
  flex: none;
  font-size: var(--ht-text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ht-text-muted);
}

.ht-mega__link {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: var(--ht-space-3);
  border-radius: var(--ht-radius-md);
  transition: background-color var(--ht-duration-fast) var(--ht-ease);
}

.ht-mega__link:hover {
  background: var(--ht-paper-warm);
}

.ht-mega__name {
  display: block;
  font-weight: 600;
  font-size: var(--ht-text-base);
  color: var(--ht-pine-900);
}

.ht-mega__meta {
  display: block;
  font-size: var(--ht-text-xs);
  color: var(--ht-text-muted);
}

.ht-mega__empty {
  padding-inline: var(--ht-space-3);
  font-size: var(--ht-text-sm);
  color: var(--ht-text-muted);
}

/* Twelve months would make the panel taller than most laptops; scroll the list
   rather than the page. */
.ht-mega__months {
  /* Six rows fit without scrolling; the cap is only a safety net. */
  max-height: 16rem;
  overflow-y: auto;
}

/* On a short laptop screen, trim the panel's own padding before trimming its
   content — the four columns are the point of the menu. */
@media (max-height: 46rem) {
  .ht-mega--wide {
    padding: var(--ht-space-5) var(--ht-space-6);
  }

  .ht-mega__months {
    max-height: 14rem;
  }

  /* Tighten the rows so all seven treks fit the panel on a short screen rather
     than leaving the last one clipped under a scrollbar. */
  .ht-mega__link {
    padding: 0.5rem var(--ht-space-3);
  }

  .ht-mega__row {
    padding-block: 0.375rem;
  }
}

.ht-mega__departures {
  display: grid;
  gap: var(--ht-space-1);
}

.ht-mega__card {
  display: block;
  border-radius: var(--ht-radius-md);
  overflow: hidden;
  background: var(--ht-paper-warm);
}

.ht-mega__card .ht-media {
  display: block;
}

.ht-mega__card:hover .ht-media--zoom > img {
  transform: scale(1.05);
}

.ht-mega__card-body {
  display: block;
  padding: var(--ht-space-4);
}

.ht-mega__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ht-space-4);
  margin-top: var(--ht-space-6);
  padding-top: var(--ht-space-5);
  border-top: 1px solid var(--ht-border-soft);
}

/* ---- Header actions ------------------------------------------------------ */

.ht-header__actions {
  display: flex;
  align-items: center;
  gap: var(--ht-space-2);
  flex: none;
}

.ht-icon-btn {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--ht-radius-sm);
  color: var(--ht-pine-800);
  transition: background-color var(--ht-duration-fast) var(--ht-ease);
}

.ht-icon-btn:hover {
  background: var(--ht-sand);
}

.ht-icon-btn svg {
  width: 1.375rem;
  height: 1.375rem;
}

@media (max-width: 63.9375rem) {
  .ht-nav,
  .ht-header__cta {
    display: none;
  }
}

@media (min-width: 64rem) {
  .ht-header__burger {
    display: none;
  }
}

/* ---- Mobile drawer ------------------------------------------------------- */

.ht-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--ht-z-scrim);
  background: rgb(11 22 17 / 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ht-duration-base) var(--ht-ease), visibility var(--ht-duration-base) var(--ht-ease);
}

.ht-scrim[data-open="true"] {
  opacity: 1;
  visibility: visible;
}

.ht-drawer {
  position: fixed;
  inset-block: 0;
  right: 0;
  z-index: var(--ht-z-drawer);
  display: flex;
  flex-direction: column;
  width: min(24rem, 100vw);
  background: var(--ht-paper);
  transform: translateX(100%);
  transition: transform var(--ht-duration-base) var(--ht-ease-out);
  overscroll-behavior: contain;
}

.ht-drawer[data-open="true"] {
  transform: translateX(0);
}

.ht-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ht-space-4);
  padding: var(--ht-space-4) var(--ht-space-5);
  border-bottom: 1px solid var(--ht-border-soft);
  flex: none;
}

.ht-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--ht-space-4) var(--ht-space-5) var(--ht-space-8);
}

.ht-drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ht-space-3);
  min-height: 3.25rem;
  padding-block: var(--ht-space-2);
  border-bottom: 1px solid var(--ht-border-soft);
  font-size: var(--ht-text-lg);
  font-weight: 500;
  color: var(--ht-text);
}

.ht-drawer__link[aria-current="page"] {
  color: var(--ht-accent);
  font-weight: 600;
}

.ht-drawer__section-label {
  margin: var(--ht-space-6) 0 var(--ht-space-2);
  font-size: var(--ht-text-xs);
  font-weight: 600;
  letter-spacing: var(--ht-tracking-caps);
  text-transform: uppercase;
  color: var(--ht-text-muted);
}

.ht-drawer__trek {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ht-space-3);
  min-height: 2.875rem;
  padding-block: var(--ht-space-2);
  border-bottom: 1px solid var(--ht-border-soft);
  font-size: var(--ht-text-base);
  color: var(--ht-text-soft);
}

.ht-drawer__trek span {
  font-size: var(--ht-text-xs);
  color: var(--ht-text-muted);
  white-space: nowrap;
}

.ht-drawer__foot {
  display: grid;
  gap: var(--ht-space-3);
  padding: var(--ht-space-5);
  border-top: 1px solid var(--ht-border-soft);
  background: var(--ht-surface-alt);
  flex: none;
}

/* Locks background scroll while the drawer is open, without the iOS jump that
   position:fixed on body causes. */
body[data-drawer-open="true"] {
  overflow: hidden;
}

/* ---- Drawer accordion ----------------------------------------------------
   The mobile drawer mirrors the mega menus as collapsible sections, so both
   navigations expose exactly the same routes. */

.ht-drawer__accordion {
  margin-top: var(--ht-space-2);
  border-top: 0;
}

.ht-drawer__accordion .ht-accordion__trigger {
  padding-block: var(--ht-space-4);
  font-size: var(--ht-text-lg);
  font-weight: 500;
}

/*
 * Padding must go INSIDE the clipped wrapper, not on it. The wrapper's height is
 * driven to zero by the panel's 0fr grid row, but its own padding still renders —
 * which left a strip of the collapsed panel visible under every closed section.
 */
.ht-drawer__accordion .ht-accordion__panel ul:last-child {
  padding-bottom: var(--ht-space-4);
}

.ht-drawer__accordion .ht-drawer__section-label:first-child {
  margin-top: 0;
}

/* Touch targets — audited at 375px. These controls were 19–32px tall, below the
   44px a thumb can hit reliably. Padding only; nothing moves visually. */
@media (max-width: 47.9375rem) {
  .ht-announce__link {
    padding-block: 0.6875rem;
  }

  .ht-announce__close {
    width: 2.75rem;
    height: 2.75rem;
  }

  .ht-brand {
    padding-block: 0.25rem;
  }
}

/* Uploaded logo (Settings → Logos) replaces the mark + name. */
.ht-brand__logo {
  display: block;
  height: 2.75rem;
  width: auto;
  max-width: min(14rem, 52vw);
  object-fit: contain;
}
