/* NAV */
#header {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 50;
  transition: background 0.5s ease, padding 0.5s ease, box-shadow 0.5s ease;
  padding: 1.5rem 0;
}
#header.scrolled {
  background: rgba(250,250,248,0.96);
  backdrop-filter: blur(12px);
  padding: 1rem 0;
  box-shadow: 0 1px 0 var(--color-border);
}
#header.scrolled .nav-link { color: var(--color-muted) !important; }
#header.scrolled .nav-link:hover { color: var(--color-foreground) !important; }
#header.scrolled .logo-text { color: var(--color-foreground) !important; }
#header:not(.scrolled) .logo-text { color: white; }
body:has(.mobile-menu.open) .logo-text { color: var(--color-foreground) !important; }
/* Reserve the home page CTA’s space while the header is transparent. */
#header:not(.scrolled) .book-btn {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#header.scrolled .book-btn {
  background: var(--color-accent) !important;
  color: white !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  display: block;
  height: 50px;
  max-height: 54px;
  width: auto;
  object-fit: contain;
  object-position: left center;
  flex-shrink: 0;
  align-self: center;
}

.logo-text {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--color-foreground);
  letter-spacing: -0.02em;
  margin: 0;
  padding: 0;
  transition: color 0.3s;
  white-space: nowrap;
}
/* Desktop: match wordmark alphabetic baseline to nav / lang */
@media (min-width: 1024px) {
  .logo-text {
    transform: translateY(-2px);
  }
}

#header nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-shrink: 1;
  min-width: 0;
}

.nav-link {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: rgba(255,255,255,0.8);
  background: none; border: none; cursor: pointer;
  transition: color 0.3s ease;
  position: relative;
  font-family: var(--font-sans);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.nav-link::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}
.nav-link:hover::after { width: 100%; }
.nav-link:hover { color: white; }
.book-btn {
  background: var(--color-accent);
  color: white !important;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.18em;
  padding: 0.75rem 1.75rem;
  border-radius: 50px; border: none; cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, opacity 0.4s ease, visibility 0.4s ease;
  font-family: var(--font-sans);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
}
.book-btn:hover {
  background: var(--color-accent-light);
  box-shadow: 0 8px 24px rgba(196,168,130,0.3);
}
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: white; padding: 8px;
  flex-shrink: 0;
  transition: color 0.3s ease;
}
#header.scrolled .hamburger,
body:has(.mobile-menu.open) .hamburger {
  color: #1c1c1a;
}
/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: rgba(28,28,26,0.6);
  backdrop-filter: blur(4px);
}
.mobile-menu.open { display: block; }
.mobile-menu-panel {
  position: absolute; top: 0; left: 0; right: 0;
  background: var(--color-bg);
  padding: 5rem 1.5rem 2.5rem;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
}
.mobile-menu.open .mobile-menu-panel { transform: translateY(0); }
.mobile-nav-link {
  display: block; width: 100%;
  text-align: left; font-size: 1.125rem; font-weight: 500;
  color: var(--color-foreground);
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  background: none; border-left: none; border-right: none; border-top: none;
  cursor: pointer; font-family: var(--font-sans);
  transition: color 0.2s;
  text-decoration: none;
  box-sizing: border-box;
}
.mobile-nav-link:hover { color: var(--color-primary); }
.mobile-book-btn {
  margin-top: 1.5rem; width: 100%;
  background: var(--color-accent); color: white;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.18em;
  padding: 1rem; border-radius: 50px; border: none; cursor: pointer;
  font-family: var(--font-sans);
  text-decoration: none;
  display: block;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
}

/* Language switcher (desktop + mobile) */
.lang-switch {
  position: relative;
  flex-shrink: 0;
  outline: none;
  cursor: pointer;
}
/* Bridge the gap so hover stays active between trigger and panel */
.lang-switch::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 0.35rem;
}
.lang-switch-trigger {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.85);
  font-family: var(--font-sans);
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.12em;
  min-width: 4.5rem;
  box-sizing: border-box;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.lang-switch:hover .lang-switch-trigger,
