// Photos Page
.photos {
    // Intro Section
    &__intro {
        overflow: hidden;
        margin-bottom: 72px;
        color: $color-text;
        text-align: center;

        // Title
        h1 {
            margin-top: -20px;
            color: $color-secondary;
            line-height: 1;

            @include bp (sm) {
                margin-top: -100px;
            }
        }
        // Text
        p {
            max-width: 456px;
            margin: 20px auto 56px;

            @include bp (sm) {
                margin: 50px auto 72px;
                max-width: 524px;
            }
        }
    }

    // Filter
    .filter {
        position: relative;
        max-width: 982px;
        margin: 0 auto;
        padding: 0 16px;

        @include bp (sm) {
            padding: 0 32px;
        }

        // Span
        &__label {
            display: block;
            color: rgba($color-tertiary, 0.7);

            @include bp (sm) {
                position: absolute;
                left: 64px;
                top: 52%;
                transform: translateY(-50%);
                margin-bottom: 0;
            }
        }

        &__bar {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 64px;
            margin: 20px 0;
            padding: 0 12px;
            background: $color-primary-darker;
            border-radius: 50vh;

            @include bp (mob-lg) {
                padding: 0 16px;
            }
            @include bp (sm) {
                height: 72px;
                padding: 28px 32px;
            }

            ul {
                display: flex;
                flex-wrap: wrap;
                align-items: center;
                justify-content: center;
            }
            li {
                display: block;
                margin: 8px 2px;
                font-size: rem(14px);
                color: #fff;

                @include bp (sm) {
                    margin: 0 2px;
                    font-size: rem(16px);
                }
            }
            .icon {
                display: block;
                width: 20px;
                height: 20px;
                overflow: hidden;
                margin-right: 12px;
                fill: #fff;
                border-radius: 100%;
                transition: fill 0.2s;

                @include bp (sm) {
                    width: 26px;
                    height: 26px;
                }
            }

            .select {
                position: relative;
                display: flex;
                align-items: center;
                padding: 8px 12px 8px 8px;
                font-weight: 900;
                border-radius: 100vh;
                transition: background-color 0.2s;

                @include bp (sm) {
                    padding: 8px 16px;
                }

                select {
                    opacity: 0;
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    cursor: pointer;
                }
            }

            // Hover
            li:hover {
                .icon {
                    fill: $color-secondary-light;
                }
                .select {
                    background-color: $color-primary-tertiary20;
                }
            }
        }

        // Actions
        &__actions {
            display: flex;
            align-items: center;
            justify-content: center;

            @include bp (sm) {
                position: absolute;
                top: 50%;
                right: 56px;
                transform: translateY(-50%);
            }

            a {
                display: block;
                text-decoration: none;
                color: rgba(#fff, 0.6);
                font-size: rem(14px);
                font-weight: 900;
                line-height: 1;

                img {
                    display: block;
                }
            }

            // Reset link
            .reset {
                margin-right: 16px;
                padding: 0;
                color: rgba($color-tertiary, 0.6);
                font-weight: 900;
                font-size: rem(14px);
                transition: color 0.3s;

                &:hover {
                    color: $color-tertiary;
                }
            }

            // Shuffle button
            .shuffle {
                display: flex;
                align-items: center;
                justify-content: center;
                height: 32px;
                background-color: $color-tertiary;
                padding: 0 16px;
                border-radius: 50vh;
            }
        }
    }

    // Content Block
    &__content {
        background-color: $color-tertiary;
        // margin: 0 12px;
        padding: 20px 0;
        border-radius: 6px;

        @include bp (sm) {
            padding: 64px 0;
            border-radius: 8px;
        }
    }

    // Photo Grid
    &__grid {
        display: grid;
        grid-column: span var(--columns);
        // Template: 2 / 1-1
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 16px;

        @include bp (mob-lg) {
            grid-gap: 20px;
        }
        @include bp (sm) {
            // Swich to template: 2-1-1 / 1-1-2 / 4
            grid-column: 2 / span 22;
            grid-template-columns: repeat(4, 1fr);
            grid-gap: 24px;
        }
        @include bp (sd) {
            grid-gap: 40px;
        }

        // Photo
        .photo {
            overflow: hidden;
            border-radius: 6px;

            a {
                position: relative;
                display: block;
                height: 100%;

                & > picture {
                    height: 100%;

                    img {
                        display: block;
                        width: 100%;
                        height: 100%;
                        object-fit: cover;
                        pointer-events: none;
                        user-select: none;
                    }
                }
            }

            /**
             * Photo sizes
             */
            // MOBILE
            // 1st photo = 2 columns
            &:nth-child(5n + 1) {
                @include bp (sm, max) {
                    grid-column: span 2;
                    grid-row: span 2;
                    margin-bottom: 8px;
                }
            }
            // 4 next photos = 1 column each
            &:nth-child(5n + 4),
            &:nth-child(5n + 5) {
                @include bp (sm, max) {
                    margin-bottom: 8px;
                }
            }


            // DESKTOP
            // 1st photo = left 2 columns, 2 rows
            &:nth-child(11n + 1){
                @include bp (sm) {
                    grid-column: span 2;
                    grid-row: span 2;
                }
            }
            // 8th photo = right 2 columns, 2 rows
            &:nth-child(11n + 8){
                @include bp (sm) {
                    grid-column: 3 / span 2;
                    grid-row: span 2;
                }
            }
            // 11th photo = 4 columns
            &:nth-child(11n){
                @include bp (sm) {
                    grid-column: span 4;
                }
            }
            // Additional spacing between grid patterns
            &:nth-child(11n + 11){
                @include bp (sm) {
                    margin-top: 12px;
                }
                @include bp (sd) {
                    margin-top: 16px;
                }
            }
            &:nth-child(11n),
            &:nth-child(11n + 1),
            &:nth-child(11n + 4),
            &:nth-child(11n + 5){
                @include bp (sm) {
                    margin-bottom: 12px;
                }
                @include bp (sd) {
                    margin-bottom: 16px;
                }
            }

            // Postcard
            .post-card {
                position: absolute;
                bottom: 0;
                right: 0;
                display: none;
            }
        }
    }


    // Message
    &__message {
        // grid-column: ;
        text-align: center;
        padding: clamp(48px, 10vw, 160px) 0;
        color: $color-text;

        @include bp (sm) {
            grid-column: 3 / span 20;
        }
    }


    /**
     * Controls
     */
    .controls {
        grid-column: span var(--columns);
        display: grid;
        margin: 48px auto;
        align-items: center;
        justify-content: center;

        @include bp (sm) {
            --columns: 22;
            grid-column: 2 / span var(--columns);
            justify-content: space-between;
            margin: 80px 0;
        }

        // Updated Date
        &__date {
            grid-column: span var(--columns);
            grid-row: 2;
            font-size: rem(18px);
            color: rgba($color-gray, 0.6);
            font-weight: 300;
            text-align: center;
            margin: 24px 0 48px;

            @include bp (sm) {
                grid-column: span 5;
                grid-row: 1;
                text-align: left;
                margin: 0;
            }
        }

        // See More Photos
        .button {
            $color-button: #F2D3B8;
            grid-column: span var(--columns);
            grid-row: 1;
            margin: 0 auto;
            height: 56px;
            background-color: $color-button;
            font-size: rem(16px);
            border: none;

            @include bp (sm) {
                grid-column: 6 / span 12;
                height: 72px;
                padding: 0 40px;
                font-size: rem(18px);
            }

            &[disabled] {
                background: none;
                border: 2px solid darken($color-button, 2);
            }
        }

        // Photo Count
        &__count {
            grid-column: span var(--columns);
            grid-row: 3;
            text-align: center;
            color: rgba($color-gray, 0.3);
            font-family: $font-serif;
            font-size: rem(64px);
            line-height: 1;
            letter-spacing: -0.05em;

            @include bp (sm) {
                grid-column: 16 / span 7;
                grid-row: 1;
                margin-left: auto;
                text-align: right;
            }
        }
    }

    // Modules
    .grid-modules {
        grid-column: span var(--columns);
        margin-bottom: 0;

        @include bp (sm) {
            grid-column: 2 / span 22;
        }
    }
}