/* =========================================================
   FOOTER.CSS — Social Welfare Department, Government of Meghalaya
   Used with components/footer.html. Load after style.css.
   Colours are the tokens from style.css (:root); text sizes are rem so the
   A+ / A- text-size buttons scale the footer too (1.6rem = 16px).
   ========================================================= */

footer {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* style.css has older footer rules (dark grey box, 3-column list, pale links);
   these selectors are more specific, so the rules below win. */
footer .footerbox {
    position: relative;
    width: 100%;
    padding: 32px 0 25px;
    background: var(--dbim-wintergreen-dream);       /* white text on it ≈ 9.8:1 */
    color: var(--dbim-white);
    box-sizing: border-box;
}


/* ==========================================
   CONTAINER
========================================== */

footer .footerbox .container {
    width: 100%;
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
}


/* ==========================================
   TOP FOOTER
========================================== */

footer .footerbox .footer-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
    margin: 0;
}


/* ==========================================
   HEADING
========================================== */

footer .footerbox .usefula {
    margin: 0 0 25px;
    padding: 0;
    color: var(--dbim-white);
    font-size: var(--dbim-fs-p1);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .04em;
}


/* ==========================================
   USEFUL LINKS AREA
========================================== */

footer .footerbox .footer-useful {
    padding-left: 0;
    padding-right: 30px;
    box-sizing: border-box;
}


/* ==========================================
   USEFUL LINKS GRID (9 links, 3 per row)
========================================== */

footer .footerbox ul.useful-links-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, max-content));
    column-gap: 40px;
    row-gap: 16px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--dbim-white);
}

footer .footerbox ul.useful-links-list li {
    position: static;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 32px;
    margin: 0;
    padding: 0;
    transform: none;                                 /* style.css shifts footer items left */
}

/* Chevron before each link (style.css turns it white) */
footer .footerbox ul.useful-links-list li img {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

footer .footerbox ul.useful-links-list li a {
    display: inline;
    margin: 0;
    padding: 0;
    color: var(--dbim-white);
    font-size: var(--dbim-fs-p1);
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none;
    white-space: normal;
}

footer .footerbox ul.useful-links-list li a:hover {
    color: var(--dbim-white);
    text-decoration: underline;
    text-underline-offset: .2em;
}

footer .footerbox a:focus-visible,
footer .footer-back-top:focus-visible {
    outline: 3px solid var(--dbim-focus-halo);       /* bright yellow – 5.9:1 on the dark brown */
    outline-offset: 3px;
    border-radius: 2px;
}


/* ==========================================
   PORTAL LOGOS AREA
========================================== */

footer .footerbox .footer-subscribe {
    padding-left: 35px;
    padding-right: 0;
    box-sizing: border-box;
}

footer .footerbox .government-logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 38px;
    padding: 0;
}

footer .footerbox .government-logos a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 116px;
    height: 45px;
    padding: 4px 6px;
    background: var(--dbim-white);
    border-radius: 3px;
    box-sizing: border-box;
    text-decoration: none;
}

footer .footerbox .government-logos img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    object-fit: contain;
}


/* ==========================================
   BOTTOM FOOTER
========================================== */

footer .footerbox .footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    width: auto;
    margin: 32px 0 0;                                /* same edges as the links row above */
    padding: 18px 0 0;
    border-top: 1px solid rgba(255, 255, 255, .25);
    box-sizing: border-box;
}

footer .footerbox .footer-below-text {
    margin: 0;
    padding: 0;
    color: var(--dbim-white);
    font-size: var(--dbim-fs-p2);
    font-weight: 400;
    line-height: 1.6;
}

footer .footerbox .footer-updated {
    margin: 0;
    padding: 0;
    color: var(--dbim-white);
    font-size: var(--dbim-fs-p2);
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
}


/* ==========================================
   FLOATING BACK TO TOP BUTTON
========================================== */

footer .footer-back-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--dbim-white);
    border: 2px solid var(--dbim-wintergreen-dream);
    border-radius: 50%;
    color: var(--dbim-wintergreen-dream);
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
    transition: background .2s ease, transform .2s ease;
}

footer .footer-back-top img {
    display: block;
    width: 22px;
    height: 22px;
}

footer .footer-back-top:hover {
    background: var(--dbim-azureish-white-bg);
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    footer .footer-back-top { transition: none; }
    footer .footer-back-top:hover { transform: none; }
}


/* ==========================================
   DESKTOP
========================================== */

@media (min-width: 992px) {

    footer .footerbox {
        min-height: 280px;
    }

    footer .footerbox .footer-subscribe {
        padding-left: 40px;
        padding-right: 24px;
    }

    footer .footerbox .footer-updated {
        margin-right: 24px;
    }

}


/* ==========================================
   TABLET
========================================== */

@media (min-width: 768px) and (max-width: 991px) {

    footer .footerbox {
        padding: 35px 20px 30px;
    }

    footer .footerbox .footer-top {
        display: block;
    }

    footer .footerbox .footer-useful,
    footer .footerbox .footer-subscribe {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    footer .footerbox .footer-subscribe {
        margin-top: 10px;
    }

    footer .footerbox ul.useful-links-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 20px;
        row-gap: 16px;
    }

    footer .footerbox .footer-bottom {
        margin-top: 35px;
    }

    footer .footer-back-top {
        right: 20px;
        bottom: 70px;
    }

}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 767px) {

    footer .footerbox {
        padding: 30px 15px 25px;
    }

    footer .footerbox .container {
        max-width: 100%;
    }

    footer .footerbox .footer-top {
        display: block;
    }

    footer .footerbox .footer-useful,
    footer .footerbox .footer-subscribe {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    footer .footerbox .footer-subscribe {
        margin-top: 6px;
    }

    footer .footerbox .usefula {
        margin-bottom: 20px;
        font-size: var(--dbim-fs-label);
    }

    footer .footerbox ul.useful-links-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 20px;
        row-gap: 12px;
    }

    footer .footerbox .government-logos {
        margin-top: 25px;
    }

    footer .footerbox .government-logos a {
        width: 110px;
        height: 42px;
    }

    footer .footerbox .footer-bottom {
        gap: 10px;
    }

    footer .footerbox .footer-updated {
        white-space: normal;
    }

    footer .footer-back-top {
        right: 15px;
        bottom: 20px;
        width: 44px;                                 /* keep the 44px touch target */
        height: 44px;
    }

}


/* ==========================================
   SMALL MOBILE
========================================== */

@media (max-width: 480px) {

    footer .footerbox ul.useful-links-list {
        grid-template-columns: 1fr;
        column-gap: 0;
        row-gap: 10px;
    }

    footer .footerbox .government-logos a {
        width: 105px;
        height: 40px;
    }

    footer .footerbox .footer-below-text {
        font-size: var(--dbim-fs-caption);
    }

}

/* columns of the bottom row sit flush with the divider */
footer .footerbox .footer-bottom > * { padding-left: 0; padding-right: 0; }
