:root {
    --gallery-item-size: 100px;
    --gallery-outline-thickness: 1px;
    --article-min-margin: 0ch;
    --article-padding: 2ch;
    --article-max-width: 120ch;
    --article-margin:  max(
        var(--article-min-margin),
        calc(100vw / 2 - var(--article-max-width) / 2)
    );
}

html {
    background-color: var(--text-background-dark);
    background-image: url(../../assets/matrix.png), url(../../assets/noise.png);
    background-position: center;
    background-repeat: repeat;
    image-rendering: crisp-edges;
    overflow-x: hidden;
    background-size: 64px, 2048px;
}

body {
    margin: 0;
}

article::before {
    content: "";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--article-margin);
    height: 100vh;
    background-image: linear-gradient(to right, #0000, var(--text-background-dark));
    z-index: -1;
}

article::after {
    content: "";
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    width: var(--article-margin);
    height: 100vh;
    background-image: linear-gradient(to left, #0000, var(--text-background-dark));
    z-index: -1;
}

article {
    background-color: var(--text-background-dark);
    box-sizing: content-box;
    padding-inline: var(--article-padding);
    padding-top: calc(var(--root-line-height) * 2);
    padding-bottom: calc(var(--root-line-height) * 2);
    margin-block: 0;
    margin-inline: var(--article-margin);
    max-width: var(--article-max-width);
    overflow-wrap: break-word;
    min-height: calc(100vh -  calc(var(--root-line-height) * 4));
}

pre {
    position: relative;
    box-sizing: border-box;
    background-color: var(--text-background);
    overflow-x: scroll;
    padding-inline: var(--article-padding);
    padding-block: calc(var(--root-line-height) - 2px);
    width: calc(100% + var(--article-padding) * 2);
    left: calc(-1 * var(--article-padding));
    margin-block: var(--root-line-height);
    border: 1px solid;
    border-color: var(--text-grey-dark);
}

pre.p {
    background-color: unset;
    padding-inline: unset;
    padding-block: unset;
    width: 100%;
    left: unset;
    margin-block: unset;
    border: unset;
}

code {
    color: var(--text-bright);
    padding-inline: calc(0.6ch - 1px);
    margin-inline: calc(0.4ch);
    border: 1px solid;
    border-color: var(--text-grey-bright);
    white-space: nowrap;
}

.quote {
    border-left: 1px solid var(--text-grey-dark);
    padding-left: 2ch;
    margin-left: 2ch;
}

hr:not(.minor) {
    border: none;
    box-sizing: border-box;
    margin-block: calc(var(--root-line-height) - 1px);
    width: calc(100% + 1.5 * var(--article-margin) + var(--article-padding));
    height: 1px;
    position: relative;
    background-color: var(--text-grey);
    margin-left: calc(-0.75 * var(--article-margin) - var(--article-padding) / 2);
    mask: linear-gradient(to right, transparent, black, black, transparent);
}

hr:is(.minor) {
    border: none;
    box-sizing: border-box;
    width: 100%;
    height: 1px;
    background-color: var(--text-background-bright);
    margin-block: calc(var(--root-line-height) - 1px);
}

article > img {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-right: -50%;
    margin-block: var(--root-line-height);
}

.gallery {
    width: 100%;
    display: grid;
    justify-content: center;
    grid-template-columns: repeat(auto-fill, var(--gallery-item-size));
    margin-block: var(--root-line-height) !important;
    grid-gap: var(--gallery-outline-thickness);
}

.gallery * { 
    width: var(--gallery-item-size);
    height: var(--gallery-item-size);
    padding: 0;
    margin: 0;
}

.gallery img {
    outline: var(--gallery-outline-thickness) solid var(--text-grey-dark);
}

.gallery img:hover {
    outline: var(--gallery-outline-thickness) solid var(--deep-purple-bright);
    filter: brightness(1.25);
    z-index: 1;
}

.gallery img:active {
    outline: var(--gallery-outline-thickness) solid #fff;
    filter: brightness(0.75);
    z-index: 1;
}

a {
    color: var(--deep-purple);
    text-decoration: none;
}

a:hover {
    color: var(--deep-purple-bright);
}

a:active {
    color: #fff;
}

#javascript-notice {
    display: flex;
    justify-content: center;
    text-align: center;
}

.centered-paragraph {
    display: flex;
    justify-content: center;
}

#problematic-toggle {
    visibility: hidden;
    position: absolute;
    display: none;
}

#problematic-toggle ~ .gallery .problematic img {
    content: url(../../assets/album_covers/BAD.png);
}

#problematic-toggle:checked ~ .gallery .problematic img {
    content: revert;
}

#problematic-toggle ~ .gallery .problematic {
    pointer-events: none;
}

#problematic-toggle:checked ~ .gallery .problematic {
    pointer-events: unset;
}

#problematic-button:hover * {
    color: var(--text-white);
}

#problematic-button:active * {
    color: var(--text-white-bright);
}

input[type=text] {
    background-color: var(--deep-purple-darkest);
    color: var(--deep-purple-bright);
    border: none;
    padding: 0;
    padding-inline: 0.5ch;
    margin: 0;
    margin-inline: 0.5ch;
    font-size: inherit;
    outline: solid 1px var(--deep-purple-darker);
    width: 1ch;
}

input[type=text]:focus {
    outline: solid 1px var(--deep-purple);
}