/* Header nav with the Courses mega menu: components/header-nav-megamenu.blade.php */

/* ===== Desktop (>=992px) ===== */
.hnm-links { display: none; }

/* Below 992px only the off-canvas drawer is used: take a zero-height row of its own so the
   header's logo and mobile icons keep their space-between layout */
@media (max-width: 991.98px) {
    .hnm { flex-basis: 100%; }
}

@media (min-width: 992px) {
    /* Three columns so the links sit on the page centre line; logo and buttons hug the edges */
    #header .hnm-shell { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: 18px; }
    #header .hnm-shell > .navbar-brand { justify-self: start; }
    #header .hnm-shell > .scoial-icon-list { justify-self: end; }

    .hnm-links {
        display: flex; align-items: center; gap: clamp(18px, calc(4.6vw - 29px), 34px);
        margin: 0; padding: 0; list-style: none;
        font-size: 14px; font-weight: 600; color: #3E4143; white-space: nowrap;
    }
    .hnm-drawer { display: none; }
}

/* Small laptops: seven items only fit with tighter spacing */
@media (min-width: 992px) and (max-width: 1179.98px) {
    .hnm-links { gap: clamp(12px, calc(4.6vw - 35px), 34px); }
    #header .hnm-shell { column-gap: 12px; }
}

.hnm-dd { display: flex; }

