/* Report 72 - Webometrics region / country navigation.
   Desktop (>= 992px with a hovering pointer): stationary 80px bar, floating mega-menu panels (no layout shift: hover, focus
   and open states only change colour, shadow and transforms, never size). Everything else: an off-canvas drawer with
   accordion groups. Markup: resources/views/components/header-mega-menu.blade.php; behaviour: assets/js/wm-nav.js. */
:root {
    --wmn-navy: #003366;
    --wmn-navy-ink: #0b2f55;
    --wmn-bar-bg: #f2f2f2;
    --wmn-line: #dde3ea;
    --wmn-soft: #eef3f8;
    --wmn-muted: #5b6b7f;
    --wmn-ease: cubic-bezier(.2, .7, .2, 1);
}
.wmn-bar {
    padding: 0;
    margin: 0 auto;
    background: var(--wmn-bar-bg);
    /* no z-index: the site's page-loading overlay (#loader-wrapper, z-index 1000) covers the bar like the rest of the page.
       Panels are anchored to .wmn; an open one is raised to 990 (above the page content, below that overlay). */
}
.wmn, .wmn * { box-sizing: border-box; }
.wmn-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wmn ul { list-style: none; margin: 0; padding: 0; }
/* sm.min.css underlines every hovered / focused link with !important; the menu uses background and underline bars instead */
.wmn a, .wmn a:hover, .wmn a:focus { text-decoration: none !important; }
.wmn-burger { display: none; }

