/*
 * File: public_html/public/assets/css/public-shell.css
 * Info: Shared theme-aware header and footer styling for all guest-facing MAC Learning Network pages.
 */

.mln-header.mln-public-shell-header {
    position: sticky;
    z-index: 1000;
    top: 0;
    width: 100%;
    border-bottom: 1px solid var(--mln-border);
    background:
        color-mix(
            in srgb,
            var(--mln-bg) 88%,
            transparent
        );
    box-shadow:
        0 10px 30px rgba(2, 6, 23, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

body.mln-public-nav-open {
    width: 100%;
    overscroll-behavior: none;
}

body.mln-public-nav-open::before {
    content: "";
    position: fixed;
    z-index: 999;
    inset: 70px 0 0;
    background: rgba(2, 6, 23, 0.46);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

:root[data-theme="light"]
body.mln-public-nav-open::before {
    background: rgba(15, 23, 42, 0.2);
}

.mln-public-shell-header-inner {
    position: relative;
    display: flex;
    gap: 1.2rem;
    align-items: center;
    width: min(100% - 2.5rem, 1320px);
    min-height: 76px;
    margin-inline: auto;
}

.mln-public-shell-brand {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 0.75rem;
    align-items: center;
    color: var(--mln-text);
    text-decoration: none;
}

.mln-public-shell-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    background:
        linear-gradient(
            145deg,
            var(--mln-accent),
            var(--mln-accent-strong)
        );
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 850;
    letter-spacing: 0.02em;
    box-shadow:
        0 12px 28px rgba(14, 165, 233, 0.24);
}

.mln-public-shell-brand-copy {
    display: grid;
    min-width: 0;
}

.mln-public-shell-brand-copy strong {
    color: var(--mln-text);
    font-size: 0.96rem;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
}

.mln-public-shell-brand-copy small {
    margin-top: 0.12rem;
    color: var(--mln-text-soft);
    font-size: 0.69rem;
    line-height: 1.3;
    white-space: nowrap;
}

.mln-public-shell-nav {
    display: flex;
    flex: 1 1 auto;
    gap: 0.2rem;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.mln-public-shell-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.58rem 0.72rem;
    border: 1px solid transparent;
    border-radius: var(--mln-radius-pill);
    color: var(--mln-text-soft);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition:
        color 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease,
        transform 160ms ease;
}

.mln-public-shell-nav-link:hover {
    border-color: var(--mln-border);
    background: var(--mln-bg-soft);
    color: var(--mln-text);
    transform: translateY(-1px);
}

.mln-public-shell-nav-link.is-active,
.mln-public-shell-nav-link[aria-current="page"] {
    border-color: rgba(14, 165, 233, 0.26);
    background: var(--mln-accent-soft);
    color: var(--mln-accent);
}

.mln-public-shell-mobile-only {
    display: none;
}

.mln-public-shell-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.65rem;
    align-items: center;
}

.mln-public-shell-login,
.mln-public-shell-courses-button {
    white-space: nowrap;
}

.mln-public-shell-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--mln-border);
    border-radius: 14px;
    background: var(--mln-surface);
    color: var(--mln-text);
    font-size: 1rem;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        transform 160ms ease;
}

.mln-public-shell-icon-button:hover {
    border-color: rgba(14, 165, 233, 0.42);
    background: var(--mln-accent-soft);
    transform: translateY(-1px);
}

.mln-public-shell-menu-button {
    display: none;
}

.mln-footer.mln-public-shell-footer {
    margin-top: 0;
    border-top: 1px solid var(--mln-border);
    background:
        linear-gradient(
            145deg,
            var(--mln-bg-alt),
            var(--mln-bg)
        );
    color: var(--mln-text);
}

.mln-public-shell-footer-inner {
    display: grid;
    grid-template-columns:
        minmax(0, 1.35fr)
        repeat(3, minmax(170px, 0.65fr));
    gap: 2rem;
    width: min(100% - 2.5rem, 1280px);
    margin-inline: auto;
    padding: 3.5rem 0 2.6rem;
}

.mln-public-shell-footer-column {
    min-width: 0;
}

.mln-public-shell-footer-title {
    color: var(--mln-text);
    font-size: 1.15rem;
    font-weight: 850;
    line-height: 1.3;
}

.mln-public-shell-footer-heading {
    margin-bottom: 0.95rem;
    color: var(--mln-text);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.3;
    text-transform: uppercase;
}

.mln-public-shell-footer-text {
    margin: 0.85rem 0 0;
    color: var(--mln-text-soft);
    font-size: 0.83rem;
    line-height: 1.75;
}

.mln-public-shell-footer-text strong {
    color: var(--mln-text);
    font-weight: 750;
}

.mln-public-shell-footer-link {
    display: block;
    width: fit-content;
    margin-top: 0.7rem;
    color: var(--mln-text-soft);
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.45;
    text-decoration: none;
    transition:
        color 160ms ease,
        transform 160ms ease;
}

.mln-public-shell-footer-link:hover {
    color: var(--mln-accent);
    transform: translateX(3px);
}

.mln-public-shell-footer-bottom {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 2.5rem, 1280px);
    margin-inline: auto;
    padding: 1.2rem 0 1.5rem;
    border-top: 1px solid var(--mln-border);
    color: var(--mln-text-soft);
    font-size: 0.76rem;
    line-height: 1.5;
}

