/* Prevent any child width calculation from overflowing */
.footer-container {
    background: var(--gradient-main);
    border-top: 0.125rem solid var(--highlight-colour);
    display: flex;
    flex-direction: column;
    width: 100%;

    padding: 0.75rem 1rem 1rem;

    row-gap: 2rem;
    font-size: 0.875rem;
    box-sizing: border-box;       /* 🚀 FIX */
    overflow-x: hidden;           /* 🚀 Safety net */
}

.footer-top {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;

    width: 100%;
    padding-bottom: 0.25rem;
    box-sizing: border-box;       /* 🚀 */
}

.footer-bottom {
    display: flex;
    justify-content: center;      /* 🚀 Avoids spreading too wide */
    align-items: center;
    flex-wrap: wrap;

    width: 100%;
    max-width: 100%;              /* 🚀 Prevent overflow with flex */
    gap: 1.5rem;                /* ~10px */
    padding-top: 0.25rem;
    box-sizing: border-box;       /* 🚀 */
}

.footer-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    text-align: center;

    max-width: 100%;              /* 🚀 Never exceed container */
    flex-shrink: 1;               /* 🚀 Shrink safely */
}

/* Text + links */
.footer-item p,
.footer-item a {
    color: white;
    font-size: 0.875rem;
    /* text-decoration: none; */
    margin: 0;
    transition: color 0.2s ease;
}

.footer-item a:hover {
    color: var(--highlight-colour);
}

/* Ref code */
.footer-item-refcode p {
    color: white;
    font-size: 0.875rem;
    margin: 0;
}

.footer-item-text-refcode {
    color: white;
    border: 0.0625rem solid white;
    padding: 0.2rem 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
    transition:
        color 0.2s ease,
        border-color 0.2s ease;
}

.footer-item-text-refcode:hover {
    color: var(--highlight-colour);
    border-color: var(--highlight-colour);
}

@media (max-width: 768px) {
    .footer-top {
        flex-direction: column;
        gap: 1.25rem;
    }
}
/* Phones (12 Oct 2026): footer links were small and close together for
   thumbs. Each link gets a comfortable 44px-high tap area, one per line in
   two columns, and the referral code a bigger button. */
@media (max-width: 600px) {
    .footer-bottom {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.25rem 0.75rem;
        justify-items: center;
    }

    .footer-item {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .footer-item a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 0.25rem 0.4rem;
    }

    .footer-item p {
        padding: 0.6rem 0.4rem;
    }

    .footer-item-text-refcode {
        display: inline-block;
        padding: 0.6rem 1rem;
    }
}

/* Quick wins (12 Oct 2026): the About page already offers the referral code
   at the end of "About Star Citizen", so the footer does not repeat it. */
body[data-page="about"] .footer-top,
body[data-page="about"] .footer-ref {
    display: none;
}

/* ------------------------------------------------------------------
   Look and layout (12 Oct 2026): the shorter footer (footer.html).
   Two small groups of links side by side, then one small line. On a phone
   the groups stack and every link keeps a 44px tap area.
   ------------------------------------------------------------------ */
.footer-compact {
    row-gap: 0.6rem;
    padding: 0.9rem 1rem 0.8rem;
}

.footer-compact .footer-groups {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem 3rem;
}

.footer-compact .footer-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.9rem;
}

.footer-compact p.footer-group-title {
    margin: 0;
    color: var(--highlight-colour);
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer-compact ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-compact li {
    margin: 0;
    color: #fff;
    font-size: 0.875rem;
}

.footer-compact li a {
    color: #fff;
    font-size: 0.875rem;
}

.footer-compact li a:hover {
    color: var(--highlight-colour);
}

.footer-compact .footer-item-text-refcode {
    display: inline-block;
    margin-left: 0.25rem;
}

.footer-compact p.footer-legal {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}

@media (max-width: 600px) {
    .footer-compact .footer-groups {
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
    }

    .footer-compact .footer-group {
        flex-direction: column;
        gap: 0;
    }

    .footer-compact ul {
        justify-content: center;
        gap: 0 1.1rem;
    }

    .footer-compact li a {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
    }

    .footer-compact li.footer-ref {
        flex-basis: 100%;
        text-align: center;
        padding: 0.2rem 0 0.4rem;
    }

    .footer-compact li.footer-ref a.footer-item-text-refcode {
        min-height: 0;
        padding: 0.45rem 0.9rem;
        margin: 0.3rem 0 0;
    }
}
