:root {
    color-scheme: light dark;

    --blue: #3d8ef7;
    --blue-dark: #2b72d6;
    --cyan: #66e8ff;

    --bg: #12141d;
    --border: #232839;
    --fg: #c3c8d8;
    --fg-strong: #e7eaf3;
    --fg-muted: #8a93a6;
    --link: var(--blue);
    --link-hover: var(--cyan);
    --code-fg: #9cc3f7;
    --code-bg: #1b1f2e;
    --accent-gradient: linear-gradient(90deg, var(--blue), var(--cyan));
    --panel-bg: color-mix(in srgb, var(--fg) 3%, var(--bg));

    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-heading: "Space Grotesk", "Inter", sans-serif;
    --font-mono: "Fira Code", ui-monospace, monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f6f8fb;
        --border: #dbe3f0;
        --fg: #1f2533;
        --fg-strong: #131927;
        --fg-muted: #5c6578;
        --link: var(--blue-dark);
        --link-hover: #1a56a8;
        --code-fg: #1f4f99;
        --code-bg: #e6ebf4;
        --accent-gradient: linear-gradient(90deg, var(--blue-dark), #1f9fd1);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
}

.wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--fg-strong);
    text-decoration: none;
}

.brand img {
    width: 1.3em;
}

.site-header nav {
    display: flex;
    gap: 20px;
}

.site-header nav a {
    color: var(--fg-muted);
    text-decoration: none;
}

.site-header nav a:hover {
    color: var(--link-hover);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 80px;
    padding: 24px 0 40px;
    border-top: 1px solid var(--border);
    color: var(--fg-muted);
    font-size: 14px;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
    color: var(--fg-strong);
}

h2 {
    margin: 2.2em 0 0.6em;
    font-size: 28px;
}

h3 {
    margin: 1.8em 0 0.5em;
    font-size: 22px;
}

h2 a,
h3 a {
    color: inherit;
    text-decoration: none;
}

a {
    color: var(--link);
    text-underline-offset: 0.18em;
}

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

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

code {
    font-family: var(--font-mono);
}

:not(pre) > code {
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: var(--code-bg);
    color: var(--code-fg);
    font-size: 0.86em;
}

pre {
    margin: 1.5em 0;
    padding: 16px 18px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.6;
}

pre[data-name] {
    padding-top: 0;
}

pre[data-name]::before {
    content: attr(data-name);
    display: block;
    width: fit-content;
    margin: 0 0 12px -18px;
    padding: 3px 12px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-bottom-right-radius: 8px;
    background: var(--panel-bg);
    color: var(--fg-muted);
    font-family: var(--font-body);
    font-size: 12px;
}

/* required by Zola's syntax highlighting */
.giallo-l {
    display: inline-block;
    min-height: 1lh;
    width: 100%;
    vertical-align: top;
}

.footnotes {
    margin-top: 3em;
    padding-top: 1em;
    border-top: 1px solid var(--border);
    font-size: 15px;
    color: var(--fg-muted);
}

.hero h1 {
    margin: 64px 0 12px;
    font-size: clamp(40px, 9vw, 56px);
}

/* modified from mimas: custom.css .cta */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.card {
    display: flex;
    flex-direction: column;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
}

.card:hover {
    border-color: var(--link);
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 600;
}

.card-sub {
    font-size: 15px;
    color: var(--fg-muted);
}

.page-title {
    margin: 48px 0 24px;
    font-size: 40px;
}

.post-list {
    padding: 0;
    list-style: none;
}

.post-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.post-list a {
    text-decoration: none;
}

.post-list time {
    margin-left: auto;
    color: var(--fg-muted);
    font-size: 15px;
}

.post-header {
    margin: 48px 0 32px;
}

.post-header h1 {
    margin: 0 0 8px;
    font-size: clamp(32px, 7vw, 42px);
}

.post-meta {
    margin: 0;
    color: var(--fg-muted);
    font-size: 15px;
}

.draft {
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, #ff9100 18%, transparent);
    color: #ff9100;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.progress {
    display: none;
}

