@font-face {
    font-family: "Lexend";
    src:
        local("Lexend"),
        url("fonts/Lexend.ttf") format("truetype");
    font-weight: 400 800;
    font-style: normal;
}

@font-face {
    font-family: "Fira Code";
    src:
        local("Fira Code"),
        url("fonts/FiraCode.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: "Roboto";
    src:
        local("Roboto"),
        url("fonts/Roboto.ttf") format("truetype");
    font-weight: 400 600;
    font-style: normal;
}

:root {
    color-scheme: dark;
    font-size: 100%;
    @media (width >= 720px) {
        font-size: 110%;
    }

    --measure: 65ch;

    --ratio: 1.5;
    --color: #dddfe9;
    --main-color: #b9a8e2;
    --accent-color: #8c2155;
    --bg-color: #02030f;
    --bluesky-embed-color: #0a7aff;

    --s0: 1rem;
    --s1: calc(var(--s0) * var(--ratio));
    --s2: calc(var(--s1) * var(--ratio));
    --s3: calc(var(--s2) * var(--ratio));
    --s4: calc(var(--s3) * var(--ratio));
    --s5: calc(var(--s4) * var(--ratio));

    --s-1: calc(var(--s0) / var(--ratio));
    --s-2: calc(var(--s-1) / var(--ratio));
    --s-3: calc(var(--s-2) / var(--ratio));
    --s-4: calc(var(--s-3) / var(--ratio));
    --s-5: calc(var(--s-4) / var(--ratio));
}

::selection {
    background: var(--main-color);
}

* {
    font-optical-sizing: auto;
    box-sizing: border-box;
    max-inline-size: var(--measure);
    line-height: var(--ratio);
    border: 0;
    margin: 0;
    padding: 0;

    font-family: "Roboto";
    font-style: normal;
    color: var(--color);
}

em {
    font-style: italic;
}

html,
body,
div,
header,
nav,
main,
footer {
    max-inline-size: none;
}

img,
video {
    max-width: 100%;
}

ul,
ol,
dl {
    list-style-type: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    text-wrap: pretty;
}

h1 {
    font-family: "Lexend";
    font-weight: bold;
    max-inline-size: 7ch;

    font-size: var(--s3);
    line-height: var(--s3);
    @media (width >= 720px) {
        font-size: var(--s4);
        line-height: var(--s4);
    }
}

h2 {
    font-family: "Lexend";
    font-weight: bold;

    font-size: var(--s2);
    line-height: var(--s2);
}

h3 {
    font-family: "Lexend";
    font-weight: bold;

    font-size: var(--s1);
    line-height: var(--s1);
}

html {
    background-color: var(--bg-color);
    height: 100%;
}

body {
    min-height: 100dvh;

    padding: var(--s3);
    @media (width >= 720px) {
        padding: var(--s4);
    }
}

hr {
    border: none;
    border-bottom: 1px solid color-mix(in oklab, var(--color) 50%, transparent);
}

.jak-cover {
    background-image:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 50%, transparent 90%),
        url("imgs/bg-vertical.jpg");
    background-position: 70% 50%;
    @media (width >= 720px) {
        background-image:
            linear-gradient(to right, rgba(0, 0, 0, 0.9) 40%, transparent 50%),
            url("imgs/bg-horizontal.jpg");
        background-position: 50% top;
    }

    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

.preview > .info {
    opacity: 0.5;
}

.article {
    & .social-logo {
        max-width: 6ch;
        margin-inline-end: var(--s-1);
    }
    & .bluesky-embed {
        background-color: color-mix(
            in oklab,
            var(--bluesky-embed-color) 15%,
            transparent
        );
        padding: var(--s1);

        & a {
            color: var(--bluesky-embed-color);
        }
    }

    & ul {
        list-style-type: disc;
        padding-inline-start: var(--s1);
    }

    & blockquote {
        background-color: color-mix(
            in oklab,
            var(--main-color) 15%,
            transparent
        );
        padding: var(--s1);
    }
}

a {
    color: var(--main-color);
    font-weight: bold;
    font-style: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/*** LAYOUT ELEMENTS **********************************************************/

.sidebar,
.broken-sidebar {
    display: flex;
    flex-wrap: wrap;
    row-gap: var(--s-5);
    column-gap: var(--s-2);
    align-items: top;
}
.broken-sidebar > :first-child,
.sidebar > :first-child {
    min-inline-size: 6ch;
    flex-grow: 1;
}
.sidebar > :last-child {
    flex-basis: 0;
    flex-grow: 999;
    min-inline-size: 80%;
}
.broken-sidebar > :last-child {
    flex-basis: 0;
    flex-grow: 999;
    min-inline-size: 100%;
}

.stack,
.stack-xs,
.stack-s,
.stack-l {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.stack > * + * {
    margin-block-start: var(--s1);
}
.stack-xs > * + * {
    margin-block-start: var(--s-5);
}
.stack-s > * + * {
    margin-block-start: var(--s-1);
}
.stack-l > * + * {
    margin-block-start: var(--s3);
}

.switcher {
    display: flex;
    flex-wrap: wrap;
    row-gap: var(--s-5);
    column-gap: var(--s0);
    --threshold: 15rem;
}
.switcher > * {
    flex-grow: 1;
    flex-basis: calc((var(--threshold) - 100%) * 999);
}
/* Exception for the nav switcher: we don't want elements to grow and we want
   to have a little dash separating elements */
.nav-switcher > * {
    flex-grow: 0;
    flex-basis: calc((var(--threshold) - 100%) * 999);
}
.nav-switcher > :not(:last-child)::after {
    content: "-" / "";
    color: var(--main-color);
    font-weight: bold;
    margin-inline-start: var(--s0);
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-1);
    align-items: top;
}
.breadcrumb * {
    display: inline;
}
.breadcrumb > :not(:last-child)::after {
    content: "/" / "";
    margin-inline-start: var(--s-1);
}
.breadcrumb > :last-child[data-crumb="block"] {
    flex: 0 0 100%;
}
.breadcrumb [aria-current="page"] {
    color: var(--color);
}

.icon {
    height: 0.8em;
    height: 1cap;
    width: 0.8em;
    width: 1cap;
}
.with-icon {
    display: inline-flex;
    align-items: baseline;
}
.with-icon .icon {
    margin-inline-end: var(--s-1);
}

/*** ANIMATIONS ***************************************************************/

@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }
}

::view-transition-group(*) {
    animation-duration: 0.25s;
}

/*** CODE HIGHLIGHT ***********************************************************/

pre code,
pre code span,
p code {
    font-family: "Fira Code", monospace;
}

p code {
    font-size: 90%;
    padding: 0 0.2rem;
    background-color: color-mix(in oklab, var(--main-color) 15%, transparent);
}

pre {
    font-size: 90%;
    line-height: calc(0.9 * var(--ratio));
    max-inline-size: 80ch;
    width: 100%;

    padding: var(--s1);
    background-color: color-mix(in oklab, var(--main-color) 15%, transparent);
    overflow-x: auto;
}

.hljs-number {
    color: rgb(219, 148, 14);
}

.hljs-string {
    color: rgb(94, 173, 94);
}

.hljs-comment {
    color: rgb(167, 167, 167);
}

.hljs-keyword,
.hljs-built_in,
.hljs-operator {
    color: rgb(255, 69, 138);
}

.hljs-title {
    color: rgb(56, 146, 240);
}

.hljs-variable {
    color: var(--text-color);
}

.hljs-addition {
    background-color: rgb(94, 173, 94, 0.4);
}

.hljs-deletion {
    background-color: rgb(255, 69, 138, 0.4);
}
