/* ==========================================================================
   Hire Minds Academy — Global site navbar
   Markup: resources/views/frontend/layouts/header.blade.php
   Loaded site-wide via layouts/common-css. Self-contained (own tokens).
   ========================================================================== */

:root {
    --hm-gold-2: #F6B72B;
    --hm-gold-dark: #C6851A;
    --hm-brown: #2A1D14;
    --hm-shadow-md: 0 14px 40px rgba(42, 29, 20, .12);
    --hm-shadow-lg: 0 30px 70px rgba(42, 29, 20, .18);
    --hm-ease: cubic-bezier(.22, .7, .2, 1);
}

.hm-navbar {
    position: fixed;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    /* The same edge as the page's content — see the width tokens in style.css.
       The pill used to stop at 1180 while the pages ran to 1320 and the home
       page to 1140, so the logo lined up with nothing below it. */
    width: min(var(--hm-width, 1600px), calc(100% - 2 * var(--hm-gutter, 16px)));
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 12px 10px 20px;
    background: #843D21;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 999px;
    box-shadow: var(--hm-shadow-md);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    transition: top .3s var(--hm-ease), transform .38s var(--hm-ease), background .3s var(--hm-ease), box-shadow .3s var(--hm-ease);
    will-change: transform;
}

/* Hidden state — slides up out of view on scroll-down (toggled by navbar.js). */
.hm-navbar--hidden {
    transform: translate(-50%, calc(-100% - 44px));
    pointer-events: none;
}
/* 
.hm-navbar.is-scrolled {
    top: 12px;
    background: rgba(28, 19, 12, .92);
    box-shadow: var(--hm-shadow-lg);
} */

.hm-navbar__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.hm-navbar__logo img {
    height: 50px;
    width: auto;
    display: block;
}

.hm-navbar__menu {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 16px;
}

.hm-navbar__links {
    display: flex;
    align-items: center;
    /* Spread the items out to use the empty space either side — but only as far
       as there is space to spare. With seven items ("Placement Readiness" is the
       longest) a fixed 40px broke every label onto two lines inside the bar. */
    gap: clamp(14px, 2vw, 40px);
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.hm-navbar__links a {
    display: inline-block;
    padding: 9px 16px;
    padding-left:0px !important;
    color: rgba(255, 255, 255, .82);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 999px;
    /* A label is one line: the bar is a fixed-width pill, so a wrapped item
       makes the whole bar two rows tall. */
    white-space: nowrap;
}

/* The tight desktop band: wide enough that the menu is still the full bar, not
   wide enough for seven roomy items AND the "Let's Talk" button — which used to
   be squeezed out of the pill between roughly 992px and 1200px. */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .hm-navbar__links { gap: 8px; }
    .hm-navbar__links a { font-size: 14.5px; padding-right: 8px; }
    .hm-navbar__cta { padding: 5px 10px; font-size: 14.5px; gap: 6px; }
    /* Sized the way the full-size chip is — by its own font-size and padding,
       never width/height, which fight that padding and crop the arrow. */
    .hm-navbar__cta i { font-size: 13px; padding: 9px; }
}

.hm-navbar__links a:hover,
.hm-navbar__links a:focus-visible,
.hm-navbar__links a.active {
    color: #F9B11D;
    /* NOT font-weight: 700. Bold glyphs are wider than medium ones, so raising
       the weight on hover re-measured the text, grew the link and shoved every
       link after it sideways — the judder you feel sweeping across the bar.
       Doubling a hairline shadow in the text's own colour thickens the strokes
       to the same effect while leaving the metrics untouched, so nothing can
       reflow. Paint only, no layout. */
    text-shadow: 0 0 .55px currentColor, 0 0 .55px currentColor;
}

.hm-navbar__cta {
  display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    color: var(--hm-brown);
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    white-space: nowrap;
    background: white;
    /* background: linear-gradient(135deg, var(--hm-gold-2), var(--hm-gold-dark)); */
    border-radius: 999px;
}
/* 
.hm-navbar__cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(233, 163, 32, .45);
    color: var(--hm-brown);
} */

.hm-navbar__cta i {
       font-size: 16px;
    background: #000;
    color: white;
    border-radius: 50%;
    padding: 11px;
    border: 1px solid black;
}

.hm-navbar__cta:hover i {
    transform: translateX(3px);
}

.hm-navbar__toggle {
    display: none;
    margin-left: auto;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, .10);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

