/* ==========================================================================
   nav.css — Top navigation
   --------------------------------------------------------------------------
   Project:   Kali Villas Mentawai
   Layer:     Components (ITCSS)
   Loaded by: All HTML pages
   --------------------------------------------------------------------------
   The navigation is fixed to the top of the viewport on every page with a
   blurred sand-coloured background. The brand mark on the left reads
   "Kali Villas · Mentawai" — split into three spans so the location can
   take a softer treatment than the brand name.

   On mobile (< 900px) the desktop link list and the "Book a Stay" CTA
   collapse, and the burger button + slide-in panel below take over.
   The slide-in is driven by js/nav.js (toggles .is-open on .nav-mobile).
   ========================================================================== */


/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.75rem 4rem;
  background: rgba(245, 239, 227, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 0.5px solid var(--sand-deeper);
  transition: background 0.4s;
}


/* --------------------------------------------------------------------------
   Brand mark
   --------------------------------------------------------------------------
   Three spans inside the anchor allow independent styling:
     .nav-logo       — "KALI VILLAS"   (navy, bold tracking)
     .nav-logo-sep   — middle dot      (terracotta accent)
     .nav-logo-loc   — "MENTAWAI"      (muted navy, lighter weight)
   -------------------------------------------------------------------------- */
.nav-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--navy);
  text-decoration: none;
}
.nav-logo-sep {
  margin: 0 0.15em;
  color: var(--terra);
  font-weight: 300;
}
.nav-logo-loc {
  color: var(--navy-muted);
  font-weight: 300;
}


/* --------------------------------------------------------------------------
   Link list
   -------------------------------------------------------------------------- */
.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}
.nav-links a {
  font-size: 0.67rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--navy-muted);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-links a:hover {
  color: var(--navy);
}


/* --------------------------------------------------------------------------
   Active link state — used in place of <a> on the current page's nav item
   -------------------------------------------------------------------------- */
.nav-active {
  font-size: 0.67rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terra);
}


/* --------------------------------------------------------------------------
   Instagram link — outline icon + lowercase handle, sits between the nav
   links and the "Book" CTA.
   --------------------------------------------------------------------------
   Outline-only SVG (Feather/Lucide style). currentColor inheritance keeps
   icon + handle the same tone as the nav links, with a terracotta hover.
   The handle uses sans-serif body type at compact size so it doesn't crowd
   the nav, while the icon stays at 18px.
   -------------------------------------------------------------------------- */
.nav-instagram {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-right: 0.25rem;
  padding: 0.35rem 0;
  font-family: 'Jost', sans-serif;
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--navy-muted);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-instagram:hover { color: var(--terra); }
.nav-instagram svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}
.nav-instagram-handle {
  /* Hidden on narrower desktops to keep the bar from wrapping; the icon
     alone still leads to the Instagram profile, and mobile users see
     the full handle inside the burger panel. */
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .nav-instagram-handle { display: none; }
}


/* --------------------------------------------------------------------------
   "Reserve a Stay" CTA — terracotta filled button on the right of the nav.
   Class name keeps the legacy `.nav-book` for less churn on the rest of
   the rule set; the displayed label was changed in js/components.js.
   -------------------------------------------------------------------------- */
.nav-book {
  padding: 0.6rem 1.5rem;
  background: var(--terra);
  color: var(--sand);
  font-size: 0.67rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.3s;
}
.nav-book:hover {
  background: var(--terra-light);
}


/* --------------------------------------------------------------------------
   Burger button — visible only under 900px (mobile)
   --------------------------------------------------------------------------
   Three lines collapse into an "X" when the menu is open via the .is-open
   class added by js/nav.js.
   -------------------------------------------------------------------------- */
.nav-burger {
  display: none;                 /* hidden by default; shown in mobile media query below */
  position: relative;
  width: 28px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 110;                   /* above the slide-in panel so it stays tappable */
}
.nav-burger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--navy);
  border-radius: 1px;
  transition: transform 0.35s ease, opacity 0.25s ease, top 0.35s ease;
}
.nav-burger span:nth-child(1) { top: 2px;  }
.nav-burger span:nth-child(2) { top: 10px; }
.nav-burger span:nth-child(3) { top: 18px; }

/* Open state — top + bottom rotate into an X, middle fades */
.nav-burger.is-open span:nth-child(1) {
  top: 10px;
  transform: rotate(45deg);
}
.nav-burger.is-open span:nth-child(2) {
  opacity: 0;
}
.nav-burger.is-open span:nth-child(3) {
  top: 10px;
  transform: rotate(-45deg);
}


/* --------------------------------------------------------------------------
   Slide-in mobile menu panel
   --------------------------------------------------------------------------
   Off-screen to the right by default; slides in when js/nav.js adds the
   .is-open class.
   -------------------------------------------------------------------------- */
.nav-mobile {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(78vw, 360px);
  z-index: 105;
  padding: 6rem 2.5rem 2.5rem;
  background: var(--sand);
  border-left: 0.5px solid var(--sand-deeper);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}
.nav-mobile.is-open {
  transform: translateX(0);
  box-shadow: -10px 0 40px rgba(28, 43, 74, 0.15);
}

.nav-mobile-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: auto;
}
.nav-mobile-links a {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.55rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--navy);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-mobile-links a:hover,
.nav-mobile-links a.is-active {
  color: var(--terra);
}
.nav-mobile-links em {
  font-style: italic;
  color: var(--terra);
}

/* "Book a Stay" CTA pinned to the bottom of the panel */
.nav-mobile-cta {
  margin-top: 2.5rem;
  padding: 1rem 1.5rem;
  background: var(--terra);
  color: var(--sand);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  transition: background 0.3s;
}
.nav-mobile-cta:hover {
  background: var(--terra-light);
}


/* --------------------------------------------------------------------------
   Backdrop — dims the page behind the open menu
   -------------------------------------------------------------------------- */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 104;
  background: rgba(28, 43, 74, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.nav-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}


/* --------------------------------------------------------------------------
   Instagram link inside the mobile slide-in panel
   --------------------------------------------------------------------------
   Sits below the link list, above the "Book a Stay" CTA. The handle is
   shown lowercase (as users would type it) at body type size; uppercase
   would read as a brand wordmark which feels wrong for a social handle.
   -------------------------------------------------------------------------- */
.nav-mobile-instagram {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.25rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--navy-muted);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-mobile-instagram:hover { color: var(--terra); }
.nav-mobile-instagram svg   { width: 22px; height: 22px; flex-shrink: 0; }


/* --------------------------------------------------------------------------
   Mobile — collapse desktop nav, show burger
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  nav {
    padding: 1.4rem 1.75rem;
  }
  .nav-links,
  .nav-book,
  .nav-instagram {
    display: none;
  }
  .nav-burger {
    display: block;
  }
}

/* On wider screens, hide the mobile panel + backdrop entirely */
@media (min-width: 901px) {
  .nav-mobile,
  .nav-backdrop {
    display: none;
  }
}
