/* Mobile navigation panel - the comp's full-screen slide-out, at and below
   JetMenu's 1024px dropdown breakpoint. Markup: template-parts/header/mobile-nav.php.

   Every selector is anchored on #jdv-mnav. The Elementor kit styles bare h2
   and a (.elementor-kit-8 h2 / a, 0,1,1), and Customizer > Additional CSS sets
   a Montserrat rule on :not(i, element-icon); an ID outranks all of them
   without resorting to !important.

   Sizes are measured off the comp, scaled to a 390px phone: menu rows on a
   60px pitch, buttons 42px tall, Explore thumbnails ~104px square, ~20px side
   padding. */

/* ---------- header toggle ---------- */
.jdv-mnav-toggle {
  display: none;
}

@media (max-width: 1024px) {
  .jdv-mnav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -10px; /* optical: keeps the glyph, not its tap box, on the gutter */
    padding: 0;
    border: 0;
    background: none;
    color: #4C423C;
    cursor: pointer;
  }

  .jdv-mnav-toggle .jdv-mnav-icon {
    width: 26px;
    height: 26px;
  }

  html[data-theme="dark"] .jdv-mnav-toggle {
    color: #E8E0D4;
  }
}

/* ---------- panel ---------- */
/* Hidden with visibility + transform rather than display:none, so it can slide.
   visibility is delayed on the way out so the slide finishes before the panel
   leaves the accessibility tree and the tab order. */
#jdv-mnav {
  position: fixed;
  inset: 0;
  /* Above #site-header, which the parent theme puts at 1000001 - at anything
     lower the sticky header paints over the panel's own bar, hiding its close
     button behind the header's hamburger. Also clears the admin bar (99999). */
  z-index: 1000010;
  display: flex;
  flex-direction: column;
  background: #FDF8EB; /* the header's cream, so opening reads as the header growing */
  color: #4C423C;
  visibility: hidden;
  transform: translateX(100%);
  transition: transform .32s ease, visibility 0s linear .32s;
}

#jdv-mnav.is-open {
  visibility: visible;
  transform: none;
  transition: transform .32s ease, visibility 0s;
}

@media (min-width: 1025px) {
  #jdv-mnav {
    display: none;
  }
}

html.jdv-mnav-open,
html.jdv-mnav-open body {
  overflow: hidden;
}

html[data-theme="dark"] #jdv-mnav {
  background: #1b1b1b;
  color: #E8E0D4;
}

/* ---------- bar: logo / search / close ---------- */
#jdv-mnav .jdv-mnav__bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: env(safe-area-inset-top) 20px 0;
}

#jdv-mnav .custom-logo-wrap,
#jdv-mnav .custom-logo-link {
  display: flex;
  align-items: center;
}

/* Same cap the header uses on phones, so the logo does not jump when the
   panel slides over it. */
#jdv-mnav .custom-logo {
  max-height: 40px;
  max-width: 120px;
  width: auto;
  height: auto;
}

#jdv-mnav .jdv-mnav__tools {
  display: flex;
  align-items: center;
  margin-right: -10px;
}

#jdv-mnav .jdv-mnav__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

#jdv-mnav .jdv-mnav__tool .jdv-mnav-icon {
  width: 24px;
  height: 24px;
}

/* ---------- views ----------
   Each view is its own scroll container, so a long Explore list scrolls inside
   the panel and always reaches its end - the failure the old dropdown had. */
#jdv-mnav .jdv-mnav__views {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}

#jdv-mnav .jdv-mnav__view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  visibility: hidden;
  transform: translateX(100%);
  transition: transform .32s ease, visibility 0s linear .32s;
}

#jdv-mnav .jdv-mnav__view.is-active {
  visibility: visible;
  transform: none;
  transition: transform .32s ease, visibility 0s;
}

/* Main slides out to the left while a sub-view is open, and back on return. */
#jdv-mnav .jdv-mnav__view.is-behind {
  transform: translateX(-100%);
}

/* A flex column that scrolls must not squeeze its children to fit. */
#jdv-mnav .jdv-mnav__view > * {
  flex-shrink: 0;
}

/* ---------- main list ---------- */
#jdv-mnav .jdv-mnav__list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

#jdv-mnav .jdv-mnav__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 60px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
  font-family: 'IM Fell English', Georgia, 'Times New Roman', serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
}

/* The label span needs the family set on itself, not just inherited from the
   row: Customizer > Additional CSS applies Montserrat to every element through
   :not(i, element-icon), which lands on the span directly and beats anything
   it would inherit. */
#jdv-mnav .jdv-mnav__item > span {
  font-family: inherit;
}

#jdv-mnav .jdv-mnav__item .jdv-mnav-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

/* ---------- sub-view ---------- */
#jdv-mnav .jdv-mnav__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  margin-left: -4px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

#jdv-mnav .jdv-mnav__back .jdv-mnav-icon {
  width: 12px;
  height: 12px;
}

#jdv-mnav .jdv-mnav__title {
  margin: 16px 0 0;
  color: inherit;
  font-family: 'IM Fell English', Georgia, 'Times New Roman', serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.15;
}

#jdv-mnav .jdv-mnav__intro {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

#jdv-mnav .jdv-mnav__all {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 20px;
  border-radius: 999px;
  background: #F3EBDB;
  color: inherit;
  font-size: 14px;
  text-decoration: none;
}

#jdv-mnav .jdv-mnav__cards {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}

#jdv-mnav .jdv-mnav__cards li {
  border-top: 1px solid #D9D0BF;
}

#jdv-mnav .jdv-mnav__card {
  display: flex;
  gap: 18px;
  padding: 16px 0;
  color: inherit;
  text-decoration: none;
}

#jdv-mnav .jdv-mnav__thumb {
  flex: 0 0 104px;
  width: 104px;
  height: 104px;
  object-fit: cover;
}

#jdv-mnav .jdv-mnav__card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

#jdv-mnav .jdv-mnav__card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'IM Fell English', Georgia, 'Times New Roman', serif;
  font-size: 20px;
  line-height: 1.2;
}

#jdv-mnav .jdv-mnav__card-title .jdv-mnav-icon {
  width: 18px;
  height: 18px;
}

#jdv-mnav .jdv-mnav__card-text {
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- Start Trial / Sign In ----------
   margin-top:auto pins them to the bottom of a short view (main) and lets
   them follow the content on a long one (Explore), as the comp shows. */
#jdv-mnav .jdv-mnav__auth {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 32px;
}

#jdv-mnav .jdv-mnav__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s ease;
}

#jdv-mnav .jdv-mnav__btn--primary {
  background: #4C423C;
  color: #F4EFE3;
}

#jdv-mnav .jdv-mnav__btn--primary:hover {
  background: #3A322D;
}

#jdv-mnav .jdv-mnav__btn--secondary {
  background: #FFFFFF;
  color: #4C423C;
}

#jdv-mnav .jdv-mnav__btn--secondary:hover {
  background: #F3EBDB;
}

/* ---------- focus + motion ---------- */
#jdv-mnav :focus-visible,
.jdv-mnav-toggle:focus-visible {
  outline: 2px solid #4C423C;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  #jdv-mnav,
  #jdv-mnav.is-open,
  #jdv-mnav .jdv-mnav__view,
  #jdv-mnav .jdv-mnav__view.is-active {
    transition: none;
  }
}