@supports (animation-timeline: scroll()) {
    .progress {
        display: block;
        position: fixed;
        inset: 0 0 auto;
        z-index: 1;
        height: 3px;
        background: var(--accent-gradient);
        transform-origin: left;
        animation: progress linear both;
        animation-timeline: scroll(root);
    }

    @keyframes progress {
        from {
            transform: scaleX(0);
        }
    }
}

/* icons, kinds, and colors from mdbook-admonish */
:root {
    --icon-note: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z'/></svg>");
    --icon-abstract: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M17 9H7V7h10m0 6H7v-2h10m-3 6H7v-2h7M12 3a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1m7 0h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z'/></svg>");
    --icon-info: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2z'/></svg>");
    --icon-tip: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M17.66 11.2c-.23-.3-.51-.56-.77-.82-.67-.6-1.43-1.03-2.07-1.66C13.33 7.26 13 4.85 13.95 3c-.95.23-1.78.75-2.49 1.32-2.59 2.08-3.61 5.75-2.39 8.9.04.1.08.2.08.33 0 .22-.15.42-.35.5-.23.1-.47.04-.66-.12a.58.58 0 0 1-.14-.17c-1.13-1.43-1.31-3.48-.55-5.12C5.78 10 4.87 12.3 5 14.47c.06.5.12 1 .29 1.5.14.6.41 1.2.71 1.73 1.08 1.73 2.95 2.97 4.96 3.22 2.14.27 4.43-.12 6.07-1.6 1.83-1.66 2.47-4.32 1.53-6.6l-.13-.26c-.21-.46-.77-1.26-.77-1.26m-3.16 6.3c-.28.24-.74.5-1.1.6-1.12.4-2.24-.16-2.9-.82 1.19-.28 1.9-1.16 2.11-2.05.17-.8-.15-1.46-.28-2.23-.12-.74-.1-1.37.17-2.06.19.38.39.76.63 1.06.77 1 1.98 1.44 2.24 2.8.04.14.06.28.06.43.03.82-.33 1.72-.93 2.27z'/></svg>");
    --icon-success: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='m9 20.42-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z'/></svg>");
    --icon-question: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='m15.07 11.25-.9.92C13.45 12.89 13 13.5 13 15h-2v-.5c0-1.11.45-2.11 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41a2 2 0 0 0-2-2 2 2 0 0 0-2 2H8a4 4 0 0 1 4-4 4 4 0 0 1 4 4 3.2 3.2 0 0 1-.93 2.25M13 19h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10c0-5.53-4.5-10-10-10z'/></svg>");
    --icon-warning: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M13 14h-2V9h2m0 9h-2v-2h2M1 21h22L12 2 1 21z'/></svg>");
    --icon-failure: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20 6.91 17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z'/></svg>");
    --icon-danger: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M11 15H6l7-14v8h5l-7 14v-8z'/></svg>");
    --icon-bug: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M14 12h-4v-2h4m0 6h-4v-2h4m6-6h-2.81a5.985 5.985 0 0 0-1.82-1.96L17 4.41 15.59 3l-2.17 2.17a6.002 6.002 0 0 0-2.83 0L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8z'/></svg>");
    --icon-example: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.25-7a.75.75 0 0 1 .75.75c0 .2-.08.39-.21.52L3.12 13H5v1H2v-.92L4 11H2v-1h2.25z'/></svg>");
    --icon-quote: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3l-2 4z'/></svg>");
    --icon-details: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8.59 16.58 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42Z'/></svg>");
}

.admonition {
    --c: var(--blue);
    --icon: var(--icon-note);
    display: flow-root;
    margin: 1.6em 0;
    padding: 0 18px;
    background: var(--panel-bg);
    border-left: 4px solid var(--c);
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
}

.admonition-title {
    position: relative;
    display: block;
    margin: 0 -18px;
    padding: 8px 18px 8px 46px;
    background: color-mix(in srgb, var(--c) 12%, transparent);
    color: var(--fg-strong);
    font-weight: 600;
}

.admonition-title::before {
    content: "";
    position: absolute;
    top: 0.65em;
    left: 16px;
    width: 20px;
    height: 20px;
    background-color: var(--c);
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}

.admonition-body > :first-child {
    margin-top: 12px;
}

.admonition-body > :last-child {
    margin-bottom: 14px;
}

