:root {
    --medium-red: #9A480C;
    --dark-red: #5B2702;
    --orange: #CF9622;
    --white: #F1E8D7;
    --grey: #8B8474;
    --black: #110A02;
    --yellow: #FEEB94;

    --bgcolor: var(--dark-red);
    --fgcolor: var(--white);

    --menu-bg: var(--medium-red);
    --menu-highlight: var(--medium-red);
    --highlight-bg: lab(from var(--medium-red) calc(l * 1.25) a b);
    --highlight-stripe: var(--white);

    --secondary-text: var(--grey);

    --header-line-light: var(--white);
    --header-line-dark: var(--orange);
}

body {
    color: var(--fgcolor);

    font-family: "Nunito Sans", sans-serif;
    display: flex;
    flex-flow: column;
    min-height: 100vh;
    margin: 0;

}

@media (width > 500px) {
    .limit-width {
        max-width: 1000px;
        margin-left: auto;
        margin-right: auto;
    }
}

.outer-container:has(.header),
.outer-container:has(footer) {
    background-color: var(--black);
    flex: 0 0 auto;
}

.header {
    display: flex;
    background-color: var(--grey);
}
.header:before {
    content: '';
    flex: 0 1 1em;
}
.header img {
    display: block;
    max-width: 100%;
}

.outer-container:has(nav) {
    background-color: var(--black);
    flex: 0 0 auto;
}

.outer-container:has(main) {
    background-color: var(--bgcolor);
    flex: 1 1 auto;
}

nav > menu {
    font-size: 125%;
    padding: 0;
    margin: 0;
    width: 100%;
    display: flex;
    background-color: var(--menu-bg);
    border-radius: 0 0 10px 10px;
}

nav menu {
    list-style-type: none;
}

nav menu li {
    position: relative;
}

.preview::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 0;
    height: 0;
    display: block;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent red transparent transparent;
}

nav menu li.spacer {
    flex: 1 0 auto;
}

nav menu li:has(a) {
    border: 2px solid var(--menu-bg);

    --amount: 0;
    --bg-highlight-col: lab(from var(--highlight-stripe) calc(l * 1.25) a b);

    --local-bgcol: color-mix(in srgb, var(--menu-bg), var(--menu-highlight) calc(var(--amount) * 100%));
    --local-bg-highlight: color-mix(in srgb, var(--menu-bg), var(--bg-highlight-col) calc(var(--amount) * 100%));

    background: linear-gradient(120deg,
    var(--local-bgcol) 30%,
    var(--local-bg-highlight) 30.5% 45%,
    var(--local-bgcol) 45.5% 50%,
    var(--local-bg-highlight) 50.5% 55%,
    var(--local-bgcol) 55.5%
    ) calc((1 - var(--amount)) * -10em) 0 padding-box;

    transition-property: --amount, border-color, text-shadow;
    transition-duration: 0.3s;
    transition-timing-function: ease-in-out;
}

nav menu li:first-child {
    border-radius: 0 0 0 10px;
}

nav menu .spacer ~ li:last-child {
    border-radius: 0 0 10px 0;
}

nav a {
    display: block;
    color: var(--fgcolor);
    text-decoration-line: none;
}

nav menu a {
    padding: 0.5em 1em;
}

nav menu li:has(menu) {
    padding: 0.5em 1em;
}

nav menu li:has(a):hover {
    background-color: var(--menu-highlight);
    border-color: var(--local-bg-highlight);
    --amount: 1;

    text-shadow: 0 0 0.5em black, 0 0 2px black;

    transition-property: --amount, border-color, text-shadow;
    transition-duration: 0.3s;
    transition-timing-function: ease-in-out;
}

nav menu menu {
    position: absolute;
    visibility: hidden;
    flex-direction: column;
    padding: 0;
    left: 0;
    margin-top: 0.5em;
}

nav menu li:hover menu {
    visibility: visible;
    min-width: 10em;
    z-index: 2;
}

nav menu menu li:first-child,
nav menu menu li:last-child {
    border-radius: 0;
}

.list-page > a {
    text-decoration-line: none;
    color: var(--fgcolor);
}

.list-page .post-preview {
    margin-bottom: 2em;
    display: flex;
    z-index: 0;

    padding: 0px;
    position: relative;

    transition-property: text-shadow;
    transition-duration: 0.5s;
    transition-timing-function: ease-in-out;
}

@property --amount {
    syntax: '<number>';
    initial-value: 0;
    inherits: false;
}

