/************************************************
* Theme Name:   Simmelink
*
* Block Name:   Footer
************************************************/

.site-footer {
    background-color: var(--blue-dark);
    border-top: 1px solid var(--hairline-on-dark);
    color: var(--white);

    .wrapper {
        padding: var(--wp--preset--spacing--70) var(--gutter) var(--wp--preset--spacing--30);
    }

    /* No gold on links: hover is the underline, like the menu. */
    a {
        color: var(--white);
        text-decoration: underline transparent;
        text-decoration-thickness: 1px;
        text-underline-offset: 3px;
        transition: var(--transition);

        &:hover,
        &:focus-visible,
        &:active {
            color: var(--white);
            text-decoration-color: currentColor;
        }
    }

    ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
    }

    .logo-container {
        align-items: center;
        display: flex;
        flex-flow: row wrap;
        gap: var(--wp--preset--spacing--30);
        justify-content: space-between;
        margin-bottom: var(--wp--preset--spacing--50);

        .site-logo {
            display: block;
            height: auto;
            max-width: 100%;
        }

        /* Score and NOvA logo side by side, centred on the Simmelink logo, on the right edge of the grid. */
        .footer-marks {
            align-items: center;
            display: flex;
            flex-flow: row wrap;
            gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
            justify-content: flex-end;
        }

        /* The score is a footer link like the others: same size and colour, underline only on hover. */

        .footer-nova {
            font-size: var(--wp--preset--font-size--small);
            text-decoration-color: currentColor;

            img {
                display: block;
                height: 64px;
                width: auto;
            }
        }
    }

    .footer-columns {
        display: grid;
        gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin-bottom: var(--wp--preset--spacing--60);
    }

    .footer-menu-item {
        margin-bottom: var(--wp--preset--spacing--20);
    }

    /* A second heading in the same column (Diensten under Rechtsgebieden). */
    .footer-menu + .footer-menu-title {
        margin-top: var(--wp--preset--spacing--40);
    }

    .footer-nap {
        font-variant-numeric: tabular-nums;

        address {
            font-style: normal;
        }

        address + .lijntitel,
        .address-line:last-child + .lijntitel,
        .footer-knop + .lijntitel {
            margin-top: var(--wp--preset--spacing--40);
        }

        /* The button: the size of the gold button in the header (.header-cta), its own class. */
        .footer-knop {
            color: var(--blue-dark);
            font-size: 15px;
            height: 40px;
            line-height: 18px;
            margin-top: var(--wp--preset--spacing--30);
            min-height: 40px;
            padding: 0 18px;
            white-space: nowrap;

            &:hover,
            &:focus-visible,
            &:active {
                color: var(--blue-dark);
                text-decoration: underline;
                text-decoration-color: currentColor;
                text-decoration-thickness: 1px;
                text-underline-offset: 3px;
            }
        }

        .address-line {
            display: block;

            &:nth-child(2):not(:last-child) {
                margin-bottom: var(--wp--preset--spacing--20);
            }
        }

        /* Icons in one row; each tap area is 44 x 44 px, the row starts with the icon on the text edge. */
        .social-links-menu {
            display: flex;
            flex-flow: row wrap;
            gap: 0;
            margin-left: -14px;
        }

        .social-icon-link {
            align-items: center;
            display: inline-flex;
            height: 44px;
            justify-content: center;
            position: relative;
            width: 44px;

            /* Hover as on the other footer links: a 1px line 3px under the icon. */
            &::after {
                border-top: 1px solid transparent;
                content: '';
                left: 14px;
                position: absolute;
                right: 14px;
                top: calc(50% + 8px + 3px);
                transition: var(--transition);
            }

            &:hover::after,
            &:focus-visible::after,
            &:active::after {
                border-top-color: currentColor;
            }
        }

        .footer-icon {
            display: block;
            flex: 0 0 auto;
            overflow: visible;

            * {
                vector-effect: non-scaling-stroke;
            }
        }
    }

    .bottom-container {
        align-items: baseline;
        border-top: 1px solid var(--hairline-on-dark);
        display: flex;
        flex-flow: row wrap;
        font-size: var(--wp--preset--font-size--small);
        gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
        padding-top: var(--wp--preset--spacing--30);

        .vital-pages-menu {
            display: flex;
            flex-flow: row wrap;

            a {
                font-size: var(--wp--preset--font-size--small);
            }

            /* The dot stands before every link and is never at the start or end of a line: the row
               starts one dot width to the left, and the nav clips what lies there, so the dot of the
               first link on each line falls away. */
            margin-left: -24px;
            row-gap: 8px;

            /* No margin of its own (the list style gives all but the last one 8px below):
               otherwise the last item stretches and its link drops. */
            .vital-pages-menu-item {
                align-items: center;
                display: flex;
                margin: 0;
            }

            .vital-pages-menu-item::before {
                content: "\00B7";
                content: "\00B7" / "";
                flex: 0 0 24px;
                text-align: center;
            }
        }

        /* The clip keeps 4px around the links free, so a focus ring stays visible. */
        .vital-pages {
            margin: -4px;
            overflow: hidden;
            padding: 4px;
        }
    }
}

/* Tap targets up to 781px: at least 40px high (up to 768px the 44px rule in style.css applies). */
@media screen and (max-width: 781px) {
    .site-footer .bottom-container .vital-pages-menu a {
        align-items: center;
        display: inline-flex;
        min-height: 40px;
    }
}

@media screen and (max-width: 1024px) {
    .site-footer .wrapper {
        padding-top: var(--wp--preset--spacing--50);
    }
}

/* From 768 to 1023px the columns two by two, below 768px one under the other. */
@media screen and (max-width: 1023px) {
    .site-footer .footer-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 767px) {
    .site-footer {
        .footer-columns {
            grid-template-columns: minmax(0, 1fr);
        }

        /* From top to bottom, on the left: Simmelink logo, NOvA logo (64px, as on desktop), score on one line. */
        .logo-container {
            align-items: flex-start;
            flex-direction: column;

            .footer-marks {
                align-items: flex-start;
                flex-direction: column;
            }

            .footer-nova {
                order: -1;
            }

            .footer-score {
                white-space: nowrap;
            }
        }
    }
}

/* Telephone and e-mail one under the other, as on desktop. The tap target rule in style.css makes
   the links inline-flex up to 768px; the address lays them out as a column instead. */
@media screen and (max-width: 768px) {
    .site-footer .footer-nap address {
        align-items: flex-start;
        display: flex;
        flex-direction: column;
    }
}
