:root {
    --color-bg: #ffffff;
    --color-ink: #10151f;
    --color-ink-muted: #5b6472;
    --color-black: #000000;
    --color-border: #e2e5eb;
    --header-height: 56px;
    --content-max: 900px;
    --header-max: 1920px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

html {
    font-size: clamp(14px, 4vw, 16px);
    background: var(--color-black);
}

body {
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-ink);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ---------- Header ---------- */

/* Safe-area padding keeps nav content clear of the iOS status bar while the
   black header background still bleeds up behind it (viewport-fit=cover +
   black-translucent status bar style). */
.site-header {
    flex: 0 0 auto;
    position: relative;
    z-index: 50;
    background: var(--color-black);
    color: #fff;
    padding-top: env(safe-area-inset-top, 0px);
}

.site-header__bar {
    max-width: var(--header-max);
    margin: 0 auto;
    height: var(--header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-header__logo {
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-header__logo-mark {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.site-header__logo-text {
    font-family: Arial Narrow, "Helvetica Neue Condensed", Arial, sans-serif;
    font-weight: 900;
    font-style: italic;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    transform: skewX(-4deg);
    white-space: nowrap;
    color: #fff;
}

.site-header__utility {
    display: none;
    align-items: center;
    min-width: 0;
    gap: 6px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.primary-nav__utility {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-switch__icon {
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.lang-switch__item {
    font-size: 0.62rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 2px solid transparent;
    padding: 6px 4px 8px;
}

.lang-switch__item:hover {
    color: #fff;
}

.lang-switch__item.is-active {
    color: #fff;
    border-bottom-color: #fff;
}

.account-link {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.75);
}

.account-link:hover {
    color: #fff;
}

.primary-nav__list {
    list-style: none;
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.primary-nav__list a,
.quick-nav__list a {
    display: block;
    padding: 8px 10px;
    font-weight: 400;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.primary-nav__list a:hover,
.quick-nav__list a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.primary-nav__list a.is-active,
.quick-nav__list a.is-active {
    color: #fff;
    border-bottom-color: #fff;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Mobile quick-nav (Scores / Standings / My Team) ---------- */

.quick-nav {
    display: none;
}

.quick-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

/* ---------- Page body ---------- */

.page-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
}

.page-container {
    max-width: var(--content-max);
    margin: 0 auto;
    background: #ffffff;
    padding: 24px 16px;
}

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

.site-footer {
    flex: 0 0 auto;
    background: var(--color-black);
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.site-footer__name {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 8px 16px 2px;
    font-size: 0.75rem;
    font-weight: 400;
    color: #fff;
}

.site-footer__copyright {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 16px 8px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.55);
}

/* ---------- Mobile (<768px) ---------- */

@media (max-width: 767px) {
    .site-header__bar {
        padding: 0 10px;
        gap: 6px;
    }

    .nav-toggle {
        display: flex;
        width: 24px;
        height: 24px;
    }

    .quick-nav {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        margin-left: 6px;
        margin-right: 8px;
    }

    .quick-nav__list li {
        flex: 1 1 auto;
        min-width: 0;
    }

    .quick-nav__list a {
        padding: 8px 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Absolute (not fixed) off .site-header: iOS standalone PWA does not
       render position:fixed reliably inside body{height:100vh;overflow:hidden}.
       top:100% sits below the header's safe-area padding automatically. */
    .primary-nav {
        position: absolute;
        top: 100%;
        left: auto;
        right: 0;
        width: 70%;
        background: var(--color-black);
        max-height: 0;
        overflow: hidden;
        border-top: 0 solid rgba(255, 255, 255, 0.08);
        border-left: 0 solid rgba(255, 255, 255, 0.08);
        transition: max-height 0.2s ease, border-top-width 0.2s ease;
    }

    .primary-nav.is-open {
        max-height: 70vh;
        overflow-y: auto;
        border-top-width: 1px;
        border-left-width: 1px;
    }

    .primary-nav__list {
        flex-direction: column;
        padding: 0;
        gap: 0;
    }

    .primary-nav__list a {
        padding: 14px 16px;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    /* Pinned items already show in .quick-nav — don't repeat them in the dropdown */
    .primary-nav .nav-item--pinned {
        display: none;
    }
}

/* ---------- Desktop (>=768px) ---------- */

@media (min-width: 768px) {
    .site-header__bar {
        display: grid;
        grid-template-columns: 15% 70% 15%;
        gap: 0;
    }

    .primary-nav {
        display: flex;
        justify-content: flex-end;
    }

    .site-header__utility {
        display: flex;
        justify-content: flex-start;
    }

    /* Desktop shows .site-header__utility instead — this copy is only for the mobile dropdown */
    .primary-nav__utility {
        display: none;
    }
}