/* Tablet & below — collapse to a hamburger dropdown */
@media (max-width: 991.98px) {
    .hm-navbar__toggle {
        display: inline-flex;
    }

    .hm-navbar__menu {
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 16px;
        background: rgba(28, 19, 12, .97);
        border-radius: 22px;
        box-shadow: var(--hm-shadow-lg);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity .25s var(--hm-ease), transform .25s var(--hm-ease);
    }

    .hm-navbar.is-open .hm-navbar__menu {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .hm-navbar__links {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        margin: 0;
    }

    .hm-navbar__links a {
        padding: 12px 16px;
    }

    .hm-navbar__cta {
        justify-content: center;
        margin-top: 6px;
    }
}

/* ============================== COURSES MEGA MENU ============================== */
/* Relative so the panel anchors to the Courses item (opens under it, not full width). */
/* Holds the label and the caret on one line, and anchors the dropdown panel. */
.hm-nav-item--mega {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.hm-mega-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    color: rgba(255, 255, 255, .82);
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: color .2s;
}
/* The label is now an <a> living inside .hm-navbar__links, so it already picks
   up that link styling — colour, size, weight and the shared hover. The rule
   below only trims the right padding so the caret sits beside the word rather
   than 16px away. It is written as .hm-navbar__links a.hm-mega-toggle because
   the plain .hm-mega-toggle selector loses to .hm-navbar__links a on
   specificity, and the padding would never apply. */
.hm-navbar__links a.hm-mega-toggle {
    padding-right: 2px !important;
    text-decoration: none;
}

.hm-mega-toggle:hover,
.hm-mega-toggle:focus-visible,
.hm-mega-toggle.active,
.hm-nav-item--mega.is-open .hm-mega-toggle {
    color: #F9B11D;
    /* Same reason as .hm-navbar__links a — see the note there. */
    text-shadow: 0 0 .55px currentColor, 0 0 .55px currentColor;
}

/* The caret is its own control: the label navigates, this opens the panel. */
.hm-mega-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 10px 9px 2px;
    color: rgba(255, 255, 255, .82);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color .25s var(--hm-ease);
}

.hm-mega-caret:hover,
.hm-mega-caret:focus-visible,
.hm-nav-item--mega.is-open .hm-mega-caret {
    color: #F9B11D;
}
.hm-mega-toggle__caret {
    font-size: 11px;
    transition: transform .25s var(--hm-ease);
}
.hm-nav-item--mega.is-open .hm-mega-toggle__caret { transform: rotate(180deg); }

.hm-mega {
    position: absolute;
    top: calc(100% + 16px);
    left: 0;
    right: auto;
    width: 44rem;
    max-width: calc(100vw - 32px);
    z-index: 1001;
    padding: 24px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(42, 29, 20, .22);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity .25s var(--hm-ease), transform .25s var(--hm-ease), visibility .25s;
}
/* Click-to-open (the caret sets .is-open) — kept global because the mobile
   stack relies on it too. */
.hm-nav-item--mega.is-open .hm-mega {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Hover-to-open — desktop only. On mobile the panel is an inline max-height
   accordion, so hovering it makes no sense and could half-open it. */
@media (min-width: 992px) {
    .hm-nav-item--mega:hover .hm-mega,
    .hm-nav-item--mega:focus-within .hm-mega {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Invisible bridge over the 16px gap between the label and the panel, so the
       pointer can travel from one to the other without crossing a dead strip
       that would close it. */
    .hm-nav-item--mega::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        height: 18px;
    }

    /* Caret rotates on hover too, so it stays in step with the panel. */
    .hm-nav-item--mega:hover .hm-mega-toggle__caret,
    .hm-nav-item--mega:focus-within .hm-mega-toggle__caret { transform: rotate(180deg); }
}

.hm-mega__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* gap: 28px; */
}
.hm-mega__col .hm-mega__thumb img{
    display: block;
    line-height: 0;
    /* border-radius: 10px; */
    overflow: hidden;
}
.hm-mega__thumb img {
    width: 100%;
    height: 78px;
    object-fit: cover;
    display: block;
    transition: transform .4s var(--hm-ease);
}
.hm-mega__thumb:hover img { transform: scale(1.05); }
.hm-mega__title {
    margin: 16px 0 12px;
    font-size: 1.06rem;
    font-weight: 800;
    color: #14100C;
}
.hm-mega__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.hm-mega__list a {
    display: block;
    padding: 7px 0;
    color: #4A4741;
    font-size: .95rem;
    font-weight: 500;
    text-decoration: none;
    transition: color .18s, padding-left .18s;
}
.hm-mega__list a:hover {
    color: #F9B11D;
    padding-left: 4px;
}
.hm-mega__list a.is-featured {
    color: #F9B11D;
    font-weight: 700;
}

