/* =============================================================================
   NAV — site header, dropdowns, search bar, mobile drawer
   Always loaded (no condition) via inc/setup.php.
   All values reference tokens from style.css :root
   ============================================================================= */


/* =============================================================================
   SITE HEADER
   ============================================================================= */

.site-header {
  background: var(--mfc-bg);
  border-bottom: 0.5px solid var(--mfc-border);
}

.site-header.is-scrolled {
  box-shadow: 0 2px 16px rgba(28, 43, 30, 0.08);
}

.site-logo {
  display: inline-flex;
  align-items: center;
}

.site-logo:hover {
  color: var(--mfc-forest);
}

/* Bundled SVG logo + WP custom-logo image: constrain by height, keep ratio.
   36px desktop / 30px mobile — sits inside the 64/56px header. */
.site-logo__img,
.site-logo .custom-logo {
  display: block;
  width: auto;
  height: 36px;
}

@media (max-width: 768px) {
  .site-logo__img,
  .site-logo .custom-logo {
    height: 30px;
  }
}


/* =============================================================================
   PRIMARY NAV (desktop)
   ============================================================================= */

.site-nav__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--mfc-space-1);
  align-items: center;
}

/* Top-level link */
.site-nav__list > li > a {
  display: inline-flex;
  align-items: center;
  padding: var(--mfc-space-2) var(--mfc-space-3);
  font-size: var(--mfc-text-sm);
  font-weight: 600;
  color: var(--mfc-text-secondary);
  text-decoration: none;
  border-radius: var(--mfc-radius-md);
  transition: color 0.15s, background-color 0.15s;
  white-space: nowrap;
}

.site-nav__list > li > a:hover,
.site-nav__list > li > a.is-current {
  color: var(--mfc-text);
  background: var(--mfc-bg-secondary);
}

.site-nav__list > li > a.is-current {
  color: var(--mfc-electric);
  background: var(--mfc-electric-surface);
}

/* Dropdown trigger button */
.site-nav__trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: var(--mfc-space-2) var(--mfc-space-3);
  font-size: var(--mfc-text-sm);
  font-weight: 600;
  color: var(--mfc-text-secondary);
  background: none;
  border: none;
  border-radius: var(--mfc-radius-md);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  white-space: nowrap;
}

.site-nav__trigger:hover,
.has-dropdown.is-open .site-nav__trigger {
  color: var(--mfc-text);
  background: var(--mfc-bg-secondary);
}

/* Chevron rotation on open */
.site-nav__chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform 0.2s;
  opacity: 0.5;
}

.has-dropdown.is-open .site-nav__chevron {
  transform: rotate(180deg);
}


/* =============================================================================
   DROPDOWN PANEL
   ============================================================================= */

.has-dropdown {
  position: relative;
}

.site-nav__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 190px;
  list-style: none;
  margin: 0;
  padding: var(--mfc-space-2) 0;
  background: var(--mfc-bg);
  border: 1px solid var(--mfc-border);
  border-radius: var(--mfc-radius-lg);
  box-shadow: 0 8px 32px rgba(28, 43, 30, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 200;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}

.has-dropdown.is-open .site-nav__dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Small arrow pointing up */
.site-nav__dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 10px;
  height: 10px;
  background: var(--mfc-bg);
  border-left: 1px solid var(--mfc-border);
  border-top: 1px solid var(--mfc-border);
  transform: rotate(45deg);
}

.site-nav__dropdown li a {
  display: block;
  padding: var(--mfc-space-2) var(--mfc-space-5);
  font-size: var(--mfc-text-sm);
  font-weight: 500;
  color: var(--mfc-text);
  text-decoration: none;
  transition: background-color 0.1s, color 0.1s;
}

.site-nav__dropdown li a:hover {
  background: var(--mfc-bg-secondary);
  color: var(--mfc-forest);
}

.site-nav__dropdown li:first-child a {
  border-radius: var(--mfc-radius-md) var(--mfc-radius-md) 0 0;
}

.site-nav__dropdown li:last-child a {
  border-radius: 0 0 var(--mfc-radius-md) var(--mfc-radius-md);
}


