/*
Theme Name: Sport and Life
Author: Maple Rock Design
Description: A custom WordPress theme for Sport and Life.
Version: 1.0.0
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 8.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sport-and-life
*/

@import url("https://use.typekit.net/yii2ruu.css");
/* <link rel="stylesheet" href="https://use.typekit.net/yii2ruu.css"> */

html,body {
    height: 100%;
    line-height: 1.4;
}

.wp-site-blocks {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}



/*Hover Effects for terms and block cards*/
.wp-block-query {
    .wp-block-post .wp-block-post-featured-image {
        overflow: hidden;
    }

    .wp-block-post .wp-block-post-featured-image img {
        transition: scale 0.3s ease-in-out;
    }

    .wp-block-post:hover .wp-block-post-featured-image img {
        scale: 1.1;
    }
}

.wp-block-terms-query .wp-block-term {

    &:hover img {
        scale: 1.1;
    }

    .wp-block-image {
        overflow: hidden;

        img {
            transition: scale 0.3s ease-in-out;
        }
    }
}


/* Main and Category Navigation Menu Styles */
.wp-block-navigation-item__label {
    font-weight: 300;
}

.wp-block-navigation-item__label:hover,
.current-menu-item .wp-block-navigation-item__label,
.current-menu-ancestor .wp-block-navigation-item__label {
    font-weight: 500;
}

li.sport-life-main-menu + li.sport-life-main-menu:before,
li.sport-life-cat-menu + li.sport-life-cat-menu:before {
  content: '|';
  margin-left: 1rem;
  margin-right: 1rem;
  position: relative;
  top: -2px;
}

.submenu-nav {
    flex: 15px 0;
    border: 0;
    background-color: var(--wp--preset--color--light);
    border-radius: 0.5rem;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M15.6315 12L10.8838 3.03212L9.11622 3.9679L13.3685 12L9.11622 20.0321L10.8838 20.9679L15.6315 12Z"></path></svg>');
    background-repeat: no-repeat;
    background-position: center center;
    margin-bottom: -0.75rem;
}

.submenu-nav.prev {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M8.3685 12L13.1162 3.03212L14.8838 3.9679L10.6315 12L14.8838 20.0321L13.1162 20.9679L8.3685 12Z"></path></svg>');
}

