/* Wander Himalaya — custom layer for Tailwind CDN.
   Written mobile-first: base rules target the small screen,
   min-width media queries layer on the larger ones. */

/* ============ Mobile-first foundations ============ */
:root {
  /* Live height of the fixed header, kept in sync by main.js.
     Used for scroll offsets and sticky sub-navs so they never
     hide underneath the navbar. The fallback matches the mobile
     header (greeting strip + 3.5rem bar). */
  --header-h: 5.375rem;
}

html {
  /* Stop iOS bumping font sizes when the phone is rotated. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Anchor jumps land below the fixed header, not behind it. */
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  /* Guard against a stray wide child causing sideways scroll.
     `clip` rather than `hidden` so position:sticky keeps working. */
  overflow-x: clip;
}

/* Media should never be the thing that overflows a phone screen. */
img,
video {
  max-width: 100%;
}

/* 16px minimum on form controls, otherwise iOS Safari zooms the
   whole page in when a field is focused. */
input,
select,
textarea,
button {
  font-size: max(1rem, 16px);
}

/* Comfortable touch targets on anything icon-sized. */
.tap-target {
  min-width: 2.75rem;
  min-height: 2.75rem;
}

/* Horizontal scrollers (mobile sub-navs) without a visible bar. */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Sub-nav that parks itself directly beneath the header. */
.subnav-sticky {
  position: sticky;
  top: var(--header-h);
}

/* Desktop "on this page" rail, offset clear of the header. */
.sidebar-sticky {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
}

/* Respect the notch / home indicator on modern phones. */
.safe-bottom {
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

/* ============ Reveal-on-scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-stagger.is-visible > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.12s; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.19s; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.26s; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.33s; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.40s; }

/* ============ Navbar brand ============ */
/* The brand string is configurable and can be long, so its size lives
   here rather than in utility classes — it has to shrink on a phone to
   leave room for the menu button. */
.nav-brand-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.9375rem;
  line-height: 1.15;
}
@media (min-width: 640px) {
  .nav-brand-text { font-size: 1.125rem; }
}
@media (min-width: 1024px) {
  .nav-brand-text { -webkit-line-clamp: 1; font-size: 1.25rem; }
}

/* ============ Navbar scroll state ============ */
/* Default (over hero) — light text.
   `.navbar-light` opts a page out: those headers sit on a cream
   background and keep their own dark text. */
#navbar:not(.navbar-light) .nav-brand-text { color: #fff; }
#navbar:not(.navbar-light) .nav-tagline-text { color: rgba(255,255,255,0.78); }
#navbar:not(.navbar-light) .nav-link-text { color: #fff; }
#navbar:not(.navbar-light) #menuBtn { color: #fff; }

/* Scrolled — solid cream background, dark text */
#navbar.scrolled {
  background-color: rgba(251, 246, 236, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px -14px rgba(42, 31, 24, 0.3);
}
#navbar.scrolled .nav-brand-text { color: #2A1F18; }
#navbar.scrolled .nav-tagline-text { color: #756359; }
#navbar.scrolled .nav-link-text { color: #3D2E24; }
#navbar.scrolled #menuBtn { color: #2A1F18; }
#navbar.scrolled .greeting-strip {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
}
.greeting-strip {
  max-height: 40px;
  opacity: 1;
}

/* ============ Destination card hover zoom ============ */
/* Only on devices with a real pointer — on a touchscreen the zoom
   sticks after a tap and looks like a rendering glitch. */
@media (hover: hover) and (pointer: fine) {
  .dest-card img {
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .dest-card:hover img { transform: scale(1.08); }
}
.img-fallback {
  background: linear-gradient(135deg, #D06636, #7A2422);
}

/* ============ Mobile menu ============ */
/* The panel scrolls independently and is capped to whatever is left
   below the header, so a long menu never pushes its own CTA off-screen. */
#mobileMenu {
  max-height: calc(100svh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* Freezes the page behind the open menu. iOS Safari ignores
   `overflow: hidden` on <body>, so the page is pinned with
   position:fixed instead; main.js preserves the scroll offset. */
body.menu-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

/* ============ In-page nav (destination pages) ============ */
.sidebar-link {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #756359;
  font-weight: 500;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.sidebar-link:hover {
  background-color: #F5EDD8;
  color: #C75B39;
}
@media (hover: hover) and (pointer: fine) {
  .subnav-sticky a:hover { background-color: #F5EDD8; }
}
/* Set by main.js on whichever section you are currently reading. */
#inPageNav a.is-active {
  background-color: #F5EDD8;
  color: #C75B39;
}
.subnav-sticky a.is-active {
  background-color: #FBEEE7;
  color: #A8492E;
  font-weight: 600;
}

/* ============ Custom select arrow ============ */
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A1F18' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
}
select option { background-color: #FBF6EC; color: #2A1F18; }

/* ============ Mandala block-print texture ============ */
.mandala-bg {
  background-image:
    radial-gradient(circle at 50% 50%, rgba(227, 181, 58, 0.9) 0%, rgba(227, 181, 58, 0) 38%),
    radial-gradient(circle at 0 0, rgba(227, 181, 58, 0.6) 0%, transparent 28%),
    radial-gradient(circle at 100% 100%, rgba(227, 181, 58, 0.6) 0%, transparent 28%),
    radial-gradient(circle at 100% 0, rgba(227, 181, 58, 0.4) 0%, transparent 25%),
    radial-gradient(circle at 0 100%, rgba(227, 181, 58, 0.4) 0%, transparent 25%);
  background-size: 220px 220px;
}

/* ============ Lotus block-print ornament dividers ============ */
.ornament-divider {
  height: 28px;
  background-color: #FBF6EC;
  background-image:
    radial-gradient(circle at 6px 14px, #D06636 2.5px, transparent 3px),
    radial-gradient(circle at 22px 14px, #C75B39 1.5px, transparent 2px);
  background-size: 32px 28px;
  background-repeat: repeat-x;
  border-top: 1px solid rgba(208, 102, 54, 0.25);
  border-bottom: 1px solid rgba(208, 102, 54, 0.25);
}
.ornament-divider--maroon {
  background-color: #5E1B1A;
  background-image:
    radial-gradient(circle at 6px 14px, #E3B53A 2.5px, transparent 3px),
    radial-gradient(circle at 22px 14px, #D9A21B 1.5px, transparent 2px);
  border-color: rgba(227, 181, 58, 0.25);
}

/* ============ Smooth scrollbar (terracotta) ============ */
/* Desktop only — styling the scrollbar on a touch device replaces the
   overlay bar with a permanent one that eats 10px of screen width. */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; }
  ::-webkit-scrollbar-track { background: #F5EDD8; }
  ::-webkit-scrollbar-thumb { background: #C75B39; border-radius: 8px; }
  ::-webkit-scrollbar-thumb:hover { background: #A8492E; }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}
