/* animation keyframes */

@keyframes unfold {
    0% {
        height: 0;
    }

    100% {
        height: var(--popupheight);
    }
}

@keyframes foldin {
    0% {
        height: var(--popupheight);
    }

    100% {
        height: 0;
    }
}

@keyframes foldimg {
    0% {
        height: 100vh;
    }

    100% {
        height: 0;
    }
}

@keyframes foldbtn {
    0% {
        max-width: 50vw;
        padding: 2.5px 15px;
        font-size: var(--basic);
    }

    100% {
        max-width: 0;
        padding: 0;
        font-size: 0;
    }
}


.popup {
    display: none;
    width: 50rem;
    margin: 0;
    padding: 0;
    top: 0;
    background: var(--gray);
    mask-image: url("../images/paper-1-copy.svg");
    mask-position: 50% 0;
    mask-repeat: no-repeat;
    mask-size: 100% var(--popupheight);
    height: var(--popupheight);
    overflow: scroll;
    scrollbar-width: none;
    position: relative;

    & > * {
        flex-shrink: 0;
    }

    &.unfold {
        display: flex;
        flex-direction: column;
        z-index: 8;
        scrollbar-width: none;
        animation: unfold 0.5s cubic-bezier(0.85, 0, 0.15, 1) both;

        &::-webkit-scrollbar {
            display: none;
        }
    }

    &.hidden {
        animation: foldin 0.5s cubic-bezier(0.85, 0, 0.15, 1) both;
    }

    .popupInner {
        width: 50rem;
        height: fit-content;
        color: var(--ac-text);
        padding: 7.5vh 0;
        font-family: var(--txt-font);
        font-size: var(--basic-josa);
        line-height: 1.45;

        p {
            width: 70%;
            margin: auto;
            margin-block-start: 0;
            margin-block-end: 0;
        }

        .contrib-name {
            font-family: var(--txt-font);
            font-size: var(--basic-josa);
            font-weight: normal;
        }

        .popupTitle {
            padding: 5rem;
            float: left;
            shape-outside: circle(50%);
            shape-margin: 0;
            max-width: 40%;
            font-family: var(--title);
            font-size: var(--big);
            font-weight: normal;

            h4 {
                margin-block-start: 0;
                margin-block-end: 2vh;
                font-weight: normal;
                line-height: 1;
            }

            .popupTags {
                display: flex;
                gap: .5rem;
                flex-wrap: wrap;

                li {
                    padding: .25rem 1rem;
                    border-radius: 15px 15px 0% 0%;
                    background: var(--bg);
                    font-size: var(--small);
                }
            }
        }

        /* if block type audio is first block add padding top */
        .popupTitle ~ .block-type-audio {
            margin: 5vh 0;
        }

        .audio-container {
            width: 70%;
            margin: auto;

            audio {
                width: 70%;
                margin: auto;
                display: block;
            }
        }
    }

    .closepopup {
        position: sticky;
        width: 32px;
        height: 32px;
        bottom: 4vh;
        left: calc(25rem - 16px);
        filter: blur(1px);
        transition: filter .5s ease;
        margin-top: 5vh;

        &:hover {
            filter: blur(0);
        }
    }
    .closepopup:before, .closepopup:after {
        position: absolute;
        left: 15px;
        top: 0;
        content: ' ';
        height: 33px;
        width: 2px;
        background-color: var(--ac-text);
    }
    .closepopup:before {
        transform: rotate(45deg);
    }
    .closepopup:after {
        transform: rotate(-45deg);
    }

    /* video tests */
    video {
        /* max-width: 100%; */
        width: 100%;
    }

    iframe {
        width: 100%;
        aspect-ratio: 16/9;
        border: 0;
    }
}

/* translation */
.translation.block {
    display: none;
}

.popupInner.translated {
    .translation.block {
        display: block;
    }

    .block {
        display: none;
    }
}