/* =============================================================================
   DINNER FINDER — accented nav entry (desktop)
   A peach ghost-pill: distinct from the plain category links AND from the solid
   electric Subscribe CTA. Selectors are scoped under .site-nav__list so they beat
   the base ".site-nav__list > li > a" rules (2 classes > 1 class + 2 types).
   ============================================================================= */

.site-nav__list .site-nav__tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: var(--mfc-space-1);
  padding: var(--mfc-space-2) var(--mfc-space-3);
  font-size: var(--mfc-text-sm);
  font-weight: 700;
  color: var(--mfc-deep);
  text-decoration: none;
  background: var(--mfc-pop-surface);
  border: 1.5px solid rgba(244, 162, 97, 0.45);
  border-radius: var(--mfc-radius-full);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.site-nav__list .site-nav__tool:hover {
  background: rgba(244, 162, 97, 0.18);
  border-color: var(--mfc-pop);
  color: var(--mfc-deep);
  transform: translateY(-1px);
}

.site-nav__list .site-nav__tool svg {
  flex-shrink: 0;
  color: var(--mfc-pop-dark);
}

.site-nav__tool-new {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
  background: var(--mfc-pop);
  padding: 2px 5px;
  border-radius: var(--mfc-radius-full);
}


/* =============================================================================
   RIGHT ACTIONS (search + CTA)
   ============================================================================= */

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--mfc-space-3);
  margin-left: auto;
  flex-shrink: 0;
}

.search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: var(--mfc-radius-md);
  cursor: pointer;
  color: var(--mfc-text-secondary);
  transition: color 0.15s, background-color 0.15s;
}

.search-toggle:hover,
.search-toggle[aria-expanded="true"] {
  color: var(--mfc-electric);
  background: var(--mfc-electric-surface);
}

.search-toggle svg {
  width: 18px;
  height: 18px;
}


/* =============================================================================
   EXPANDING SEARCH BAR
   ============================================================================= */

.site-search {
  max-height: 0;
  overflow: hidden;
  border-top: 0px solid var(--mfc-border);
  transition: max-height 0.25s ease, border-top-width 0.25s;
}

.site-search.is-open {
  max-height: 80px;
  border-top-width: 0.5px;
}

.site-search__form {
  display: flex;
  align-items: center;
  gap: var(--mfc-space-3);
  padding: var(--mfc-space-4) 0;
}

.site-search__input {
  background: var(--mfc-bg-secondary);
  border-color: var(--mfc-border);
  color: var(--mfc-text);
}

.site-search__input::placeholder {
  color: var(--mfc-text-muted);
}

.site-search__input:focus {
  border-color: var(--mfc-electric);
  outline-color: var(--mfc-electric);
}

.site-search__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: var(--mfc-radius-md);
  cursor: pointer;
  font-size: var(--mfc-text-base);
  color: var(--mfc-text-muted);
  transition: color 0.15s, background-color 0.15s;
}

.site-search__close:hover {
  color: var(--mfc-text);
  background: var(--mfc-bg-secondary);
}


/* =============================================================================
   MOBILE HAMBURGER BUTTON
   ============================================================================= */

.nav-toggle {
  color: var(--mfc-text);
  padding: var(--mfc-space-2);
}

/* Hamburger → ✕ morph */
.nav-toggle.is-open .nav-toggle__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle__line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle.is-open .nav-toggle__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}


/* =============================================================================
   MOBILE DRAWER
   ============================================================================= */

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--mfc-bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-drawer.is-open {
  transform: translateX(0);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 43, 30, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 299;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer header row */
.nav-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--mfc-space-5) var(--mfc-space-6);
  border-bottom: 0.5px solid var(--mfc-border);
  flex-shrink: 0;
}

.nav-drawer__brand {
  font-size: var(--mfc-text-base);
  font-weight: 800;
  color: var(--mfc-text);
  letter-spacing: -0.015em;
}

.nav-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--mfc-bg-secondary);
  border: none;
  border-radius: var(--mfc-radius-md);
  cursor: pointer;
  color: var(--mfc-text);
  font-size: var(--mfc-text-lg);
  transition: background-color 0.15s;
}

.nav-drawer__close:hover {
  background: var(--mfc-bg-tertiary);
}

/* Nav list */
.nav-drawer__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--mfc-space-3) 0;
}

