/*
 * Ave Atelier — Max Mega Menu Custom CSS
 * Luxury Christian jewelry e-commerce
 * Design language: Tiffany / Cartier — airy, whitespace-first, refined
 *
 * Targets Max Mega Menu plugin markup.
 * Add via: Mega Menu > Menu Themes > Custom Styling > Custom CSS
 * or Theme > Additional CSS.
 *
 * Token reference (defined elsewhere in theme):
 *   --aa-cream: #FAF9F6
 *   --aa-white: #FFFFFF
 *   --aa-tiffany: #0ABAB5
 *   --aa-gold: #D4AF37
 *   --aa-deep-gold: #B8960C
 *   --aa-charcoal: #1A1A1A
 *   --aa-gray-dark: #444444
 *   --aa-gray: #666666
 *   --aa-gray-light: #999999
 *   --aa-font-heading: 'Cormorant Garamond', serif
 *   --aa-font-body: 'Lato', sans-serif
 */

/* =========================================================
   1. MENU BAR — top-level strip
   ========================================================= */

#mega-menu-wrap-primary {
  background: #FFFFFF;
  border-bottom: 1px solid #EEEEEE;
  position: relative;
  z-index: 1000;
}

#mega-menu-wrap-primary #mega-menu-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  background: transparent;
}

/* ── current/active page — override plugin white-on-white ─ */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-current-menu-item > a.mega-menu-link,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-current-menu-ancestor > a.mega-menu-link,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-current-page-ancestor > a.mega-menu-link {
  color: #1A1A1A !important;
  background: transparent !important;
}

/* ── top-level items ────────────────────────────────────── */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item {
  position: static; /* required for full-width panel */
  background: transparent;
  border: none;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 24px 20px;
  font-family: 'Lato', sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #463F3A;
  text-decoration: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-toggle-on > a.mega-menu-link,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-align-bottom-left.mega-toggle-on > a.mega-menu-link,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-align-bottom-right.mega-toggle-on > a.mega-menu-link {
  color: #1A1A1A !important;
  border-bottom-color: transparent !important;
  background: transparent !important;
}

/* hide all dropdown indicators */
#mega-menu-wrap-primary #mega-menu-primary span.mega-indicator,
#mega-menu-wrap-primary #mega-menu-primary span.mega-indicator::after,
#mega-menu-wrap-primary #mega-menu-primary span.mega-indicator::before,
#mega-menu-wrap-primary #mega-menu-primary li.mega-menu-item-has-children > a.mega-menu-link > span.mega-indicator {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  border: none !important;
  content: none !important;
  visibility: hidden !important;
}

/* =========================================================
   2. MEGA PANEL — full-width drop
   ========================================================= */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu {
  /* positioning */
  position: absolute;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  top: 100%;

  /* appearance */
  background: #FFFFFF;
  border-top: 2px solid #D4AF37;
  border-bottom: 1px solid #EEEEEE;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);

  /* layout */
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  padding: 40px 60px 48px;

  /* animation — hidden state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s linear 0.28s;

  /* override plugin */
  border-radius: 0;
  margin: 0;
  z-index: 999;
}

/* open state — toggled by plugin via .mega-toggle-on */
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-toggle-on > ul.mega-sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s linear 0s;
}

/* ── decorative gold rule across the top of panel content ─ */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu::before {
  content: '';
  display: block;
  position: absolute;
  top: 0;
  left: 60px;
  right: 60px;
  height: 0; /* the border-top on the panel itself is the gold line */
}