/* Mobile: up to 599px */
@media (max-width: 599px) {
    .mln-public-shell-header-inner {
        gap: 0.65rem;
        width: min(100% - 1.25rem, 1320px);
        min-height: 70px;
    }

    .mln-public-shell-logo {
        width: 43px;
        height: 43px;
        border-radius: 14px;
        font-size: 0.85rem;
    }
    
    .mln-public-shell-brand {
        gap: 0.55rem;
    }

    .mln-public-shell-brand-copy {
        max-width: 158px;
    }
    
    .mln-public-shell-brand-copy strong {
        max-width: 100%;
        overflow: hidden;
        font-size: 0.78rem;
        line-height: 1.25;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .mln-public-shell-brand-copy small {
        display: block;
        max-width: 100%;
        margin-top: 0.12rem;
        overflow: hidden;
        font-size: 0.57rem;
        line-height: 1.25;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mln-public-shell-nav {
        position: absolute;
        z-index: 1002;
        top: calc(100% + 0.55rem);
        right: 0;
        left: 0;
        display: none;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
        align-items: stretch;
        max-height: calc(100dvh - 92px);
        padding: 0.7rem;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 1px solid var(--mln-border);
        border-radius: 20px;
        background: rgba(15, 23, 42, 0.98);
        box-shadow:
            0 24px 60px rgba(2, 6, 23, 0.3);
    }

    :root[data-theme="light"]
    .mln-public-shell-nav {
        border-color: rgba(148, 163, 184, 0.45);
        background: rgba(255, 255, 255, 0.98);
        box-shadow:
            0 24px 60px rgba(15, 23, 42, 0.18);
    }

    .mln-public-shell-nav.mln-nav--open {
        display: grid;
    }

    .mln-public-shell-nav::before {
        content: "Student and Tutor Access";
        grid-column: 1 / -1;
        order: 2;
        margin-top: 0.15rem;
        padding: 0.65rem 0.35rem 0.25rem;
        border-top: 1px solid var(--mln-border);
        color: var(--mln-text-soft);
        font-size: 0.68rem;
        font-weight: 850;
        letter-spacing: 0.09em;
        line-height: 1.3;
        text-transform: uppercase;
    }

    .mln-public-shell-nav
    > .mln-public-shell-nav-link:nth-child(-n + 6) {
        order: 1;
    }

    .mln-public-shell-nav
    > .mln-public-shell-nav-link:nth-child(n + 7) {
        order: 3;
    }

    .mln-public-shell-nav-link {
        width: 100%;
        min-height: 46px;
        justify-content: flex-start;
        padding: 0.7rem 0.75rem;
        border-radius: 12px;
        font-size: 0.82rem;
        line-height: 1.35;
        white-space: normal;
    }

    .mln-public-shell-nav-link:hover {
        transform: none;
    }

    .mln-public-shell-nav-link.is-active,
    .mln-public-shell-nav-link[aria-current="page"] {
        border-color: rgba(14, 165, 233, 0.32);
        background: var(--mln-accent-soft);
    }

    .mln-public-shell-mobile-only {
        display: inline-flex;
        border-color: var(--mln-border);
        background: var(--mln-bg-soft);
    }

    .mln-public-shell-login,
    .mln-public-shell-courses-button {
        display: none;
    }

    .mln-public-shell-actions {
        margin-left: auto;
    }

    .mln-public-shell-icon-button {
        width: 40px;
        height: 40px;
        border-radius: 13px;
    }

    .mln-public-shell-menu-button {
        display: inline-flex;
    }

    .mln-public-shell-footer-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
        width: min(100% - 1.5rem, 1280px);
        padding: 2.8rem 0 2.2rem;
    }

    .mln-public-shell-footer-bottom {
        align-items: flex-start;
        flex-direction: column;
        width: min(100% - 1.5rem, 1280px);
    }
}

/* Tablet: 600px to 1023px */
@media (min-width: 600px) and (max-width: 1023px) {
    .mln-public-shell-header-inner {
        width: min(100% - 2rem, 1320px);
    }

    .mln-public-shell-nav {
        position: absolute;
        top: calc(100% + 0.55rem);
        right: 0;
        left: 0;
        display: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
        padding: 1rem;
        border: 1px solid var(--mln-border);
        border-radius: 20px;
        background: var(--mln-card);
        box-shadow: var(--mln-shadow-strong);
    }

    .mln-public-shell-nav.mln-nav--open {
        display: grid;
    }

    .mln-public-shell-nav-link {
        justify-content: flex-start;
        padding: 0.8rem 0.9rem;
        border-radius: 13px;
    }

    .mln-public-shell-mobile-only {
        display: inline-flex;
    }

    .mln-public-shell-login {
        display: none;
    }

    .mln-public-shell-menu-button {
        display: inline-flex;
    }

    .mln-public-shell-footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: min(100% - 2rem, 1280px);
    }

    .mln-public-shell-footer-bottom {
        width: min(100% - 2rem, 1280px);
    }
}

/* Desktop/Laptop: 1024px and above */
@media (min-width: 1024px) {
    .mln-public-shell-nav {
        display: flex !important;
    }

    .mln-public-shell-menu-button {
        display: none;
    }
}