:root {
    --site-footer-height: 3.75rem;
    --page-content-bottom-pad: 2rem;
    /* Extra scroll room below footer when fixed save/unsaved bars are visible */
    --sk-viewport-dock-reserve: 0px;
}

.legal-page-body {
    padding-bottom: var(--site-footer-height);
}

.site-footer {
    position: static;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.site-footer__bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.45rem 1.25rem;
    min-height: var(--site-footer-height);
    box-sizing: border-box;
}

/* Brand (left) */
.site-footer__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    justify-self: start;
    line-height: 0;
}

.site-footer__brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 50%;
    display: block;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.site-footer__brand:hover .site-footer__brand-logo {
    transform: scale(1.04);
    filter: brightness(1.08);
}

/* Social (center) */
.site-footer__social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.site-footer__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 50%;
    transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.site-footer__social-link:hover {
    color: var(--discord-blurple);
    background: rgba(88, 101, 242, 0.12);
    transform: translateY(-1px);
}

.site-footer__discord-icon {
    display: block;
    width: 1.375rem;
    height: auto;
    max-width: 1.375rem;
    max-height: 1.0625rem;
    flex: 0 0 auto;
}

/* Legal + AI (right) */
.site-footer__end {
    justify-self: end;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

.site-footer__ai {
    margin: 0;
    font-size: 0.68rem;
    color: var(--text-secondary);
    max-width: 22rem;
    line-height: 1.25;
}

.site-footer__legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
}

.site-footer__legal a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
}

.site-footer__legal a:hover {
    color: var(--discord-blurple);
}

/* App pages — footer at end of document (scroll to reveal) */
body:has(.site-footer--app) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding-bottom: var(--sk-viewport-dock-reserve);
}

body:has(.site-footer--app) .dashboard-home,
body:has(.site-footer--app) .guild-layout,
body:has(.site-footer--app) .admin-layout,
body:has(.site-footer--app) .transcript-page:not(.transcript-page--guild) {
    flex: 1 0 auto;
}

.site-footer--app {
    margin-top: auto;
    flex-shrink: 0;
    position: relative;
    /* Below .guild-layout (z-index: 2) so absolute/fixed dropdowns are not covered */
    z-index: 1;
}

/* Login page */
.site-footer--login {
    background: rgba(15, 18, 38, 0.92);
    border-top-color: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.site-footer--login .site-footer__brand,
.site-footer--login .site-footer__legal a,
.site-footer--login .site-footer__social-link {
    color: rgba(255, 255, 255, 0.95);
}

.site-footer--login .site-footer__ai {
    color: rgba(255, 255, 255, 0.55);
}

.site-footer--login .site-footer__legal a:hover,
.site-footer--login .site-footer__social-link:hover {
    color: #fff;
}

.site-footer--legal {
    position: relative;
    margin-top: 2rem;
}

.legal-page-body:has(.site-footer--legal) {
    padding-bottom: 0;
}

@media (max-width: 768px) {
    .site-footer__bar {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        text-align: center;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .site-footer__brand,
    .site-footer__end {
        justify-self: center;
    }

    .site-footer__end {
        align-items: center;
        text-align: center;
    }

    .site-footer__legal {
        justify-content: center;
    }

    :root {
        --site-footer-height: 7rem;
    }

    .site-footer__brand-logo {
        width: 40px;
        height: 40px;
    }
}
