/* ──────────────────────────────────────────────────────────────────────────
   SnowBrains Weather — shared top navigation (single source of truth).

   Linked on EVERY page AFTER that page's inline <style>. Every selector is
   scoped under .top-nav so this file beats each page's own nav rules on
   specificity AND source order — the header therefore renders identically
   everywhere: stacked, centered "icon-above-word" tabs, red active state,
   one uniform GO PREMIUM pill, and the SAME responsive breakpoints on every
   page. With 12 tabs the full row needs room, so: tabs shrink <= 1440px,
   and switch to the hamburger <= 1260px (header search stays until 768px).

   It controls the nav ONLY. Each page keeps its own #mobileMenu markup/JS;
   this file just decides when the hamburger button is visible.
   ────────────────────────────────────────────────────────────────────────── */

.top-nav {
  display: flex;
  background: rgba(10, 14, 26, 0.98);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  height: 56px;
  align-items: center;
  justify-content: space-between;
}

.top-nav .nav-left { display: flex; align-items: center; gap: 18px; flex: 0 1 auto; }

.top-nav .logo {
  white-space: nowrap;
  font-family: 'Montserrat', -apple-system, system-ui, sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: normal;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.top-nav .logo .sn { color: var(--text-primary); }
.top-nav .logo .flake { color: var(--sb-red); font-size: 22px; vertical-align: -2px; -webkit-text-fill-color: var(--sb-red); }
.top-nav .logo span { display: inline; font-weight: 900; font-size: 18px; margin-left: 0; letter-spacing: -0.5px; color: var(--text-primary); }

/* Tabs: ALWAYS icon-above-word, centered. Each tab is a vertical column with
   the emoji on its own line above the label — never inline, regardless of
   screen width. All icons render at the same size (.nav-ico font-size). */
.top-nav .nav-links { display: flex; gap: 4px; align-items: stretch; }
.top-nav .nav-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.1;
  padding: 5px 8px;
  border-radius: 7px;
  text-align: center;
  white-space: nowrap;
  min-width: 52px;
  transition: color .2s, background .2s;
}
.top-nav .nav-links .nav-ico {
  display: block;
  font-size: 18px;
  line-height: 1;
  /* keep every emoji the same visual size */
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.top-nav .nav-links .nav-label { display: block; font-size: 13px; }
/* SnowBrains skier mark — recolorable via CSS mask (renders in currentColor). */
.sb-skier { display: inline-block; background-color: currentColor; vertical-align: middle; -webkit-mask: url("skier-icon.svg") center / contain no-repeat; mask: url("skier-icon.svg") center / contain no-repeat; }
/* In the header/menu the skier stays white regardless of the tab's active/hover color. */
.top-nav .nav-links .sb-skier, .mobile-menu .sb-skier { background-color: #f0f4ff; }
/* The big skier renders 28px but we pull its layout footprint in so the Conditions
   tab isn't taller than the others (keeps the skier + label size, shrinks the tab). */
.top-nav .nav-links .nav-ico .sb-skier { margin: -6px 0; }
.top-nav .nav-links a:hover { color: var(--text-primary); background: var(--bg-card); }
.top-nav .nav-links a:hover .nav-label { color: var(--text-primary); }
.top-nav .nav-links a.active { color: var(--sb-red); background: rgba(234, 47, 74, 0.10); }
.top-nav .nav-links a.active .nav-label { color: var(--sb-red); }

.top-nav .nav-right { display: flex; align-items: center; gap: 12px; }

/* Search box + dropdown (shared so search looks & works the same on every page) */
.top-nav .search-wrap { position: relative; display: block; }
.top-nav .search-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 13px;
  width: 170px;
  max-width: 22vw;
  outline: none;
  font-family: 'Montserrat', sans-serif;
}
.top-nav .search-box::placeholder { color: var(--text-muted); }
.top-nav .search-box:focus { border-color: var(--sb-red); }

.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  min-width: 280px;
}
.search-dropdown.active { display: block; }
.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(42, 53, 80, 0.3);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-card-hover); }
.search-result-name { font-size: 13px; font-weight: 600; }
.search-result-region { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.search-result-elev { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.search-no-results { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* One uniform GO PREMIUM pill everywhere */
.top-nav .btn-premium {
  display: inline-block;
  background: linear-gradient(135deg, var(--sb-red) 0%, #c41e3a 100%);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.15;
  cursor: pointer;
  white-space: nowrap;
}
.top-nav .btn-premium:hover { background: linear-gradient(135deg, #c41e3a 0%, var(--sb-red) 100%); }

/* Hamburger: hidden on desktop, shown on mobile (uniform breakpoint below) */
.top-nav .hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
.top-nav .hamburger span { width: 24px; height: 2px; background-color: var(--text-primary); transition: all 0.3s ease; border-radius: 2px; }

/* ── Laptop: shrink the 12 stacked tabs so they still fit one row ── */
@media (max-width: 1440px) {
  .top-nav .nav-links { gap: 2px; }
  .top-nav .nav-links a { padding: 3px 4px; min-width: 42px; }
  .top-nav .nav-links .nav-ico { font-size: 15px; }
  .top-nav .nav-links .nav-label { font-size: 11px; }
  .top-nav .search-box { width: 120px; }
}

/* ── Below ~1260px there isn't room for all 12 tabs: use the hamburger.
   (Measured: the 12-tab row needs ~1230px; below that it would crowd.)
   The header search stays visible down to the phone breakpoint below. ── */
@media (max-width: 1260px) {
  .top-nav .nav-links { display: none; }
  .top-nav .nav-right .btn-premium { display: none; }
  .top-nav .hamburger { display: flex; }
}

/* ── Phone: drop the header search too, tighten padding ── */
@media (max-width: 768px) {
  .top-nav { padding: 0 14px; }
  .top-nav .nav-right .search-wrap { display: none; }
}

/* Mobile dropdown menu icons — same size & column alignment on every page. */
.mobile-menu .menu-icon,
.mobile-menu-links .menu-icon {
  display: inline-block;
  width: 28px;
  text-align: center;
  font-size: 18px;
  vertical-align: -2px;
}

/* ── Mobile dropdown menu: authoritative positioning so it ALWAYS sits above
   page content (some pages set it `absolute`/no z-index, which let page
   features cover it — favorites did) and is scrollable on short screens.
   `overscroll-behavior: contain` + `body.menu-open { overflow:hidden }` stop
   the page behind the menu from scrolling while it's open. ── */
.mobile-menu {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  width: auto;
  z-index: 1200;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.menu-open { overflow: hidden; }
