/* ==========================================================================
   Header dropdown menus — First Coast Dental Center
   --------------------------------------------------------------------------
   Added on top of the Webflow export.

   The markup uses Webflow's own .w-dropdown component, whose JS module is
   already bundled in assets/js/webflow.*.js. That module handles:
     - hover to open on desktop, tap to open on touch devices
     - Escape to close, arrow keys / Home / End to move between links
     - aria-haspopup, aria-expanded, aria-controls, role, tabindex
   So this file supplies visual styling only — no behaviour.

   Two deliberate choices worth knowing before editing:

   1. The toggle is NOT given the .navbar-link class, even though it is styled
      to match one. Each page has an inline script that closes the mobile menu
      whenever any .navbar-link is clicked — if the toggle carried that class,
      tapping "Services" on a phone would close the whole menu instead of
      expanding the submenu.

   2. Below 991px .header-nav-wrapper gets overflow-y:auto. It is a fixed,
      full-viewport panel with no scrolling of its own; once the 12-item
      Services submenu expands, the lower entries would otherwise be
      unreachable on short screens.
   ========================================================================== */

/* ---- container ---------------------------------------------------------- */
.navbar-dropdown {
  z-index: 950;
  margin-left: 0;
  margin-right: 0;
}

.navbar-dropdown.w--open {
  z-index: 960;
}

/* ---- toggle (mirrors .navbar-link) -------------------------------------- */
.navbar-dropdown-toggle {
  color: var(--white);
  text-transform: uppercase;
  cursor: pointer;
  gap: .45em;
  margin-left: 1.5em;
  margin-right: 0;
  padding: 0;
  font-size: .88em;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  transition: color .4s cubic-bezier(.785, .135, .15, .86);
  display: flex;
  align-items: center;
}

.navbar-dropdown-toggle:hover,
.navbar-dropdown-toggle.w--open {
  color: var(--cta-hover);
}

.navbar-dropdown-toggle:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 4px;
  border-radius: 2px;
}

/* current section — static per page, so no hover jitter */
.navbar-dropdown-toggle.is-current {
  font-weight: 700;
}

.navbar-dropdown-arrow {
  width: .7em;
  height: .7em;
  flex: none;
  transition: transform .25s ease;
}

.navbar-dropdown-toggle.w--open .navbar-dropdown-arrow {
  transform: rotate(180deg);
}

/* ---- panel -------------------------------------------------------------- */
.navbar-dropdown-list {
  background-color: var(--white);
  border-radius: .75rem;
  min-width: 15rem;
  margin-top: 1rem;
  padding: .5rem;
  top: 100%;
  left: 0;
  right: auto;
  box-shadow: 0 1.25rem 2.5rem #1f263826;
}

/* Services carries 12 links — two columns, anchored to the right edge so a
   wide panel on the last nav item cannot overflow the viewport. */
.navbar-dropdown-list.is-wide {
  min-width: 34rem;
  left: auto;
  right: 0;
}

.navbar-dropdown-list.w--open {
  grid-template-columns: 1fr;
  gap: .125rem;
  display: grid;
}

.navbar-dropdown-list.is-wide.w--open {
  grid-template-columns: 1fr 1fr;
}

/* invisible bridge across the gap, so the pointer can travel from the toggle
   to the panel without the dropdown closing under it */
.navbar-dropdown-list:before {
  content: "";
  position: absolute;
  top: -1rem;
  left: 0;
  right: 0;
  height: 1rem;
}

/* ---- links -------------------------------------------------------------- */
.navbar-dropdown-link {
  color: var(--text);
  text-align: left;
  border-radius: .5rem;
  /* Webflow's base .w-dropdown-link sets margin-left/right:auto, which makes
     these grid items shrink-wrap and centre themselves. */
  margin-left: 0;
  margin-right: 0;
  padding: .7rem .9rem;
  font-size: .88em;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  transition: background-color .2s ease, color .2s ease;
}

.navbar-dropdown-link:hover {
  background-color: var(--primary-soft-light);
  color: var(--cta);
}

.navbar-dropdown-link:focus-visible {
  outline: 2px solid var(--cta);
  outline-offset: -2px;
}

/* Webflow's links module strips .w--current here, because the href is
   "our-doctors.html" while .htaccess serves the page at "/our-doctors" and the
   two paths don't compare equal. It leaves aria-current alone, so key the
   highlight off that as well — this then works under either URL form. */
.navbar-dropdown-link.w--current,
.navbar-dropdown-link[aria-current="page"] {
  background-color: var(--primary-soft-light);
  color: var(--cta);
  font-weight: 700;
}

/* ==========================================================================
   Tablet + mobile (<=991px): the nav becomes a full-screen panel, so the
   dropdowns become inline accordions rather than floating flyouts.
   ========================================================================== */
@media screen and (max-width: 991px) {
  .header-nav-wrapper {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* set by assets/js/header-menu.js while the panel is open. overflow-y only:
     the site's own inline script writes style="overflow-x:visible" onto <body>,
     which would win over a shorthand. */
  body.nav-open {
    overflow-y: hidden;
  }

  .navbar-dropdown {
    width: 100%;
    margin-bottom: 2rem;
    display: block;
  }

  .navbar-dropdown-toggle {
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
    font-size: 1.25em;
  }

  .navbar-dropdown-toggle:hover,
  .navbar-dropdown-toggle.w--open {
    color: var(--white-o50);
  }

  .navbar-dropdown-arrow {
    width: .6em;
    height: .6em;
  }

  .navbar-dropdown-list,
  .navbar-dropdown-list.is-wide {
    background-color: #0000;
    border-left: 1px solid #ffffff40;
    border-radius: 0;
    min-width: 0;
    margin-top: .75rem;
    padding: 0 0 0 1rem;
    position: static;
    box-shadow: none;
  }

  .navbar-dropdown-list.w--open,
  .navbar-dropdown-list.is-wide.w--open {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .navbar-dropdown-list:before {
    display: none;
  }

  .navbar-dropdown-link {
    color: var(--white);
    border-radius: 0;
    padding: .6rem 0;
    font-size: 1em;
  }

  .navbar-dropdown-link:hover {
    background-color: #0000;
    color: var(--white-o50);
  }

  .navbar-dropdown-link.w--current,
  .navbar-dropdown-link[aria-current="page"] {
    background-color: #0000;
    color: var(--white);
    font-weight: 700;
  }
}