/* =========================================================
   3. COLUMN HEADERS inside panel
   ========================================================= */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item {
  padding: 0 16px;
  border-right: 1px solid #EEEEEE;
  background: transparent;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item:last-child {
  border-right: none;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item:first-child {
  padding-left: 0;
}

/* column header link */
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
  display: block;
  padding: 0 0 10px 0;
  margin-bottom: 14px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1A1A1A;
  text-decoration: none;
  border: none;
  border-bottom: 1px solid #D4AF37;
  background: transparent;
  transition: color 0.2s ease;
  white-space: nowrap;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover {
  color: #D4AF37;
  background: transparent;
}

/* =========================================================
   4. PANEL CHILD ITEMS (sub-items within each column)
   ========================================================= */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu {
  /* override flyout behavior — render as a flat list, not a nested dropdown */
  position: static !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  padding: 0;
  margin: 0;
  min-width: 0;
  width: auto;
  float: none;
}

/* individual sub-item */
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item {
  display: block;
  background: transparent;
  border: none;
  padding: 0;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
  display: block;
  padding: 5px 0;
  font-family: 'Lato', sans-serif;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: #666666;
  text-decoration: none;
  background: transparent;
  border: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
  white-space: nowrap;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover {
  color: #444444;
  padding-left: 6px;
  background: transparent;
}

/* =========================================================
   5. SALE ITEM — tiffany accent
   ========================================================= */

/* Top-level Sale column header */
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item.mega-menu-item-sale > a.mega-menu-link,
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item[class*="sale"] > a.mega-menu-link {
  color: #0ABAB5;
  border-bottom-color: #0ABAB5;
}

/* If "Sale" is a direct top-level nav item (no mega panel) */
#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-menu-item-sale > a.mega-menu-link {
  color: #0ABAB5;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-menu-item-sale > a.mega-menu-link:hover {
  color: #B8960C;
  border-bottom-color: #B8960C;
}

/*
 * Because WordPress class names on menu items are generated from the post
 * slug, "Sale" will typically get .menu-item-object-{id} classes.
 * The plugin also allows adding a custom CSS class via Appearance > Menus.
 * Add the class "aa-sale" to the Sale item in the menu editor for reliable targeting.
 */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item.aa-sale > a.mega-menu-link {
  color: #0ABAB5;
  border-bottom-color: #0ABAB5;
}

/* =========================================================
   6. DECORATIVE CROSS DIVIDER
   A hairline cross motif sits between columns — rendered
   via a CSS-only absolute cross on the panel's ::after pseudo.
   Using the natural column dividers is cleaner; the cross
   sits centered in the last column separator.
   ========================================================= */

/* The cross is rendered as a tiny stacked pair of lines
   placed at the intersection of the panel's top edge and
   the right edge of the first column. It serves as a quiet
   religious signature without competing with product content. */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu::after {
  content: '';
  display: block;
  position: absolute;
  top: -1px;   /* sits on the gold border */
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 12px;
  background: #D4AF37;
  box-shadow:
    -4px 4px 0 0 #FFFFFF,           /* clear cross junction */
     4px 4px 0 0 #FFFFFF,
    -4px 3px 0 0 #D4AF37,           /* horizontal arm left */
     4px 3px 0 0 #D4AF37;           /* horizontal arm right */
}

/* =========================================================
   7. SIMPLE TOP-LEVEL ITEMS (About, Journal, Contact)
      — no sub-menu, no panel
   ========================================================= */

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item:not(.mega-menu-item-has-children) > a.mega-menu-link {
  /* inherits all top-level styles; just make sure no pseudo-panel shows */
  border-bottom-color: transparent;
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item:not(.mega-menu-item-has-children) > a.mega-menu-link:hover {
  color: #1A1A1A;
  border-bottom-color: transparent;
  background: transparent;
}

/* =========================================================
   8. FLYOUT SUPPRESSION
   Force the plugin into mega-panel mode visually even if
   a column is configured as flyout. Belt-and-suspenders.
   ========================================================= */

#mega-menu-wrap-primary .mega-menu-flyout .mega-sub-menu,
#mega-menu-wrap-primary .mega-sub-menu .mega-sub-menu {
  position: static !important;
  display: block !important;
  float: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border: none !important;
  width: auto !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* =========================================================
   9. PANEL BACKDROP / OVERLAY
   A faint cream wash behind the panel creates depth
   without lifting the content too harshly.
   ========================================================= */

@keyframes aa-panel-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-toggle-on > ul.mega-sub-menu {
  animation: aa-panel-in 0.28s ease forwards;
}

/* =========================================================
   10. RESPONSIVE — TABLET (≤ 1024px)
   ========================================================= */

@media screen and (max-width: 1024px) {
  #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu {
    grid-template-columns: repeat(3, 1fr);
    padding: 28px 32px 36px;
    gap: 0 0;
  }

  #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item {
    padding: 0 12px 24px;
    border-right: none;
    border-bottom: 1px solid #EEEEEE;
  }

  #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item:nth-child(3n) {
    border-right: none;
  }

  #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link {
    padding: 20px 14px;
    font-size: 9px;
  }
}

