

:root {
    --color-text-lighter: #555;
    --color-hyperlink: #0042C7;
    --color-selected: #fbf46d;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #2c2c2c;
        --color-text: #feffef;
        --color-text-lighter: #feffef;
        --color-hyperlink: deepskyblue;
    }

    a:hover {
        color: var(--color-background);
    }
}

body {
    max-width: 60ch;
    margin: 0 auto;
    padding: 0 1ch;
    min-height: 97vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

/* TITLE GLITCH */
[data-glitch] {
    position: relative;
}

[data-glitch]::before {
    content: attr(data-glitch);
    color: var(--color-text);
    background: var(--color-background);
    position: absolute;
    top: 0;
    left: -3px;
    right: 0;
    bottom: -2px;
    overflow: hidden;
    animation: glitch-animation 15s ease-in infinite;
}

@keyframes glitch-animation {
    15% {
        clip-path: inset(0 0 0 0);
    }
    18% {
        clip-path: inset(50% 36% 0 0);
    }
    24% {
        clip-path: inset(10% 0 30% 0);
    }
    30% {
        clip-path: inset(0 0 50% 0);
    }
    35% {
        clip-path: inset(12% 0 62% 0);
    }
    37% {
        clip-path: inset(87% 0 2% 0);
    }
    40% {
        clip-path: inset(40% 0 40% 40%);
    }
    42% {
        clip-path: inset(0 0 0 0);
    }
}


/* HEADER */
body > header {
    display: block;
    padding-top: 24px;
    margin-bottom: 64px;
    border-bottom: none;
}

.main-menu {
    display: flex;
    justify-content: center;
    list-style: none;
    margin-left: 0;
    margin-top: 1.2rem;
    padding: 0.4ch 0;
    font-size: 12px;
}

.main-menu > li {
    display: flex;
}

.main-menu > li+li::before {
    content: "✼";
    color: var(--color-text-lighter);
    font-size: 0.75rem;
    align-self: center;
    padding: 0 0.7ch;
}

.main-menu > li::marker {
    content: none;
}

body > header > h2 {
    font-weight: normal;
    text-transform: none;
    counter-increment: none;
    counter-reset: none;
    line-height: 0.7rem;
    margin-bottom: -0.4rem;
}

body > header > h2::before {
    content: none;
}

a:hover {
    margin: -0.1rem -0.3ch -0.1rem -0.312ch;  /* a little more than padding to prevent break in new place */
}

a[aria-describedby="footnotes"] {
    /* hide value of element */
    content: attr(aria-label);
}

a[aria-describedby="footnotes"]::before {
    /* vertical-align: super;
    font-size: 0.7rem; */
    content: attr(data-marker);
}

body > article {
    padding-bottom: 1.5rem;
}


footer {
    border-top: 1px solid var(--color-text-lighter);
    padding-top: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: left;
    hyphens: none;
}

footer :target {
    outline: var(--color-selected) solid 2px;
    outline-offset: 2px;
}

footer h4 {
    display: none;
}

footer ol,
footer ol > li {
    padding-left: 1ch;
}

footer ol > li::marker {
    content: attr(data-marker);
}

footer div[role="listitem"] {
    text-indent: -1.5ch;
    margin-left: 1.6ch;
    hyphens: none;
}

footer div[role="listitem"] dfn {
    font-style: normal;
}

/* TIL */

.til {
    padding-top: 1.5rem;
    line-height: 1.25;
}

.til>h2 {
    text-transform: none;
}

.til>h2::before {
    display: none;
}

.til nav ul {
    padding-left: 0;
    margin-left: 0;
    margin-top: 2rem;
}

.til nav ul li::marker {
    content: none;
}

.til nav li {
    border-bottom: 2px dotted var(--color-text);
    margin-bottom: 1ch;
}

.til nav a {
    display: flex;
    justify-content: space-between;
    align-items: end;
}

.til nav a[data-created]::after {
    content: attr(data-created);
    padding-left: 0.16rem;
    margin-bottom: -5px;
    background-color: var(--color-background);
}

.til nav a:hover[data-created]::after {
    background-color: var(--color-selected);
    margin-bottom: 0px;
}


.til nav a:hover {
    margin-bottom: -0.7ch;
}

.til nav a cite {
    margin-bottom: -5px;
    background-color: var(--color-background);
    padding-right: 0.16rem;
    font-style: normal;
}

.til nav a:hover cite {
    margin-bottom: 0;
    background-color: var(--color-selected);
}


.til header {
    margin-bottom: 1rem;
}

.til header h2,
.til header h3 {
    text-transform: none;
    text-align: left;
    line-height: 0.2;
}

.til header h2::before {
    content: "TIL: ";
    font-weight: bold;
}

.til header h3::before {
    content: none;
}

.til header h3 {
    font-weight: normal;
    color: var(--color-text-lighter);
}

.til blockquote {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.til figure {
    display: inline;
}

.til figure figcaption::before,
.til figure::after {
    content: none;
}

.til blockquote,
.til figcaption {
    line-height: 1.5;
}
