/*------------------------------------*\
    SITE FOOTER
\*------------------------------------*/

@use "../../base/helpers";
@use "../../base/settings";

/// Footer background colour
/// @type Color
$site-footer__background: settings.$ds_colour__background--tertiary !default;

// fixed vars
$site-footer__border-width: 0.0625rem; // 1px

.ds_site-footer {
    /// [1] subtracting the border width
    background-color: $site-footer__background;
    border-top: $site-footer__border-width solid settings.$ds_colour__border;
    @include helpers.ds_small-size;

    &__content {
        padding-top: #{1.5rem - $site-footer__border-width}; /// [1]
        padding-bottom: 2rem;
    }

    &__site-items {
        border-bottom: $site-footer__border-width solid settings.$ds_colour__border;
        font-size: settings.$small-size--fixed;
        line-height: helpers.line-height-on-grid(settings.$small-size--fixed);
        list-style-type: none;
        margin: -0.5rem 0 #{1.5rem - $site-footer__border-width};
    }

    /// [2] minimum OGL logo width for digital according to the OGL branding guidelines
    &__copyright {
        &-logo {
            display: block;
            width: max(2.5625rem, 41px); /// [2]

            img {
                width: 100%;
            }
        }

        @include helpers.ds_media-query(medium) {
            @include helpers.ds_last-child-no-margin;
        }
    }

    &__org {
        max-width: 10rem;
        position: relative;
    }

    &__org-logo {
        display: block;
        width: 100%;
    }

    &__org-link {
        display: block;

        @include helpers.ds_fancy-underscore;
    }

    .ds_site-footer__org-link,
    .ds_site-footer__copyright-logo {
        color: currentColor !important;
    }

    @include helpers.checkAndFixDescendantLinkColour(settings.$ds_colour__link, settings.$ds_colour__background--tertiary, 'site footer');
}

.ds_site-items {
    &__item,
    &__item:last-child {
        display: inline-block;
        margin-bottom: 1rem;

        &:not(:last-child) {
            margin-right: 1.5rem;
        }
    }
}

@include helpers.ds_media-query(medium) {
    .ds_site-footer {
        &__content {
            display: grid;
            gap: 0 settings.$grid-gap-x;
            grid-template-columns: repeat(12, 1fr);
            grid-template-areas: 'a a a a a a a a a a a a'
                                 'b b b b b b b b . c c c';
        }

        &__site-items {
            grid-area: a;
        }

        &__copyright {
            grid-area: b;
        }

        &__org {
            grid-area: c;
            justify-self: right;
            width: 100% !important;
        }
    }
}