.list-page .post-preview:before {
    content: '';
    display: block;
    z-index: -1;

    border: 2px solid transparent;
    border-radius: 10px;

    position: absolute;
    width: 100%;
    height: 100%;
    left: 0px;
    top: 0px;
    padding: 0px;

    --amount: 0;

    --bg-highlight-col: lab(from var(--highlight-stripe) calc(l * 1.25) a b);
    --half-highlight-col: lab(from var(--highlight-stripe) calc(l * 1.5) a b);
    --highlight-col: lab(from var(--highlight-stripe) calc(l * 1.75) a b);

    --local-bgcol: color-mix(in srgb, var(--bgcolor), var(--highlight-bg) calc(var(--amount) * 100%));
    --local-bg-highlight: color-mix(in srgb, var(--bgcolor), var(--bg-highlight-col) calc(var(--amount) * 100%));

    --local-half-highlight: color-mix(in srgb, var(--bgcolor), var(--half-highlight-col) calc(var(--amount) * 100%));
    --local-highlight: color-mix(in srgb, var(--bgcolor), var(--highlight-col) calc(var(--amount) * 100%));

    background: linear-gradient(135deg,
    var(--local-bgcol) 10em,
    var(--local-bg-highlight) 10em 12.5em,
    var(--local-bgcol) 12.5em 15em,
    var(--local-bg-highlight) 15em 18.5em,
    var(--local-bgcol) 18.5em
    ) calc((1 - var(--amount)) * -60em) 0 padding-box,
    linear-gradient(135deg,
        var(--local-half-highlight) 10em,
        var(--local-highlight) 10em 13em,
        var(--local-half-highlight) 13em 15em,
        var(--local-highlight) 15em 19em,
        var(--local-half-highlight) 19em
    ) calc((1 - var(--amount)) * 60em) 0 border-box;

    transition-property: --amount, text-shadow, padding, left, top;
    transition-duration: 0.4s;
    transition-timing-function: ease-in-out;
}

.list-page .post-preview:hover:before {
    padding: 10px;
    left: -10px;
    top: -10px;
    --amount: 1;

    transition-property: --amount, padding, left, top;
    transition-duration: 0.4s;
    transition-timing-function: ease-in-out;
}

.list-page .post-preview:hover {
    text-shadow: 0 0 0.5em black, 0 0 2px black;
    transition-property: text-shadow;
    transition-duration: 0.4s;
    transition-timing-function: ease-in-out;
}

h1 {
    font-size: 2em;
    margin: 0 0 0.25em;
}

h2 {
    margin: 0 0 0.25em;
}

h1::after, h2::after {
    display: block;
    content: '';
    background: linear-gradient(30deg, var(--header-line-light), var(--header-line-dark) 80%, transparent);
    height: 2px;
    width: 30rem;
    max-width: 90%;
}

h1 .img-container {
    float: right;
    position: relative;
}

h1 img {
    position: absolute;
    right: 0;
    mask-image: linear-gradient(to left, black, transparent);
    z-index: -1;
}

.post-header {
    min-height: 150px;
    position: relative;
    z-index: 1;
}

.list-page .post-preview h2 a {
    text-decoration-line: none;
    color: var(--fgcolor);
}

main {
    margin-top: 1.5em;
}

main a {
    color: var(--orange);
}

main a:hover {
    color: var(--yellow);
}

main.list-page article {
    margin-left: 1em;
    margin-right: 1em;
}

nav.admin {
    /*float: right;*/
    display: flex;
    flex-direction: row-reverse;
}

nav.admin a {
    display: block;
    padding: 0.5em 1em;
    color: var(--fgcolor);
    border: 1px solid var(--fgcolor);
    background-color: var(--medium-red);
}

nav.admin a:hover {
    background-color: var(--fgcolor);
    color: var(--medium-red);
}

.errors {
    border: 1px solid orange;
    padding: 0.25em;
}

.errors ul {
    margin: 0;
}

.errors::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    content: '\f071';
    color: red;
    margin: auto 0.25em;
    float: left;
}

.warning {
    border: 1px solid orange;
    padding: 0.25em;
}

.warning::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    content: '\f071';
    color: orange;
    margin: 0 0.25em;
}

article {
    font-size: 125%;
}

.time {
    color: var(--secondary-text);
    font-style: italic;
    font-size: 85%;
}

.time::before {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    margin-right: 0.5em;
    content: '\f133';
}

.post-preview .cover {
    flex: 0 0 auto;
    float: right;
    padding-left: 1em;
}

.post-full {
    text-align: justify;
    margin: 0 5rem 1rem;
}

.pswp img.pixeled {
    image-rendering: pixelated;
}

.tags {
    color: var(--secondary-text);
    font-size: 85%;
}

.tags ul {
    display: inline-block;
    list-style-type: none;
    padding: 0;
    margin-top: 0;
}

.tags ul li {
    display: inline;
}

.tags ul li:after {
    content: ', ';
}

.tags ul li:last-child:after {
    content: '';
}

.tags::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    content: '\f02c';
    margin-right: 0.5em;
}

/* --- Single & gallery image views --- */

figure {
    display:flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin: 1em 0;
}

.post-full figure {
    width: 900px;
    /* Outer width: 1000px, content margin: 2*5rem */
    margin-left: calc(50px - 5rem)
}

figure:after {
    /* This pseudo-element will force a break of the flex row. With the figcaption being ordered
       after it, this ensures proper caption placement. */
    content: '';
    flex-basis: 100%;
    height: 0;
    order: 1;
}