.lang-switch:focus-within .lang-switch-trigger {
  color: #fff;
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.08);
}
.lang-switch:focus-visible .lang-switch-trigger {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.lang-switch-caret {
  font-size: 0.72em;
  opacity: 0.72;
  font-weight: 400;
  letter-spacing: 0;
}
#header.scrolled .lang-switch-trigger {
  color: var(--color-muted) !important;
  border-color: rgba(28,28,26,0.1) !important;
  background: rgba(28,28,26,0.03) !important;
}
#header.scrolled .lang-switch:hover .lang-switch-trigger,
#header.scrolled .lang-switch:focus-within .lang-switch-trigger {
  color: var(--color-foreground) !important;
  border-color: rgba(196,168,130,0.4) !important;
  background: rgba(196,168,130,0.07) !important;
}
.lang-switch-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 5.5rem;
  padding: 0.35rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(28,28,26,0.09);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  width: max-content;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 60;
  pointer-events: none;
}
.lang-switch:hover .lang-switch-panel,
.lang-switch:focus-within .lang-switch-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.lang-switch-option {
  display: block;
  padding: 0.45rem 0.65rem;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: var(--font-sans);
  color: var(--color-muted);
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
  text-align: center;
}
.lang-switch-option:hover {
  color: var(--color-foreground);
  background: var(--color-bg-warm);
}
.lang-switch-option--current {
  color: var(--color-accent);
  cursor: default;
  pointer-events: none;
}
.mobile-lang {
  border-bottom: 1px solid var(--color-border);
}
.mobile-lang > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 0;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-foreground);
  font-family: var(--font-sans);
  cursor: pointer;
  box-sizing: border-box;
  transition: color 0.2s;
}
.mobile-lang > summary:hover { color: var(--color-primary); }
.mobile-lang > summary::-webkit-details-marker { display: none; }
.mobile-lang .lang-switch-caret {
  font-size: 0.75em;
  opacity: 0.55;
  font-weight: 400;
  letter-spacing: 0;
}
.mobile-lang-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0 1rem;
}
.mobile-lang-opt {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  border-radius: 50px;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  text-decoration: none;
  font-family: var(--font-sans);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}
.mobile-lang-opt:hover {
  color: var(--color-foreground);
  border-color: rgba(196,168,130,0.45);
}
.mobile-lang-opt--current {
  color: var(--color-accent);
  border-color: rgba(196,168,130,0.45);
  background: rgba(196,168,130,0.1);
  pointer-events: none;
  cursor: default;
}

/* Interior pages reserve space for the solid header. */
body.tour-page {
  padding-top: calc(50px + 2rem);
}

@media (max-width: 768px) {
  #header { padding: 1rem 0; }

  #header .logo-img {
    height: 38px;
    max-height: 40px;
  }

  body.tour-page {
    padding-top: calc(44px + 2rem);
  }
}

/* Collapse the navigation before the links crowd. */
#header .nav-inner {
  width: 100%;
  max-width: 1280px;
  box-sizing: border-box;
  padding-inline: clamp(0.75rem, 3.125vw, 2.5rem);
  gap: clamp(0.75rem, 1.25vw, 1rem);
}

#header .logo {
  min-width: 0;
  flex-shrink: 1;
}

#header .nav-right {
  min-width: 0;
  flex-shrink: 0;
  gap: clamp(0.75rem, 1.7vw, 1.5rem);
}

#header nav {
  flex-shrink: 0;
  gap: clamp(0.75rem, 1.7vw, 1.5rem);
}

#header .nav-link {
  white-space: nowrap;
}

#header .book-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  min-height: 44px;
  padding-inline: clamp(1rem, 1.8vw, 1.75rem);
}

/* The complete EN/RU navigation needs more room than the old 1024px breakpoint. */
@media (max-width: 1279px) {
  #header nav {
    display: none;
  }

  #header .hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    padding: 10px;
  }

  #header .logo-text {
    font-size: 0.95rem;
    line-height: 1.25;
    white-space: normal;
    max-width: none;
    transform: none;
  }

  #mobileMenu .mobile-menu-panel {
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: 6rem;
  }

  #mobileMenu .mobile-book-btn {
    white-space: normal;
  }
}

/* On phones the full-size booking action remains in the expandable menu. */
@media (max-width: 639px) {
  #header .book-btn {
    display: none;
  }

  #header .nav-right {
    gap: 0.5rem;
  }

  #header .logo-img {
    width: 34px;
    height: 34px;
    max-height: 34px;
  }

  #header .logo-text {
    font-size: 0.8125rem;
    letter-spacing: -0.02em;
  }
}

/* A menu opened in a narrow window must not cover the desktop navigation. */
@media (min-width: 1280px) {
  #mobileMenu {
    display: none;
  }
}
