/* =========================================================================
 * TDW Mobile Menu — slide-stack panel system
 *
 * Panels mounted on #main-menu (Magnific drawer root) — they fill it 100%
 * via inset:0 so they cover everything (search bar, tabs, content list).
 *
 * Bunden: vi tilføjer padding-bottom på listen lig env(safe-area-inset-bottom)
 * + buffer, så iOS Safari's bundnavigation ikke dækker sidste kategori.
 * ========================================================================= */

/* ---- Entry buttons (replaces accordion-item triggers) ------------------ */

.tdw-mm-entry {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 18px 20px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: inherit;
    font-size: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-align: left;
    transition: background-color .15s;
}
.tdw-mm-entry:hover,
.tdw-mm-entry:focus-visible {
    background: rgba(255,255,255,0.04);
}
.tdw-mm-entry-label { flex: 1 1 auto; }
.tdw-mm-entry-chevron {
    color: rgba(255,255,255,0.5);
    font-size: 22px;
    line-height: 1;
    margin-left: 12px;
}

/* ---- Panel ------------------------------------------------------------ */

.tdw-mm-panel {
    /* position: fixed sammen med inset: 0 sikrer at panelet altid dækker
       hele viewport — uanset om mfp drawer er kortere end indholdet,
       om iOS Safari's bundnav er der, osv. z-index: 1100 er over
       Magnific Popup's mfp-wrap (1043) så vi kommer ovenpå sidebaren. */
    position: fixed;
    inset: 0;
    background: #111;
    color: #fff;
    transform: translateX(100%);
    /* Bemærk visibility i transition-listen: visibility har normalt ingen
       overgang og skifter øjeblikkeligt. Ved at bruge 0s duration + .28s
       delay i default-state, holdes panelet synligt under exit-animationen
       og skiftes først til hidden EFTER transform er færdig. */
    transition: transform .28s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear .28s;
    visibility: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1100;
    overflow: hidden;
}
.tdw-mm-panel.is-active {
    transform: translateX(0);
    visibility: visible;
    /* I active state har visibility 0s delay → instant visible, så enter-
       animationen kører fra fuldt synligt panel. */
    transition: transform .28s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0s;
}

/* Panel header — three-column grid (back | title | spacer) */
.tdw-mm-panel-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;     /* back fylder venstre 1fr,
                                                title auto i midten,
                                                spacer 1fr højre */
    align-items: center;
    gap: 12px;
    padding: 18px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    min-height: 56px;
    box-sizing: border-box;
}
.tdw-mm-back {
    appearance: none;
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 10px;
    margin: -8px 0 -8px -10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    transition: background-color .12s;
    white-space: nowrap;
    justify-self: start;     /* venstrejusteret i sin grid-celle */
}
.tdw-mm-back:hover { background: rgba(255,255,255,0.06); }
.tdw-mm-back-chevron {
    font-size: 22px;
    line-height: 1;
    color: rgba(255,255,255,0.65);
}
.tdw-mm-back-text {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
}
.tdw-mm-panel-title {
    margin: 0;
    grid-column: 2;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: center;
}

/* Close button — far right of header */
.tdw-mm-close {
    appearance: none;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.7);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    margin: -4px -10px -4px 0;
    border-radius: 4px;
    transition: background-color .12s, color .12s;
    justify-self: end;
    grid-column: 3;
}
.tdw-mm-close:hover,
.tdw-mm-close:focus-visible {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* List inside panel — scrolls if content overflows.
   padding-bottom håndterer iOS Safari's bottom UI safe-area + en buffer. */
.tdw-mm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-bottom: calc( 24px + env(safe-area-inset-bottom, 0px) );
    overflow-y: auto;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.tdw-mm-item { margin: 0; padding: 0; }

.tdw-mm-link,
.tdw-mm-link-drilldown {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: 0;
    color: inherit;
    text-decoration: none;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background-color .15s;
}
.tdw-mm-link:hover,
.tdw-mm-link-drilldown:hover,
.tdw-mm-link:focus-visible,
.tdw-mm-link-drilldown:focus-visible {
    background: rgba(255,255,255,0.05);
    color: inherit;
}

.tdw-mm-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.tdw-mm-text { flex: 1 1 auto; min-width: 0; word-break: break-word; }

.tdw-mm-count {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.65);
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    font-weight: 600;
}

.tdw-mm-chevron {
    color: rgba(255,255,255,0.5);
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 4px;
}

/* "Se alle X" link top of every non-root panel */
.tdw-mm-item-shop-all {
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.tdw-mm-link-shop-all {
    color: rgba(255,255,255,0.85);
    font-style: italic;
    font-weight: 500;
}


/* When a panel is active, hide Magnific Popup's own close (×) button on
   the drawer — our panel header has its own × that closes the popup. */
body.tdw-mm-active .mfp-wrap .mfp-close {
    display: none !important;
}

/* ---- Accordion (expandable section in panel) -------------------------- *
 * Bruges når en cat har children — header er en knap der toggler is-open.
 * Sub-listen expander inline med smooth animation (grid-rows trick:
 * grid-template-rows: 0fr → 1fr animerer pænt uden at vi behøver kende
 * exact højde, og med overflow:hidden på inner container klippes indhold
 * korrekt mens det animerer).
 * ---------------------------------------------------------------------- */

.tdw-mm-item-accordion {
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tdw-mm-item-accordion:last-child { border-bottom: 0; }

.tdw-mm-link-accordion {
    /* override .tdw-mm-link's bottom border — accordion item handles its own */
    border-bottom: 0 !important;
    padding: 16px 20px;
    gap: 14px;
}

/* Større thumb til sektion-billeder fra Menu Builder */
.tdw-mm-thumb-large {
    width: 50px;
    height: 50px;
    border-radius: 8px;
}

/* Accordion-toggle chevron — peger højre, roterer 90° ned ved expand */
.tdw-mm-chevron-toggle {
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
}
.tdw-mm-link-accordion[aria-expanded="true"] .tdw-mm-chevron-toggle {
    transform: rotate(90deg);
}

/* Sublist-wrap: collapsing container brug grid-rows trick.
   Default: 0fr (kollapset). is-open: 1fr (expanded). Animérbart. */
.tdw-mm-sublist-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tdw-mm-sublist-wrap.is-open {
    grid-template-rows: 1fr;
}
.tdw-mm-sublist-wrap > .tdw-mm-sublist {
    overflow: hidden;     /* så indhold klippes mens grid-row animerer */
    min-height: 0;        /* grid-rule for at 0fr faktisk kan være 0 */
}

/* Sub-items inde i accordion — indrykket, lidt blødere tekst */
.tdw-mm-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(255,255,255,0.02);
}
.tdw-mm-item-sub > .tdw-mm-link-sub,
.tdw-mm-item-shop-all-sub > .tdw-mm-link-shop-all-sub {
    padding-left: 36px;          /* indryk ift. accordion-header */
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 400;
}
.tdw-mm-item-sub:last-of-type > .tdw-mm-link-sub {
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* "Gå til X" link nederst i accordion */
.tdw-mm-item-shop-all-sub > .tdw-mm-link-shop-all-sub {
    color: rgba(255,255,255,0.7);
    font-style: italic;
    font-weight: 500;
}