/* Color Variables */
.capsule-1 {
    --gradient-capsule: var(--gradient-mauve);
    --qa-background: rgba(189, 188, 225, 0.6);
}

.capsule-2 {
    --gradient-capsule: var(--gradient-cyan);
    --qa-background: rgba(143, 213, 213, 0.8);
}

.capsule-3 {
    --gradient-capsule: var(--gradient-orange);
    --qa-background: rgba(250, 194, 140, 0.8);
}

.capsule-4 {
    --gradient-capsule: var(--gradient-rouge);
    --qa-background: rgba(243, 171, 150, 0.8);
}

.capsule-5 {
    --gradient-capsule: var(--gradient-vert);
    --qa-background: rgba(139, 227, 195, 0.8);
}

.capsule-6 {
    --gradient-capsule: var(--gradient-bleu);
    --qa-background: rgba(171, 203, 235, 0.8);
}

/* Single Capsule Section */
.single-capsule {
    padding: 85px 0 70px;
    background: var(--gradient-capsule) no-repeat;
    background-size: 100% 605px;
    gap: 0;

    h1 {
        max-width: 920px;
        text-align: center;
    }

    .intro-container {
        gap: 40px !important;

        .preambule {
            margin-bottom: 0 !important;
        }
    }

    hr.wp-block-separator {
        max-width: 920px;
        width: 100%;
        margin: 70px 0 !important;
        background-color: #ababab;
    }

    .quick-access-container,
    .materiel-container {
        gap: 60px !important;
    }

    /* Quick Access Grid */
    .grid-quick-access {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        column-gap: 30px !important;
        row-gap: 60px !important;
        max-width: calc((445px * 2) + (30px * 2)) !important;
        margin: 0 auto 10px !important;
        padding: 0 !important;

        &:has(:nth-child(3)) {
            grid-template-columns: repeat(3, 1fr);
            max-width: calc((445px * 3) + (30px * 2)) !important;

            @media (max-width: 1440px) {
                max-width: 100% !important;
                padding: 0 40px !important;
            }
        }

        .quick-access {
            position: relative;
            margin: 0 auto;
            padding: 0;

            h3 {
                width: 90%;
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                z-index: 2;
                text-align: center;
            }

            figure {
                position: relative;

                &::after {
                    content: "";
                    position: absolute;
                    inset: 0;
                    background: var(--qa-background);
                    z-index: 1;
                }
            }

            img {
                max-width: 350px;
                display: block;
                filter: brightness(1);
                position: relative;
                z-index: 0;
            }

            &:hover figure::after {
                background: #ede1cacc;
            }

            &:focus-visible {
                outline: auto !important;
            }
        }
    }

    /* Materiel Grid */
    .grid-materiel {
        display: grid !important;
        column-count: 2 !important;
        column-gap: 30px !important;
        row-gap: 60px !important;
        max-width: calc((445px * 3) + (31px * 2)) !important;
        margin: 0 auto 100px !important;
        padding: 0 !important;

        .materiel {
            align-items: flex-start !important;
            max-width: 445px;
            gap: 40px;

            img {
                max-width: 99px;
            }

            p {
                font-size: 16px !important;
                color: #666666 !important;
            }

            h3 {
                line-height: 26px !important;
                margin-bottom: 12px !important;
                font-weight: 400 !important;

                @media (max-width: 744px) {
                    font-size: 16px !important;
                    line-height: 20px !important;
                }

                a {
                    text-decoration: none !important;

                    &:hover {
                        text-decoration: underline !important;
                    }
                }
            }
        }
    }
}

/* Video Shortcode Styles */
.custom-video-container {
    max-width: 920px !important;
    width: 100%;
    margin: 70px auto 70px !important;

    .custom-video-wrapper {
        position: relative;
        overflow: hidden;
        cursor: pointer;

        &:focus-visible {
            outline: auto !important;
            outline-width: 2px !important;
            outline-style: solid !important;
        }
    }

    .custom-video-poster {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        z-index: 1;
    }

    .custom-video-player {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: contain;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 0;
    }

    /* Vidéo cachée tant qu’il y a un poster ; visible au clic (is-playing) */
    .custom-video-wrapper.has-poster .custom-video-player {
        visibility: hidden;
    }

    .custom-video-wrapper.has-poster.is-playing .custom-video-player {
        visibility: visible;
        z-index: 2;
    }

    .custom-video-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 20px;
    }

    .custom-video-transcription {
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: var(--font-family-primary);
        font-size: 18px;
        font-weight: 400;
        color: #666;
        text-decoration: underline;

        .external-link-icon {
            width: 16px;
            height: auto;
            display: inline-block;
        }
    }

    .custom-video-duration {
        font-family: var(--font-family-primary);
        font-size: 18px;
        font-weight: 400;
        color: #666;
        text-align: right;
    }
}