.submenu__wrapper {
    display: flex;
    gap: 5px;
    margin-top: 0.5rem !important;

}
.submenu__track {
    width: 100%;
    overflow-x: auto;
    margin-top: 0.75rem;
    scroll-behavior: smooth;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.sport-life-cat-menu-wrapper {
    font-size: 1.1rem !important;
    display: flex;
    flex-wrap: nowrap;
    scroll-snap-type: x mandatory;
}

.sport-life-cat-menu-wrapper li {
    flex: 1 0 auto;
    scroll-snap-align: start;
}

@media (min-width: 1024px) {
    .submenu-nav {
        display: none;
    }
    .sport-life-cat-menu-wrapper {
        justify-content: center;
    }
    .sport-life-cat-menu-wrapper li {
        flex: 0 0 auto;
    }
}

.mrd-search {

    .wp-block-search__button {
        max-width: 30px !important;
    }

}

.mrd-featured-posts {
    list-style: none;
    margin: 3rem 0 0 0;
    padding: 0;

    > * + * {
        margin-top: 1.5rem;
    }

    img {
        width: 100%;
        height: auto;
    }
}

.wp-block-group.is-linked {

    .wp-block-group:first-of-type:has(img) {
        overflow: hidden;
    }
    .wp-block-group:first-of-type img {
        transition: 0.2s;
    }
    &:hover .wp-block-group:first-of-type img {
        scale: 1.3
    }
}

.is-advert {

    text-align: center;
    position: relative;

    &:before {
        display: block;
        content: 'Advertisement';
        padding: 1rem 0;
        text-align: center;
        text-transform: uppercase;
        font-size: 80%;
        background-color: white;
        display: inline-block;
        margin: 0 auto;
        z-index: 1;
        position: relative;
        padding: 8px 10px;
    }

    &:after {
        display: block;
        content: '';
        height: 1px;
        width: 100%;
        background-color: var(--wp--preset--color--mid);
        position: absolute;
        top: 16px;
    }
}



/*.wp-block-query .wp-block-post > .wp-block-group {
    position: relative;

    --transition: 0.25s;

    &:before {
        content: "";
        position: absolute;
        inset: -2px;
        border-radius: inherit;
        padding: 2px;

        background: linear-gradient(
                45deg,
                transparent 20%,
                black,
                transparent 80%
        );

        background-size: 200% 100%;
        background-position: 200% 0;

        -webkit-mask:
                linear-gradient(#000 0 0) content-box,
                linear-gradient(#000 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;

        pointer-events: none;
        opacity: 0;
        background-position: 200% 0;
        transition:
                opacity 0.25s ease,
                background-position 0.8s ease
    }

    &:hover:before {
        opacity: 1;
        background-position: 0% 0;
    }
}*/

.wp-block-query .is-layout-grid .wp-block-post:has(> .mrd-stack-pattern.has-light-background-color) {
    display: flex;
    flex-direction: column;

    > div {
        flex: 1 0 auto;
    }

    background-color: var(--wp--preset--color--light);
}


.mrd-stack-pattern {
    flex: 1 0 auto;

    &:hover  h3 a, &:hover  h3{
        color: var(--wp--preset--color--accent);
    }
}

body.is-featured {
    main > .wp-block-group:nth-child(2) > .wp-block-group {
        border-top: 5px solid var(--wp--preset--color--mid);
    }
}



/*MOBILE STYLES CUSTOM BLOCK BITS*/
.wp-site-blocks .wp-block-template-part:has(header) {

    header {
        gap: 20px;
        justify-content: center;
        align-items: center;
        padding: 0 !important;


        @media (max-width: 600px) {
            > .wp-block-group {
                justify-content: center;
                align-items: center;
            }
        }

    }

    .site-logo {
        width: 300px;
        height: auto;

        @media (min-width: 600px) {
            width: revert;
        }
    }
}


.wp-block-terms-query .is-layout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    @media (min-width: 600px) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


:root :where(.is-layout-grid) {
    gap: calc(var(--wp--style--block-gap)/2);

    @media (min-width: 600px) {
        gap: var(--wp--style--block-gap)
    }
}


/* Ordering example for homepage */
/* .wp-container-core-group-is-layout-2631b7c5 .wp-block-group:nth-child(1) {
  order: 2;
}

.wp-container-core-group-is-layout-2631b7c5 .wp-block-group:nth-child(2) {
  order: 1;
} */

main {

    @media (max-width: 600px) {
        margin-top: 0 !important;
        margin-block-start: 0 !important;
    }

}

@media (max-width: 600px) {

    .mrd-featured.mrd-collapse-mobile {
        gap: 0;
    }

    .mrd-featured.mrd-collapse-mobile > *:not(figure, a) {
        padding: 1rem;
    }
    .mrd-featured.mrd-collapse-mobile .wp-block-post-title {
        margin-block-start: 1rem;
    }


    footer {

        .alignright {
            float: none  !important;
            margin-inline-start: 0  !important;
        }

        figure {
            margin: 0 auto  !important;
        }

        .subscribe-card {
            gap: 10px !important;
            padding-bottom: 1rem;

            img {
                width: 100% !important;
            }

            > *:not(:first-child) {
                padding: 0 1rem;
            }
        }
    }
}

/*Mobile header override*/
@media (max-width: 600px) {
    .wp-site-blocks .wp-block-template-part:first-of-type > .wp-block-group {
        padding-top: var(--wp--preset--spacing--30) !important;
    }

    .wp-block-template-part:first-of-type header {
        display: flex;
        gap: 20px !important;
        justify-content: space-around;


        > * {
            padding: 0 !important;
        }

        > *:nth-child(3) {
            order: 1;
            flex: 1 0 auto !important;
            justify-content: flex-end !important;
            gap: 5px;

            .wp-block-buttons {
                font-size: 75% !important;
            }

            .wp-block-search__input {
                font-size: 80%; /*Weird font size for wrapping*/
            }
        }
        > *:nth-child(2) {
            order: 2
        }
        > *:nth-child(1) {
            order: 0;
            flex-basis: 20px !important;
            flex-grow: 0;
        }
    }
}