/* ========== BASE STYLES ========== */
header {
    position: relative;
}

.menu-item.active {
    z-index: 100;
}

.menu-item .menu-content {
    transition: all 0.75s ease;
}

.menu-content a.wp-block-navigation-item__content {
    position: relative;
}

.menu-content a.wp-block-navigation-item__content:after {
    content: "";
    position: absolute;
    top: calc(50% - 7px);
    width: 100px;
    height: 14px;
    left: calc(100% + 0.5rem);
    background-size: contain;
    background-repeat: no-repeat;
    transition: all 0.25s ease;
    background-position: -100% center;
    transform-origin: left;
    opacity: 0;
}

.menu-content a.wp-block-navigation-item__content:hover:after {
    opacity: 1;
    background-position: 0% center;
}

.menu-tag-primary > .top-level-item {
    font-family: var(--wp--preset--font-family--libre-baskerville);
    text-wrap: nowrap;
}

.menu-tag-standard > .top-level-item {
    color: var(--wp--preset--color--grey-300) !important;
}

/* ========== HEADER SEARCH ========== */

.wp-block-search__button {
    background: transparent !important;
    height: 40px !important;
    aspect-ratio: 1/1 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.wp-block-search__button svg {
    display: none !important;
}
.wp-block-search__inside-wrapper {
    background-color: white !important;
    border: 1px solid var(--wp--preset--color--grey-950) !important;
    padding: 0 !important;
}
.wp-block-search__inside-wrapper input {
    padding: 8px 16px !important;
    font-size: var(--wp--preset--font-size--lg) !important;
    height: 40px !important;
    border: 0 !important;
}

.wp-block-search__button::before {
    content: "";
    display: block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2226%22%20height%3D%2226%22%20viewBox%3D%220%200%2026%2026%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M23.75%2023.75L18.3125%2018.3125M21.25%2011.25C21.25%2016.7728%2016.7728%2021.25%2011.25%2021.25C5.72715%2021.25%201.25%2016.7728%201.25%2011.25C1.25%205.72715%205.72715%201.25%2011.25%201.25C16.7728%201.25%2021.25%205.72715%2021.25%2011.25Z%22%20stroke%3D%22%230169A3%22%20stroke-width%3D%222.5%22%20stroke-linecap%3D%22square%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
    background-size: contain;
    position: relative;
    z-index: 1;
}

@media screen and (min-width: 1280px) {
    .wp-block-search__button::before {
        width: 23px;
        height: 23px;
    }
    .wp-block-search__button {
        height: 80px !important;
    }
    .wp-block-search__inside-wrapper input {
        font-size: var(--wp--preset--font-size--display-sm) !important;
        height: 80px !important;
    }
    ._search {
        opacity: 0;
        pointer-events: none;
        transition: all 0.25s ease 0.25s;
    }
    ._search.active {
        opacity: 1;
        pointer-events: all;
        transition: all 0.25s ease 0s;
    }
    ._search .wp-block-search__inside-wrapper {
        transform: translateY(20px);
        opacity: 0;
        transition: all 0.25s ease 0.15s;
    }
    ._search.active .wp-block-search__inside-wrapper {
        transform: translateY(0);
        opacity: 1;
        transition: all 0.25s ease 0.25s;
    }
    ._search ._search-close {
        transform: translateY(20px);
        opacity: 0;
        transition: all 0.25s ease 0s;
    }
    ._search.active ._search-close {
        transform: translateY(0);
        opacity: 1;
        transition: all 0.25s ease 0.45s;
    }
}

/* ========== MENU TOGGLE BUTTON ========== */

/* Container button */
.nav-btn > span {
    position: relative;
    height: 13px;
    width: 16px;
    cursor: pointer;
}

/* Reset .nav-icon span structure */
.nav-btn .nav-icon span {
    position: absolute;
    left: 0;
    right: 0;
    height: 1.5px;
    top: calc(50% - 0.75px);
    transform-origin: center;
    transition: transform 0.15s ease;
}

/* Inner <i> handles rotation */
.nav-btn .nav-icon span i {
    display: block;
    height: 100%;
    width: 100%;
    background: white;
    transform-origin: center;
    transition: transform 0.2s ease;
    transition-delay: 0.15s;
}

.mega-menu-wrapper.active .nav-btn .nav-icon span i {
    background: white;
}

/* Line 1 (top) */
.nav-btn .nav-icon span:nth-child(1) {
    transform: translateY(-5.75px);
}
.nav-btn .nav-icon span:nth-child(1) i {
    transform: rotate(0deg);
}

/* Line 2 (middle) */
.nav-btn .nav-icon span:nth-child(2) {
    transform: translateY(0);
}
.nav-btn .nav-icon span:nth-child(2) i {
    transform: rotate(0deg);
    transition: opacity 0.15s ease;
    opacity: 1;
}

/* Line 3 (bottom) */
.nav-btn .nav-icon span:nth-child(3) {
    transform: translateY(5.75px);
}
.nav-btn .nav-icon span:nth-child(3) i {
    transform: rotate(0deg);
}

/* === ACTIVE STATE === */

/* Move lines to center */
.nav-btn.active .nav-icon span:nth-child(1),
.nav-btn.active .nav-icon span:nth-child(3) {
    transform: translateY(0);
}

/* Hide middle bar */
.nav-btn.active .nav-icon span:nth-child(2) i {
    opacity: 0;
}

/* Rotate after translateY (delayed) */
.nav-btn.active .nav-icon span:nth-child(1) i {
    transform: rotate(-45deg);
}
.nav-btn.active .nav-icon span:nth-child(3) i {
    transform: rotate(45deg);
}

/* === REVERSE TRANSITION === */
/* When .nav-btn loses .active class */
.nav-btn .nav-icon span:nth-child(1),
.nav-btn .nav-icon span:nth-child(3) {
    transition-delay: 0.15s; /* delay returning to top/bottom */
}

.nav-btn .nav-icon span:nth-child(1) i,
.nav-btn .nav-icon span:nth-child(3) i {
    transition-delay: 0s; /* rotate back immediately */
    transform: rotate(0deg);
}

/* Middle line fades back in */
.nav-btn .nav-icon span:nth-child(2) i {
    opacity: 1;
    transition-delay: 0.15s;
}

/* ========== MEDIA QUERIES ========== */
@media screen and (max-width: 990px) {
    .menu-content .wp-block-columns {
        flex-direction: column !important;
    }
}

@media screen and (max-width: 992px) {
    header {
        padding: 0;
    }
    header .nav-bar {
        position: absolute;
        top: 0;
        right: 0;
        background: transparent !important;
    }
    header .secondary-links {
        display: none !important;
    }
    header .contact-details {
        position: absolute;
        right: calc(var(--wp--style--root--padding-right) * 2 + 25px);
        gap: var(--wp--style--root--padding-right) !important;
    }
    header .contact-details > div p {
        display: none !important;
    }
    header .contact-details .contact-icon,
    header .contact-details svg {
        width: 22px !important;
        height: 22px !important;
        flex-basis: 22px !important;
    }
    header .contact-details .feather-icon {
        max-width: unset !important;
    }
}

@media screen and (max-width: 1279px) {
    /* Mobile Menu Styles */

    .menu {
        position: fixed;
        top: var(--header-height-mobile);
        left: 0;
        width: 100vw;
        height: calc(100svh - var(--header-height-mobile));
        transform: translateX(100%);
        transition: all 0.75s ease;
        z-index: 999;
        overflow: clip;
        border-top: 1px solid var(--wp--preset--color--grey-200);
    }
    .menu.active {
        transform: translateX(0);
    }
    .dropdown_logo_container {
        flex-basis: 0 !important;
    }

    .menu-item .back-btn {
        position: relative;
        background-color: transparent;
        border: 0;
    }
    .menu-item .back-btn:before {
        content: "";
        background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2217%22%20viewBox%3D%220%200%2016%2017%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M14.75%208.06066H0.75M0.75%208.06066L7.75%2015.0607M0.75%208.06066L7.75%201.06066%22%20stroke%3D%22%23686E72%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22square%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
        display: block;
        width: 16px;
        height: 17px;
        background-size: contain;
    }
    .menu-item .menu-content {
        transform: translateX(100%);
    }
    .menu-item .menu-content > div:not(.back-btn-container) {
        padding-top: 1rem;
        padding-bottom: 0 !important;
        position: relative;
        z-index: 5;
        height: 100%;
    }
    .menu-item.active .menu-content {
        transform: translateY(0);
        -webkit-box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0.15);
        box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0.15);
    }
    .menu-content .has-stroke-decoration {
        display: none;
    }
    .menu-content {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        padding-top: 50px;
        padding-bottom: 80px;
    }
    .menu-item {
        padding: calc(var(--wp--style--root--padding-right) * 1.25)
            var(--wp--style--root--padding-right);
        border-bottom: 1px solid var(--wp--preset--color--grey-300);
    }
    .menu-item > .top-level-item {
        display: flex;
        position: relative;
    }
    .menu-item.menu-tag-primary > .top-level-item {
        width: 100%;
    }

    .menu .menu-item.menu-tag-primary {
        display: flex;
        position: relative;
        font-weight: 500;
    }

    .menu
        .menu-item.menu-tag-primary.last-item
        + .menu-item.menu-tag-portfolio-ethos
        > a {
        padding-top: var(--wp--style--root--padding-right);
    }
    .menu-item:last-child > .top-level-item {
        border-bottom: 0;
        padding-bottom: 0;
    }
    .menu-content .animated_logo:not(.no_animation) {
        display: none !important;
        visibility: hidden !important;
    }
    .menu-content a.wp-block-navigation-item__content:after {
        background-position: center;
    }
}

