/*
Theme Name: Stories V2 - Relatoa & Cartas Branch
Theme URI: https://github.com/chanovera-dev/stories-V2
Author: Chano Vera
Author URI: https://chano.dev
Description: Tema WordPress personalizado para Blog. Tiene soporte para diversos tipos de formatos de artículos (minientrada, galería, imagen, enlace, cita, video).
Version: 2.0.0
Tested up to: 6.8.3
Requires PHP: 8.0
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

body {
    background-color: light-dark(var(--wp--preset--color--base), var(--base-dark));
    color: light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100dvh;
} 

*,
::before,
::after {
    margin: 0;
    box-sizing: border-box;
}

img {
    display: block;
    height: auto;
}

:is(.scroll-down,.scroll-up) {
    & #main-header {
        box-shadow: rgba(17, 12, 46, 0.3) 0px 24px 50px 0px;
    }
}

& #main-header {
    position: sticky;
    top: 0;
    z-index:99;
    transition: all .3s ease-in-out, padding .3s ease-in-out;

    & .block {
        & > .glass-backdrop {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            backdrop-filter: blur(2rem);
        }

        & .content {
            z-index: 0;
            padding: .625rem 0;

            & .site-brand {
                & a {
                    &:hover {
                        color: var(--wp--preset--color--main);
                    }

                    &:focus-visible {
                        outline: none;
                        color: orangered;
                    }
                }
            }

            & .navigation-searchform--wrapper {
                & ul {
                    padding-left: 0;
                    list-style: none;
                }
            }

            & > div:has(.search-mobile__button) {
                margin-left: auto;

                .search-mobile__button {
                    display: grid;
                    place-content: center;
                    width: 46px;
                    height: 46px;
                    border-radius: .5rem;
                    border: 1px solid transparent;
                    background-color: transparent;
                    transition: border-color .3s ease;                    

                    & .icon--wrapper {
                        position: relative;
                        display: grid;
                        width: 16px;
                        height: 16px;

                        &::before {
                            position: absolute;
                            content: '';
                            top: 0;
                            left: 0;
                            width: 50px;
                            max-width: 13px;
                            aspect-ratio: 1 / 1;
                            border: 1px solid light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
                            border-radius: 50%;
                            z-index: 1;
                            transition: max-width .3s ease;
                        }

                        &::after {
                            position: absolute;
                            content: '';
                            top: 82%;
                            left: 83%;
                            transform: translate(-50%, -50%) rotate(-45deg);
                            width: 2px;
                            height: 50px;
                            max-height: 7.5px;
                            border-radius: 2px;
                            background-color: light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
                            transition: max-height .3s ease, top .3s ease, left .3s ease, border-radius .3s ease; 
                        }

                        & .bar {
                            position: absolute;
                            content: '';
                            top: 50%;
                            left: 50%;
                            transform: translate(-50%, -50%) rotate(45deg);
                            width: 1px;
                            height: 50px;
                            max-height: 0;
                            border-radius: 1px;
                            background-color: light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
                            transition: max-height .3s ease; 
                        }
                    }

                    &.active {
                        background-color: light-dark(var(--wp--preset--color--secondary), var(--secondary-dark));

                        & .icon--wrapper {
                            border-color: light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
                            
                            &::before {
                                max-width: 16px;
                            }

                            &::after {
                                top: 50%;
                                left: 50%;
                                width: 1px;
                                max-height: 10px;
                                border-radius: 1px;
                                background-color: light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
                            }

                            & .bar {
                                max-height: 10px;
                            }
                        }
                    }

                    &:hover {
                        border-color: light-dark(var(--wp--preset--color--main-alpha-50), var(--wp--preset--color--main));
                    }

                    &:focus-visible {
                        outline: none;
                        border-color: light-dark(orangered, orangered);
                    }
                }
            }

            & .menu-mobile__button {
                -webkit-tap-highlight-color: transparent;
                -webkit-touch-callout: none;
                -webkit-appearance: none;
                -moz-appearance: none;
                appearance: none;
                display: grid;
                width: 46px;
                height: 46px;
                place-content: center;
                border: 1px solid transparent;
                border-radius: .5rem;
                background-color: transparent;
                transition: background-color .3s ease-in-out, border-color .3s ease-in-out, box-shadow .3s ease-in-out;

                &:hover {
                    border-color: light-dark(var(--wp--preset--color--main-alpha-50), var(--wp--preset--color--main));
                }

                & .bar {
                    position: relative;
                    width: 1rem;
                    height: 1px;
                    background-color: light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
                    transition: transform .3s ease-in-out;

                    &::before,
                    &::after {
                        position: absolute;
                        content: '';
                        left: 0;
                        width: 1rem;
                        height: 1px;
                        background-color: light-dark(var(--wp--preset--color--contrast), var(--wp--preset--color--base));
                    }

                    &::before {
                        top: -0.35rem;
                        transition: transform .3s ease-in-out, top .3s ease-in-out;
                    }

                    &::after {
                        bottom: -0.35rem;
                        transition: opacity .3s ease-in-out, bottom .3s ease-in-out;
                    }
                }

                &:focus {
                    outline: none;
                }

                &.active {
                    & .bar {
                        transform: rotate(45deg);
                    }

                    & .bar:before {
                        top: 0;
                        transform: rotate(90deg);
                    }

                    & .bar:after {
                        bottom: 0;
                        opacity: 0;
                    }
                }
            }
        }
    }
}

#main-footer {
    background-color: var(--secondary-darker);
    color: var(--wp--preset--color--base);
    font-weight: 300;

    & ul {
        padding-left: 0;
        list-style: none;

        & li {
            & a {
                &:hover {
                    color: var(--main--lighter);

                    &::before {
                        background-color: var(--main--lighter);
                    }
                }
            }
        }
    }

    & .title-section {
        font-weight: 400;
        margin-bottom: 1rem;
    }

    & .block.middle-footer {
        & .content {
            padding: 4rem 0;
            display: flex;
            align-items: start;
            justify-content: space-between;
            flex-wrap: wrap;

            & .about {
                max-width: 400px;

                & > *:not(:last-child) {
                    margin-bottom: 1rem;
                }

                & .site-bio {
                    font-size: var(--wp--preset--font-size--small);
                }
            }

            & .other-links {
                display: flex;
                flex-wrap: wrap;
                gap: 3rem;
            }
        }
    }

    & .block.end-footer {
        & .content {
            text-align: center;
            padding: 1rem 0;
            border-top: 1px dashed var(--wp--preset--color--accent-7);
        }
    }
}

@media (width < 530px) {
    #main-header {
        & .block {
            & .content {
                & .navigation-searchform--wrapper {
                    & #custom-searchform {
                        justify-content: left !important;

                        & .section {
                            input[type="text"] {
                                width: 277px !important;
                            }
                        }
                    }
                }
            }
        }
    }
}

@media (width < 1024px) {
    #main-header {
        & .block {
            position: relative;

            & .content {
                width: 100%;
                display: flex;
                padding-left: 1.25rem;
                padding-right: .5rem;
                gap: 10px;
                align-items: center;
                justify-content: space-between;

                & .navigation-searchform--wrapper {
                    & .main-navigation {
                        position: absolute;
                        top: 0;
                        left: 0;
                        width: 250px;
                        height: 100dvh;
                        transform: translateX(-130%);
                        transition: transform .5s ease-in-out;
                        box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;

                        & > .glass-backdrop {
                            position: absolute;
                            top: 0;
                            left: 0;
                            width: 100%;
                            height: 100%;
                            z-index: -1;
                            backdrop-filter: blur(2rem);
                        }

                        &.open {
                            transform: translateX(0);
                        }

                        & .menu {
                            padding-left: 0;
                            list-style: none;

                            & :is(.menu-item-with-submenu,a) {
                                display: flex;
                                align-items: center;
                                justify-content: space-between;
                                gap: 10px;
                                padding: 15.25px 20px;
                                font-size: var(--wp--preset--font-size--large);
                                font-weight: 300;
                                color: var(--color-text-base);
                            }

                            & .menu-item-has-children {
                                & .button-for-submenu {
                                    -webkit-tap-highlight-color: transparent;
                                    -webkit-touch-callout: none;
                                    -webkit-appearance: none;
                                    -moz-appearance: none;
                                    appearance: none;
                                    background-color: transparent;
                                    border: none;
                                    width: 56px;
                                    height: 56px;
                                    display: grid;
                                    place-content: center;
                                    cursor: pointer;

                                    & svg {
                                        transform: rotate(0deg);
                                        transition: transform .3s ease;
                                    }
                                }

                                &.open {
                                    & .button-for-submenu {
                                        & svg {
                                            transform: rotate(180deg);
                                        }
                                    }
                                }

                                & .wrapper-for-title {
                                    display: flex;
                                    align-items: center;
                                    justify-content: space-between;
                                }

                                & .sub-menu {
                                    padding-left: 0;
                                    list-style: none;
                                    max-height: 0;
                                    overflow: hidden;
                                    background-color: var(--background-desktop-header);

                                    &.open {
                                        max-height: 500px;
                                    }

                                    & li {
                                        & a {
                                            padding-left: 40px;
                                            font-size: var(--wp--preset--font-size--medium);
                                        }
                                    }

                                    & li:first-child {
                                        & a {
                                            box-shadow: inset 0 5px 10px -8px var(--line-1);
                                        }
                                    }

                                    & li:last-child {
                                        & a {
                                            box-shadow: inset 0 -5px 10px -8px var(--line-1);
                                        }
                                    }

                                    & li:only-child {
                                        & a {
                                            position: relative;
                                            box-shadow: inset 0 -5px 10px -8px var(--line-1);

                                            &::after {
                                                position: absolute;
                                                top: 0;
                                                left: 0;
                                                content: '';
                                                width: 100%;
                                                height: 20px;
                                                background: transparent;
                                                box-shadow: inset 0 5px 10px -8px var(--line-1);
                                                z-index: 0;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    
                    & #custom-searchform {
                        position: absolute;
                        top: 0;
                        left: 0;
                        transform: translateY(-130%);
                        width: 100%;
                        height: 100%;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        padding-left: 1.25rem;
                        padding-right: .45rem;
                        z-index: 2;
                        background-color: light-dark(var(--wp--preset--color--base-alpha-50), var(--wp--preset--color--contrast-alpha-50));
                        backdrop-filter: blur(7px);
                        transition: transform .5s ease-in-out;

                        &.show {
                            transform: translateY(0);
                        }

                        & .section {
                            display: flex;
                            width: 100%;
                            max-width: 500px;
                            gap: .5rem;

                            & .wp-block-search__input {
                                height: 46px;
                            }

                            & .buttons-container {
                                display: flex;
                                position: relative;

                                & #searchsubmit {
                                    position: absolute;
                                    top: 3px;
                                    left: 0;
                                    transform: translateX(calc(-100% - 3px - .5rem));
                                    height: 2.46rem;
                                    background-color: var(--wp--preset--color--main-alpha-25);
                                    border: none;
                                    border-radius: 6px;
                                    width: 3rem;
                                    transition: background-color .3s ease, color .3s ease;

                                    &:hover {
                                        background-color: var(--wp--preset--color--main-alpha-50);
                                    }
                                }

                                & .close-custom-searchform {
                                    & svg {
                                        width: 1rem;
                                        height: 1rem;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

@media (width >= 1024px) {
    :is(.scroll-down,.scroll-up) {
        & #main-header {
            & .block {
                & .content {
                    padding: 0;
                }
            }
        }
    }

    & #main-header {
        & .block {
            & .content {
                display: grid;
                align-items: center;
                grid-template-columns: 1fr auto 1fr;
                padding: 0;
                transition: padding .3s ease-in-out;

                & .site-brand {
                    padding-right: 1.2rem;
                }

                & .navigation-searchform--wrapper {
                    display: flex;
                    align-items: center;

                    & .main-navigation {
                        & .glass-backdrop {
                            background-color: transparent;
                        }

                        & .glass-bright {
                            &::before,
                            &::after {
                                content: none;
                            }
                        }

                        /* NAVIGATION */
                        & > ul {
                            display: flex;
                            align-items: center;
                            padding-left: 0;
                            list-style: none;

                            &.hide {
                                max-width: 0;
                                padding: 0;
                                overflow: hidden;
                                transition: max-width .6s, padding .6s;

                                & li {
                                    & a {
                                        padding: 0;
                                        font-size: 0;
                                        opacity: 0;
                                        transition: font-size 0s ease, opacity 0s ease, padding 0s ease;
                                    }
                                }
                            }

                            & li {
                                position: relative;

                                &:has(.wrapper-for-title) {
                                    & .wrapper-for-title {
                                        display: flex;
                                        align-items: center;
                                        gap: .5rem;
                                        height: 56px;
                                        padding-left: 1rem;
                                        padding-right: .5rem;
                                        transition: background-color .3s ease;

                                        & .button-for-submenu {
                                            width: 1rem;
                                            height: 1rem;
                                            background-color: transparent;
                                            display: grid;
                                            place-content: center;
                                            border: none;
                                            transition: transform .3s ease-in-out;
                                        }

                                        &:hover {
                                            background-color: light-dark(var(--wp--preset--color--main-alpha-25), var(--wp--preset--color--main-alpha-25));

                                            & .button-for-submenu {
                                                transform: rotate(180deg);
                                            }
                                        }
                                    }
                                }

                                & > a {
                                    padding: 0 1rem;
                                    height: 56px;
                                    display: flex;
                                    align-items: center;
                                    transition: background-color .3s ease;

                                    &:hover {
                                        background-color: light-dark(var(--wp--preset--color--main-alpha-25), var(--wp--preset--color--main-alpha-25));
                                    }
                                }


                                /* MENÚ ABIERTO - EFECTO SUAVE */
                                &.menu-item-has-children .sub-menu {
                                    padding: 10px 0;
                                    position: absolute;
                                    top: 54px;
                                    width: max-content;
                                    background-color: light-dark(var(--wp--preset--color--base), var(--wp--preset--color--contrast));
                                    box-shadow: 0 1px 15px rgba(0, 0, 0, 0.25);
                                    z-index: 100;
                                    transition: 0.4s padding, 0.4s background-color, 0.4s box-shadow;

                                    /* ANIMACIÓN DE LOS ÍTEMS DEL SUBMENÚ */
                                    & li {
                                        height: 30px;
                                        padding: 0;
                                        background: transparent;
                                        white-space: nowrap;
                                        transition: 0.4s height cubic-bezier(0.4, 0, 0.2, 1),
                                                    0.4s padding cubic-bezier(0.4, 0, 0.2, 1),
                                                    0.4s margin cubic-bezier(0.4, 0, 0.2, 1),
                                                    0.1s 0.1s color,
                                                    0.2s background-color;

                                        &:hover {
                                            /* HOVER DE ÍTEMS */
                                            & > a {
                                                background-color: light-dark(var(--wp--preset--color--main-alpha-25), var(--wp--preset--color--main-alpha-25));
                                            }
                                        }

                                        & :is(a, .button-for-submenu) {
                                            padding: 0 20px;
                                            height: 30px;
                                            font-size: 14px;
                                            font-weight: 500;
                                            width: 100%;
                                            gap: 20px;
                                            justify-content: space-between;
                                            transition: 0.5s 0.2s color, 0.3s background-color ease;
                                        }

                                        & a {
                                            transition: background-color .3s ease, color .3s ease;
                                        }
                                    }
                                }

                                /* MENÚ CERRADO */
                                &.menu-item-has-children:not(:hover) > .sub-menu {
                                    padding: 0;
                                    box-shadow: 0 1px 15px rgba(0, 0, 0, 0);
                                    overflow-y: hidden;
                                    z-index: 99;

                                    /* ESTADO CERRADO DE ÍTEMS INTERIORES */
                                    & > * {
                                        visibility: hidden;
                                        height: 0;
                                        padding-top: 0;
                                        padding-bottom: 0;
                                        margin: 0;
                                        color: rgba(25, 25, 25, 0);
                                        transition: 0.4s 0.1s height,
                                                    0.4s 0.1s padding,
                                                    0.4s 0.1s margin,
                                                    0.1s color,
                                                    0.6s visibility;
                                    }
                                }
                                
                                /* EFECTO VISUAL EN PADRE ACTIVO (solo en navegadores modernos) */
                                &.menu-item-has-children:hover > :is(a, .button-for-submenu), 
                                &.menu-item-has-children:has(.sub-menu:hover) > .wrapper-for-title {
                                    background-color: light-dark(var(--wp--preset--color--main-alpha-25), var(--wp--preset--color--main-alpha-25));

                                    & .button-for-submenu {
                                        transform: rotate(180deg);
                                    }
                                }
                            } 
                        }


