/* ---------------------------------------------------------------------------
   Public-site footer.

   Desktop: 4-column flex (brand block + 3 link sections).
   Tablet  (≤1024px): brand stacks above a 3-column links grid.
   Mobile  (≤640px): 2-column links grid; the social-links section spans
   both columns at the bottom so social icons sit centered, no awkward gap.
--------------------------------------------------------------------------- */

/* --- Shared public chrome ------------------------------------------------
   footer.css is loaded by every page that includes fragments/public-header.jsp,
   so the skip link and the screen-reader-only helper it needs live here.
   (Authenticated pages get their own copies from dashboard.css.)
------------------------------------------------------------------------- */

.skip-link {
    position: fixed;
    inset-inline-start: 1rem;
    top: -100px;
    z-index: 2000;
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--accent-primary);
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 24px var(--shadow);
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 1rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* The header brand is a link to the home page; index.css styles .logo but
   never resets the anchor underline. */
.header .nav-brand .logo {
    text-decoration: none;
}

.footer {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 4rem 0 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
}

/* --- Brand block --------------------------------------------------------- */

.footer-brand {
    flex: 0 1 300px;
    min-width: 0;
}

.footer-brand .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.footer-brand .brand-icon {
    width: 40px;
    height: 40px;
}

.footer-brand p {
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 320px;
    margin: 0;
}

/* --- Link sections ------------------------------------------------------- */

.footer-links {
    flex: 1 1 480px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    min-width: 0;
}

.footer-section {
    min-width: 0;
}

.footer-section h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
    letter-spacing: 0.01em;
}

.footer-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    /* Spacing lives on the links themselves (below) so each one is a real
       tap target; the visual rhythm stays what it was. */
    gap: 0.15rem;
}

.footer-section a {
    display: inline-block;
    padding-block: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: var(--accent-primary);
}

/* --- Social icons -------------------------------------------------------- */

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

/* Scoped to .footer so the 44px hit area beats public-polish.css, which
   sizes .social-links a at 40px and owns their light/dark colour treatment. */
.footer .social-links a {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin: 0;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease,
                border-color 0.2s ease, box-shadow 0.2s ease;
}

.social-links a:hover {
    transform: translateY(-2px);
    background: var(--accent-secondary);
    color: #fff;
}

/* --- Bottom strip -------------------------------------------------------- */

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 0;
}

.footer-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Language + theme toggles need a full-size touch target. */
.footer-controls .lang-toggle,
.footer-controls .theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 1024px) {
    .footer-content {
        flex-direction: column;
        gap: 2.5rem;
    }

    .footer-brand {
        flex: 1 1 auto;
        text-align: center;
    }

    .footer-brand .logo {
        justify-content: center;
    }

    .footer-brand p {
        margin: 0 auto;
    }

    .footer-links {
        flex: 1 1 auto;
    }
}

@media (max-width: 640px) {
    .footer {
        padding: 3rem 0 1.25rem;
    }

    .footer-content {
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .footer-links {
        grid-template-columns: 1fr 1fr;
        gap: 1.75rem 1.5rem;
        text-align: start;
    }

    /* Social section stretches across both columns and centers itself,
       so the social icons sit nicely beneath the link lists. */
    .footer-section:last-child {
        grid-column: 1 / -1;
        text-align: center;
        margin-top: 0.5rem;
    }

    .footer-section:last-child h4 {
        margin-bottom: 0.85rem;
    }

    .social-links {
        justify-content: center;
    }

    .footer-bottom {
        flex-direction: column-reverse;
        text-align: center;
        gap: 0.75rem;
    }

    .footer-controls {
        justify-content: center;
    }
}

/* public-polish.css shrinks the floating back-to-top button to 42px below
   768px — under the touch target on exactly the devices that need it. */
@media (max-width: 768px) {
    .footer .back-to-top {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 380px) {
    .footer-links {
        grid-template-columns: 1fr;
        text-align: center;
    }
}