@media screen and (min-width: 1280px) {
    header {
        height: var(--header-height) !important;
    }
    .mega-menu-wrapper > button {
        display: none;
    }
    .menu {
        gap: 10px;
    }

    .menu-item {
        min-height: 63px;
        display: flex;
        align-items: center;
    }

    .menu-item .menu-content {
        opacity: 0;
        transform: translateY(-100%);
        transition: all 0.75s ease;
        box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.1);
    }
    .menu-item.active .menu-content {
        opacity: 1;
        transform: translateY(0);
    }

    .menu-item > .top-level-item {
        position: relative;
        transition: color 0.75s ease;
    }
    .menu-item > .top-level-item:after {
        content: "";
        position: absolute;
        top: calc(100% + 5px);
        left: 0;
        width: 100%;
        height: 2px;
        background: var(--wp--preset--color--blue-600);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.75s ease;
    }

    .menu-item.active > .top-level-item:after {
        transform: scaleX(1);
    }
    .menu .menu-item.menu-tag-primary.last-item {
        position: relative;
        padding-right: 10px;
    }
}

.menu-item .top-level-item.is-dropdown .dropdown-indicator span {
    transition: transform 0.5s ease;
}

.top-level-item.is-dropdown .dropdown-indicator span:last-child {
    transform: rotate(90deg) scaleX(1);
}
.menu-item.active
    .top-level-item.is-dropdown
    .dropdown-indicator
    span:last-child {
    transform: rotate(90deg) scaleX(0);
}

.menu > .acf-block-preview.wp-block-acf-menu-item {
    display: flex !important;
    justify-content: space-between !important;
    width: 100% !important;
}