.nav-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Top-level flat link */
.nav-drawer__list > li > a {
  display: block;
  padding: var(--mfc-space-3) var(--mfc-space-6);
  font-size: var(--mfc-text-base);
  font-weight: 600;
  color: var(--mfc-text-secondary);
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}

.nav-drawer__list > li > a:hover {
  color: var(--mfc-text);
  background: var(--mfc-bg-secondary);
}

/* Dinner Finder — accented drawer entry (card, not a flush link).
   Scoped under .nav-drawer__list to beat ".nav-drawer__list > li > a". */
.nav-drawer__list .nav-drawer__tool {
  display: flex;
  align-items: center;
  gap: var(--mfc-space-3);
  margin: var(--mfc-space-2) var(--mfc-space-4);
  padding: var(--mfc-space-3) var(--mfc-space-4);
  background: var(--mfc-pop-surface);
  border: 1.5px solid rgba(244, 162, 97, 0.45);
  border-radius: var(--mfc-radius-md);
  font-size: var(--mfc-text-base);
  font-weight: 800;
  color: var(--mfc-deep);
  text-decoration: none;
}

.nav-drawer__list .nav-drawer__tool:hover {
  background: rgba(244, 162, 97, 0.18);
  color: var(--mfc-deep);
}

.nav-drawer__tool-emoji {
  font-size: 1.2rem;
  line-height: 1;
}

.nav-drawer__tool-new {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
  background: var(--mfc-pop);
  padding: 3px 7px;
  border-radius: var(--mfc-radius-full);
}

/* Accordion trigger */
.nav-drawer__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--mfc-space-3) var(--mfc-space-6);
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--mfc-text-base);
  font-weight: 600;
  color: var(--mfc-text-secondary);
  text-align: left;
  transition: color 0.15s, background-color 0.15s;
}

.nav-drawer__trigger:hover,
.nav-drawer__item.is-open > .nav-drawer__trigger {
  color: var(--mfc-text);
  background: var(--mfc-bg-secondary);
}

.nav-drawer__chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: transform 0.2s;
}

.nav-drawer__item.is-open > .nav-drawer__trigger .nav-drawer__chevron {
  transform: rotate(180deg);
  opacity: 0.7;
}

/* Sub-menu (accordion) */
.nav-drawer__sub {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.nav-drawer__item.is-open > .nav-drawer__sub {
  max-height: 480px;
}

.nav-drawer__sub li a {
  display: block;
  padding: var(--mfc-space-2) var(--mfc-space-6) var(--mfc-space-2) calc(var(--mfc-space-6) + var(--mfc-space-4));
  font-size: var(--mfc-text-sm);
  font-weight: 500;
  color: var(--mfc-text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-drawer__sub li a:hover {
  color: var(--mfc-electric);
  border-left-color: var(--mfc-electric);
}

/* Bottom CTA.
   Raptive's mobile anchor ad overlays bottom-fixed UI at a near-max
   z-index — reserve its height so the CTA stays reachable while it shows. */
.nav-drawer__footer {
  padding: var(--mfc-space-5) var(--mfc-space-6);
  padding-bottom: calc(var(--mfc-space-5) + var(--mfc-raptive-anchor) + env(safe-area-inset-bottom));
  border-top: 0.5px solid var(--mfc-border);
  flex-shrink: 0;
}

/* Desktop has no anchor ad — drop the reservation (drawer is hidden ≥769px
   anyway, but keep the rule honest for the 768px boundary). */
@media (min-width: 769px) {
  .nav-drawer__footer {
    padding-bottom: var(--mfc-space-5);
  }
}

.nav-drawer__footer .btn {
  width: 100%;
  justify-content: center;
}


/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
  /* Hide desktop nav + CTA on mobile */
  .site-nav,
  .site-header__actions .site-nav__cta {
    display: none;
  }

  /* Show hamburger */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
  }

  /* Search toggle stays visible on mobile */
  .site-header__actions {
    gap: var(--mfc-space-2);
  }
}

@media (min-width: 769px) {
  /* Drawer hidden on desktop */
  .nav-drawer,
  .nav-overlay {
    display: none !important;
  }

  /* Hamburger hidden on desktop */
  .nav-toggle {
    display: none !important;
  }
}
