/**
 * Dream Navigation Menu — Front-end styles
 * BEM-like naming: .dnm__*
 *
 * One breakpoint (992px, aligned with the header's own desktop switch in
 * header-footer-overrides.css) drives everything below via plain media
 * queries, so behaviour tracks the live viewport — window resize, rotation,
 * an external monitor, a future device width — rather than any device check.
 *
 *   >= 992px : unchanged desktop hover bar
 *   <  992px : burger button + offcanvas accordion drawer (mobile & tablet)
 */

/* ── Reset & base (all sizes) ─────────────────────────────────────────── */
.dnm__list,
.dnm__dropdown {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dnm__item {
  position: relative;
}

.dnm__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
  border: 1px solid transparent;
}

.dnm__link:hover,
.dnm__item.is-open > .dnm__link {
  text-decoration: none;
}

.dnm__arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.dnm__subitem {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dnm__subitem:last-child {
  border-bottom: none;
}

.dnm__sublink {
  display: block;
  padding: 9px 18px;
  color: #333;
  text-decoration: none;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease, padding-left 0.15s ease;
}

.dnm__sublink:hover {
  background-color: rgba(0, 0, 0, 0.04);
  padding-left: 24px;
  text-decoration: none;
}

/* Accessibility: keyboard focus (all sizes) */
.dnm__link:focus,
.dnm__sublink:focus,
.dnm__burger:focus,
.dnm__close:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ── Burger button ─────────────────────────────────────────────────────── */
.dnm__burger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  /* The widget's header column keeps the same dark strip background used by
     the desktop nav bar (see header-footer-overrides.css .dnm__link color),
     so the burger stays white to match instead of relying on `inherit`. */
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

.dnm__burger-bar {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.dnm__burger[aria-expanded="true"] .dnm__burger-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.dnm__burger[aria-expanded="true"] .dnm__burger-bar:nth-child(2) {
  opacity: 0;
}

.dnm__burger[aria-expanded="true"] .dnm__burger-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── Backdrop (mobile/tablet only) ────────────────────────────────────── */
.dnm__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 22, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1049;
}

.dnm__backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

.dnm__panel-head,
.dnm__close {
  display: none;
}

/* Locks page scroll while the drawer is open (toggled by front.js) */
body.dnm-scroll-lock {
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════
   DESKTOP — >= 992px : unchanged hover bar
   ══════════════════════════════════════════════════════════════════════ */
@media (min-width: 992px) {
  .dnm {
    position: relative;
    z-index: 1000;
  }

  .dnm__list {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .dnm__item.is-open > .dnm__link .dnm__arrow,
  .dnm__item:hover > .dnm__link .dnm__arrow {
    transform: rotate(180deg);
  }

  .dnm__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: #fff;
    border-top: 3px solid transparent;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    max-height: none;
    overflow: visible;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1001;
  }

  /* Show on hover */
  .dnm__item--has-dropdown:hover > .dnm__dropdown,
  .dnm__item.is-open > .dnm__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE & TABLET — < 992px : burger + offcanvas accordion drawer
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .dnm__burger {
    display: flex;
  }

  .dnm {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    width: min(320px, 86vw);
    max-width: 360px;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    color: #253237;
    box-shadow: 0 20px 45px rgba(20, 15, 22, 0.25);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.32, 1);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

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

  .dnm__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    padding: 14px 8px 14px 18px;
    border-bottom: 1px solid rgba(37, 50, 55, 0.08);
  }

  .dnm__panel-title {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: #253237;
  }

  .dnm__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #253237;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .dnm__list {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
  }

  .dnm__item {
    border-bottom: 1px solid rgba(37, 50, 55, 0.06);
  }

  .dnm__link {
    width: 100%;
    justify-content: space-between;
    padding: 13px 18px;
    color: #253237;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
  }

  .dnm__arrow {
    border-top-color: #7C157D;
  }

  /* Sub-list becomes an accordion panel instead of a hover dropdown */
  .dnm__dropdown {
    position: static;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border-top: 0;
    border-left: 3px solid transparent;
    background: #faf8fa;
    transition: max-height 0.22s ease;
  }

  .dnm__item.is-open > .dnm__dropdown {
    max-height: min(640px, 60vh);
    overflow-y: auto;
    border-left-color: #7C157D;
  }

  .dnm__sublink {
    padding-left: 30px;
    white-space: normal;
  }
}