/* =========================================================
   11. RESPONSIVE — MOBILE (≤ 768px)
   The plugin renders a hamburger / accordion on mobile.
   We inherit that structure and restyle for luxury feel.
   ========================================================= */

@media screen and (max-width: 768px) {

  /* ── Mobile menu wrapper ─────────────────────────────── */
  #mega-menu-wrap-primary {
    border-bottom: none;
  }

  /* Mobile toggle button (hamburger) */
  #mega-menu-wrap-primary .mega-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 18px 20px;
    background: #FFFFFF;
    border: none;
    border-bottom: 1px solid #EEEEEE;
    cursor: pointer;
  }

  #mega-menu-wrap-primary .mega-menu-toggle .mega-toggle-blocks-left,
  #mega-menu-wrap-primary .mega-menu-toggle .mega-toggle-blocks-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* hamburger bars */
  #mega-menu-wrap-primary .mega-menu-toggle .mega-toggle-block-1 span {
    background: #463F3A;
    height: 1px;
    transition: all 0.2s ease;
  }

  /* Mobile nav container */
  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile {
    display: none;
    flex-direction: column;
    background: #FFFFFF;
    border-bottom: 2px solid #D4AF37;
    padding: 0;
  }

  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile.mega-menu-open {
    display: flex;
  }

  /* ── Mobile top-level items ──────────────────────────── */
  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item {
    border-bottom: 1px solid #EEEEEE;
  }

  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > a.mega-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    font-family: 'Lato', sans-serif;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #463F3A;
    text-decoration: none;
    background: transparent;
    border: none;
    transition: color 0.2s ease, background 0.2s ease;
  }

  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item.mega-toggle-on > a.mega-menu-link {
    color: #D4AF37;
    background: #FAF9F6;
  }

  /* ── Mobile accordion panel ──────────────────────────── */
  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu {
    /* override grid for mobile — single column accordion */
    display: none;
    grid-template-columns: 1fr;
    padding: 0;
    border-top: 1px solid #EEEEEE;
    border-bottom: none;
    box-shadow: none;
    background: #FAF9F6;
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    animation: none;
  }

  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item.mega-toggle-on > ul.mega-sub-menu {
    display: grid;
  }

  /* Mobile column items */
  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item {
    padding: 0;
    border-right: none;
    border-bottom: 1px solid #EEEEEE;
  }

  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item:last-child {
    border-bottom: none;
  }

  /* Mobile column headers */
  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px 13px 28px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #1A1A1A;
    border-bottom: none;
    margin-bottom: 0;
    background: transparent;
    transition: color 0.2s ease;
  }

  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover {
    color: #D4AF37;
    background: transparent;
    padding-left: 28px;
  }

  /* Mobile nested sub-items */
  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
    padding: 9px 20px 9px 36px;
    font-size: 12px;
    color: #666666;
  }

  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover {
    color: #D4AF37;
    padding-left: 40px;
  }

  /* Mobile Sale accent */
  #mega-menu-wrap-primary #mega-menu-primary.mega-menu-mobile > li.mega-menu-item > ul.mega-sub-menu > li.mega-menu-item.aa-sale > a.mega-menu-link {
    color: #D4AF37;
  }

  /* Suppress the decorative cross on mobile */
  #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > ul.mega-sub-menu::after {
    display: none;
  }
}

/* =========================================================
   12. ACCESSIBILITY — focus-visible states
   ========================================================= */

#mega-menu-wrap-primary a.mega-menu-link:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

/* =========================================================
   13. PRINT — collapse menu neatly
   ========================================================= */

@media print {
  #mega-menu-wrap-primary > ul.mega-sub-menu,
  #mega-menu-wrap-primary .mega-sub-menu {
    display: none !important;
  }
}
