/* Pages */

/* Typology grid: the index, and related stories on the show page */
section.story-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(var(--tg-columns, 4), 1fr);
    position: relative;

    canvas {
        mix-blend-mode: overlay;
    }

    &.is-arranging {
        visibility: hidden;
    }

    .typology-links {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;

        path {
            fill: none;
            stroke: var(--typology-link-colour, #fff);
            stroke-width: 3px;
            stroke-linecap: round;
            stroke-linejoin: round;
            vector-effect: non-scaling-stroke;
            stroke-dasharray: 0 8;
        }
    }

    .story {
        aspect-ratio: 1/1;
        width: 100%;
        height: 100%;
        line-height: 0;
        overflow: hidden;
        position: relative;
        cursor: pointer;
        color: inherit;
        text-decoration: none;
        opacity: 0;
        transition: opacity 1s ease;

        &:has([data-halftone-drawn]),
        &:not(:has([data-halftone-target])),
        .halftone--fallback & {
            opacity: 1;
        }

        &:nth-of-type(4n) {
            border-radius: 40rem;
        }

        .story-information {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 1rem;
            align-items: center;
            text-align: center;
            color: white;
            line-height: 1.2;
            opacity: 0;
            transition: opacity 0.2s ease-in-out;

            .icons {
                display: flex;
                gap: 0.25rem;
            }

            .icon {
                width: 1rem;
                height: 1rem;
                object-fit: contain;
            }
        }

        &:hover .story-information {
            opacity: 1;
        }

        img, video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            aspect-ratio: 1/4;
        }
    }
}


main.stories {
    display: flex;
    flex-direction: column;

    section.introduction {
        color: var(--white);
        display: grid;
        grid-template-columns: repeat(var(--tg-columns, 4), 1fr);
        position: relative;
        row-gap: 2.5rem;
        padding: 2rem 0 10rem 0;

        .button {
            width: 100%;

            &:hover {
                gap: 1rem;
            }
        }

        img {
            max-width: 15rem;
        }

        .span-2 {
            grid-column: span 2;
            padding-right: 4rem;
        }

        @media (width < 77rem) {
            .section:nth-of-type(2) {
                grid-column: 3/5;
            }

            nav {
                grid-column: 1/3;
            }

            .section:nth-of-type(3) {
                grid-column: 3;
            }
        }

        @media (width < 50rem) {
            grid-template-columns: 1fr 1fr;
            padding-bottom: 4rem;

            .section:nth-of-type(3) {
                grid-column: inherit;
            }

            .section:nth-of-type(2) {
                grid-column: span 2 ;
            }

            > :nth-child(-n + 3) {
                grid-column: 1 / -1;
            }

            .span-2 {
                padding-right: 0;
            }
        }
    }

    section.type-grid {
        position: absolute;
        height: 100vh;
        width: 150vh;
        z-index: 2;
        display: grid;
        grid-template-columns: repeat(6, 1fr);

        .letter {
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }

    canvas {
        mix-blend-mode: overlay;
    }
}

main.story {
    padding: 6rem 0 0 0;
    display: flex;
    gap: 2rem;
    min-height: calc(100svh - 4rem);
    flex-direction: column;

    .story-background {
        position: fixed;
        inset: 0;

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

        canvas {
            mix-blend-mode: overlay;
        }
    }

    section.story-text {
        @media (scripting: enabled) {
            &:not([data-line-reveal-ready]) :is(.h4, .lexxy-content > *, .tag, .button) {
                visibility: hidden;
            }
        }

        position: relative;
        padding: 4rem 0;
        width: 100%;
        max-width: 1200px;
        margin: auto;
        display: flex;
        flex-direction: column;
        gap: 6rem;
        align-items: center;
        justify-content: center;

        @media (width < 50rem) {
            gap: 4rem;
        }

        .icon {
            display: inline-block;
            width: 0.8rem;
            height: 0.8rem;
            background-color: var(--story-colour);
            background-color: white;
            mask: var(--icon) center / contain no-repeat;
        }

        p {
            color: white;
            color: oklch(from var(--story-colour, white) clamp(0, (0.65 - l) * infinity, 1) 0 0);
        }

        .h4 {
            color: oklch(from var(--story-colour, white) clamp(0, (0.65 - l) * infinity, 1) 0 0);
            text-align: center;
        }

        .button {
            background-color: black;

            &:hover {
                background-color: var(--white);
            }
        }
    }

    .tags {
        justify-content: center;
    }

}

main.page {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 10rem 0;
    align-items: center;
    color: white;

    @media (width < 50rem) {
        padding: 6rem 0;
    }

    section.content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6rem;
        width: 100%;

        @media (width < 50rem) {
            gap: 4rem;
        }

        .large {
            max-width: 1200px;

            p {
                font-size: clamp(1.6rem, 3.5vw, 3.1rem);
            }
        }

        .body {
            max-width: 800px;

            p + p {
                text-indent: clamp(2rem, 6vw, 4rem);
            }

            /* Lexxy's content styles default to dark ink */
            .lexxy-content {
                color: inherit;
            }

            /* Pull quotes, e.g. the jury's comments: a Lexxy quote in a text block */
            blockquote {
                padding-left: clamp(2rem, 6vw, 4rem);
                font-style: italic;

                p + p {
                    text-indent: 0;
                }
            }

            a {
                color: rgb(215, 91, 14);
                text-decoration: underline;
                text-underline-offset: 0.15rem;
                text-decoration-thickness: 0.1rem;
            }
        }

        .image {
            width: 100%;
            max-width: 1200px;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;

            img {
                width: 100%;
            }

            figcaption {
                opacity: 0.5;
            }
        }
    }

}
