:root {
    /* fonts */
    --main-font: sans-sarif;
    --secondary-font: sans-sarif;
    --mono-font: "Cascadia Code", monospace, monospace;

    /* layout */
    --density: 1.5;
}

/* Light Mode */
:root {
    --bg: rgb(255, 255, 255);
    --accent: rgb(216, 216, 216);
    --fg: rgb(0, 0, 0);
}

.rust {
    background-color: #ffe9e9;
}

.data {
    background-color: #caf4ca;
}

.about {
    background-color: rgb(214, 241, 249);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: rgb(0, 0, 0);
        --accent: rgb(125, 125, 125);
        --fg: rgb(255, 255, 255);
    }

    .rust {
        background-color: #292323;
    }

    .about {
        background-color: rgb(0, 0, 139);
    }

    .data {
        background-color: #265f27;
    }
}

*,
:before,
:after {
    box-sizing: border-box;
    background-repeat: no-repeat;
}
:before,
:after {
    -webkit-text-decoration: inherit;
    text-decoration: inherit;
    vertical-align: inherit;
}
:root {
    cursor: default;
    overflow-wrap: break-word;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: none;
    -moz-text-size-adjust: none;
    -ms-text-size-adjust: none;
    text-size-adjust: none;
}
abbr[title] {
    text-decoration: underline dotted;
}
strong,
b {
    font-weight: bolder;
}
small {
    font-size: 80%;
}
audio,
canvas,
iframe,
img,
svg,
video {
    vertical-align: middle;
}
svg:not([fill]) {
    fill: currentColor;
}
table {
    border-collapse: collapse;
    text-indent: 0;
    border-color: currentColor;
}
button,
input,
select {
    margin: 0;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
}
fieldset {
    border: 1px solid var(--accent);
}
progress {
    vertical-align: baseline;
}
textarea {
    margin: 0;
}
[type="search"] {
    -webkit-appearance: textfield;
    outline-offset: -2px;
}
::-webkit-inner-spin-button {
    height: auto;
}
::-webkit-outer-spin-button {
    height: auto;
}
::-webkit-input-placeholder {
    color: inherit;
    opacity: 0.54;
}
::-webkit-search-decoration {
    -webkit-appearance: none;
}
::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}
[hidden] {
    display: none !important;
}

body {
    width: 100%; /* do not use '100dvw' as it doesn't take into account vertical scrollbar :( */
    height: 100dvh;

    margin: 0;

    display: grid;
    grid-template-rows: auto 1fr auto;

    color: var(--fg);
    background-color: var(--bg);
}

a {
    color: var(--fg);
}

body > header {
    margin: 0;
    font-family: var(--mono-font);
    border-bottom: 1px solid var(--accent);
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 10px;
    padding-inline: 10px;
}

body > header.grid {
    grid-template-columns: 1fr auto auto;
}

body > footer {
    border-top: 1px solid var(--accent);
    display: grid;
    grid-template-columns: 1fr auto;
}

@media only screen and (max-width: 320px) {
    body > footer {
        grid-template-columns: 1fr;
    }
}

body > header a,
body > footer a {
    text-decoration: none;
}

body > header .htmx-indicator {
    opacity: 0;
    transition: opacity 500ms ease-in;
    color: var(--fg);
}

body > header .htmx-request .htmx-indicator {
    opacity: 1;
}

body > header .htmx-request.htmx-indicator {
    opacity: 1;
}

@media not all and (hover: none) {
    body > header a:hover,
    body > footer a:hover {
        opacity: 0.65;
    }

    body > header a:hover .icon {
        visibility: hidden;
    }

    body > header a:hover .hover-icon::before {
        content: "⬅  ";
    }
}

.nuance {
    opacity: 75%;
}

body > header > div {
    font-size: 0px;
    margin: 5px;
}

body > footer > div {
    margin: 5px;
}

body > header > div span {
    font-size: 18px;
}

span.cursor {
    animation: blink 2s step-end infinite;
}

@keyframes blink {
    from,
    to {
        background-color: var(--bg);
    }
    50% {
        background-color: var(--fg);
    }
}

div#content {
    width: 100%;
}

main {
    width: 100%;
    max-width: 1200px;
    margin: 5px auto;
    padding: 0 20px;
}

main.article {
    max-width: 850px;
}

div.cardbox {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 20px;
    justify-items: center;
    margin: 20px 0;
}

@media only screen and (max-width: 720px) {
    div.cardbox {
        grid-template-columns: 1fr;
    }
}

div.card {
    width: 100%;
    max-width: 650px;
}

div.card a {
    text-decoration: none;
}

div.card a header {
    font-size: 20px;
    width: 100%;
    text-align: right;
    display: grid;
    background-color: var(--bg);
    grid-template-columns: auto 1fr 1fr;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    align-items: center;
    padding-inline: 10px;
    gap: 10px;
}

div.card a header > div {
    margin-block: 5px;
}

.card .btn-icon::after {
    content: "⇨";
}

div.card a > div {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: solid 1px var(--accent);
}

div.card article {
    padding: 0 10px;
}

div.card .htmx-indicator {
    opacity: 0;
    transition: opacity 500ms ease-in;
    color: var(--fg);
}

div.card .htmx-request .htmx-indicator {
    opacity: 1;
}

div.card .htmx-request.htmx-indicator {
    opacity: 1;
}

@media not all and (hover: none) {
    div.card a:hover header {
        background-color: var(--accent);
    }

    div.card a:hover > div {
        transform: scale(1.025);
        box-shadow: 0px 5px 10px 0px rgba(125, 125, 125, 0.5);
    }

    .card a:hover .btn-icon {
        font-size: 24px;
        font-weight: bold;
    }

    .card a:hover .btn-icon::after {
        content: "☞";
    }
}

nav {
    width: 100%;
    background-color: var(--accent);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    padding: 5px 0;
}

nav .button > div {
    border: 2px solid var(--accent);
    border-radius: 10px;
    font-size: 18px;
    padding: 5px 20px;
}

nav .button .icon,
.card .icon {
    margin-right: 8px;
}

nav .button {
    text-decoration: none;
}

nav .button.idle > div {
    box-shadow: inset 0px 3px 5px rgba(0, 0, 0, 0.3);
    transform: scale(0.85);
}

nav .button .htmx-indicator {
    display: none;
    transition: opacity 500ms ease-in;
    opacity: 0;
    color: var(--fg);
    padding-inline: 12px;
}

nav .button .htmx-request .htmx-indicator {
    display: inline;
    opacity: 1;
}

nav .button .htmx-request.htmx-indicator {
    display: inline;
    opacity: 1;
}

nav .button .htmx-request.htmx-indicator ~ .button-text {
    display: none;
}

.card .btn-icon {
    margin-block: auto;
}

@media not all and (hover: none) {
    nav .button.active:hover > div {
        background-color: var(--bg);
        transform: scale(0.95);
    }
}

@media only screen and (max-width: 640px) {
    nav .button .icon {
        display: none;
    }
}

blockquote > p {
    font-style: italic;
    border-left: 1px solid var(--accent);
    padding-left: 10px;
}
