/* =========================================
   Turtle Header & Navigation (clean build)
   ========================================= */

/* Header polish */
.turtle-header {
  background-color: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 100;
  overflow: visible; /* prevent clipping */
}

/* Base nav layout */
.turtle-nav {
  --gap: 2rem;
  --hover: var(--wp--preset--color--dark-green);
  flex: 1 1 auto;
  position: relative;
  z-index: 110;
}
.turtle-nav .wp-block-navigation__container {
  gap: var(--gap);
  justify-content: center;
}

/* Top-level links */
.turtle-nav .wp-block-navigation-item__content {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.75rem;
  color: var(--wp--preset--color--ink);
  transition: color 0.25s ease;
}
.turtle-nav .wp-block-navigation-item__content:hover,
.turtle-nav .wp-block-navigation-item__content:focus {
  color: var(--hover);
}

/* Force nav link colors (overrides global link color) */
.turtle-nav a {
  color: var(--wp--preset--color--ink) !important;
}
.turtle-nav a:hover {
  color: var(--wp--preset--color--dark-green) !important;
}

/* ===============================
   A) Navigation block submenus
   =============================== */
.turtle-nav .has-child {
  position: relative;
}

.turtle-nav .wp-block-navigation__submenu-container {
  position: absolute; /* keep on its own layer */
  left: 0;
  top: 100%;
  min-width: 240px;
  background: var(--wp--preset--color--white);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  padding: 0.25rem;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  overflow: visible;
}
.turtle-nav .has-child:hover > .wp-block-navigation__submenu-container,
.turtle-nav .has-child:focus-within > .wp-block-navigation__submenu-container {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.turtle-nav
  .wp-block-navigation__submenu-container
  .wp-block-navigation-item__content {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  color: var(--wp--preset--color--ink) !important;
}
.turtle-nav
  .wp-block-navigation__submenu-container
  .wp-block-navigation-item__content:hover {
  background: var(--wp--preset--color--sand);
  color: var(--wp--preset--color--dark-green) !important;
}

/* =======================================
   B) Page List-based dropdown (auto nav)
   ======================================= */
.turtle-nav .wp-block-page-list > li {
  position: relative;
}

/* Submenu UL from Page List */
.turtle-nav .wp-block-page-list > li > ul.children {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 240px;
  background: var(--wp--preset--color--white);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  padding: 0.25rem;
  margin: 0; /* avoid hover gap */
  list-style: none;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  margin-top: 10px;
}

/* Hover bridge to prevent flicker when moving cursor down */
.turtle-nav .wp-block-page-list > li > ul.children::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 12px;
  background: transparent;
}

/* Reveal when hovering parent OR submenu itself */
.turtle-nav .wp-block-page-list > li:hover > ul.children,
.turtle-nav .wp-block-page-list > li:focus-within > ul.children,
.turtle-nav .wp-block-page-list > li > ul.children:hover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Submenu item links */
.turtle-nav .wp-block-page-list > li > ul.children > li > a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  color: var(--wp--preset--color--ink);
  white-space: nowrap;
}
.turtle-nav .wp-block-page-list > li > ul.children > li > a:hover {
  background: var(--wp--preset--color--sand);
  color: var(--wp--preset--color--dark-green);
}

/* =========================
   Mobile overlay adjustments
   ========================= */
@media (max-width: 992px) {
  .turtle-header {
    background: #fff;
    backdrop-filter: none;
  }
  /* Flatten panels inside the overlay */
  .turtle-nav .wp-block-navigation__submenu-container,
  .turtle-nav .wp-block-page-list > li > ul.children {
    position: static;
    box-shadow: none;
    border-radius: 12px;
    padding: 0.5rem;
    margin: 0;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
}

/* =========================
   Dropdown indicator (below, baseline aligned)
   ========================= */

/* 1) Make every top-level link share the same vertical rhythm */
.turtle-nav .wp-block-navigation-item__content,
.turtle-nav .wp-block-page-list > li > a {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem; /* keep same as others */
  line-height: 1.2; /* steady baseline */
}

/* 2) Arrow drawn inside the bottom padding (looks “below” the text) */
.turtle-nav .has-child > .wp-block-navigation-item__content::after,
.turtle-nav .wp-block-page-list > li:has(> ul.children) > a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.15rem; /* sits within padding, no height change */
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
  opacity: 0.6;
  transition: transform 0.25s ease, opacity 0.25s ease;
  margin-block: -10px;
}

/* 3) Hover state (gentle rotate + brighten) */
.turtle-nav .has-child:hover > .wp-block-navigation-item__content::after,
.turtle-nav .has-child:focus-within > .wp-block-navigation-item__content::after,
.turtle-nav .wp-block-page-list > li:has(> ul.children):hover > a::after,
.turtle-nav
  .wp-block-page-list
  > li:has(> ul.children):focus-within
  > a::after {
  transform: translateX(-50%) rotate(225deg) translateY(2px);
  opacity: 1;
}

/* Burger breakpoint override — 1000px */
.turtle-nav .wp-block-navigation__responsive-container-open {
  /* hide the hamburger by default (desktop) */
  display: none;
}

/* Swap to burger at <= 1000px */
@media (max-width: 1000px) {
  /* hide the inline links */
  .turtle-nav .wp-block-navigation__container {
    display: none !important;
  }
  /* show the hamburger button */
  .turtle-nav .wp-block-navigation__responsive-container-open {
    display: inline-flex;
  }
  /* ensure overlay content is visible when opened */
  .turtle-nav .wp-block-navigation__responsive-container.is-menu-open {
    display: block;
  }
}