/* SUBSUBMENÚS (DESPLEGABLE A LA DERECHA) */

#menu-primary.menu li.menu-item-has-children .sub-menu li.menu-item-has-children .sub-menu {
    top: 0;
    left: 100%;
    z-index: 1;
}

#menu-primary.menu li.menu-item-has-children .sub-menu li.menu-item-has-children .sub-menu li:hover :is(a,.button-for-submenu) {
    background-color: var(--submenu--link--hover);
}


#menu-primary.menu li.menu-item-has-children:not(:hover) > .sub-menu > li :is(a, .button-for-submenu) {
    color: rgba(25, 25, 25, 0);
    fill: rgba(25, 25, 25, 0);
    transition: 0.1s color, 0.1s fill;
}


                        /* & .menu {
                            display: flex;
                            align-items: center;

                            max-width: fit-content;
                            transition: max-width .6s ease-in-out, padding .6s ease-in-out;
                            
                            &.hide {
                                max-width: 0;
                                padding: 0;
                                overflow: hidden;
                                transition: max-width .6s, padding .6s;

                                & li {
                                    & a {
                                        padding: 0;
                                        font-size: 0;
                                        opacity: 0;
                                        transition: font-size 0s ease, opacity 0s ease, padding 0s ease;
                                    }
                                }
                            }

                            > *:not(:nth-child(1)):after {
                                position: absolute;
                                top: 50%;
                                transform: translateY(-50%);
                                left: 0;
                                content: '';
                                width: 1px;
                                min-height: 43.8px;
                                background: linear-gradient(to bottom, transparent 10%, var(--line-1) 40%, var(--line-1) 60%, transparent 90%);
                            }

                            & li {
                                position: relative;

                                & a {
                                    padding: 0 1.2rem;
                                    transition: font-size .3s .6s, opacity .3s .8s, padding .3s .6s;
                                }
                            }
                        } */
                    }

                    & #custom-searchform {
                        position: relative;
                        width: 500px;
                        max-width: 0;
                        overflow: hidden;
                        height: 48px;
                        transition: max-width .6s ease-in-out;

                        & .section {
                            display: flex;
                            position: absolute;
                            top: 50%;
                            left: 50%;
                            transform: translate(-50%, -50%);

                            input[type="text"] {
                                width: 350px;
                                height: 42px;
                                padding-right: 60px;

                                &:focus {
                                    border-color: light-dark(var(--wp--preset--color--main), var(--wp--preset--color--main));
                                    outline: none;
                                    box-shadow: 0 0 0 1px var(--wp--preset--color--main),
                                                0 0 0 .2rem var(--wp--preset--color--main-alpha-50); 
                                }
                            }

                            & .buttons-container {
                                position: absolute;
                                top: 50%;
                                right: 3px;
                                transform: translateY(-50%);

                                & #searchsubmit {
                                    display: grid;
                                    place-content: center;
                                    width: 36px;
                                    height: 36px;
                                    border: none;
                                    background-color: transparent;
                                    border-radius: 6px;
                                    transition: background-color .3s ease, border-color .3s ease;

                                    &:hover {
                                        background-color: light-dark(var(--hover-gallery-button), var(--dark-hover-gallery-button));
                                    }

                                    &:focus-visible {
                                        outline: none;
                                        border-color: orangered;
                                        background-color: orangered;
                                    }
                                }

                                & .close-custom-searchform {
                                    display: none;
                                }
                            }
                        }

                        &.show {
                            max-width: 390px;

                            & .section {
                                opacity: 1;
                            }
                        }
                    }
                }

                & > div:has(.search-mobile__button) {
                    padding-left: 1.2rem;

                    & .search-mobile__button {
                        height: 42px;
                        width: 42px;
                    }
                }
                
                & #menu-mobile__button {
                    display: none;
                }
            }
        }
    }
}

body.is-chromium {
    & .search-mobile__button,
    & #menu-mobile__button,
    & #custom-searchform .section input[type="text"],
     & .close-custom-searchform {
        border-radius: 1rem !important;
        corner-shape: squircle;
    }
    & #searchsubmit {
        border-radius: 12px !important;
        corner-shape: squircle;
    }
}