*,
*::before,
*::after {
    box-sizing: border-box;
}

@font-face {
    font-family: "Greger";
    font-weight: 700;
    font-style: normal;
    font-display: optional;
    src: url("/fonts/Greger.woff2"), url("/fonts/Greger.woff");
}

:root {
    --primary-color: #002e40;
    --secondary-color: #fa9600;
}

body {
    --padding-inline: 2em;
    --max-content-width: 1000px;
    --grid-columns: [full-width-start] minmax(var(--padding-inline), 1fr)
        [content-start]
        min(var(--max-content-width), (100% - (var(--padding-inline) * 2)))
        [content-end] minmax(var(--padding-inline), 1fr) [full-width-end];
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--primary-color);
    background: color-mix(in srgb, #fff 100%, #000 10%);
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica,
        Arial, sans-serif;
    display: grid;
    grid-template-columns: var(--grid-columns);
    grid-template-rows: auto 1fr auto;
    min-height: 100dvh;
    margin: 0;
    padding-block: 1em;

    > :not(header, footer, .full-width) {
        grid-column: content;
    }

    &:has(> header) {
        grid-template-rows: auto 1fr auto;
    }

    header {
        row-gap: 1em;
    }

    > header,
    > footer,
    .full-width {
        width: 100%;
        justify-self: center;
        display: grid;
        grid-template-columns: var(--grid-columns);
        grid-column: full-width;

        > *:not(.full-width) {
            grid-column: content;
        }
    }
}