/* Capsule Navigation */
.capsule-navigation {
    max-width: none !important;
    width: 100% !important;
    background: rgba(237, 225, 202, 0.4);
    padding: 82px 0;
    margin: 0 auto !important;
    gap: 10px;

    .row {
        max-width: none !important;
        width: 442px !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        position: relative;

        p {
            margin: 0 !important;
            font-weight: 600;
            font-size: 20px !important;
            line-height: 24px;
            text-decoration: none !important;
            color: #000 !important;

            &:last-of-type {
                margin-left: 0 !important;
                padding-left: 0 !important;

                &::before {
                    content: "";
                    display: inline-block;
                    width: 2px;
                    height: 20px;
                    background-color: #000;
                    margin-right: 14px;
                    vertical-align: middle;
                }
            }

            &:first-of-type::after {
                content: none;
            }
        }

        figure {
            margin: 0 !important;
            line-height: 0;
            transition: transform 0.25s ease-out !important;
            display: inline-block;

            img {
                width: 15.68px !important;
                height: auto !important;
            }
        }
    }
}

@media (max-width: 1210px) {
    .single-capsule {
        padding: 40px 20px 60px;
    }
}

/* Hide mobile-only elements on desktop */
.capsule-mobile-header,
.capsule-mobile-divider {
    display: none;
}

/* Mobile Responsive Styles */
@media (max-width: 744px) {
    .single-capsule {

        .intro-container {
            max-width: 100% !important;
            text-align: center;
            gap: 24px !important;
        }

        hr.wp-block-separator {
            margin: 50px 0 !important;
        }

        .quick-access-container,
        .materiel-container {
            gap: 40px !important;
        }

        .grid-quick-access {
            grid-template-columns: 1fr !important;
            column-gap: 0 !important;
            row-gap: 30px !important;

            .quick-access img {
                width: 220px !important;
            }
        }

        .grid-materiel {
            grid-template-columns: 1fr !important;
            row-gap: 40px !important;
            padding: 0 !important;
            margin: 0 !important;

            .materiel {
                max-width: 100%;
                gap: 16px;

                img {
                    max-width: 73px;
                }

                p {
                    font-size: 14px !important;
                }
            }
        }
    }

    .custom-video-container {
        max-width: 100% !important;
        margin: 50px auto 50px !important;

        .custom-video-meta {
            margin-top: 15px;
        }

        .custom-video-transcription,
        .custom-video-duration {
            font-size: 14px;
        }
    }

    .capsule-navigation {
        padding: 40px 20px;

        .row {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            gap: 10px;
            width: 100% !important;
            max-width: 100% !important;

            .desktop-capsule-word {
                display: none;
            }

            p:last-of-type::before {
                display: none !important;
            }

            .capsule-mobile-header {
                display: block;
                width: 100%;
                order: 0;
                font-family: var(--font-family-primary, 'Albert Sans');
                font-weight: 600;
                font-size: 16px;
                line-height: 19px;
                text-align: center;
                color: #000;
                margin-bottom: 0;
            }

            figure:first-of-type {
                order: 1;
            }

            p:first-of-type {
                order: 2;
                margin: 0 !important;
                font-weight: 600;
                font-size: 16px !important;
                line-height: 19px;
            }

            .capsule-mobile-divider {
                display: block;
                order: 3;
                width: 0;
                height: 16px;
                border-left: 2px solid #000;
            }

            p:last-of-type {
                order: 4;
                margin: 0 !important;
                font-weight: 600;
                font-size: 16px !important;
                line-height: 19px;
            }

            figure:last-of-type {
                order: 5;
            }

            /* Arrow styling */
            figure {
                margin: 0 !important;
                line-height: 0;

                img {
                    width: 15.68px !important;
                    height: 20px;
                }
            }
        }
    }
}