/* =============================================================================
   Nerd.Lineup — Models mega menu (master/detail)
   Brand-tunable: consumes theme CSS vars (--blue, --font, --grey-*) with neutral
   fallbacks, so BMW/Volvo/etc. tune it via their brand layer while it still works
   on the generic theme. Desktop = full-width dropdown panel; mobile drill-down
   lives in the header's mobile overlay (see .lm-drill at the bottom).
   ============================================================================= */

/* ---- Dropdown shell: neutralize the theme's decorative megamenu treatment ---- */
.lm-megamenu { background: #fff; }
.lm-megamenu::before,
.lm-megamenu::after { display: none !important; }

/* ---- Open on CLICK, not hover (the menu is large). Cancel the theme's hover/
   focus reveal while closed; reveal only when JS adds .is-open. ---- */
.nav-item.lm-nav.has-megamenu:not(.is-open):hover > .lm-megamenu,
.nav-item.lm-nav.has-megamenu:not(.is-open):focus-within > .lm-megamenu {
    opacity: 0; visibility: hidden; transform: translateY(20px);
}
.nav-item.lm-nav.is-open > .lm-megamenu {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.lm-nav .dropdown-arrow { transition: transform .3s var(--ease, ease); }
.lm-nav.is-open .dropdown-arrow { transform: rotate(180deg); }

/* ===== Panel ===== */
.lm { width: 100%; background: #fff; border-top: 3px solid var(--brand-primary, var(--blue, #0066b1));
      font-family: var(--font, "BMW Type Next", "Helvetica Neue", Arial, sans-serif); color: var(--grey-700, #494949); }
/* Content capped + centered so proportions stay consistent from laptop to 2K/4K
   (the white panel itself stays full-bleed). Fluid clamps handle everything below. */
.lm__inner { max-width: var(--container-wide, 1536px); margin-inline: auto; padding: clamp(26px, 2vw, 40px) clamp(28px, 4vw, 72px) 18px; }
.lm__title { font-size: clamp(21px, 1.7vw, 30px); font-weight: 300; color: var(--black, #1a1a1a); letter-spacing: -.01em; margin: 0 0 clamp(16px, 1.6vw, 24px); }

/* ---- Category tabs: flex-distribute across the width (size adapts to the number
   of categories), wrap to a new row on narrow screens — never horizontal scroll. ---- */
.lm__tabs-wrap { position: relative; }
.lm__tabs-wrap::after,
.lm__tabs-hint { display: none; }   /* scroll affordances no longer needed */
/* Grid auto-fit: equal-width tabs that fill the row and adapt to the number of
   categories (fewer = wider); wrap to a new row when they don't fit — never scroll. */
.lm__tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: clamp(8px, 0.7vw, 14px); }
/* Accent bar (col 1) + stacked name/count (col 2): the name gets the full tab
   width and wraps at word boundaries; the count sits beneath it. */
.lm__tab { display: grid; grid-template-columns: 3px 1fr; column-gap: clamp(11px, 1vw, 16px); row-gap: 3px;
           align-content: center;
           padding: clamp(12px, 1.2vw, 18px) clamp(14px, 1.2vw, 20px) clamp(12px, 1.2vw, 18px) 0;
           border: 1px solid var(--grey-200, #d6d6d6); background: #fff;
           position: relative; cursor: pointer; text-align: left; }
.lm__tab::before { content: ""; grid-column: 1; grid-row: 1 / -1; align-self: stretch; background: var(--blue, #0066b1); }
.lm__tab-name { grid-column: 2; grid-row: 1; font-size: clamp(14px, 1vw, 16px); line-height: 1.15; color: var(--black, #1a1a1a); font-weight: 400; }
.lm__tab-count { grid-column: 2; grid-row: 2; font-size: clamp(12px, 0.85vw, 14px); font-weight: 300; color: var(--grey-500, #6f6f6f); }
.lm__tab.is-active { background: var(--black, #1a1a1a); border-color: var(--black, #1a1a1a); }
.lm__tab.is-active .lm__tab-name { color: #fff; }
.lm__tab.is-active .lm__tab-count { color: rgba(255,255,255,.7); }

/* ---- Body: model lists (one per category, only active shown) + detail ---- */
.lm__body { display: grid; grid-template-columns: minmax(300px, 33%) 1fr; gap: 0; margin-top: clamp(16px, 1.6vw, 22px);
            border-top: 1px solid var(--grey-100, #ededee); }
.lm__lists { max-height: min(620px, 56vh); overflow-y: auto; overscroll-behavior: contain; padding: 6px clamp(14px, 1.6vw, 26px) 6px 0;
             border-right: 1px solid var(--grey-100, #ededee); scrollbar-width: thin; }
.lm__list { list-style: none; margin: 0; padding: 0; display: none; }
.lm__list.is-active { display: block; }
.lm__row { display: flex; align-items: center; gap: clamp(14px, 1.5vw, 22px); padding: clamp(10px, 1vw, 14px) clamp(10px, 1.2vw, 18px);
           border-bottom: 1px solid var(--grey-100, #ededee); cursor: pointer; text-decoration: none; }
.lm__list li:last-child .lm__row { border-bottom: 0; }
.lm__row.is-selected { border: 1px solid var(--grey-300, #c7c7c7); }
.lm__thumb { flex: 0 0 clamp(112px, 9vw, 150px); height: clamp(64px, 5vw, 84px); display: grid; place-items: center; }
.lm__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lm__row-info { display: flex; flex-direction: column; }
.lm__row-name { font-size: clamp(19px, 1.5vw, 26px); font-weight: 300; color: var(--black, #1a1a1a); line-height: 1.1; }
.lm__row-price { font-size: 15px; font-weight: 300; color: var(--black, #1a1a1a); margin-top: 4px; }
.lm__row-price b { font-weight: 700; color: var(--grey-700, #494949); }

/* ---- Detail pane ---- */
.lm__detail { padding: 6px 0 clamp(88px, 8vw, 172px) clamp(20px, 2.2vw, 40px); position: relative; overflow: visible; }

/* Smooth data loading: the current content stays visible until the new content
   is ready, which then fades/slides up (elements are recreated on every swap, so
   the animation replays each time — no JS needed to re-trigger it). */
@keyframes lmFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
    .lm__chips       { animation: lmFadeUp .34s var(--ease, cubic-bezier(.2,.7,.2,1)) both; }
    .lm__detail-text { animation: lmFadeUp .34s var(--ease, cubic-bezier(.2,.7,.2,1)) .05s both; }
    .lm__hero        { animation: lmFadeUp .40s var(--ease, cubic-bezier(.2,.7,.2,1)) .10s both; }
    .lm__list.is-active { animation: lmFadeUp .28s var(--ease, cubic-bezier(.2,.7,.2,1)) both; }
}
.lm__detail-grid { display: grid; grid-template-columns: 41% 1fr; align-items: start; column-gap: 20px; }
.lm__detail-text { position: relative; z-index: 2; }
.lm__chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.lm__chip { font-size: 14px; font-weight: 300; letter-spacing: -.02em; padding: 8px 15px; border: 1px solid var(--grey-200, #d6d6d6);
            color: var(--black, #1a1a1a); background: #fff; display: inline-flex; align-items: center; gap: 8px; }
.lm__chip.is-active { background: var(--grey-100, #ededee); border-color: var(--grey-200, #d6d6d6); color: var(--black, #1a1a1a); }
.lm__chip-fuel { font-size: 10px; font-weight: 300; letter-spacing: .05em; text-transform: uppercase; display: inline-flex;
                 align-items: center; gap: 3px; padding: 2px 7px 2px 5px; margin-left: 2px; }
.lm__chip-fuel svg { width: 12px; height: 12px; }
/* Vert assombri, sans toucher au fond ni à la teinte : #0a7d3c -> #096e35.
   ⚠️ Le fond réel n'est PAS #ededee : la puce pose son propre `rgba(10,125,60,.10)`
   PAR-DESSUS le #ededee de `.lm__chip.is-active`, ce qui donne rgb(214,226,220) —
   mesuré dans le navigateur. Contre ce fond-là, le vert d'origine ne fait que 3.93:1
   (et non 4.47) ; #096e35 donne 4.79:1, avec de la marge. */
.lm__chip-fuel--ev { color: #096e35; background: rgba(10,125,60,.10); }
/* Mêmes 10 px, même famille : les deux autres puces échouaient aussi contre leur fond
   réel — bleu 4.42:1, gris 4.29:1 (mesuré). Assombries au minimum : 4.70 et 4.74:1.
   ⛔ On ne prend PAS `var(--blue)` ici : ce token est la couleur de marque, elle sert
   partout ailleurs et n'a pas à bouger pour une puce de 10 px. */
.lm__chip-fuel--phev { color: #0062aa; background: rgba(0,102,177,.10); }
.lm__chip-fuel--hyb { color: #686868; background: var(--grey-100,#ededee); }

.lm__model { font-size: clamp(46px, 4.6vw, 84px); font-weight: 300; color: var(--black, #1a1a1a); line-height: .92; letter-spacing: -.02em; margin: 0; }
/* --grey-400 (#929292) échoue WCAG AA sur fond blanc à cette taille (3.11:1) ; --grey-500
   est déjà le prochain cran de la même échelle et sert au même usage plus haut (.lm__tab-count). */
.lm__year { font-size: clamp(16px, 1.3vw, 22px); color: var(--grey-500, #6f6f6f); font-weight: 300; margin: 8px 0 clamp(16px, 1.6vw, 22px); }
.lm__desc { font-size: 13.5px; font-weight: 300; line-height: 1.6; color: var(--black, #1a1a1a); max-width: 100%; margin: 0 0 34px;
            display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

/* Hover matches the BMW quick-search submit button (.btn): a darker layer slides
   up from the bottom, a float shadow, and the arrow nudges right. */
.lm__cta { display: inline-flex; align-items: center; gap: 40px; justify-content: space-between; background: var(--blue, #0066b1);
           color: #fff; font-size: 15px; font-weight: 300; letter-spacing: .04em; padding: 15px 22px; text-decoration: none; min-width: 230px;
           position: relative; overflow: hidden; isolation: isolate;
           transition: box-shadow .35s var(--ease, cubic-bezier(.2,.7,.2,1)); }
.lm__cta::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--blue-dark, #003d78);
                  transform: translateY(101%); transition: transform .42s var(--ease, cubic-bezier(.2,.7,.2,1)); }
.lm__cta:hover::after { transform: translateY(0); }
.lm__cta,
.lm__cta:hover,
.lm__cta:focus { color: #fff; text-decoration: none !important; }  /* white text, no UA underline on hover */
.lm__cta:hover { box-shadow: var(--shadow-float, 0 24px 60px -28px rgba(0,61,120,.35)); }
.lm__cta svg { flex: 0 0 auto; transition: transform .4s var(--ease, cubic-bezier(.2,.7,.2,1)); }
.lm__cta:hover svg { transform: translateX(5px); }

/* Hero: interior = 3:2 backdrop; car = constant size, bottom-left, overflows a bit
   (panel padding-bottom contains it). See prototype for the measured geometry. */
.lm__hero { position: relative; margin-right: calc(-1 * clamp(28px, 4vw, 72px)); }
.lm__hero-int { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; padding-right: 100px; }
.lm__hero-int img { width: 100%; height: 100%; object-fit: cover; object-position: center 42%; display: block; }
.lm__hero-ext { position: absolute; right: 35%; bottom: -42%; width: 94%; filter: drop-shadow(0 26px 34px rgba(0,0,0,.28)); }
.lm__hero-ext img { width: 100%; display: block; }

/* =====================================================================
   MOBILE DRILL-DOWN  (rendered in the header mobile overlay)
   L1 categories -> L2 models -> L3 detail (reuses @detail markup).
   ===================================================================== */
.lm-drill { position: relative; overflow: hidden; font-family: var(--font, "Helvetica Neue", Arial, sans-serif);
            border-top: 3px solid var(--brand-primary, var(--blue, #0066b1));
            transition: height .32s var(--ease, cubic-bezier(.2,.7,.2,1)); }
.lm-drill__viewport { display: flex; align-items: flex-start; width: 300%;
                      transition: transform .32s var(--ease, cubic-bezier(.2,.7,.2,1)); }
.lm-drill.is-l2 .lm-drill__viewport { transform: translateX(-33.333%); }
.lm-drill.is-l3 .lm-drill__viewport { transform: translateX(-66.666%); }
.lm-drill__panel { width: 33.333%; flex: 0 0 33.333%; }

.lm-drill__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--grey-100,#ededee); }
.lm-drill__back { width: 30px; height: 30px; display: grid; place-items: center; color: var(--black,#1a1a1a); background: none; border: 0; cursor: pointer; }
.lm-drill__title { font-size: 16px; font-weight: 300; color: var(--black,#1a1a1a); }
.lm-drill__sub { margin-left: auto; font-size: 13px; color: var(--grey-400,#929292); }

.lm-drill__cat { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--grey-100,#ededee);
                 position: relative; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; }
.lm-drill__cat::before { content:""; position:absolute; left:0; top:13px; bottom:13px; width:3px; background: var(--blue,#0066b1); }
.lm-drill__cat-name { font-size: 15px; font-weight: 300; color: var(--black,#1a1a1a); }
.lm-drill__cat-count { margin-left: auto; font-size: 13px; font-weight: 300; color: var(--grey-500,#6f6f6f); }
.lm-drill__chev { color: var(--grey-400,#929292); display: grid; place-items: center; }

.lm-drill__model { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--grey-100,#ededee);
                   text-decoration: none; cursor: pointer; }
.lm-drill__thumb { flex: 0 0 90px; height: 54px; display: grid; place-items: center; }
.lm-drill__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lm-drill__model-name { font-size: 17px; font-weight: 300; color: var(--black,#1a1a1a); }
.lm-drill__model-price { font-size: 12.5px; font-weight: 300; color: var(--black,#1a1a1a); }
.lm-drill__model-price b { font-weight: 700; color: var(--grey-700,#494949); }

/* L3 detail reuses @detail (.lm__* classes), restyled compact + stacked for mobile. */
.lm-drill__detail { padding: 4px 0 8px; }
.lm-drill__detail .lm__chips { padding: 16px 16px 0; margin-bottom: 14px; }
.lm-drill__detail .lm__chip { font-size: 12.5px; padding: 6px 11px; }
.lm-drill__detail .lm__detail-grid { display: block; }
.lm-drill__detail .lm__hero { margin: 0; }
.lm-drill__detail .lm__hero-int { display: none; }           /* mobile: single exterior shot */
.lm-drill__detail .lm__hero-ext { position: static; width: 100%; filter: none; }
.lm-drill__detail .lm__detail-text { padding: 0 16px 16px; }
.lm-drill__detail .lm__model { font-size: 40px; }
.lm-drill__detail .lm__year { font-size: 15px; margin: 4px 0 14px; }
.lm-drill__detail .lm__desc { font-size: 13px; margin-bottom: 20px; }
.lm-drill__detail .lm__cta { display: flex; width: 100%; }

/* ⭐ Bandeau de liens fixes en bas du méga-menu (réglage `lineup_menu_links`).
   Séparé du contenu par un filet, aligné sur le rythme de `.lm__inner`. Les tokens
   de marque sont repris avec un repli neutre : ce plugin sert 9 concessions. */
.lm__links {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(10px, 1.4vw, 26px);
    align-items: center;
    margin: clamp(14px, 1.4vw, 22px) 0 0;
    padding: clamp(12px, 1.2vw, 18px) 0 0;
    border-top: 1px solid var(--brand-border, #e3e3e5);
    list-style: none;
}
.lm__links li { margin: 0; }
.lm__links a {
    display: inline-block;
    font-size: clamp(13px, 0.9vw, 15px);
    font-weight: 400;
    line-height: 1.2;
    color: var(--brand-text, #1a1a1a);
    text-decoration: none;
    padding: 4px 0;
    border-bottom: 1px solid transparent;
    transition: border-color .16s ease, color .16s ease;
}
.lm__links a:hover,
.lm__links a:focus-visible {
    color: var(--brand-accent, #0066b1);
    border-bottom-color: currentColor;
}