@keyframes rotate-gradient {
    from {
        background-position: 10% 20%;
        background-size: 200% 200%;
    }
    to {
        background-position: 90% 80%;
        background-size: 200% 200%;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: clip;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

h1 {
    container-type: inline-size;
    position: relative;
    flex-grow: 1;
    font-family: "Greger";
    font-weight: 700;
    font-size: clamp(7.5rem, 3.587rem + 19.5652vw, 12.75rem);
    height: 0.8em;
    line-height: 1em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    text-align: center;
    color: transparent;
    transition:
        0.3s ease-in-out opacity,
        0.3s ease-in-out filter,
        0.1s ease-in-out background-size,
        0.1s ease-in-out background-position,
        0.1s ease-in-out -webkit-text-stroke;
    overflow: clip;

    a {
        display: inline-block;
        position: relative;
        color: inherit;
        background: inherit;
        padding: inherit;
        transition: inherit;
        line-height: inherit;
        height: inherit;

        &:after {
            content: attr(data-title);
            top: 0;
            left: 0;
            padding: inherit;
            position: absolute;
            transition: inherit;
            -webkit-text-stroke: 0.0125em oklch(1 0 0);
        }

        &:after {
            background: radial-gradient(
                var(--secondary-color),
                var(--primary-color)
            );
            animation: rotate-gradient 6s infinite alternate;
            opacity: 0.8;
            background-clip: text;
            -webkit-background-clip: text;
        }

        &:hover {
            color: inherit;
            transition: inherit;

            &:after {
                opacity: 1;
            }
        }
    }
}

h2 {
    margin-block-start: 0;
    text-align: center;
    text-shadow: 0 0 3px #000;
    color: #fff;
}

h3 {
    margin-block-end: 0;
    text-align: center;
}

a {
    color: var(--primary-color);
    font-weight: 600;

    &[href$=".ics"] {
        align-self: end;
        justify-self: center;
        display: block;
        font-weight: 600;
        font-size: large;
        padding: 0.5em 1em;
        background: var(--primary-color);
        border: none;
        border-radius: 4px;
        opacity: 0.9;
        box-shadow: 1px 1px 4px oklch(0 0 0 / 0.5);
        transition:
            0.25s ease-in-out opacity,
            0.25s ease-in-out color,
            0.25s ease-in-out box-shadow;
        color: oklch(from #fff l c h / 0.9);
        text-decoration: none;

        &:hover {
            opacity: 1;
            color: #fff;
            box-shadow: 1px 1px 2px oklch(0 0 0 / 0.5);
        }

        &::before {
            content: "";
            display: inline-block;
            vertical-align: middle;
            width: 1em;
            height: 1em;
            margin-inline-end: 0.25ch;
            mask-image: url("/images/rss.svg");
            background: currentColor;
        }
    }
}

form {
    display: grid;
    justify-content: center;
    gap: 0.5em;

    label {
        font-weight: 600;
        text-align: center;
    }

    button {
        position: relative;
        cursor: pointer;
        font-weight: 600;
        font-size: large;
        padding: 0.5em 1em;
        background: var(--primary-color);
        border: none;
        border-radius: 4px;
        opacity: 0.9;
        box-shadow: 1px 1px 4px oklch(0 0 0 / 0.5);
        transition:
            0.25s ease-in-out opacity,
            0.25s ease-in-out color,
            0.25s ease-in-out box-shadow;
        color: oklch(from #fff l c h / 0.9);

        &:hover {
            opacity: 1;
            color: #fff;
            box-shadow: 1px 1px 2px oklch(0 0 0 / 0.5);
        }

        &.steam {
            padding-inline-end: 3.5em;

            &::after {
                position: absolute;
                top: 0;
                left: 0;
                content: "";
                display: block;
                background-image: url("/images/steam.svg");
                background-size: 3.5em;
                background-repeat: no-repeat;
                background-position: calc(100% + 10px) center;
                mix-blend-mode: soft-light;
                border-radius: 4px;
                width: 100%;
                height: 100%;
            }
        }
    }
}

main {
    display: grid;
    grid-auto-rows: auto 1fr auto;
    align-self: start;
    container-type: inline-size;
    gap: 1em;

    &:not(.event) {
        &:not(:has(> ul)) {
            grid-auto-rows: 1fr auto;

            h3 {
                align-self: center;
            }
        }

        > ul,
        > form {
            align-self: start;
        }

        > form {
            margin-block-start: 2em;
        }
    }

    a[href^="https://steamcommunity.com/profiles/"] {
        display: inline-grid;
        gap: 0.25em;

        img {
            max-width: 64px;
            border: 0.125em solid oklch(1 0 0);
            border-radius: 4px;
            box-shadow: 1px 1px 4px oklch(0 0 0 / 0.5);
        }
    }

    &.event {
        margin-block-start: 1em;

        dl {
            display: grid;
        }

        ul {
            list-style: none;
            padding: 0;
        }

        a img {
            border: 0.125em solid oklch(1 0 0);
            border-radius: 4px;
            box-shadow: 1px 1px 4px oklch(0 0 0 / 0.5);
        }

        ul:has(a[href^="https://steamcommunity.com/profiles/"]) {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr 1fr;
            justify-content: center;
            gap: 1em;

            @container (width < 1000px) {
                grid-template-columns: 1fr 1fr 1fr;
            }

            @container (width < 600px) {
                grid-template-columns: 1fr 1fr;
            }

            li {
                position: relative;
                display: grid;
                grid-template-columns: auto 1fr;
                gap: 1em;

                div {
                    display: grid;
                    gap: 0.125em;
                    align-content: center;
                }

                em {
                    font-size: small;
                }

                strong,
                em {
                    white-space: nowrap;
                    text-overflow: ellipsis;
                    overflow: hidden;
                }

                span {
                    width: fit-content;
                    font-variant: small-caps;
                    text-transform: lowercase;
                    font-size: smaller;
                    background: var(--primary-color);
                    color: #fff;
                    padding: 0.125em 0.5em;
                    border-radius: 4px;
                    font-weight: 400;

                    &[data-state="attending"] {
                        background: var(--secondary-color);
                    }

                    &[data-state="unavailable"] {
                        background: oklch(
                            from var(--primary-color) l c h / 0.5
                        );
                    }
                }
            }
        }

        ul:has(a[href^="https://store.steampowered.com/app/"]) {
            display: grid;
            justify-content: center;
            grid-template-columns: 1fr 1fr;
            gap: 1em;

            @container (width < 600px) {
                grid-template-columns: 1fr;
            }

            a {
                display: inline-block;

                img {
                    width: 100%;
                }
            }

            p {
                position: absolute;
                width: 1px;
                height: 1px;
                padding: 0;
                margin: -1px;
                overflow: clip;
                clip: rect(0, 0, 0, 0);
                border: 0;
            }
        }
    }
}

a:has(> lanjam-ticket) {
    perspective: 600px;
    &:hover {
        lanjam-ticket {
            filter: drop-shadow(1px 1px 3px oklch(0 0 0 / 1));
            transform: translateZ(0.5em);
        }
    }
}

lanjam-ticket {
    --rotate-x: 0deg;
    --rotate-y: 0deg;
    --rotate-z: 0deg;
    display: grid;
    position: relative;
    margin-inline: auto;
    width: 100%;
    max-width: 600px;
    filter: drop-shadow(2px 2px 6px oklch(0 0 0 / 0.5));
    perspective: 600px;
    transform: rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg))
        rotateZ(var(--rotate-z, 0deg)) scale(var(--scale, 1));
    transition: 0.125s ease-in-out transform;

    picture {
        mask-image: url("/images/ticket_mask.svg");
        mask-repeat: no-repeat;
        mask-size: contain;
        width: inherit;
        max-width: inherit;
        height: auto;
        pointer-events: none;

        img {
            display: block;
        }
    }
}

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

dl {
    margin: 0;
}

dt {
    font-weight: 600;
    margin-block: 1.5em 0.5em;

    &:first-child {
        margin-block: 0 0.5em;
    }
}

dd {
    margin: 0;
}

ul:has(li > a > lanjam-ticket),
main.event div:has(> lanjam-ticket) {
    dt,
    dd strong,
    dd em {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: clip;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    dd:not(.attendee) a:has(img) {
        position: absolute;
        top: -0.5em;
        left: 2em;
    }

    dd.attendee {
        position: relative;
        display: inline-block;
        top: -0.6em;

        & + & {
            margin-inline-start: 0.25em;
        }

        img {
            max-width: 42px;
        }
    }
}

main.event div:has(> lanjam-ticket) {
    display: block;
    margin-inline: auto;
}

ul:has(li > a > lanjam-ticket),
main.event {
    display: grid;
    justify-content: center;
    list-style: none;
    padding: 0;
    gap: 2em;

    > li,
    div:has(> lanjam-ticket) {
        display: inline-grid;
        position: relative;
        padding-block-start: 1.5em;
        justify-items: center;
    }

    time {
        display: grid;
        position: absolute;
        top: -0.7em;
        right: 3em;
        margin-block-end: 1em;
        font-size: 0.7rem;
        background: #fff;
        color: var(--primary-color);
        border-radius: 4px;
        font-weight: 400;
        box-shadow: 1px 1px 4px oklch(0 0 0 / 0.5);

        > span {
            text-align: center;
        }

        .month {
            order: -1;
            padding: 0.5em 0.75em;
            background: var(--primary-color);
            color: #fff;
            font-weight: 600;
            border-radius: 4px 4px 0 0;
        }

        .day {
            padding-block: 0.125em;
            font-size: 2.5em;
        }

        .year {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: clip;
            clip: rect(0, 0, 0, 0);
            border: 0;
        }

        .time {
            position: absolute;
            bottom: -1.25em;
            justify-self: center;
            background: oklch(
                from var(--secondary-color) calc(l * 1.25) calc(c / 1.25) h
            );
            padding: 0.25em 0.5em;
            border-radius: 4px;
        }
    }
}

footer {
    margin-block: 4em 1em;
    text-align: center;
    text-wrap: balance;

    img {
        max-width: 1em;
        margin: 0.0625em;
        vertical-align: bottom;
    }
}