/* Tablet & below — collapse the mega panel inline inside the mobile menu */
@media (max-width: 991.98px) {
    /* The item is an inline-flex ROW: label, caret, panel. On desktop that is
       fine because the panel is absolutely positioned and out of flow — but
       here it turns static, joins the row as a third item and gets squeezed
       into a sliver beside the caret. Wrapping the row fixes it: label + caret
       on line one, panel full width on line two. */
    .hm-nav-item--mega {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
    }

    .hm-mega-toggle {
        flex: 1 1 auto;
        width: auto;
        justify-content: flex-start;
        padding: 12px 16px;
    }

    /* Caret pushed to the far edge — a big, obvious target for the panel. */
    .hm-mega-caret {
        flex: 0 0 auto;
        margin-left: auto;
        padding: 12px 14px;
    }

    .hm-mega {
        flex: 0 0 100%;
        position: static;
        width: 100%;
        max-width: none;
        opacity: 1;
        visibility: hidden;
        transform: none;
        pointer-events: auto;
        padding: 0 12px;
        overflow: hidden;
        background: rgba(255, 255, 255, .05);
        border-radius: 14px;
        box-shadow: none;
        /* 0fr → 1fr animates to the content's real height, so a long category
           list is never clipped the way a fixed max-height cap clipped it. */
        display: grid;
        grid-template-rows: 0fr;
        transition:
            grid-template-rows .32s var(--hm-ease),
            padding .32s var(--hm-ease),
            visibility .32s;
    }

    .hm-mega > .hm-mega__grid { min-height: 0; overflow: hidden; }

    .hm-nav-item--mega.is-open .hm-mega {
        visibility: visible;
        grid-template-rows: 1fr;
        padding: 12px;
        margin-top: 8px;
    }

    .hm-mega__grid { grid-template-columns: 1fr 1fr; gap: 16px; }
    .hm-mega__thumb { display: none; }
    .hm-mega__title { margin-top: 0; color: #fff; font-size: .95rem; }
    .hm-mega__list a { color: rgba(255, 255, 255, .8); }
    .hm-mega__list a:hover,
    .hm-mega__list a.is-featured { color: #F9B11D; }
}

/* Phone navigation: keep the fixed bar comfortable under device safe areas and
   make every control a full-width, thumb-friendly target. */
@media (max-width: 575.98px) {
    .hm-navbar {
        top: max(10px, env(safe-area-inset-top));
        width: calc(100% - 20px);
        gap: 10px;
        padding: 8px 10px 8px 14px;
        border-radius: 22px;
    }

    .hm-navbar__logo img { height: 38px; }

    .hm-navbar__toggle {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    .hm-navbar__menu {
        top: calc(100% + 8px);
        max-height: calc(100vh - 82px - env(safe-area-inset-bottom));
        overflow-y: auto;
        padding: 12px;
        border-radius: 18px;
    }

    .hm-navbar__links a,
    .hm-mega-toggle {
        min-height: 46px;
        display: flex;
        align-items: center;
        padding: 12px 14px;
    }

    .hm-mega-caret {
        min-width: 46px;
        min-height: 46px;
        padding: 10px;
    }

    /* Full-width so it is a comfortable thumb target, but sized like a button
       rather than a slab: fixed height, label and arrow kept on one line and
       centred as a pair, and a shadow so the white pill lifts off the dark
       menu panel instead of reading as a blank white bar. */
    .hm-navbar__cta {
        display: flex;
        width: 100%;
        justify-content: center;
        align-items: center;
        gap: 10px;
        margin-top: 10px;
        padding: 0 18px;
        min-height: 48px;
        font-size: 15px;
        letter-spacing: .01em;
        border-radius: 999px;
        white-space: nowrap;
        box-shadow: 0 10px 22px rgba(0, 0, 0, .22);
    }

    /* A fixed circle instead of a padded glyph. Padding on an inline <i> scales
       with its font size, which is what made the arrow bubble larger than the
       label sitting next to it. */
    .hm-navbar__cta i {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 28px;
        height: 28px;
        padding: 0;
        font-size: 12px;
        line-height: 1;
    }

    /* One department per row — two columns of category names are unreadable at
       this width. Each department reads as its own labelled group. */
    .hm-mega__grid { grid-template-columns: 1fr; gap: 0; }

    .hm-mega__col + .hm-mega__col {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, .12);
    }

    .hm-mega__title {
        margin-bottom: 4px;
        font-size: .72rem;
        letter-spacing: .1em;
        text-transform: uppercase;
        color: #F9B11D;
    }

    /* Thumb-sized rows, and long category names wrap instead of overflowing. */
    .hm-mega__list a {
        display: flex;
        align-items: center;
        min-height: 40px;
        padding: 6px 8px;
        border-radius: 8px;
        font-size: .9rem;
        line-height: 1.35;
    }
    .hm-mega__list a:hover,
    .hm-mega__list a:active { padding-left: 8px; background: rgba(255, 255, 255, .06); }
}
