/* Footer */
.site-footer {
    background: #F7F7F7;
    color: #231F20;
    padding: 80px 0 24px;
    font-size: 14px;
}

.footer__cols {
    display: grid;
    gap: 11rem;
    grid-template-columns: repeat(4, max-content);
    align-items: start;
    margin-bottom: 60px;
    max-width: 1220px;
}

/* Responsive margin limits for footer columns to prevent overflow on narrow viewports */
.site-footer .footer__cols {
    margin-left: auto;
    margin-right: auto;
}

.site-footer h4 {
    color: #000;
    margin: 0 0 1.5rem;
    font-size: 20px;
    font-weight: 600;
}

.site-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.site-footer li {
    margin-bottom: 16px;
}

.site-footer a {
    color: #666666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    font-weight: 500;
}

.site-footer a:hover {
    color: #DA291C;
    text-decoration: none;
}

.footer__social {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
    color: #666666;
}

    .footer__social a {
        display: block;
        width: 24px;
        height: 24px;
    }

        .footer__social a:hover img {
            filter: invert(0);
        }

    .footer__social img {
        width: 100%;
        height: 100%;
        display: block;
        filter: invert(40%);
        transition: filter 0.2s;
    }
    /* Ensure inline SVG icons inherit the color; raster images will remain as-is */
    .footer__social svg {
        width: 100%;
        height: 100%;
        display: block;
        color: inherit;
    }

        .footer__social svg path {
            fill: currentColor;
        }

.footer__bottom {
    max-width: 1220px;
    margin: 0 350px;
    padding: 24px 0 0;
    border-top: 1px solid #E5E5E5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
}

/* Responsive margin limits for footer bottom bar */
.site-footer .footer__bottom {
    margin-left: auto;
    margin-right: auto;
}

.footer__legal-links {
    font-size: 12px;
    color: #666666;
    line-height: 1.6;
}

    .footer__legal-links a {
        color: #666666;
        font-size: 12px;
    }

        .footer__legal-links a:hover {
            color: #DA291C;
        }

    .footer__legal-links .separator {
        margin: 0;
        color: #ccc;
    }

    .footer__legal-links .copyright {
        margin-top: 8px;
        color: #666666;
    }

    .footer__legal-links .copyright .icp-filing {
        margin-left: 8px;
    }

.footer__logo {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-left: 2rem;
    color: #27201F;
    font-weight: 700;
    font-size: 18px;
    line-height: 24px;
    height: 28px;
    width: 140px;
}

    .footer__logo img {
        height: 24px;
        width: auto;
        display: block;
    }

/* WeChat QR popup on footer social hover: improved arrow + caption */
.footer__social a[aria-label="WeChat"] {
    position: relative;
}

    .footer__social a[aria-label="WeChat"]::after {
        display: none;
    }

    .footer__social a[aria-label="WeChat"] .wechat-qr {
        display: none;
        position: absolute;
        bottom: calc(100% + 12px);
        left: 50%;
        transform: translateX(-50%);
        width: 220px;
        max-width: 80vw;
        background: #fff;
        padding: 12px;
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.18);
        z-index: 2000;
        text-align: center;
    }

        .footer__social a[aria-label="WeChat"] .wechat-qr img {
            width: 100%;
            height: auto;
            display: block;
            border-radius: 4px;
        }

        .footer__social a[aria-label="WeChat"] .wechat-qr .wechat-caption {
            margin-top: 8px;
            color: #666666;
            font-size: 0.95rem;
            line-height: 1.2;
        }

        /* Create a subtle shadow triangle and a white triangle on top */
        .footer__social a[aria-label="WeChat"] .wechat-qr::before,
        .footer__social a[aria-label="WeChat"] .wechat-qr::after {
            content: "";
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 0;
        }

        .footer__social a[aria-label="WeChat"] .wechat-qr::before {
            bottom: -10px; /* shadow layer */
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-top: 10px solid rgba(0,0,0,0.12);
            z-index: 1998;
        }

        .footer__social a[aria-label="WeChat"] .wechat-qr::after {
            bottom: -8px; /* white triangle sits over the shadow */
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-top: 8px solid #fff;
            z-index: 1999;
        }

    .footer__social a[aria-label="WeChat"]:hover .wechat-qr,
    .footer__social a[aria-label="WeChat"]:focus .wechat-qr {
        display: block;
    }


/* Responsive Styles */

/* 1024px - 1279px (Small Desktop) */
@media (min-width:1024px) and (max-width:1279px) {
    .site-footer .footer__cols {
        margin: 0;
    }

    .footer__cols {
        grid-template-columns: repeat(2, 1fr); /* 2 columns, 2 rows */
        gap: 1.25rem 2rem; /* smaller horizontal gap */
        justify-items: start;
        margin-left: 0;
        margin-right: 0;
        padding: 2rem 24px;
    }

    .footer__cols > * {
        width: 100%;
    }

    .footer__social {
        justify-content: center;
        margin-bottom: 18px;
    }

    .footer__bottom {
        margin-left: auto;
        margin-right: auto;
        width: calc(100% - 2rem);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 12px;
    }

    .footer__logo {
        margin-left: 0;
        display: block;
        margin-top: 8px;
        display: inline-flex;
        align-items: center;
        gap: 12px;
    }
}

/* 768px - 1023px (Tablet) */
@media (max-width: 1023px) and (min-width: 768px) {
    .site-footer .footer__cols {
        display: none;
    }

    /* Footer adjustments for tablet */
    .site-footer .footer__bottom {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding-top: 24px;
        border-top: 1px solid #E5E5E5; /* Ensure border exists */
    }

    .site-footer .footer__legal-links {
        width: 100%;
        text-align: center;
    }

    /* Hide all children of legal-links except .copyright */
    .site-footer .footer__legal-links > *:not(.copyright) {
        display: none;
    }

    .site-footer .footer__logo {
        margin-left: 0;
        justify-content: center;
    }
}

/* 360px - 767px (Mobile) */
@media (min-width: 360px) and (max-width: 767px) {
    /* Footer adjustments for mobile */
    .site-footer .footer__cols {
        display: none;
    }

    .site-footer .footer__social {
        justify-content: center;
        margin-top: 1rem;
        padding-bottom: 1.5rem;
        border-bottom: none;
        margin-bottom: 1.5rem;
    }

    .site-footer .footer__bottom {
        flex-direction: column;
        align-items: center;
        padding-top: 0;
        gap: 1rem;
    }

    /* Hide legal links and separators */
    .site-footer .footer__legal-links > span,
    .site-footer .footer__legal-links > a {
        display: none;
    }

    /* Ensure copyright is visible and centered */
    .site-footer .footer__legal-links {
        width: 100%;
        text-align: center;
    }

    .site-footer .footer__legal-links .copyright {
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: #666;
        line-height: 1.6;
        padding: 0 1rem;
    }

    .site-footer .footer__logo {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }
    
    /* WeChat popup mobile fix */
    .footer__social a[aria-label="WeChat"] .wechat-qr {
        width: 160px;
    }
}