/* Header/footer matching learn.mcirn.com's real site (mb2nl Moodle theme) —
   hand-authored and scoped entirely under .moodle-header / .moodle-footer so
   it can never affect the rest of this app's own theme.css. Colors, fonts,
   nav links, footer content, and the icon glyphs are taken directly from the
   live site; the underlying page-builder theme itself (its ~2MB compiled
   stylesheet, Bootstrap, and Moodle's own AMD-module JS for the mega-menu)
   was not imported wholesale — that would risk leaking global resets/utility
   classes onto every other page here. Interactivity (mobile toggle, Online
   Ed. dropdown) is reimplemented in plain JS — see moodle-nav.js.
*/

.moodle-header {
    background: var(--color-primary);
    position: relative;
    z-index: 20;
}

/* The navy background itself (.moodle-header, above) spans the full
   browser width, but the actual content — logo/nav/button — sits in a
   centered boxed container, matching mcirn.com: confirmed from a real
   screenshot that the content doesn't reach the true viewport edges. */
.moodle-header-inner {
    position: relative;
    /* Higher than .moodle-hero-content's z-index: 1 — they're siblings
       under .moodle-header, and without this the "Online Ed." dropdown
       (nested in here, position:absolute) loses to the hero heading text
       on tied z-index + later DOM order, bleeding through the dropdown. */
    z-index: 2;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.85rem 7.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Photo hero merged with the nav bar — matches mcirn.com/all-events/: the
   nav sits transparently over a photo+gradient block that continues down
   through a page heading, with rounded bottom corners on the whole thing.
   Opt-in per page via $heroTitle (see templates/public/layout.php) — pages
   without a hero (activity detail, payment flow, etc.) keep the plain solid
   navy header above, unaffected by any of this.

   This wrap is an absolutely-positioned background layer behind the nav
   and hero content (its own siblings in the DOM, not its children) rather
   than a container they sit inside. The nav's "Online Ed." dropdown is
   position:absolute with its own border-radius/box-shadow; nesting it
   inside an overflow:hidden + border-radius ancestor caused Chromium to
   corrupt the paint where the dropdown's rounded corners crossed the
   hero wrap's clip mask (ghosted/doubled text on some dropdown items). */
.moodle-hero-photo-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 0 0 50px 50px;
    z-index: 0;
}

.moodle-hero-photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.moodle-hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4.5rem;
    text-align: center;
    color: #fff;
}

.moodle-hero-content h1 {
    margin: 0 0 0.5rem;
    font-size: 2.4rem;
}

.moodle-hero-content p {
    margin: 0;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.88);
}

@media (max-width: 600px) {
    .moodle-hero-photo-wrap {
        border-radius: 0 0 30px 30px;
    }

    .moodle-hero-content {
        padding: 2rem 1.25rem 3rem;
    }

    .moodle-hero-content h1 {
        font-size: 1.7rem;
    }
}

.moodle-header-logo {
    display: block;
    flex-shrink: 0;
    line-height: 0;
}

.moodle-header-logo img {
    height: 42px;
    width: auto;
}

.moodle-header-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: auto;
}

/* Fixed value, not margin-left:auto — auto greedily claims 100% of the
   free space, which jammed nav+Contact Us together with almost no gap
   between them. mcirn.com's actual proportions (measured from a real
   screenshot): a sizeable-but-not-total gap after the logo, then nav items,
   then a much smaller gap before Contact Us. */
.moodle-header-nav {
    margin-left: 6rem;
}

.moodle-nav-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.6rem;
    margin: 0;
    padding: 0;
}

.moodle-nav-list > li {
    position: relative;
}

.moodle-nav-list > li > a,
.moodle-nav-toggle-sub {
    color: #fff;
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0;
}

.moodle-nav-list > li > a:hover,
.moodle-nav-toggle-sub:hover,
.moodle-nav-item-has-dropdown.is-open > .moodle-nav-toggle-sub {
    text-decoration: none;
    opacity: 0.8;
}

