#msp-oa-detail {

    overscroll-behavior: contain;
    width: 100vw;
    max-width: 1140px;
    height: 95vh;
    border: none;
    padding: 2rem 1rem;
    container-type: inline-size;
    border-radius: 20px;
    overflow: auto;
    scrollbar-color: white black;
    scroll-behavior: smooth;

    @media screen and (min-width: 700px) {
        padding: 3rem;

    }

    header {
        position: relative;

        h2 {
            text-align: center;
        }
    }

    button.close {
        position: absolute;
        top: 1em;
        right: 3em;
        border: none;
        background: none;
        padding: 0;
        line-height: normal;
        color: black;
        display: flex;
        gap: .3rem;
        align-items: center;
        padding: .3rem .5rem;

        &::after {
            line-height: normal;
            
        }

        @container (width > 600px) {
            top: 2em;
        }
    }

    a.read-more {
        display: inline-flex;
        gap: .5rem;
        align-items: center;
        padding: 0 .3rem;
        transform: translateX(-.3rem);
        &::after {
            transform-origin: center;
            transform: rotate(-90deg);
        }
        span {
            text-decoration: underline  ;
        }
    }

    .downloads a {
        padding: .3rem .5rem;
        span {
            text-decoration: underline;
        }
        
    }

    section,
    .part {
        margin-bottom: 5rem;
        &.diff {
            margin-bottom: 2.5rem;
        }
    }



    h4 {
        margin: 0 0 1rem 0;
    }

    .map {
        position: relative;

        .canvas {
            border-radius: 20px 20px 0 0;
            aspect-ratio: 3 / 5;
            overflow: hidden;

            @container (width > 840px) {
                aspect-ratio: 3 / 2;
            }
        }

        #msp-oa-elevation {
            position: absolute;
                left: 0;
                right: 0;
                bottom: 0;

            @container (width > 840px) {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
            }
        }

        .elevation-detached {
            height: 13.75rem;

            svg {
                height: 100%;
            }

            @container (width > 840px) {
                height: 15rem;
            }

        }

        .elevation-summary {
            display: none;
        }

    }

    .info {
        padding: 1.8rem;
        border: 2px solid black;
        border-radius: 0 0 20px 20px;
        display: grid;
        gap: 2rem 5rem; 

        grid-template-columns: 1fr;

        
        grid-template-areas: "a""b""c""d";

        @container (width > 840px) {
            grid-template-columns: repeat(2, 1fr);
            grid-template-areas: "a a""b c""d d";
        }

        header {
            grid-area: a;
        }

        dl {
            grid-area: b;
            display: grid;
            grid-template-columns: auto 1fr;
            gap: .5rem;
            align-items: start;
        }

        .tags {
            grid-area: c;

            ul {
                display: flex;
                flex-wrap: wrap;
                gap: 8px;
                margin: 0;
                padding: 0;
            }

            li {
                padding: 4px 8px;
                list-style-type: none;
                border-radius: 2px;
            }
        }

        .downloads {
            grid-area: d;

            ul {
                display: flex;
                flex-wrap: wrap;
                gap: 2rem;
                margin: 0;
                padding: 0;

                li {
                    list-style-type: none;

                    a {
                        display: flex;
                        gap: .5rem;
                        align-items: center;
                    }
                }
            }

        }
    }

    &::backdrop {
        background-color: rgba(0, 0, 0, .7);
        overflow: hidden;
        /* Needed to make this a scroll container */
        overscroll-behavior: contain;
    }

    &::before {
        content: "";
        display: block;
        height: 2rem;
        background-image: url(/wp-content/plugins/msp-oa/assets/svg/points.svg);
        background-repeat: no-repeat;
        background-position: center;
        background-size: auto 100%;
        margin: 1rem 0 2rem;
    }

    /*
    button.close span {
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        height: 1px;
        overflow: hidden;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }
        */

    ul.gallery {
        margin: 5rem 0 0 0;
        padding: 0;
        border-radius: 20px;
        overflow: hidden;

        li {
            list-style-type: none;
        }

        figure {
            position: relative;
            margin: 0;

            img {
                display: block;
                width: 100%;
            }
        }

        figcaption {
            padding: .5rem 1rem;

            @container (width > 840px) {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                background-color: rgba(0, 0, 0, .7);
            }

        }

        .hidden {
            display: none;
        }

        .splide__arrow {
            opacity: 1;
            padding: 1.2rem;
            &::before {
                line-height: normal;
                border-radius: 50%;
            }
            &:hover::before {
                background-color: black;
                border: 1.5px solid black;
                color: white;
            }
        }

        .splide__arrow--prev {
            left: 0;
            border-radius: 0 50% 50% 0;

            &::before {
                transform: rotate(90deg);
            }
        }

        .splide__arrow--next {
            right: 0;
            border-radius: 50% 0 0 50%;

            &::before {
                transform: rotate(-90deg);
            }
        }
    }

    header+ul.gallery {
        margin: 0;
        border-radius: 20px 20px 0 0;
    }

    strong.difficulty,
    strong.rating,
    strong.elevation,
    strong.season {
        display: flex;
        gap: 1rem;
        align-items: center;
    }

    strong.rating {
        @container (width < 600px) {
            justify-content: space-between;
        }
    }

    .diff p,
    .track p {
        padding-bottom: 1em;
        border-bottom: 1px solid #b1b1b1;

        &:last-child {
            border: none;
            padding-bottom: 0;
        }
    }
    .track p:has(.season) {
        border: none;
        padding-bottom: 0;
    }

    figure.rating {
        align-items: center;
        display: inline-flex;
        margin: 0.5rem 0;
    }

    ul.rating {
        display: inline-flex;
        gap: .5rem;
        margin: 0;
        padding: 0;

        li {
            list-style-type: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;

            &:not(.mark) {
                border: 1.5px solid black;
            }

        }
    }

    ul.season-legend {
        margin: 1rem 0 0 0;
        padding: 0;
        li {
            display: flex;
            gap: .5rem;
            align-items: center;
            &::before {
                content: "";
                display: block;
                width: 10px;
                height: 10px;
                background-color: black;
                border-radius: 50%;
            }
        }
    }
    ul.season {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        margin: 1rem 0 0 0;
        gap: 1px;
        padding: 0;

        li {
            &:first-child {
                padding-left: 20px;
                border-radius: 20px 0 0 0;
            }

            &:last-child {
                padding-right: 20px;
                border-radius: 0 0 20px 0;
            }
        }

        @container (width > 620px) {
            grid-template-columns: repeat(12, 1fr);

            li {
                &:first-child {

                    border-radius: 20px 0 0 20px;
                }

                &:last-child {
                    padding-right: 20px;
                    border-radius: 0 20px 20px 0;
                }
            }
        }

        li {
            list-style-type: none;
            padding: 5px 10px;
            text-align: center;




        }
    }

    ul.waypoints {
        margin-left: 0;
        padding: 0;
        position: relative;

        &::before {
            content: "";
            position: absolute;
            display: block;
            left: 3rem;
            top: 3rem;
            bottom: 3rem;
            width: 5px;
            background-color: #C6C6C6;
            z-index: 0;

            @container (width > 620px) {
                left: 7rem;
            }
        }

        li {
            list-style-type: none;
            padding: 1rem;
            margin-bottom: 3rem;
            border-radius: 20px;

            &,
            * {
                position: relative;
            }

            @container (width > 620px) {
                padding: 2rem 3rem 2rem 5rem;
            }
        }

        li>div {
            display: grid;
            grid-template-columns: 4rem 1fr 5rem;
            gap: 1.5rem;
            align-items: center;

            p {
                margin-bottom: 0;
            }

            span.distance {
                text-align: right;
                display: flex;
                gap: .5rem;
            }
        }

        li>figure {
            display: grid;
            grid-template-areas: "a";
            margin: 2rem 0 0 0;

            figure {
                position: relative;
                margin: 0;

                &::after {
                    content: "";
                    display: block;
                    position: absolute;
                    background-color: white;
                    z-index: 10;
                }
            }

            img {
                object-fit: cover;
                width: 100%;
                height: 100%;
                display: block;
            }

            &.img2 {
                grid-template-areas: "a a b";

                &>*:nth-child(1) {
                    aspect-ratio: 2 / 1;

                }

                &>*:nth-child(2) {
                    aspect-ratio: 1 / 1;
                }
            }

            &.img3 {
                grid-template-areas: "a a b""a a c";

                &>*:nth-child(1) {
                    aspect-ratio: 2 / 1;
                }

                &>*:nth-child(2),
                &>*:nth-child(3) {
                    aspect-ratio: 2 / 1;
                }

                &>*:nth-child(2)::after {
                    left: 0;
                    right: 0;
                    bottom: 0;
                    height: .5rem;
                    transform: translateY(50%);
                }
            }

            &.img2,
            &.img3 {
                &>*:nth-child(1) {
                    aspect-ratio: 2 / 1;

                    &::after {
                        right: 0;
                        top: 0;
                        bottom: 0;
                        width: .5rem;
                        transform: translateX(50%);
                    }
                }
            }

            &>*:nth-child(1) {
                grid-area: a;
            }

            &>*:nth-child(2) {
                grid-area: b;
            }

            &>*:nth-child(3) {
                grid-area: c;
            }
        }
    }

    figure.way {
        margin: 0 0 1em;

        ul {
            display: flex;
            width: 100%;
            margin: 0;
            padding: 0;

            li {
                list-style-type: none;
                height: 20px;
            }
        }
    }

    div.way dl {
        margin-left: 1em;
        display: grid;
        grid-template-columns: auto 1fr;

        dt,
        dd {
            display: inline-flex;
            align-items: center;
        }

        dt {
            .bullet::before {
                content: "•";
                margin-right: .5em;
                color: currentColor;
                font-size: 2rem;
                line-height: normal;
            }
        }
    }

    p.cols2 {
        display: grid;
        
        grid-template-columns: 1fr;
        @container (width > 840px) {
            gap: 2rem;
            grid-template-columns: repeat(2, 1fr);
        }
    }

    section.recommendations {


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

        .items[data-view="grid"] {
            display: grid;
            grid-template-rows: auto auto;
            gap: 1.5rem;

            grid-template-columns: 1fr;

            @container (width > 500px) {
                grid-template-columns: repeat(2, 1fr);
            }

            @container (width > 840px) {
                grid-template-columns: repeat(3, 1fr);
            }

            article {
                grid-row: span 2;
                display: grid;
                grid-template-rows: subgrid;

                header {
                    grid-row: 1;
                    display: grid;
                    grid-template-rows: auto 1fr;
                }

                &>div {
                    grid-row: 2;
                }

                div.category {
                    position: absolute;
                    top: 0;
                    left: 0;
                    z-index: 10;

                    gap: .3rem;
                    padding: .2rem .5rem;

                    img {
                        height: 24px;
                    }
                }
            }
        }

        article {
            overflow: hidden;
            border-radius: 15px 15px 10px 10px;

            &[role="button"] {
                cursor: pointer;
            }

            header {
                display: flex;
                flex-wrap: wrap;

                &>img {
                    order: 1;
                    aspect-ratio: 4 / 2;

                }

                h4 {
                    order: 2;
                    margin: 1.2rem 1.2rem 0;

                }
            }

            div {
                padding: 0 1.2rem 1.2rem;

                p.desc {
                    margin-top: 1.2rem;
                }
            }
        }
    }
}

.msp-oa {
    .address {
        span {
            display: block;
        }
    }

    dd div.category {
        border-radius: 5px;

    }
}

.msp-oa-elevation-theme.elevation-control {
    .background {
        background-color: rgba(0, 0, 0, .7);
        border-radius: 10px 10px 0 0;
    }

    .area path.altitude,
    .legend-altitude rect.area {
        fill: black;
        stroke: white;
        stroke-width: 2;
    }

    g.area,
    path.area {
        paint-order: unset;
    }

    .axis text {
        fill: none;
        font-weight: 300;
        paint-order: unset;
        stroke-width: 1;
    }

    .elevation-summary.inline-summary {
        margin: 0;
        padding: .5rem;
    }

    .grid,
    .ruler {
        display: none;
    }

}

#msp-oa-detail section.recommendations {
    h4 {
        display: flex;
        align-items: flex-end;
    }
}