
@font-face {
    font-family: "Fredoka";
    src: url("./fonts/Fredoka-VariableFont_wdth,wght.woff2") format("woff2");
    font-weight: 300 700;
    font-display: swap;
}

:root {
    --bg: oklch(0.99 0.003 325);
    --primary: oklch(0.25 0.01 325);

    font-family: "Fredoka", sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--primary);
}

.container {
    max-width: 80rem;
    margin-inline: auto;
    padding-inline: 1rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

header {
    background-color: oklch(30% 0.08 255);
    color: oklch(98% 0 0);
}

header nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;

    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

header nav a {
    display: inline-block;
    color: inherit;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;

    transition: background-color 0.2s ease-in-out;
}

header nav a:hover {
    background-color: oklch(43% 0.11 255);
}

header nav a:focus-visible {
    outline: 2px solid oklch(85% 0.15 90);
    outline-offset: 3px;
}

.row {
    display: flex;
    gap: 2rem;

    > div {
        flex: 1;
        padding: 1rem;
        border: 1px dashed var(--primary);
    }

    > div:first-child {
        flex-grow: 2;
    }
}

@media (max-width: 40rem) {
    .row {
        flex-direction: column;
    }
}

main nav {
    --text: oklch(0.99 0.003 325);
    --bg: oklch(0.45 0.32 40);

    ul {
        display: flex;
        flex-wrap: wrap;
        align-items: center;

        list-style: none;
        padding: 0;
        margin: 0;
    }

    li:first-child {
        margin-inline-end: auto;
    }

    a {
        display: block;
        padding: 0.75rem 1rem;

        color: var(--text);
        background-color: var(--bg);
        text-decoration: none;

        transition:
            color 0.2s ease-in-out,
            background-color 0.2s ease-in-out;
    }

    li:first-child a {
        color: inherit;
        background-color: transparent;
        font-weight: bold;
        padding-inline-start: 0;
    }

    li:not(:first-child) a {
        &:hover,
        &:focus-visible {
            color: var(--bg);
            background-color: var(--text);
        }
    }

    a:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 2px;
    }
}

.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;

    list-style: none;
    margin: 0;
    padding: 0;

    > li {
        flex: 1 1 18rem;
        min-width: 0;

        display: flex;
        flex-direction: column;

        position: relative;
        border-radius: 0.5em;
        overflow: hidden;
        isolation: isolate;

        box-shadow:
            0 0 0.2rem oklch(0 0 0 / 0.2),
            0 0 2rem oklch(0 0 0 / 0.1);

        transition: box-shadow 0.2s ease-in-out;

        &:hover,
        &:focus-within {
            box-shadow:
                0 0 0.4rem oklch(0 0 0 / 0.3),
                0 0 2.5rem oklch(0 0 0 / 0.2);
        }

        &:focus-within {
            outline: 2px solid var(--primary);
            outline-offset: 3px;
        }

        &::before {
            content: "";
            position: absolute;
            inset: 0;

            background-color: oklch(70% 0.18 25 / 0.7);
            mix-blend-mode: multiply;

            transform: scale(0);
            transform-origin: top left;
            border-radius: 50%;

            z-index: 1;
            pointer-events: none;

            transition:
                transform 450ms cubic-bezier(0.2, 0.7, 0.2, 1),
                border-radius 350ms ease 100ms;
        }

        &:hover::before,
        &:focus-within::before {
            transform: scale(1);
            border-radius: 0;
        }
    }

    img {
        order: -1;
        display: block;
        width: 100%;
        aspect-ratio: 7 / 3;
        object-fit: cover;
        z-index: 0;
    }

    .content {
        display: flex;
        flex-direction: column;
        flex: 1;
        padding: 1rem;
        z-index: 2;

        a:first-of-type {
            margin-block-start: auto;

            &::after {
                content: "";
                position: absolute;
                inset: 0;
            }
        }

        a:not(:first-of-type) {
            position: relative;
            z-index: 1;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        scroll-behavior: auto;
    }

    .cards > li,
    .cards > li::before,
    header nav a,
    main nav a {
        transition: none;
    }
}