/* AGL site header — single source of truth (linked from includes/header.php) */

.agl-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* Sponsor strip — above main nav, right-aligned logos */
.agl-header-sponsors {
    background: linear-gradient(180deg, #f4f8f5 0%, #fafcfa 100%);
    border-bottom: 1px solid #e8efe9;
}

.agl-header-sponsors-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6px 18px;
    display: flex;
    justify-content: flex-end;
}

.agl-sponsor-strip {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px 14px;
}

.agl-sponsor-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 44px;
    max-width: 130px;
}

.agl-sponsor-item a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    border-radius: 6px;
    transition: opacity 0.2s, transform 0.2s;
}

.agl-sponsor-item a:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.agl-sponsor-item a:focus-visible {
    outline: 2px solid #1f5f3b;
    outline-offset: 2px;
}

.agl-sponsor-item img {
    display: block;
    max-width: 100%;
    max-height: 44px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.agl-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
}

.agl-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
    flex: 1 1 auto;
}

.agl-brand img {
    width: 56px;
    height: auto;
    flex-shrink: 0;
}

.agl-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.agl-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f5f3b;
    line-height: 1.2;
}

.agl-subtitle {
    font-size: 12px;
    color: #666;
}

/* Hamburger — hidden on desktop */
.agl-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #d8e8dc;
    border-radius: 8px;
    background: #ffffff;
    color: #1f5f3b;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.agl-menu-toggle:hover {
    background: #eef7ee;
    border-color: #1f5f3b;
}

.agl-menu-toggle:focus-visible {
    outline: 2px solid #1f5f3b;
    outline-offset: 2px;
}

.agl-menu-bars,
.agl-menu-bars::before,
.agl-menu-bars::after {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
    transition: transform 0.2s, opacity 0.2s, top 0.2s;
}

.agl-menu-bars::before,
.agl-menu-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.agl-menu-bars::before {
    top: -6px;
}

.agl-menu-bars::after {
    top: 6px;
}

.agl-menu-toggle[aria-expanded="true"] .agl-menu-bars {
    background: transparent;
}

.agl-menu-toggle[aria-expanded="true"] .agl-menu-bars::before {
    top: 0;
    transform: rotate(45deg);
}

.agl-menu-toggle[aria-expanded="true"] .agl-menu-bars::after {
    top: 0;
    transform: rotate(-45deg);
}

/* Nav */
.agl-nav {
    display: flex;
    align-items: center;
    gap: 8px 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.agl-nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.agl-nav a {
    text-decoration: none;
    color: #1f5f3b;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 15px;
    white-space: nowrap;
}

.agl-nav a:hover {
    background: #eef7ee;
}

.agl-nav .nav-btn {
    background: #1f5f3b;
    color: #ffffff !important;
}

.agl-nav .nav-btn:hover {
    background: #17462c;
}

.agl-nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    color: #444;
    padding: 6px 10px;
    border-right: 1px solid #ddd;
    margin-right: 2px;
    max-width: 220px;
    text-align: right;
    min-width: 0;
}

.user-pill strong {
    font-size: 13px;
    color: #1f5f3b;
}

.user-pill strong a {
    padding: 0;
    font-weight: 700;
}

.user-pill strong a:hover {
    background: transparent;
    text-decoration: underline;
}

.user-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.user-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 0;
}

.next-match {
    font-size: 12px;
    color: #1f5f3b;
    font-weight: 600;
    white-space: nowrap;
}

.weather-line {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 280px;
    line-height: 1.35;
}

/* Mobile backdrop */
.agl-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 999;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.agl-nav-backdrop.is-visible {
    display: block;
}

body.agl-nav-open {
    overflow: hidden;
}

/* Sponsor strip — compact on small tablets */
@media (max-width: 768px) {
    .agl-header-sponsors-inner {
        padding: 5px 14px;
    }

    .agl-sponsor-item {
        height: 32px;
        max-width: 88px;
    }

    .agl-sponsor-item img {
        max-height: 32px;
    }

    .agl-sponsor-strip {
        gap: 8px 10px;
    }
}

/* ——— Mobile (hamburger) ——— */
@media (max-width: 768px) {
    .agl-header-inner {
        flex-wrap: nowrap;
        padding: 10px 14px;
    }

    .agl-brand {
        flex: 1 1 auto;
    }

    .agl-brand img {
        width: 48px;
    }

    .agl-title {
        font-size: 17px;
    }

    .agl-subtitle {
        font-size: 11px;
    }

    .agl-menu-toggle {
        display: inline-flex;
    }

    .agl-nav {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 14px 16px;
        background: #ffffff;
        border-bottom: 1px solid #e5e5e5;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
        max-height: calc(100vh - 72px);
        overflow-y: auto;
        z-index: 1001;
    }

    .agl-nav.is-open {
        display: flex;
    }

    .agl-header-inner {
        position: relative;
    }

    .agl-nav-links {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 2px;
        padding-bottom: 8px;
        border-bottom: 1px solid #eee;
    }

    .agl-nav-links a {
        width: 100%;
        text-align: left;
        white-space: normal;
    }

    .agl-nav-user {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

    .user-pill {
        align-items: flex-start;
        text-align: left;
        border-right: none;
        margin-right: 0;
        max-width: none;
        padding: 4px 0;
    }

    .user-stack {
        align-items: flex-start;
    }

    .weather-line {
        max-width: none;
        flex-wrap: wrap;
    }

    .agl-nav .nav-btn {
        width: 100%;
        text-align: center;
        margin-top: 4px;
    }
}

/* Hide sponsor strip on narrow phones so hamburger row stays clean */
@media (max-width: 520px) {
    .agl-header-sponsors {
        display: none;
    }
}
