/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/* ============================================================================
   Makerique Boutique — Mega Menu (optional Journal-style category panel)
   ----------------------------------------------------------------------------
   Rendered by common/menu.twig only when theme_makerique_mega_enabled = 1.
   The .mr-mega panel is a wide, container-aligned dropdown with an optional
   category image lead cell and child links laid out in N columns.

   Responsive: the mega layout applies on >=lg only. Below lg the nav lives in
   the header off-canvas, where .mr-mega degrades to a plain stacked list so the
   mobile experience is unchanged.
   ========================================================================== */

/* --- Large screens: the real mega panel --------------------------------- */
@media (min-width: 992px) {
  /* Anchor the panel to the whole nav container (li is .position-static). */
  #menu.mr-menu .nav-item.dropdown.position-static { position: static; }

  #menu.mr-menu .mr-mega.dropdown-menu {
    display: none;
    left: 0;
    right: 0;
    width: auto;
    max-width: 100%;
    margin-top: .35rem;
    padding: 0;
    border: 1px solid var(--mr-border);
    border-radius: var(--mr-radius);
    background: var(--mr-surface);
    box-shadow: var(--mr-shadow-hover);
    overflow: hidden;
  }

  #menu.mr-menu .mr-mega.dropdown-menu.show { display: block; }

  .mr-mega-inner {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  /* Optional category image lead cell. */
  .mr-mega-media {
    flex: 0 0 240px;
    max-width: 240px;
    border-radius: var(--mr-radius);
    overflow: hidden;
    background: var(--mr-surface-2);
  }

  .mr-mega-img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 260px;
    object-fit: cover;
  }

  .mr-mega-body { flex: 1 1 auto; min-width: 0; }

  /* Child links distributed across N columns (set inline as --mr-mega-columns). */
  .mr-mega-cols {
    column-count: var(--mr-mega-columns, 4);
    column-gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .mr-mega-cols > li {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* --- Shared link styling (applies at all sizes) ------------------------- */
.mr-mega-link {
  display: block;
  padding: .4rem .6rem;
  border-radius: var(--mr-radius-sm);
  color: var(--mr-text);
  text-decoration: none;
  font-family: var(--mr-font-nav);
  transition: background var(--mr-transition), color var(--mr-transition);
}

.mr-mega-link:hover,
.mr-mega-link:focus {
  background: var(--mr-surface-2);
  color: var(--mr-primary);
}

.mr-mega-all {
  display: inline-block;
  margin-top: 1rem;
  padding: .4rem .6rem;
  color: var(--mr-primary);
  font-weight: 600;
  text-decoration: none;
  border-top: 1px solid var(--mr-border);
  transition: color var(--mr-transition);
}

.mr-mega-all:hover,
.mr-mega-all:focus { color: var(--mr-primary-600); }

/* --- Small screens: degrade to a plain stacked list --------------------- */
@media (max-width: 991.98px) {
  .mr-mega-inner {
    display: block;
    padding: 0;
  }

  /* Category image is decorative here — the off-canvas list stays compact. */
  .mr-mega-media { display: none; }

  .mr-mega-cols {
    column-count: 1;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .mr-mega-all {
    margin-top: .5rem;
    border-top: 0;
  }
}

/* --- Reduced-motion safe ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .mr-mega-link,
  .mr-mega-all { transition: none; }
}

/* ── Third-level categories (grandchildren) — see navmode.php + menu.twig ──── */
/* Mega panel: grandchildren as an indented sub-list under each child link. */
.mr-mega-sublist {
  list-style: none;
  margin: .15rem 0 .5rem;
  padding-left: .75rem;
  border-left: 1px solid var(--mr-border, rgba(0,0,0,.1));
}
.mr-mega-sublink {
  display: block;
  padding: .12rem 0;
  font-size: .85rem;
  opacity: .82;
  text-decoration: none;
  color: inherit;
}
.mr-mega-sublink:hover { opacity: 1; color: var(--mr-primary, inherit); }

/* Stock dropdown: grandchildren indented under their parent child. */
.mr-menu-dropdown .mr-menu-sub {
  padding-left: 2rem;
  font-size: .9rem;
  opacity: .85;
}

/* ── Per-category nav icon (theme_makerique_mega_icons) ──────────────────
   A small icon before a top-level category label, in both the bar and mega
   layouts. Renders nothing when a category has no mapping. */
.mr-nav-ico {
  display: inline-block;
  width: 1.15em;
  margin-right: .45em;
  text-align: center;
  opacity: .85;
  flex: 0 0 auto;
}
.nav-link:hover .mr-nav-ico { opacity: 1; }
.mr-nav-ico--emoji {
  font-size: 1.05em;
  line-height: 1;
  font-style: normal;
}

/* Dropdown affordance: visible chevron on every menu item with children, hover and keyboard focus states. */
.mr-menu .nav-link.dropdown-toggle::after {
  content: "\f078"; font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", sans-serif; font-weight: 900;
  border: 0; font-size: .6em; margin-left: .45em; vertical-align: .12em; display: inline-block;
  transition: transform .15s ease;
}
.mr-menu .nav-link.dropdown-toggle.show::after,
.mr-menu .nav-link.dropdown-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.mr-menu .nav-link .mr-nav-ico { margin-right: .45em; color: var(--mr-primary); }
.mr-menu .nav-link:hover,
.mr-menu .nav-link:focus-visible,
.mr-menu .nav-link.show { color: var(--mr-primary); background: color-mix(in srgb, var(--mr-primary) 8%, transparent); }
.mr-menu .nav-link:focus-visible { outline: 2px solid var(--mr-primary); outline-offset: -2px; }
.mr-menu .dropdown-item .mr-nav-ico { margin-right: .5em; color: var(--mr-primary); width: 1.1em; text-align: center; }