details.admonition > summary {
    padding-right: 44px;
    cursor: pointer;
    list-style: none;
}

details.admonition > summary::-webkit-details-marker {
    display: none;
}

details.admonition > summary::after {
    content: "";
    position: absolute;
    top: 0.65em;
    right: 16px;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: var(--icon-details) center / contain no-repeat;
    mask: var(--icon-details) center / contain no-repeat;
    transition: transform 0.2s;
}

details[open].admonition > summary::after {
    transform: rotate(90deg);
}

.admonish-abstract, .admonish-summary, .admonish-tldr { --c: #00b0ff; --icon: var(--icon-abstract); }
.admonish-info, .admonish-todo { --c: #00b8d4; --icon: var(--icon-info); }
.admonish-tip, .admonish-hint, .admonish-important { --c: #00bfa5; --icon: var(--icon-tip); }
.admonish-success, .admonish-check, .admonish-done { --c: #00c853; --icon: var(--icon-success); }
.admonish-question, .admonish-help, .admonish-faq { --c: #64dd17; --icon: var(--icon-question); }
.admonish-warning, .admonish-caution, .admonish-attention { --c: #ff9100; --icon: var(--icon-warning); }
.admonish-failure, .admonish-fail, .admonish-missing { --c: #ff5252; --icon: var(--icon-failure); }
.admonish-danger, .admonish-error { --c: #ff1744; --icon: var(--icon-danger); }
.admonish-bug { --c: #f50057; --icon: var(--icon-bug); }
.admonish-example { --c: #7c4dff; --icon: var(--icon-example); }
.admonish-quote, .admonish-cite { --c: #9e9e9e; --icon: var(--icon-quote); }

figcaption {
    margin-top: 10px;
    color: var(--fg-muted);
    font-size: 14px;
    text-align: center;
}

.figure,
.stats,
.chain {
    margin: 2em 0;
}

.figure :is(img, video) {
    display: block;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--border);
}

.stat {
    padding: 16px 18px;
    background: var(--panel-bg);
}

.stat-value {
    width: fit-content;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    color: var(--fg-muted);
    font-size: 14px;
    line-height: 1.4;
}

.stat-label p,
.panel p {
    margin: 0;
}

.chain-links {
    display: flex;
    gap: 32px;
}

.chain-link {
    position: relative;
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-bg);
}

.chain-link span {
    display: block;
    margin-top: 6px;
    color: var(--fg-muted);
    font-size: 14px;
    line-height: 1.4;
}

.chain-link + .chain-link::before {
    content: "→";
    position: absolute;
    top: 50%;
    left: -24px;
    transform: translateY(-50%);
    color: var(--link);
    line-height: 1;
}

.chain-link-repeats::after {
    content: "↻ each tick";
    position: absolute;
    top: -10px;
    right: 10px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--link-hover);
    font-size: 11px;
    line-height: 18px;
}

@media (max-width: 560px) {
    .chain-links {
        flex-direction: column;
    }

    .chain-link + .chain-link::before {
        top: -24px;
        left: 50%;
        transform: translateX(-50%) rotate(90deg);
    }
}

.steps ol {
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps li {
    position: relative;
    margin-bottom: 16px;
    padding-left: 50px;
    counter-increment: step;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    top: -2px;
    left: 0;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid color-mix(in srgb, var(--blue) 50%, transparent);
    border-radius: 50%;
    background: color-mix(in srgb, var(--blue) 12%, transparent);
    color: var(--link);
    font-family: var(--font-heading);
    font-weight: 700;
}

.panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.panel {
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-bg);
}

.panel-title {
    color: var(--fg-strong);
    font-family: var(--font-heading);
    font-weight: 600;
}

.terminal {
    padding: 0;
    border-color: #232839;
    background: #0d0f16;
    color: #c3c8d8;
}

.terminal-bar {
    display: block;
    height: 32px;
    padding: 11px 14px;
    border-bottom: 1px solid #232839;
    background: #161927;
}

.terminal-bar::before {
    content: "";
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 16px 0 #febc2e, 32px 0 #28c840;
}

.terminal code {
    display: block;
    padding: 14px 18px;
    white-space: pre-wrap;
}

.terminal .fail {
    color: #ff5252;
    font-weight: 600;
}