.translatebtn {
    display: none;
    column-gap: 10px;
    position: absolute;
    top: 55vh;
    padding: 2.5px 15px;
    background-color: var(--gray);
    border-radius: 6px 6px 0% 0%;
    font-family: var(--title);
    font-size: var(--basic);
    transform: rotate(90deg);
    right: 25rem;
    transform-origin: right bottom;

    span {
        color: var(--op-text);
    }
    span.active {
        color: var(--ac-text);
    }
    &.hideAnimation {
        animation: foldbtn 0.5s cubic-bezier(0.85, 0, 0.15, 1) both;
    }
}

.popup.unfold:has(.translation) ~ .translatebtn {
    display: flex;
}


.block-type-heading {
    font-size: var(--big);
    font-family: var(--subtitle);
    margin-bottom: 2vh !important;

    > * {
        font-weight: normal;
        margin-block-end: 0;
        width: 70%;
        margin: auto;
        /* text-align: center; */
    }

}

.popup.image-recipe {
    .popupTitle {
        padding: 5rem;
        float: none;
        shape-outside: none;
        shape-margin: 0;
        max-width: 100%;
        text-align: center;

        .popupTags {
            justify-content: center;
        }
    
        & + .block-type-text {
            margin-top: 10vh;
        }

    }
  .popupInner {
    padding: 0;
    padding-bottom: 7.5vh;

        p {
            width: 80%;
            text-align: center;
        }
  }
}

.block-type-image {
    figure {
        margin: 2rem 5rem;
    }
    figcaption {
        font-size: var(--small);
        text-align: center;
    }
    img {
        width: 100%;
        /* max-height: 98vh;
        object-fit: contain;
        object-position: center; */
    }
}

/* video recipe */
.popup.video-recipe {
    .popupInner {
        padding: 0;
    }
    .popupTitle + .block-type-text {
        margin-top: 10vh;
    }
}


/* poem popup */
.popup.poem-recipe {
    .popupInner {
        padding: 0;
    }

    .popupTitle {
      padding: 5rem;
      float: none;
      shape-outside: none;
      shape-margin: 0;
      max-width: 100%;
      text-align: center;
    }

    & .popupTags {
        justify-content: center;
    }

    .popupTitle + .block {
        margin-top: -5vh;
    }

    p {
        width: 70%;
        margin-block-start: 2vh;
        margin-block-end: 2vh;
    }

    /* .secondLang {
        color: var(--op-text);
    } */

    .block:last-of-type {
        margin-bottom: 11vh;
    }
}

.popup.text-recipe {
    .block {
        margin-bottom: 5vh;
    }
    .block-type-list {
        margin-bottom: 2vh;
    }
}

/* blocks */
.block-type-align-right p {
    margin-block-start: 1vh;
    margin-block-end: 1vh;
    text-align: right;
}

.block-type-align-left p {
    margin-block-start: 1vh;
    margin-block-end: 1vh;
    text-align: left;
}

.block-type-align-center p {
    margin-block-start: 1vh;
    margin-block-end: 1vh;
    text-align: center;
}

.block-type-footnote-text {
    float: left;
    shape-outside: circle(50%);
    shape-margin: 0;
    max-width: 45%;
    padding: 2rem 1rem;
    font-size: var(--small);
    margin-bottom: 0 !important;

    sup {
        font-size: var(--small);
        font-family: var(--title);
        margin: 0;
        font-weight: bold;
        margin-right: 5px;
    }
}

.block-type-text {
    sup {
        font-size: var(--small);
        font-family: var(--title);
        margin: 0 5px;
        font-weight: bold;
        border-bottom: 1px solid var(--ac-text);
        padding: 2px;
    }
}

.block-type-list {

    ul {
        display: block;
        font-weight: normal;
        width: 70%;
        margin: auto;
        
        li:not(:last-child)::after {
            content: '';
        }
    }
}

