/* RESET CSS */
/* https://piccalil.li/blog/a-more-modern-css-reset/ */
/* https://www.joshwcomeau.com/css/custom-css-reset/ */

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

html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

body {
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, button, input, label { line-height: 1.1; }
input, button, textarea, select { font: inherit; }
h1, h2, h3, h4 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }

img, picture {
    display: block;
    max-width: 100%;
}

textarea:not([rows]) { min-height: 10em; }
:target { scroll-margin-block: 5ex; }

/* GLOBAL CSS */

@font-face {
    font-family: "Ioskeley";
    src: url("assets/Ioskeley Mono.woff2");
}

@font-face {
    font-family: "IBM Plex Sans";
    src: url("assets/IBM Plex Sans.woff2");
}

@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("assets/Atkinson Hyperlegible Next.woff2");
}

@keyframes flicker-opacity {
    0%   { opacity: 1; }
    50%  { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes flicker-background {
    0%   { background-color: white; }
    50%  { background-color: transparent; }
    100% { background-color: white; }
}

@keyframes fade-in {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

:root { --background-color: #1D2336; }
body {
    height: 100vh;
    background-color: var(--background-color);
    font-family: Ioskeley, monospace;
    font-size: 1.25rem;
    color: white;
}

/* ELEMENTS AND COMPONENTS */

article {
    & h1, h2 {
        padding: 0.5rem 1rem;
        background-color: white;
        color: var(--background-color);
    }

    & h1 {
        font-family: system-ui, sans-serif;
        font-stretch: ultra-expanded;
        margin-top: 0;
    }

    & h2, h3 { width: max-content; }
    & h2, h3, p, li, dt, dd { font-size: inherit; }

    & ul > * + * { margin-block-start: 0.5rem; }
}

a:not(.filled) {
    background-color: transparent;
    color: white;

    &:hover {
        background-color: white;
        color: var(--background-color);
        text-decoration: none;
        animation: flicker-background 0.15s 1;
    }
}

button {
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
}

*:focus {
    background-color: transparent;
    color: white;
    outline: 1px solid white;
}

input, textarea {
    width: 100%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: white;
}

input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, 0.7); }
input:focus, textarea:focus {
    border: 2px solid white;
    outline: none;
    z-index: 1000;
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    & label {
        display: block;
        margin-bottom: 0.5rem;
    }

    & button { max-width: max-content; }
}

/* LAYOUTS */

.nav-main {
    display: grid;
    grid-template-columns: 1fr min(65ch, 100%) 1fr;
    gap: 4rem;
    height: 100vh;
    padding-block: 4rem;

    & main {
        overflow-y: scroll;
        scrollbar-width: none;
    }
}

.sidebar {
    display: flex;
    justify-content: flex-end;

    & ul {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        margin: 0;
        padding: 0;
        list-style-type: none;
    }

    & a {
        display: block;
        padding: 0.5rem 1rem;
        text-decoration: none;
    }
}

.columns {
    display: flex;
    gap: 1rem;
    & * { flex-grow: 1; }
}

/* CLASS STYLES */

.active { box-shadow: -2px 0 0 white; }
.padding-md { padding: 0.5rem 1rem; }
.padding-lg { padding: 0.5rem 2rem; }

.font-expanded {
    font-family: system-ui, sans-serif;
    font-stretch: ultra-expanded;
}

/* .blur { backdrop-filter: blur(1px); } */
.filled {
    background-color: white;
    color: var(--background-color);
    text-decoration: none;
    a&:hover, button&:hover { animation: flicker-background 0.1s 2; }
}

.flicker {
    opacity: 0;
    animation: flicker-opacity 0.1s 2 forwards;
}

.trickle > * {
    opacity: 0;
    animation: flicker-opacity 0.1s forwards;
    &:nth-child(1) { animation-delay: 100ms; }
    &:nth-child(2) { animation-delay: 200ms; }
    &:nth-child(3) { animation-delay: 300ms; }
    &:nth-child(4) { animation-delay: 400ms; }
    &:nth-child(5) { animation-delay: 500ms; }
    &:nth-child(6) { animation-delay: 600ms; }
    &:nth-child(7) { animation-delay: 700ms; }
}

article.trickle > * { animation: fade-in 0.2s forwards; }

/* PAGE SPECIFIC */

#background {
    position: fixed;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}

#splash {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: max-content;
    height: 100%;
    margin-inline: auto;
    font-family: system-ui, sans-serif;
    font-stretch: ultra-expanded;

    & h1 {
        margin: 0;
        text-wrap: nowrap;
        text-align: center;
        font-size: clamp(3rem, 10vw, 8rem);
        font-weight: 800;
    }

    & span:has(a) { align-self: flex-end; }
}

#controls {
    & *:first-child { margin-top: 0; }

    & #background-control {
        width: max-content;

        & input { display: none; }
        & label {
            display: block;
            padding: 0.5rem 1rem;
            cursor: pointer;

            &:hover {
                background-color: white;
                color: black;
                mix-blend-mode: screen;
                animation: flicker-background 0.15s 1;
            }

            input:checked + & {
                background-color: white;
                color: black;
                mix-blend-mode: screen;
            }
        }

        & button {
            margin-top: 1rem;
            width: 100%;
            display: block;
            cursor: pointer;
        }
    }
}

#guests {
    button { align-self: flex-end; }
    & .guest-post {
        padding: 1rem;
        margin-top: 2rem;
        border: 2px solid rgba(255, 255, 255, 0.5);

        & h3 { margin: 0; }
        & span { margin-left: auto; }
        & div {
            display: flex;
            align-items: baseline;
            gap: 1rem;
        }

        & p { margin-bottom: 0; }
    }
}