/* flags: fixed box (no shift); the image itself is only requested when its panel is about to open */
.wmn-flag.fi {
    display: inline-block; flex: none; width: 1.5rem; height: 1.125rem; line-height: 1; vertical-align: middle;
    background-size: cover; background-position: center; border-radius: 2px; background-color: #e9edf2;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}
.wmn-panel:not(.is-warm) .wmn-flag.fi { background-image: none !important; }

/* ---------------------------------------------------------------- panel content (shared) */
.wmn-panel__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .9rem; }
.wmn-panel__title { font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--wmn-navy); }
.wmn-panel__count { color: var(--wmn-muted); font-size: .85rem; }
.wmn-panel__all { margin-inline-start: auto; color: var(--wmn-navy); font-size: .9rem; font-weight: 600; border-radius: 4px; }
.wmn .wmn-panel__all:hover { text-decoration: underline !important; text-underline-offset: 3px; }
.wmn-country { break-inside: avoid; }
.wmn-country a {
    display: flex; align-items: center; gap: .6rem; padding: .42rem .55rem; border-radius: 6px;
    color: var(--wmn-navy-ink); line-height: 1.25; transition: background-color .12s;
}
.wmn-country a:hover { background: var(--wmn-soft); color: var(--wmn-navy); }
.wmn-country.is-current a { background: #e3ecf5; color: var(--wmn-navy); text-shadow: .35px 0 0 currentColor; }
.wmn a:focus-visible, .wmn button:focus-visible, .wmn-burger:focus-visible { outline: 2px solid var(--wmn-navy); outline-offset: -2px; }
.wmn-chevron { display: block; transition: transform .18s var(--wmn-ease); }
.wmn-item.is-open .wmn-chevron { transform: rotate(180deg); }

/* ================================================================ DESKTOP: mega menu */
@media (min-width: 992px) and (hover: hover) {
    /* the whole menu row is solid white from screen edge to screen edge: a white band drawn behind the bar and widened
       with a horizontal-only shadow (clip-path keeps it to the bar's height; shadows never cause horizontal scrolling).
       The bar is its own layer at 990: above the page content (so its dropdowns open over the page and the band covers the
       top bar's shadow) and below the page-loading overlay (#loader-wrapper, 1000). */
    .wmn-bar { position: relative; z-index: 990; background: #fff; }
    .wmn-bar::before {
        content: ""; position: absolute; inset: 0; z-index: -1; background: #fff;
        box-shadow: 0 0 0 100vmax #fff; clip-path: inset(0 -100vmax);
    }
    .wmn { position: relative; }
    .wmn-backdrop, .wmn-drawer__head { display: none !important; }
    .wmn-drawer, .wmn-drawer__body { display: flex; align-items: stretch; min-height: 80px; }
    .wmn-drawer__body { flex: 1; min-width: 0; }
    .wmn-list { display: flex; align-items: stretch; flex: 0 1 auto; min-width: 0; order: 1; }
    .wmn-item { position: static; }
    .wmn-tab { position: relative; display: flex; align-items: stretch; height: 80px; /* full bar height: text centred (equal space above and below), underline on the bar edge */ background: transparent; }
    .wmn-tab::after {
        content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: var(--wmn-navy);
        transform: scaleX(0); transition: transform .18s var(--wmn-ease);
    }
    .wmn-link {
        display: flex; align-items: center; padding: 0 .9rem; white-space: nowrap;
        text-transform: uppercase; color: var(--wmn-navy); border-radius: 0;
    }
    .wmn-item--mega .wmn-link { padding-inline-end: .35rem; }
    .wmn-toggle {
        display: flex; align-items: center; justify-content: center; width: 26px; padding: 0; margin: 0; margin-inline-end: .35rem;
        border: 0; background: transparent; color: var(--wmn-navy); cursor: pointer; border-radius: 4px;
    }
    /* hover / open / current: only the navy underline (no background, no border, no weight change) */
    .wmn-tab:hover::after, .wmn-item.is-open > .wmn-tab::after, .wmn-item.is-current > .wmn-tab::after, .wmn-item.is-current-parent > .wmn-tab::after { transform: scaleX(1); }

    /* the floating panel: below the bar, over the page, never in the flow */
    .wmn-panel {
        position: absolute; z-index: 990; top: 100%; inset-inline: 0;
        visibility: hidden; opacity: 0; transform: translateY(-6px); pointer-events: none;
        transition: opacity .16s ease, transform .18s var(--wmn-ease), visibility 0s linear .18s;
    }
    .wmn-item.is-open > .wmn-panel {
        visibility: visible; opacity: 1; transform: none; pointer-events: auto;
        transition: opacity .16s ease, transform .18s var(--wmn-ease), visibility 0s;
    }
    .wmn-panel__inner {
        background: #fff; border: 1px solid var(--wmn-line); border-top: 3px solid var(--wmn-navy);
        border-radius: 0 0 12px 12px; overflow: hidden;
        box-shadow: 0 24px 48px -16px rgba(0, 32, 64, .30), 0 6px 14px rgba(0, 32, 64, .08);
    }
    .wmn-panel__head { padding: 1rem 1.5rem .8rem; border-bottom: 1px solid #edf1f5; }
    .wmn-panel__scroll {
        max-height: max(220px, calc(100vh - var(--wmn-top, 150px) - 90px));
        overflow-y: auto; overscroll-behavior: contain; padding: .75rem 1rem 1.1rem; scrollbar-width: thin;
    }
    .wmn-countries { columns: 200px 5; column-gap: 1rem; }
    /* short lists (5 countries or fewer, e.g. North America): one row at natural width, names on one line */
    .wmn-countries--row { columns: auto; display: flex; flex-wrap: wrap; gap: 0 1rem; }
    .wmn-countries--row .wmn-country { flex: 0 0 auto; min-width: 200px; }
    .wmn-countries--row .wmn-country__name { white-space: nowrap; }
    /* without JavaScript the panels still open on hover / keyboard focus */
    .wmn:not(.wmn--js) .wmn-item--mega:hover > .wmn-panel,
    .wmn:not(.wmn--js) .wmn-item--mega:focus-within > .wmn-panel { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition: none; }
    .wmn-list:first-of-type { margin-inline-end: 1rem; }
}
/* small desktops and laptops (992-1199px, container 960px): compact tabs so everything stays on one line */
@media (min-width: 992px) and (max-width: 1199.98px) and (hover: hover) {
    .wmn-link { padding: 0 .45rem; font-size: .9em; /* 18px: two px under the 20px menu text elsewhere */ }
    .wmn-item--mega .wmn-link { padding-inline-end: 0; }
    .wmn-toggle { width: 20px; margin-inline-end: .15rem; }
    .wmn-list:first-of-type { margin-inline-end: .25rem; }
}

/* ================================================================ MOBILE + TABLET: drawer */
@media not all and (min-width: 992px) and (hover: hover) {
    .wmn-bar { background: transparent; }
    .wmn-burger {
        display: inline-flex; align-items: center; justify-content: center; align-self: center; width: 44px; height: 44px;
        margin: -8px .5rem -8px 0; margin-inline: 0 .5rem; /* 44px tap target without making the top bar taller */
        padding: 0; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer;
    }
    .wmn-burger:hover { background: rgba(255, 255, 255, .12); }
    .wmn-burger:focus-visible { outline-color: #fff; outline-offset: 2px; }
    /* hidden by CSS alone (not by the script), so nothing appears in the page and then disappears while it loads */
    .wmn-drawer {
        position: fixed; z-index: 1060; top: 0; bottom: 0; inset-inline-end: 0; width: min(420px, 100vw);
        display: flex; flex-direction: column; background: #fff; box-shadow: -12px 0 40px rgba(0, 32, 64, .25);
        visibility: hidden; transform: translateX(100%);
        transition: transform .26s var(--wmn-ease), visibility 0s linear .26s;
    }
    [dir="rtl"] .wmn-drawer { transform: translateX(-100%); box-shadow: 12px 0 40px rgba(0, 32, 64, .25); }
    .wmn.is-drawer-open .wmn-drawer { visibility: visible; transform: none; transition: transform .26s var(--wmn-ease), visibility 0s; }
    .wmn-backdrop {
        position: fixed; inset: 0; z-index: 1055; background: rgba(0, 26, 51, .45);
        opacity: 0; transition: opacity .26s ease;
    }
    .wmn-backdrop[hidden] { display: block; visibility: hidden; pointer-events: none; }
    .wmn.is-drawer-open .wmn-backdrop { opacity: 1; }
    .wmn-drawer__head {
        display: flex; align-items: center; justify-content: space-between; flex: none; min-height: 60px; padding: 0 .5rem 0 1rem;
        padding-inline: 1rem .5rem; background: var(--wmn-navy); color: #fff;
    }
    .wmn-drawer__title { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
    .wmn-drawer__close {
        display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
        border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer;
    }
    .wmn-drawer__close:focus-visible { outline-color: #fff; }
    .wmn-drawer__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 2rem; }
    .wmn:not(.wmn--js) .wmn-drawer__head { display: none; }
    .wmn-item { border-bottom: 1px solid #edf1f5; }
    .wmn-tab { display: flex; align-items: stretch; }
    .wmn-link {
        flex: 1; display: flex; align-items: center; min-height: 52px; padding: .25rem 1rem;
        color: var(--wmn-navy); font-weight: 600; text-transform: uppercase;
    }
    .wmn-item.is-current > .wmn-tab .wmn-link, .wmn-item.is-current-parent > .wmn-tab .wmn-link { box-shadow: inset 4px 0 0 var(--wmn-navy); }
    [dir="rtl"] .wmn-item.is-current > .wmn-tab .wmn-link, [dir="rtl"] .wmn-item.is-current-parent > .wmn-tab .wmn-link { box-shadow: inset -4px 0 0 var(--wmn-navy); }
    .wmn-toggle {
        flex: none; display: flex; align-items: center; justify-content: center; width: 56px; padding: 0;
        border: 0; border-inline-start: 1px solid #edf1f5; background: transparent; color: var(--wmn-navy); cursor: pointer;
    }
    .wmn-toggle .wmn-chevron { width: 14px; height: 14px; }
    .wmn:not(.wmn--js) .wmn-toggle, .wmn:not(.wmn--js) .wmn-panel { display: none; }
    .wmn-panel { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .24s var(--wmn-ease), visibility 0s linear .24s; }
    .wmn-item.is-open > .wmn-panel { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .24s var(--wmn-ease), visibility 0s; }
    .wmn-panel__inner { min-height: 0; overflow: hidden; background: #f7f9fb; }
    .wmn-panel__head { padding: .75rem 1rem .25rem; }
    .wmn-panel__title { display: none; }
    .wmn-panel__scroll { padding: .25rem .5rem 1rem; }
    .wmn-countries { columns: 2 150px; column-gap: .25rem; }
    .wmn-country a { min-height: 44px; }
    html.wmn-locked, html.wmn-locked body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .wmn *, .wmn-drawer, .wmn-backdrop { transition-duration: 0s !important; transition-delay: 0s !important; }
    .wmn-panel { transform: none !important; }
}

/* ================================================================ BREADCRUMBS (owner request, Report 72)
   Styling only: same markup, links and text. No dashed line under the trail (the template sets it inline, hence !important);
   18px (two px under the 20px menu text); Home and earlier steps in a lighter link blue without underline
   (#1a66b8 on #f2f2f2 = 5.16:1, WCAG AA), underlined on hover / focus; the current step stays dark navy (11.26:1). */
nav[aria-label="breadcrumb"] { border-bottom: 0 !important; }
nav[aria-label="breadcrumb"] .breadcrumb { font-size: 18px; }
nav[aria-label="breadcrumb"] .breadcrumb-item, nav[aria-label="breadcrumb"] .breadcrumb-item a { font-size: 18px; }
nav[aria-label="breadcrumb"] .breadcrumb-item a { color: #1a66b8 !important; text-decoration: none !important; }
nav[aria-label="breadcrumb"] .breadcrumb-item a:hover { text-decoration: underline !important; text-underline-offset: 3px; }
nav[aria-label="breadcrumb"] .breadcrumb-item a:focus-visible { outline: 2px solid #1a66b8; outline-offset: 2px; border-radius: 2px; text-decoration: underline !important; }
nav[aria-label="breadcrumb"] .breadcrumb-item.active { color: var(--wmn-navy); }
/* phones and small tablets: one tidy line. The template's p-3 link padding is removed; Home, the country and "Rankings" keep
   their full text, a long middle step (e.g. a university name) is shortened with "…" (its full name stays in the page title). */
@media (max-width: 767.98px) {
    nav[aria-label="breadcrumb"] .breadcrumb { flex-wrap: nowrap; align-items: center; min-width: 0; margin-bottom: .75rem; font-size: 15px; line-height: 1.4; }
    nav[aria-label="breadcrumb"] .breadcrumb-item, nav[aria-label="breadcrumb"] .breadcrumb-item a { font-size: 15px; }
    nav[aria-label="breadcrumb"] .breadcrumb-item { display: flex; align-items: center; flex: 0 0 auto; min-width: 0; white-space: nowrap; }
    nav[aria-label="breadcrumb"] .breadcrumb-item::before { flex: none; }
    nav[aria-label="breadcrumb"] .breadcrumb-item a { display: block; padding: .5rem 0 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    /* only the step just before the current one (a university name on a profile) may shorten; Home, country, current stay whole */
    nav[aria-label="breadcrumb"] .breadcrumb-item:nth-last-child(2):not(:first-child) { flex: 0 1 auto; }
    nav[aria-label="breadcrumb"] .breadcrumb-item.active { padding-block: .5rem; }
}
