/* =====================================================================
   HEADER BRAND (Fadal, Eklogè, Eklogè Home, Dreamtime, Amacook): menu desktop
   Attivo solo da 992px e solo sugli header con classe .brand-nav.
   Smartphone e tablet invariati (menu a hamburger).
   Si adatta alla struttura generata dal gestionale:
   - voce con sottomenu            -> pannello a tutta larghezza
   - sottomenu a 3 livelli         -> colonne con titolo e voci
   - sottomenu a 2 livelli         -> elenco distribuito su più colonne
   - voce "Home" e link morti (#)  -> nascosti su desktop (c'è il logo)
   - voci generali (.sa-item)      -> nascoste su desktop (sono nel footer)
   ===================================================================== */
@media (min-width: 992px) {
  header.brand-nav {
    --bn-accent: #1a1a1a;
    --bn-ink: #1a1a1a;
    --bn-line: #e9e9e9;
    --bn-soft: #f6f6f4;
    --bn-ease: cubic-bezier(.22, 1, .36, 1);
  }
  header.brand-fadal       { --bn-accent: #4c9c2e; }
  header.brand-dreamtime   { --bn-accent: #5f9a1a; }
  header.brand-ekloge      { --bn-accent: #be894a; }
  header.brand-ekloge-home { --bn-accent: #9a914f; }
  header.brand-amacook     { --bn-accent: #099d78; }

  /* ---------- barra superiore (D Shop + icone): sottile ---------- */
  header.brand-nav .primary-navigation { padding: 6px 0; border-bottom: 1px solid var(--bn-line); }
  header.brand-nav .primary-navigation .container { max-width: 1240px; }
  header.brand-nav .primary-navigation .navbar-brand { padding: 0; cursor: pointer; }
  header.brand-nav .primary-navigation .navbar-brand img { width: 104px; }
  header.brand-nav .primary-navigation .navbar-nav { gap: 4px; }
  header.brand-nav .primary-navigation .nav-link { padding: 6px 8px !important; border-radius: 6px; transition: background-color .2s var(--bn-ease); }
  header.brand-nav .primary-navigation .nav-link:hover { background: var(--bn-soft); }
  header.brand-nav .primary-navigation .nav-link img { width: 21px; height: 21px; object-fit: contain; }

  /* ---------- barra principale: logo | voci | ricerca ---------- */
  header.brand-nav .secondary-navigation { padding: 0 !important; box-shadow: 0 1px 0 var(--bn-line), 0 8px 24px -16px rgba(0, 0, 0, .25); }
  header.brand-nav .secondary-navigation > .container {
    display: flex; align-items: center; flex-wrap: nowrap; gap: 28px;
    max-width: 1240px; height: 72px; position: relative;
  }
  header.brand-nav .secondary-navigation .navbar-toggler { display: none; }
  header.brand-nav .secondary-navigation .navbar-brand { position: static; transform: none; order: 1; margin: 0; flex: none; }
  header.brand-nav .secondary-navigation .navbar-brand img { width: auto; height: 34px; max-width: 170px; display: block; }
  header.brand-nav .secondary-navigation .navbar-search {
    position: static; order: 3; margin-left: auto; padding: 8px; border-radius: 50%; cursor: pointer;
    transition: background-color .2s var(--bn-ease);
  }
  header.brand-nav .secondary-navigation .navbar-search:hover { background: var(--bn-soft); }
  header.brand-nav .secondary-navigation .navbar-search img { width: 22px; display: block; }

  header.brand-nav .secondary-navigation .navbar-collapse {
    display: flex !important; order: 2; flex: 1 1 auto; height: 100%; min-width: 0;
    padding: 0 !important; max-height: none; overflow: visible; background: none; position: static;
  }
  header.brand-nav .secondary-navigation .navbar-collapse > .navbar-nav {
    flex-direction: row; align-items: stretch; flex-wrap: nowrap; margin: 0 !important; height: 100%;
  }
  header.brand-nav .secondary-navigation .navbar-collapse > .navbar-nav > .nav-item { display: flex; align-items: center; position: static; }

  /* nascosti su desktop */
  header.brand-nav .navbar-collapse > .navbar-nav > .sa-item,
  header.brand-nav .navbar-collapse > .navbar-nav > .nav-item:has(> .link-header > a[href="index.php"]),
  header.brand-nav .navbar-collapse > .navbar-nav > .nav-item:not(:has(> ul)):has(> .link-header > a[href="#"]) { display: none !important; }

  /* voce della barra */
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > .link-header { padding: 0 !important; height: 100%; display: flex; align-items: center; }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > .link-header > .arrow { display: none; }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > .link-header > .nav-link {
    position: relative; display: flex; align-items: center; gap: 7px; height: 100%;
    padding: 0 11px !important; font-size: 12.5px; font-weight: 500; letter-spacing: .07em;
    color: var(--bn-ink) !important; text-transform: uppercase; white-space: nowrap;
  }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item:has(> ul) > .link-header > .nav-link::after {
    content: ""; width: 5px; height: 5px; margin-top: -3px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg); transition: transform .25s var(--bn-ease);
  }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item:has(> ul):hover > .link-header > .nav-link::after,
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item:has(> ul):focus-within > .link-header > .nav-link::after { transform: rotate(225deg); margin-top: 3px; }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > .link-header > .nav-link::before {
    content: ""; position: absolute; left: 11px; right: 11px; bottom: 0; height: 2px;
    background: var(--bn-accent); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--bn-ease);
  }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item:hover > .link-header > .nav-link::before,
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item:focus-within > .link-header > .nav-link::before { transform: scaleX(1); }

  /* ---------- pannello a tutta larghezza ---------- */
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > ul.flex-column {
    display: grid !important; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 40px; align-items: start;
    visibility: hidden; opacity: 0;
    position: absolute; top: 100%; left: 0; right: 0; margin: 0; padding: 28px 40px 32px !important;
    max-height: calc(100vh - 200px); overflow-y: auto;
    background: #fff; border-top: 1px solid var(--bn-line); border-radius: 0 0 12px 12px;
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, .35);
    transform: translateY(6px); transition: opacity .2s var(--bn-ease), transform .2s var(--bn-ease), visibility 0s linear .2s;
    z-index: 1050;
  }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item:hover > ul.flex-column,
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item:focus-within > ul.flex-column {
    visibility: visible; opacity: 1; transform: none; transition-delay: .06s;
  }
  /* voci del pannello */
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column .nav-link {
    display: block; padding: 6px 0 !important; font-size: 14px; font-weight: 400; letter-spacing: 0;
    text-transform: none; color: var(--bn-ink) !important; transition: color .15s ease, transform .15s ease;
  }
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column a.nav-link:not([href="#"]):hover { color: var(--bn-accent) !important; transform: translateX(3px); }

  /* gruppo con sottovoci (3 livelli): titolo di colonna + elenco sempre visibile */
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column > .nav-item:has(> ul) { grid-row: span 6; }
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column > .nav-item > .link-header { padding: 0 0 10px !important; margin: 0 0 6px; border-bottom: 1px solid var(--bn-line); }
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column > .nav-item > .link-header .arrow { display: none; }
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column > .nav-item > .link-header > .nav-link {
    padding: 0 !important; font-size: 11.5px; font-weight: 600; letter-spacing: .12em;
    color: var(--bn-accent) !important; text-transform: uppercase;
  }
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column > .nav-item > .link-header > a[href="#"] { pointer-events: none; }
  header.brand-nav .navbar-nav > .nav-item > ul.flex-column > .nav-item > ul.flex-column { display: block !important; padding: 0 !important; margin: 0 0 12px; }
  /* "Vedi tutti" in evidenza */
  header.brand-nav .navbar-nav ul.flex-column > .nav-item:last-child > a.nav-link[href*="shop.php"]:not([href*="categc=C"]):not([href*="categc=c"]) {
    font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  }
}

/* schermi desktop stretti: voci più compatte */
@media (min-width: 992px) and (max-width: 1279.98px) {
  header.brand-nav .secondary-navigation > .container { gap: 16px; }
  header.brand-nav .secondary-navigation .navbar-brand img { height: 28px; }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > .link-header > .nav-link { padding: 0 7px !important; font-size: 11.5px; letter-spacing: .04em; }
}
@media (min-width: 992px) {
  /* voce semplice senza .link-header (es. Promozioni in Eklogè) */
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > a.nav-link {
    position: relative; display: flex; align-items: center; height: 100%;
    padding: 0 11px !important; font-size: 12.5px; font-weight: 500; letter-spacing: .07em;
    color: var(--bn-ink) !important; text-transform: uppercase; white-space: nowrap;
  }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > a.nav-link::before {
    content: ""; position: absolute; left: 11px; right: 11px; bottom: 0; height: 2px;
    background: var(--bn-accent); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--bn-ease);
  }
  header.brand-nav .secondary-navigation .navbar-nav > .nav-item > a.nav-link:hover::before { transform: scaleX(1); }
}