.hnm-trigger {
    display: flex; align-items: center; gap: 4px;
    padding: 0; border: 0; background: none;
    font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer;
    transition: color 150ms ease-out;
}
.hnm-trigger:hover, .hnm-dd.is-open .hnm-trigger, .hnm-link:not(.hnm-ai):hover { color: #3B82F6; }
.hnm-live:hover, .hnm-mlink.hnm-mlink-live:hover { color: #1E40AF; background: #DBEAFE; }
.hnm-trigger:focus-visible, .hnm-link:focus-visible, .hnm-panel a:focus-visible, .hnm-cats .hnm-cat:focus-visible { outline: 2px solid #3B82F6; outline-offset: 2px; }
.hnm-car { display: inline-block; transition: transform 150ms ease-out; }
.hnm-dd.is-open .hnm-car { transform: rotate(180deg); }

.hnm-link { color: inherit; text-decoration: none; transition: color 150ms ease-out; }
/* The aurora's overflow clip needs a box: on an inline link its blobs tint the neighbouring links.
   Block, not inline-block, which would sit the clipped box on the text baseline and lift it */
.hnm-link.hnm-ai { display: block; }
/* The aurora's lighten blend needs a white backdrop to tint only the text. iOS Safari puts the
   drawer's scrolling content on its own transparent layer once a submenu makes it overflow, and
   the blobs then fill the whole link; isolating the link over its own white keeps the backdrop */
.hnm-ai { isolation: isolate; background: #fff; }

.hnm-live { display: flex; align-items: center; gap: 6px; padding: 6px 10px; margin: -6px 0; }
.hnm-live, .hnm-mlink.hnm-mlink-live { border-radius: 8px; background: #EFF6FF; color: #1E40AF; transition: background-color 150ms ease-out; }
.hnm-count {
    display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: #3B82F6; color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: 0; font-variant-numeric: tabular-nums;
}

/* Panels hang under the navbar, aligned to their trigger (--hnm-x set by the script) */
.hnm-panel {
    display: none; position: absolute; z-index: 1030; top: calc(100% + 4px); left: var(--hnm-x, 16px);
    background: #fff; border: 1px solid #E4E8EB; border-radius: 12px; box-shadow: 0 16px 40px rgba(16, 17, 18, .08);
    white-space: normal; font-weight: 500; color: #1C1D1F; text-align: left;
}
/* Invisible bridge over the gap so moving from trigger to panel doesn't close it */
.hnm-panel::before { content: ''; position: absolute; left: 0; right: 0; top: -24px; height: 24px; }
.hnm-dd.is-open .hnm-panel { display: block; }

.hnm-row {
    display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 8px;
    color: #1C1D1F; text-decoration: none; transition: background-color 150ms ease-out;
}
.hnm-row:hover { background: #F5F9FF; color: #1C1D1F; }
.hnm-row-plain { font-size: 14px; font-weight: 600; }

/* Free and Success Stories menus and the mega menu's left pane share the category row */
.hnm-dd.is-open .hnm-iconlist { display: flex; }
.hnm-iconlist { width: 372px; flex-direction: column; gap: 4px; padding: 12px; background: #F7F9FA; }

.hnm-cat {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent;
    background: none; font: inherit; text-align: left; color: #1C1D1F; text-decoration: none; transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.hnm-cat.is-on, .hnm-iconlist .hnm-cat:hover, .hnm-iconlist .hnm-cat:focus-visible,
.hnm-acc-body .hnm-cat:hover, .hnm-acc-body .hnm-cat:focus-visible { background: #fff; border-color: #E4E8EB; color: #1C1D1F; }
.hnm-cat-ic {
    flex: none; width: 40px; height: 40px; border-radius: 8px;
    display: grid; place-items: center; background: #EBF2FE; color: #2F68C5;
}
.hnm-cat-text { flex: 1; min-width: 0; }
.hnm-cat-text b { display: block; font-size: 15px; line-height: 20px; font-weight: 700; transition: color 150ms ease-out; }
.hnm-cat-text small { display: block; margin-top: 1px; font-size: 13px; line-height: 17px; color: #54585B; }
.hnm-cat-ic .bi { font-size: 20px; line-height: 1; }
.hnm-cat.is-on b, .hnm-iconlist .hnm-cat:hover b, .hnm-acc-body .hnm-cat:hover b { color: #2F68C5; }
.hnm-chev { font-size: 20px; line-height: 1; color: #9DA3A7; transition: color 150ms ease-out; }
.hnm-cat.is-on .hnm-chev { color: #3B82F6; }

/* Courses mega menu: categories left, the selected category's programs right */
.hnm-mega { width: min(1040px, calc(100vw - 32px)); }
.hnm-dd.is-open .hnm-mega { display: grid; grid-template-columns: 296px minmax(0, 1fr); }
.hnm-cats {
    display: flex; flex-direction: column; gap: 4px; padding: 12px;
    background: #F7F9FA; border-right: 1px solid #E4E8EB; border-radius: 12px 0 0 12px;
}
.hnm-panes { padding: 20px 24px; }
.hnm-pane { display: none; }
.hnm-pane.is-on { display: block; }
/* "See all" sits top right; the heading and description flow into the first column */
.hnm-pane-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; }
.hnm-pane-head .hnm-see-all {
    grid-area: 1 / 2; align-self: start; font-size: 14px; line-height: 24px; font-weight: 600;
    text-decoration: none; white-space: nowrap;
}
.hnm-pane-head .hnm-see-all:hover { color: #1E40AF; text-decoration: underline; }
.hnm-pane-head b { display: block; font-size: 18px; line-height: 24px; font-weight: 700; }
.hnm-pane-head span { display: block; margin-top: 2px; font-size: 14px; line-height: 20px; color: #54585B; }

.hnm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; margin-top: 14px; }
.hnm-item {
    display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px;
    color: #1C1D1F; text-decoration: none; transition: background-color 150ms ease-out;
}
.hnm-item:hover, .hnm-mitem:hover { background: #F5F9FF; color: #1C1D1F; }
.hnm-item img, .hnm-thumb {
    display: block; flex: none; width: 112px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #EBF2FE;
}
.hnm-grid.is-small .hnm-item img, .hnm-grid.is-small .hnm-thumb { width: 72px; }
.hnm-item-text { min-width: 0; }
.hnm-item-text b {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: 14px; line-height: 19px; font-weight: 700; transition: color 150ms ease-out;
}
.hnm-item:hover b, .hnm-mitem:hover b { color: #2F68C5; }
.hnm-item-text small {
    display: block; margin-top: 3px; font-size: 13px; line-height: 17px; color: #54585B;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.hnm-tag {
    display: flex; align-items: center; gap: 5px; margin-bottom: 4px;
    font-style: normal; font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #2F68C5;
}
.hnm-tag i { width: 6px; height: 6px; border-radius: 50%; background: #3B82F6; }
.hnm-tag.is-soon { color: #54585B; }
.hnm-tag.is-soon i { background: #9DA3A7; }

/* ===== Mobile drawer (<992px) ===== */
.hnm-drawer { --bs-offcanvas-width: min(380px, 92vw); }
.hnm-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #EEF0F2;
}
.hnm-drawer-title { font-size: 16px; font-weight: 700; color: #1C1D1F; }
.hnm-drawer-body { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.hnm-drawer-foot {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #EEF0F2; background: #fff;
}

.hnm-acc { border-bottom: 1px solid #EEF0F2; }
.hnm-acc summary, .hnm-mlink {
    display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 8px;
    font-size: 15px; font-weight: 700; color: #1C1D1F; text-decoration: none; cursor: pointer; list-style: none;
}
.hnm-mlink { border-bottom: 1px solid #EEF0F2; }
.hnm-acc summary::-webkit-details-marker { display: none; }
.hnm-acc summary::after {
    content: '▾'; margin-left: auto; color: #9DA3A7; transition: transform 150ms ease-out;
}
/* An expanded menu is blue, caret included, like its open desktop trigger */
.hnm-acc[open] summary, .hnm-acc[open] summary::after { color: #3B82F6; }
.hnm-acc[open] summary::after { transform: rotate(180deg); }
/* A filled pill instead of a divided row, as on desktop */
.hnm-mlink.hnm-mlink-live { margin: 4px 0; border-bottom: 0; }
/* An expanded menu looks like its desktop panel: grey card, with Courses' chips as the desktop
   categories (selected one on white) and the programs on a white pane */
.hnm-acc-body {
    display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 12px 8px;
    background: #F7F9FA; border: 1px solid #E4E8EB; border-radius: 12px;
}
.hnm-acc-body .hnm-row { min-height: 44px; justify-content: center; }

.hnm-chips { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 8px; }
.hnm-chip {
    height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 16px; background: none;
    font: inherit; font-size: 13px; font-weight: 600; color: #3E4143; cursor: pointer;
}
.hnm-chip[aria-pressed="true"] { border-color: #E4E8EB; background: #fff; color: #2F68C5; }
.hnm-chip-pane {
    display: flex; flex-direction: column; gap: 2px; padding: 8px;
    background: #fff; border: 1px solid #E4E8EB; border-radius: 8px;
}
.hnm-chip-pane[hidden] { display: none; }
.hnm-mitem {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px; border-radius: 8px;
    color: #1C1D1F; text-decoration: none; transition: background-color 150ms ease-out;
}
.hnm-mitem img { flex: none; width: 56px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: #EBF2FE; }
.hnm-mitem .hnm-item-text b { -webkit-line-clamp: 2; }
.hnm-see-all { color: #2F68C5; }

@media (prefers-reduced-motion: reduce) {
    .hnm-car, .hnm-acc summary::after, .hnm-trigger, .hnm-cat, .hnm-item, .hnm-mitem, .hnm-row { transition: none; }
}
