/* BoardGameGeek attribution badge.
   - Desktop: floats in the bottom-right corner.
   - Mobile (<= 768px): pinned to the bottom, centred horizontally.
   - Light/dark variants are swapped via the `.theme-dark` class set on the
     authenticated layout, and via `prefers-color-scheme` for unauthenticated
     pages where no theme class is applied. */

.bgg-attribution {
    position: fixed;
    right: 16px;
    bottom: 12px;
    z-index: 950;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    line-height: 0;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
    pointer-events: auto;
}

.bgg-attribution:hover,
.bgg-attribution:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
    background: rgba(255, 255, 255, 0.95);
    outline: none;
}

.bgg-attribution-img {
    display: block;
    height: 28px;
    width: auto;
    max-width: 160px;
}

/* Default: show the light-background (dark text) variant. */
.bgg-attribution-img--dark {
    display: none;
}

/* Authenticated pages – theme is applied via .page.theme-dark. */
.page.theme-dark .bgg-attribution {
    background: rgba(15, 23, 42, 0.7);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.page.theme-dark .bgg-attribution:hover,
.page.theme-dark .bgg-attribution:focus-visible {
    background: rgba(15, 23, 42, 0.9);
}

.page.theme-dark .bgg-attribution-img--light {
    display: none;
}

.page.theme-dark .bgg-attribution-img--dark {
    display: block;
}

/* Unauthenticated layouts (login/register/home) follow OS preference. */
@media (prefers-color-scheme: dark) {
    body:not(:has(.page.theme-light)) .bgg-attribution {
        background: rgba(15, 23, 42, 0.7);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }

    body:not(:has(.page)) .bgg-attribution-img--light,
    body:has(.empty-layout-lang) .bgg-attribution-img--light,
    body:has(.auth-container) .bgg-attribution-img--light,
    body:has(.home-page) .bgg-attribution-img--light {
        display: none;
    }

    body:not(:has(.page)) .bgg-attribution-img--dark,
    body:has(.empty-layout-lang) .bgg-attribution-img--dark,
    body:has(.auth-container) .bgg-attribution-img--dark,
    body:has(.home-page) .bgg-attribution-img--dark {
        display: block;
    }
}

/* Mobile: centre at the bottom so the badge does not overlap key actions. */
@media (max-width: 768px) {
    .bgg-attribution {
        right: auto;
        left: 50%;
        bottom: calc(8px + env(safe-area-inset-bottom));
        transform: translateX(-50%);
        padding: 3px 6px;
    }

    .bgg-attribution:hover,
    .bgg-attribution:focus-visible {
        transform: translateX(-50%) translateY(-1px);
    }

    .bgg-attribution-img {
        height: 22px;
    }
}

/* Variant rendered inline inside the public home page hero/footer area –
   sits in normal flow rather than fixed, so it can be "wpasowane".
   On the dark public home page we give it a contrasting pill background
   so the logo is clearly readable instead of blending into the dark page. */
.bgg-attribution.bgg-attribution--inline {
    position: static;
    transform: none;
    margin: 24px auto 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.bgg-attribution.bgg-attribution--inline .bgg-attribution-img {
    height: 32px;
    max-width: 200px;
}

.bgg-attribution.bgg-attribution--inline:hover,
.bgg-attribution.bgg-attribution--inline:focus-visible {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.28);
}

/* Inline badge on the public home page should always show the light-background
   (dark text) variant for maximum contrast, regardless of OS color scheme. */
.bgg-attribution.bgg-attribution--inline .bgg-attribution-img--light {
    display: block;
}

.bgg-attribution.bgg-attribution--inline .bgg-attribution-img--dark {
    display: none;
}

@media (max-width: 768px) {
    .bgg-attribution.bgg-attribution--inline {
        margin: 16px auto 8px;
        left: auto;
        bottom: auto;
        padding: 6px 12px;
    }

    .bgg-attribution.bgg-attribution--inline .bgg-attribution-img {
        height: 24px;
    }

    .bgg-attribution.bgg-attribution--inline:hover,
    .bgg-attribution.bgg-attribution--inline:focus-visible {
        transform: translateY(-1px);
    }
}

/* On the unauthenticated home page we render the inline badge inside the
   page content – hide the floating one to avoid duplication. */
body:has(.home-intro-card) .bgg-attribution:not(.bgg-attribution--inline) {
    display: none;
}

.home-bgg-attribution {
    display: flex;
    justify-content: center;
    width: 100%;
}