/* General case: > 2 images. 3 per row max. */
figure a {
    flex: 0 0 32%;
    display: inline;
    line-height: 0;
    margin: 0.25em 0.5% 0;
}

/* Special case: exacty 2 images. Put on one row. */
figure a:first-of-type:nth-last-of-type(2),
figure a:last-of-type:nth-of-type(2) {
    flex: 0 0 48%;
}

/* Special case: only 1 image. Full size. */
figure a:only-of-type {
    flex: none;
}

figure a img {
    width: 100%;
    height: auto;
}
figure a:only-of-type img {
    width: auto;
    height: auto;
}

figcaption {
    margin-top: 0.25em;
    align-self: center;
    font-style: italic;
    font-size: 80%;
    order: 2;
}

figcaption:after {
    content: '';
    width: 80%;
    border-bottom: 1px solid var(--secondary-text);
    display: block;
    margin: 0 auto;
}

/* Video */
figure video {
    max-width: 100%;
    height: auto;
}

/* --- Forms --- */

form label {
    display: block;
}

.inputRow {
    display: flex;
    flex-direction: row;
}

.inputRow div {
    margin-right: 2em;
}

form input, form select {
    margin: 0.5em 0;
    padding: 0.5em;
    width: 20em;
}

form input[type=checkbox] {
    width: auto;
}

form input[type=checkbox] + label {
    display: inline;
}

nav ul.pagination {
    display: flex;
    background-color: var(--menu-bg);
    border-radius: 10px;
}

nav .pagination li {
    list-style-type: none;
}

nav .pagination li.disabled {
    padding: 0.5em;
    color: var(--secondary-text);
}

nav .pagination li.active {
    padding: 0.5em;
    background-color: var(--bgcolor);
}

nav .pagination a {
    display: block;
    padding: 0.5em;
    text-decoration-line: none;
}

nav .pagination a:hover {
    background-color: var(--fgcolor);
    color: var(--menu-bg);
}

/* --- Footer --- */
footer {
    display: flex;
    flex-direction: row-reverse;
}

footer section {
    padding-right: 2em;
    margin: 2em 0 2em 2em;
    border-right: 1px solid var(--secondary-text);
}

footer section:first-child {
    border: none;
}

footer a {
    text-decoration-line: none;
    color: var(--medium-red);
}

footer a i {
    margin-right: 0.5em;
}

footer a:hover {
    color: var(--yellow);
}

footer a span {
    text-decoration-line: underline;
}

footer li {
    list-style-type: none;
    margin: 0.25em 0;
}

/* --- Stickers --- */
.sticker {
    display: block;
    margin: 0 auto;
    position: relative;
    font-size: 1rem;
}

.sticker.aside {
    float: right;
    margin-left: .5em;
    margin-right: 0;
}

.sticker.large {
    width: 20em;
    height: 20em;
}

.sticker.medium {
    width: 15em;
    height: 15em;
}

.sticker.small {
    width: 10em;
    height: 10em;
}

.sticker img {
    width: 100%;
    height: 100%;
}

.sticker .artist {
    position: absolute;
    right: 0;
    bottom: 0;
    color: var(--black);
    background-color: var(--fgcolor);
    font-size: 80%;
    padding: 0;
    max-width: 1.25em;
    min-width: 1.25em;
    height: 1.25em;
    border-radius: 50cqh;
    overflow: hidden;
    text-wrap: nowrap;

    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.5s ease-in-out;
}

.sticker .artist:hover,
.sticker .artist:focus {
    max-width: 100%;
    padding: 0.5em 0.75em;
    transition: all 0.5s ease-in-out;
}

.sticker .artist span {
    max-width: 0;
    display: inline-block;
    clip-path: content-box;
    margin-right: 1.1em;
    margin-left: 0.5em;
    transition: all 0.5s ease-in-out;
}
.sticker .artist:hover span,
.sticker .artist:focus span{
    max-width: 30em;
    margin-left: 0;
    transition: all 0.5s ease-in-out;
}

.sticker .artist:after {
    position: absolute;
    right: 0.15em;
    content: 'i';
    display: inline-block;
    font-size: 80%;
    width: 1.3em;
    height: 1.3em;
    background-color: var(--fgcolor);
    border: 1px solid var(--black);
    border-radius: 50cqh;
    text-align: center;
    box-sizing: border-box;
    transition: all 0.5s ease-in-out;
}

.sticker .artist:hover:after,
.sticker .artist:focus:after {
    right: 0.6em;
    transition: all 0.5s ease-in-out;
}

.sticker .artist a {
    color: var(--black);
}

.sticker .artist a:hover {
    color: var(--grey);
}

/* --- Editing --- */

textarea.editorjs-target {
    display: none;
}

#editorjs {
    border: 1px solid var(--fgcolor);
}

.ce-toolbar__plus,
.ce-toolbar__settings-btn {
    color: var(--fgcolor);
}

.ce-toolbar__plus:hover,
.ce-toolbar__settings-btn:hover {
    color: #1d202b;
}

.cdx-notifies {
    color: var(--black);
}