.moodle-nav-toggle-sub i {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.moodle-nav-item-has-dropdown.is-open .moodle-nav-toggle-sub i {
    transform: rotate(180deg);
}

.moodle-nav-dropdown {
    list-style: none;
    margin: 0;
    padding: 0.4rem 0;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    display: none;
    z-index: 30;
}

.moodle-nav-item-has-dropdown.is-open .moodle-nav-dropdown {
    display: block;
}

.moodle-nav-dropdown a {
    display: block;
    padding: 0.55rem 1rem;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 400;
}

.moodle-nav-dropdown a:hover {
    background: #f2f6fa;
    text-decoration: none;
}

.moodle-header-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.moodle-header-contact-btn {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: var(--color-primary);
    border-radius: 999px;
    padding: 0.55rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.moodle-header-contact-btn:hover {
    background: var(--color-gold);
    color: var(--color-primary);
    text-decoration: none;
}

/* Scales down the fixed 6rem nav gap on laptop-width screens so the row
   doesn't get tight/overflow before the mobile layout (900px) kicks in. */
@media (max-width: 1300px) {
    .moodle-header-nav {
        margin-left: 2rem;
    }
}

@media (max-width: 900px) {
    .moodle-header-inner {
        padding: 0.85rem 1.25rem;
    }

    .moodle-header-toggle {
        display: inline-block;
        order: 3;
    }

    .moodle-header-nav {
        flex-basis: 100%;
        order: 4;
        display: none;
    }

    .moodle-header.is-menu-open .moodle-header-nav {
        display: block;
    }

    .moodle-nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 0.5rem 0 1rem;
    }

    .moodle-nav-list > li {
        width: 100%;
    }

    .moodle-nav-list > li > a,
    .moodle-nav-toggle-sub {
        width: 100%;
        padding: 0.6rem 0;
    }

    .moodle-nav-dropdown {
        position: static;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.06);
        border-radius: 0;
        padding-left: 1rem;
        min-width: 0;
        width: 100%;
    }

    .moodle-nav-dropdown a {
        color: #fff;
    }

    .moodle-nav-dropdown a:hover {
        background: rgba(255, 255, 255, 0.12);
    }

    .moodle-header-tools {
        order: 2;
        margin-left: auto;
    }

    .moodle-header-contact-btn {
        padding: 0.45rem 1rem;
        font-size: 0.85rem;
    }
}

/* ---- Footer ---- */

.moodle-footer {
    font-size: 0.9rem;
    color: var(--color-text);
}

.moodle-footer-top,
.moodle-footer-middle,
.moodle-footer-bottom {
    background: #f2f6fa;
    border-top: 1px solid #dddddd;
}

.moodle-footer-top-inner,
.moodle-footer-middle-inner,
.moodle-footer-bottom-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.moodle-footer-top-inner {
    justify-content: space-between;
}

.moodle-footer-logo {
    height: 34px;
    width: auto;
}

.moodle-footer-nav {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
    margin: 0;
    padding: 0;
}

.moodle-footer-nav a {
    color: rgb(23, 44, 85);
    font-weight: 600;
    font-size: 0.95rem;
}

.moodle-footer-nav a:hover {
    text-decoration: underline;
}

.moodle-footer-middle-inner {
    justify-content: space-between;
}

.moodle-footer-university img {
    height: 44px;
    width: auto;
}

.moodle-footer-contact {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.moodle-footer-contact li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #000;
}

.moodle-footer-contact i {
    color: #000;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.moodle-footer-bottom-inner {
    justify-content: space-between;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.moodle-footer-disclaimer {
    flex: 2;
    min-width: 280px;
    margin: 0;
    font-size: 0.72rem;
    color: rgb(96, 96, 96);
    line-height: 1.5;
}

.moodle-footer-copyright {
    flex: 1;
    min-width: 200px;
    margin: 0;
    text-align: right;
    color: var(--color-text);
    font-size: 0.85rem;
}

@media (max-width: 700px) {
    .moodle-footer-top-inner,
    .moodle-footer-middle-inner,
    .moodle-footer-bottom-inner {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .moodle-footer-copyright {
        text-align: left;
    }
}
