/* =============================================
   IMBELCHEV THEME
   Technical: aurora hero, condensed display type, mono meta, panels, Experience as a timeline,
   the Article as a terminal window. Styles the markup the components already render.

   One design, two Palettes. Every colour below the Palettes is a token, so a Palette is the
   whole difference between dark and light:
     :root                         dark — the Theme's own
     :root[data-palette="light"]   light
   Each declares color-scheme, which is how the Palette script tells them apart. Which one
   shows is the visitor's: Components/Palette/, ADR-0020.

   The Palette is applied to the public chrome (nav, main, footer, the Section editor's
   preview), never to body text: the admin modals render outside every layout and read body's
   colours on white. The admin screens and /Error have no Palette at all: its colours are only
   defined where body holds a .site-nav, and "main" in this file is always the public layout's,
   main:where(.site-nav ~ *) — :where() so the scoping adds no specificity.

   Component-scoped CSS carries a [b-*] attribute, so overrides of it are prefixed with :root
   to win on order instead of losing on specificity.
   ============================================= */

@font-face {
    font-family: BricolageGrotesque;
    src: url('/fonts/BricolageGrotesque.ttf') format('truetype');
    font-weight: 200 800;
    font-stretch: 75% 100%;
    font-display: swap;
}

/* THEME TOKENS */
:root {
    /* Read by app.css and the Page Designer chrome — keep their (light UI) meaning. */
    --white-color: #ffffff;
    --section-bg-color: #f9f9f9;
    --dark-color: #10141a;
    --p-color: rgba(16, 20, 26, 0.7);
    --primary-color: #0f9f8a;
    --primary-strong-color: #0b7a6a;
    --border-color: rgba(16, 20, 26, 0.12);

    --font-weight: 300;
    --font-base: 1.0625rem;
    --font-small: 0.9rem;
    --font-large: 1.15rem;

    --space-1: 0.35rem;
    --space-2: 0.65rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2.25rem;

    --radius-sm: 0.35rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.25rem;

    --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
    --shadow-strong: 0 16px 36px rgba(15, 23, 42, 0.14);

    --font-family-base: BricolageGrotesque;
    --font-mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

    --nav-height: 72px;
    --section-space: clamp(3rem, 6vw, 5rem);
    --measure: 46rem;
}

:root:has(> body > .site-nav) {
    /* ---- Dark Palette ---- */
    --scheme: dark;
    --bg: #0a0c11;
    --bg-raised: #0e1117;
    --panel: #12161d;
    --panel-top: rgba(255, 255, 255, 0.035);
    --panel-bottom: rgba(255, 255, 255, 0.012);
    --panel-shadow: none;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.18);

    --text-rgb: 231, 234, 240;
    --text: rgb(var(--text-rgb));
    --text-body: rgba(var(--text-rgb), 0.74);
    --text-soft: rgba(var(--text-rgb), 0.6);
    --text-faint: rgba(var(--text-rgb), 0.4);
    --muted-rgb: 150, 160, 176;

    --accent-rgb: 94, 234, 212;
    --accent: rgb(var(--accent-rgb));
    --accent-2: #93c5fd;
    --on-accent: #0a0c11;

    --nav-glass: rgba(10, 12, 17, 0.72);
    --toggler-filter: invert(1);
    --input-bg: #0a0c11;
    --select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e7eaf0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");

    --hero-glow-1: rgba(94, 234, 212, 0.16);
    --hero-glow-2: rgba(147, 197, 253, 0.14);
    --hero-glow-3: rgba(167, 139, 250, 0.16);
    --hero-dots: rgba(255, 255, 255, 0.13);
    --title-fill: linear-gradient(180deg, #ffffff 35%, rgba(231, 234, 240, 0.5));

    --term-bg: #0b0e13;
    --term-bar: #161a21;
    --term-text: #c9d1d9;
    --term-dim: #8b949e;
    --term-heading: #f0f3f6;
    --term-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 60px -20px rgba(94, 234, 212, 0.18);
}

:root[data-palette="light"]:has(> body > .site-nav) {
    /* ---- Light Palette ---- */
    /* Thin dark type on white reads fainter than thin light type on dark, so light runs a
       touch heavier and its greys sit closer to ink. */
    --font-weight: 350;

    --scheme: light;

    --bg: #ffffff;
    --bg-raised: #f6f8fa;
    --panel: #ffffff;
    --panel-top: #ffffff;
    --panel-bottom: #fcfcfd;
    --panel-shadow: 0 1px 2px rgba(13, 17, 23, 0.05);
    --line: rgba(13, 17, 23, 0.11);
    --line-strong: rgba(13, 17, 23, 0.24);

    --text-rgb: 13, 17, 23;
    --text-body: rgba(var(--text-rgb), 0.86);
    --text-soft: rgba(var(--text-rgb), 0.74);
    --text-faint: rgba(var(--text-rgb), 0.6);
    --muted-rgb: 66, 74, 83;

    --accent-rgb: 15, 118, 110;
    --accent-2: #1d4ed8;
    --on-accent: #ffffff;

    --nav-glass: rgba(255, 255, 255, 0.8);
    --toggler-filter: none;
    --input-bg: #ffffff;
    --select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230d1117' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");

    --hero-glow-1: rgba(20, 184, 166, 0.16);
    --hero-glow-2: rgba(59, 130, 246, 0.12);
    --hero-glow-3: rgba(139, 92, 246, 0.12);
    --hero-dots: rgba(13, 17, 23, 0.12);
    --title-fill: linear-gradient(180deg, #0d1117 35%, rgba(13, 17, 23, 0.7));

    --term-bg: #fbfbfc;
    --term-bar: #eef0f3;
    --term-text: #1f2328;
    --term-dim: #57606a;
    --term-heading: #0d1117;
    --term-shadow: 0 30px 70px -35px rgba(13, 17, 23, 0.35), 0 0 0 1px rgba(13, 17, 23, 0.1);
}

/* Unconditional, unlike the colours: the Palette script reads these in <head>, before there is a
   body to find a layout in. */
:root {
    color-scheme: dark;
}

:root[data-palette="light"] {
    color-scheme: light;
}

/* Below the root, everything but the public chrome is light UI — the admin modals, the reconnect
   dialog — so body takes the browser's default and the chrome takes its Palette back (--scheme,
   below). A main that follows no .site-nav is an admin screen or /Error: not even the page's
   scrollbar has a Palette there. The script read the root before body existed, so neither
   override reaches it. */
body {
    color-scheme: normal;
}

:root:has(> body > main:not(.site-nav ~ *)) {
    color-scheme: normal;
}

html, body {
    font-family: var(--font-family-base), system-ui, sans-serif;
    font-weight: var(--font-weight);
    font-size: var(--font-base);
    -webkit-font-smoothing: antialiased;
}

body {
    line-height: 1.65;
}

/* Only the public layout takes the Palette's ground; AdminLayout has no .site-nav. */
html:has(body > .site-nav),
body:has(> .site-nav) {
    background: var(--bg);
}

/* The public layout is a column and main (already .flex-grow-1) takes what is left, so a
   short Page still ends with the footer at the bottom of the screen. */
body:has(> .site-nav) {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
}

.site-nav,
main:where(.site-nav ~ *),
.theme-footer,
.editor-preview-card {
    color-scheme: var(--scheme);
    color: var(--text);
    --bs-body-color: var(--text);
    --bs-heading-color: var(--text);
    --bs-emphasis-color-rgb: var(--text-rgb);
    --bs-secondary-rgb: var(--muted-rgb);
    --bs-border-color: var(--line);
}

main:where(.site-nav ~ *) ::selection {
    background: var(--accent);
    color: var(--on-accent);
}

/* The Section editor previews a Section on its own card, outside main: give it the page's
   ground so the preview tells the truth. */
.editor-preview-card {
    background: var(--bg);
    border-color: var(--line);
}

.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
    font-weight: 350;
    letter-spacing: -0.01em;
}

:is(main:where(.site-nav ~ *), .editor-preview-card) a {
    color: var(--accent-2);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

:is(main:where(.site-nav ~ *), .editor-preview-card) a:hover {
    color: var(--accent);
}

@keyframes theme-drift {
    from { background-position: 0% 0%; }
    to { background-position: 100% 100%; }
}

@keyframes theme-blink {
    50% { opacity: 0; }
}

@keyframes theme-cursor {
    50% { background-size: 0 0; }
}

/* ---------- Navigation ---------- */

:root .site-nav {
    padding: 1rem 0;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background-color .3s ease, border-color .3s ease;
}

:root body.scrolled .cover-nav,
:root body.nav-open .cover-nav,
:root .cover-nav.nav-open {
    background: var(--nav-glass);
    backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: none;
    border-bottom-color: var(--line);
}

:root .site-nav .nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--text);
}

/* "Online" dot */
:root .site-nav .nav-brand::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.8);
}

:root .site-nav .nav-list {
    counter-reset: nav;
    gap: 1.9rem;
}

:root .site-nav .nav-item {
    counter-increment: nav;
}

:root .site-nav .nav-link-item {
    position: relative;
    padding: 0.35rem 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: var(--text-soft);
    text-decoration: none;
}

:root .site-nav .nav-link-item::before {
    content: counter(nav, decimal-leading-zero) ".";
    margin-right: 0.45em;
    color: var(--accent);
    opacity: 0.75;
}

:root[data-palette="light"] .site-nav .nav-link-item::before {
    opacity: 1;
}

:root .site-nav .nav-link-item:hover,
:root .site-nav .nav-link-item.active {
    color: var(--text);
    text-decoration: none;
}

:root .site-nav .nav-link-item.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.2rem;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

:root .site-nav .navbar-toggler-icon {
    filter: var(--toggler-filter);
}

:root .site-nav .palette-switcher {
    padding: 0.35rem 0;
    color: var(--text-soft);
}

:root .site-nav .palette-switcher:hover {
    color: var(--accent);
}

@media (max-width: 991.98px) {
    :root .site-nav .nav-list {
        gap: 0.35rem;
        padding: 1rem 0 0.75rem;
    }

    :root .site-nav .nav-link-item {
        font-size: 1rem;
    }
}

/* ---------- Page Hero ---------- */

:root .cover-hero {
    min-height: 100svh;
    padding: calc(var(--nav-height) + 3rem) 0 5rem;
    box-shadow: none;
    color: var(--text);
}

:root .cover-hero::before {
    background:
        radial-gradient(900px circle at 18% 28%, var(--hero-glow-1), transparent 60%),
        radial-gradient(800px circle at 85% 55%, var(--hero-glow-2), transparent 60%),
        radial-gradient(700px circle at 50% 115%, var(--hero-glow-3), transparent 60%),
        var(--bg);
    background-size: 140% 140%;
    animation: theme-drift 22s ease-in-out infinite alternate;
}

/* Dot grid, fading out from the text. */
:root .cover-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: radial-gradient(var(--hero-dots) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 35% 45%, #000 15%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 35% 45%, #000 15%, transparent 75%);
    pointer-events: none;
}

:root .cover-layout,
:root .cover-stack {
    text-align: left;
    align-items: flex-start;
}

:root .cover-title {
    margin: 0;
    font-size: clamp(2.8rem, 7.6vw, 7.75rem);
    font-stretch: 75%;
    font-weight: 300;
    letter-spacing: -0.01em;
    line-height: 0.94;
    text-transform: uppercase;
    background: var(--title-fill);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    caret-color: var(--text);
}

:root .cover-tagline {
    margin-top: 2rem;
    max-width: 36rem;
    font-size: clamp(1.15rem, 2vw, 1.7rem);
    font-style: normal;
    font-weight: 300;
    line-height: 1.4;
    color: var(--text-soft);
}

:root .cover-text {
    margin-top: 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1;
    text-align: left;
    color: var(--accent);
}

:root .cover-text::after {
    content: "";
    display: inline-block;
    width: 0.55em;
    height: 1.05em;
    margin-left: 0.35em;
    vertical-align: -0.15em;
    background: var(--accent);
    animation: theme-blink 1.1s steps(1) infinite;
}

/* ---------- Sections ---------- */

:root .section {
    padding: var(--section-space) 0;
}

:root .section-fluid {
    padding: var(--section-space) 0;
    background: var(--bg-raised);
    border-block: 1px solid var(--line);
}

/* A Page Header sits close to what it introduces. */
:root .section:has(.page-title) {
    padding-bottom: 1rem;
}

.section > :is(.container, .container-fluid) > .row.g-3,
.section > .container-fluid > .container > .row.g-3 {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

/* Panels in one row share a height. */
.section .row.g-3 > [class*="col-"] > .row {
    --bs-gutter-y: 0;
    height: 100%;
}

.section .row.g-3 > [class*="col-"] > .row > .col-12 > .card {
    height: 100%;
}

/* ---------- Panels ---------- */

:is(main:where(.site-nav ~ *), .editor-preview-card) .card-soft {
    background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--panel-shadow);
    transition: border-color .2s ease;
}

:is(main:where(.site-nav ~ *), .editor-preview-card) .card-soft:hover {
    border-color: var(--line-strong);
}

:is(main:where(.site-nav ~ *), .editor-preview-card) .card-soft .card-body {
    padding: clamp(1.25rem, 2.4vw, 1.9rem);
    color: var(--text-body);
}

:is(main:where(.site-nav ~ *), .editor-preview-card) .card-soft .card-body > .mt-4:last-child {
    margin-top: 1.25rem !important;
}

/* ---------- Markdown inside panels ---------- */

.card-body .md-h3 {
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--accent);
}

.card-body .md-h3::before,
.card-body .md-h6::before {
    content: "// ";
    opacity: 0.6;
}

.card-body .md-h3 + p {
    max-width: 54rem;
    font-size: clamp(1.25rem, 2.2vw, 1.8rem);
    font-weight: 300;
    line-height: 1.42;
    color: var(--text);
}

.card-body .md-h4 {
    margin-bottom: 1rem;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    font-weight: 350;
    line-height: 1.2;
    color: var(--text);
}

.card-body .md-h4 strong {
    font-weight: inherit;
}

.card-body .md-h5 {
    margin-bottom: 0.85rem;
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--text);
}

.card-body .md-h6 {
    margin-bottom: 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.card-body .md-h5 + .md-h6 {
    margin-top: -0.45rem;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--text-faint);
}

.card-body .md-h5 + .md-h6::before {
    content: none;
}

.card-body strong {
    font-weight: 500;
    color: var(--text);
}

.card-body ul,
.article-detail-body ul {
    padding-left: 0;
    list-style: none;
}

.card-body li,
.article-detail-body li {
    position: relative;
    padding-left: 1.3em;
}

.card-body li + li,
.article-detail-body li + li {
    margin-top: 0.4rem;
}

/* Drawn rather than typed: "›" in a weight-300 face is a hairline. Centred on the first line. */
.card-body li::before {
    --chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.3' d='m6 3.5 4.5 4.5-4.5 4.5'/%3e%3c/svg%3e");
    content: "";
    position: absolute;
    left: 0;
    top: calc((1lh - 0.8em) / 2);
    width: 0.8em;
    height: 0.8em;
    background: var(--accent);
    -webkit-mask: var(--chevron) center / contain no-repeat;
    mask: var(--chevron) center / contain no-repeat;
}

/* Markdown has no way to colour an inline SVG, and they draw in black by default. */
.about-me-section svg {
    height: 1.15rem;
    width: auto;
    fill: currentColor;
    color: var(--accent);
}

/* An entry — a Card opening with an h4 whose list has a label — splits into
   story on the left and the labelled list on the right. Projects and Experience roles. */
@media (min-width: 992px) {
    .card-body > .mt-3:has(> .md-h4:first-child):has(> p + ul) {
        display: grid;
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
        grid-template-rows: auto auto auto auto auto 1fr;
        grid-auto-flow: row dense;
        column-gap: clamp(2rem, 4vw, 3.5rem);
        align-items: start;

        & > * {
            grid-column: 1;
        }

        & > .md-h4 {
            grid-column: 1 / -1;
        }

        /* Label and list share row 2 so the list hugs its label however tall the story is;
           the list's own top margin clears the label. */
        & > p:has(+ ul) {
            grid-column: 2;
            grid-row: 2;
            margin: 0;
        }

        & > ul {
            grid-column: 2;
            grid-row: 2 / -1;
            margin: 2.1rem 0 0;
        }
    }
}

.card-body > .mt-3:has(> .md-h4:first-child) > p:has(+ ul) {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;

    & strong {
        font-weight: 400;
        color: var(--accent);
    }
}

/* Entries in a Section without a heading (Projects) are indexed. */
:is(main:where(.site-nav ~ *), .editor-preview-card) {
    counter-reset: entry;
}

.section > .container:not(:has(> .row:first-child > .col > .d-flex.justify-content-between)) .card-body > .mt-3:has(> .md-h4:first-child) {
    counter-increment: entry;

    & > .md-h4::before {
        content: counter(entry, decimal-leading-zero);
        display: block;
        margin-bottom: 0.9rem;
        font-family: var(--font-mono);
        font-size: 0.75rem;
        letter-spacing: 0.08em;
        color: var(--accent);
    }
}

/* ---------- A Section with a heading is a timeline stop (Experience) ---------- */

.section:has(> .container > .row:first-child > .col > .d-flex.justify-content-between) {
    padding: 2rem 0;
}

.section > .container:has(> .row:first-child > .col > .d-flex.justify-content-between) {
    position: relative;
    padding-left: calc(var(--bs-gutter-x) * 0.5 + 2.25rem);

    /* The rail runs on into the next stop's padding, so consecutive stops read as one line. */
    &::before {
        content: "";
        position: absolute;
        left: calc(var(--bs-gutter-x) * 0.5 + 0.35rem);
        top: 0.9rem;
        bottom: -4rem;
        width: 1px;
        background: linear-gradient(var(--accent), var(--line) 60%);
    }

    & h3 {
        position: relative;
        font-size: clamp(1.35rem, 2.4vw, 1.9rem);
        font-stretch: 75%;
        font-weight: 400;
        letter-spacing: 0;
        text-transform: uppercase;
        color: var(--text);

        &::before {
            content: "";
            position: absolute;
            left: -2.25rem;
            top: 50%;
            width: 0.75rem;
            height: 0.75rem;
            border-radius: 50%;
            background: var(--bg);
            border: 2px solid var(--accent);
            box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
            transform: translate(-0.05rem, -50%);
        }
    }
}

/* ---------- Tags ---------- */

:is(main:where(.site-nav ~ *), .editor-preview-card) .pill {
    padding: 0.42em 0.7em;
    border: 1px solid rgba(var(--accent-rgb), 0.24);
    border-radius: 6px !important;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

:is(main:where(.site-nav ~ *), .editor-preview-card) button.pill:hover {
    border-color: var(--accent);
}

/* ---------- Page Header ---------- */

.kicker {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.kicker:not(:empty)::before {
    content: "// ";
    opacity: 0.6;
}

:root .page-title {
    font-size: clamp(2.8rem, 7.4vw, 6.75rem);
    font-stretch: 75%;
    font-weight: 300 !important;
    letter-spacing: -0.005em;
    line-height: 0.95;
    text-transform: uppercase;
    color: var(--text);
}

.page-lead.text-body-emphasis {
    max-width: 42rem;
    font-size: clamp(1.05rem, 1.6vw, 1.3rem);
    line-height: 1.5;
    color: var(--text-soft) !important;
}

/* ---------- A Page that is only a Page Header (the 404) fills the screen like the hero ---------- */

main:where(.site-nav ~ *):has(.page-title):not(:has(.section-edit-shell ~ .section-edit-shell)) {
    display: flex;
    flex-direction: column;

    & :is(.section-edit-shell, .section-content-shell) {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    & .section {
        position: relative;
        flex: 1;
        display: flex;
        align-items: center;
        overflow: hidden;
        padding-bottom: 6rem;

        & > .container {
            position: relative;
            z-index: 1;
            width: 100%;
        }

        &::before {
            content: "";
            position: absolute;
            inset: 0;
            background:
                radial-gradient(900px circle at 18% 30%, var(--hero-glow-1), transparent 60%),
                radial-gradient(800px circle at 85% 60%, var(--hero-glow-2), transparent 60%),
                radial-gradient(700px circle at 50% 115%, var(--hero-glow-3), transparent 60%);
            background-size: 140% 140%;
            animation: theme-drift 22s ease-in-out infinite alternate;
        }

        &::after {
            content: "";
            position: absolute;
            inset: 0;
            background-image: radial-gradient(var(--hero-dots) 1px, transparent 1px);
            background-size: 26px 26px;
            -webkit-mask-image: radial-gradient(ellipse 70% 60% at 30% 50%, #000 15%, transparent 75%);
            mask-image: radial-gradient(ellipse 70% 60% at 30% 50%, #000 15%, transparent 75%);
            pointer-events: none;
        }
    }

    & .kicker:not(:empty) {
        margin-bottom: 1.5rem !important;
        font-family: var(--font-family-base);
        font-size: clamp(7rem, 26vw, 19rem);
        font-stretch: 75%;
        font-weight: 300;
        letter-spacing: -0.02em;
        line-height: 0.8;
        background: var(--title-fill);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;

        &::before {
            content: none;
        }
    }

    & .page-lead {
        max-width: 52rem;

        &::after {
            content: "";
            display: inline-block;
            width: 0.55em;
            height: 1.05em;
            margin-left: 0.35em;
            vertical-align: -0.15em;
            background: var(--accent);
            animation: theme-blink 1.1s steps(1) infinite;
        }
    }
}

/* ---------- Articles list ---------- */

.card-soft:has(.form-control) {
    & .form-label {
        font-family: var(--font-mono);
        font-size: 0.7rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-faint) !important;
    }

    & :is(.form-control, .form-select) {
        padding: 0.7rem 0.9rem;
        border: 1px solid var(--line-strong);
        border-radius: 8px;
        background-color: var(--input-bg);
        color: var(--text);
        font-size: 1rem;
        font-weight: 300;
        --bs-form-select-bg-img: var(--select-arrow);
    }

    & :is(.form-control, .form-select):focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    }

    & .form-control::placeholder {
        color: var(--text-faint);
    }

    & .form-select option {
        background: var(--panel);
        color: var(--text);
    }
}

.row:has(> .col-12 > a > .article-list-card) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
    gap: 1.25rem;
    margin: 0;

    & > .col-12 {
        width: auto;
        margin: 0;
        padding: 0;
    }
}

:root .article-list-card {
    border: 1px solid var(--line);
    background: var(--panel);
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

a:hover > .article-list-card {
    border-color: rgba(var(--accent-rgb), 0.45);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.12), 0 18px 40px -20px rgba(var(--accent-rgb), 0.35);
    transform: translateY(-2px);
}

.article-list-card .card-body > .d-flex {
    height: 100%;
}

.article-meta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--accent-2);
}

.article-list-card h3 {
    margin-top: 0.4rem;
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1.25;
    color: var(--text);
}

.article-list-card .muted {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-soft);
}

/* ---------- Article: a terminal window ---------- */

#article-detail .my-4,
#article-detail article {
    max-width: 54rem;
    margin-inline: auto;
}

#article-detail .my-4 a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-soft) !important;

    & strong {
        font-weight: 400;
    }

    &:hover {
        color: var(--accent) !important;
    }
}

#article-detail .card-soft,
#article-detail .card-soft:hover {
    overflow: hidden;
    background: var(--term-bg);
    border: 0;
    border-radius: 12px !important;
    box-shadow: var(--term-shadow) !important;
    font-family: var(--font-mono);
    color: var(--term-text);
}

/* Title bar: three window buttons and the working directory. */
#article-detail .card-soft::before {
    content: "~/articles";
    display: block;
    height: 2.4rem;
    line-height: 2.4rem;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--term-dim);
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 1.25rem 50%, #ff5f57 0.36rem, transparent 0.4rem),
        radial-gradient(circle at 2.4rem 50%, #febc2e 0.36rem, transparent 0.4rem),
        radial-gradient(circle at 3.55rem 50%, #28c840 0.36rem, transparent 0.4rem),
        var(--term-bar);
}

#article-detail .card-body {
    padding: clamp(1.25rem, 4vw, 2.75rem) !important;
    color: var(--term-text);
}

#article-detail .kicker {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--term-dim);

    &:not(:empty)::before {
        content: "# ";
    }
}

.article-detail-title {
    font-family: var(--font-mono);
    font-size: clamp(1.45rem, 3.2vw, 2.25rem);
    font-weight: 600 !important;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--term-heading);

    &::before {
        content: "❯ ";
        color: var(--accent);
    }
}

.article-detail-meta {
    font-size: 0.8rem;
    color: var(--term-dim);

    /* Tags take their own line, so the separator before them has nothing to separate. */
    & > span:nth-last-child(2) {
        display: none;
    }

    & > span:last-child {
        flex-basis: 100%;
    }

    & .pill {
        padding: 0;
        border: 0;
        background: none;
        font-size: 0.8rem;
        color: var(--accent-2);

        &::before {
            content: "#";
            opacity: 0.6;
        }
    }
}

.article-detail-body {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--term-text);

    & > hr:first-child {
        margin: 0 0 2rem;
        border: 0;
        border-top: 1px dashed var(--line-strong);
        opacity: 1;
    }

    & .md-h2 {
        margin: 2.5rem 0 0.9rem;
        font-family: var(--font-mono);
        font-size: 1.1rem;
        font-weight: 600;
        letter-spacing: 0;
        color: var(--term-heading);

        &::before {
            content: "## ";
            color: var(--accent);
        }
    }

    & li::before {
        content: "-";
        position: absolute;
        left: 0.1em;
        color: var(--accent);
    }

    & strong {
        font-weight: 600;
        color: var(--term-heading);
    }

    & em {
        font-style: normal;
        color: var(--accent-2);
    }

    /* A prompt waiting after the last line. */
    &::after {
        content: "❯";
        display: block;
        width: 1.8em;
        margin-top: 2rem;
        color: var(--accent);
        background: linear-gradient(var(--accent), var(--accent)) no-repeat right center / 0.6em 1.15em;
        animation: theme-cursor 1.1s steps(1) infinite;
    }
}

/* ---------- Footer ---------- */

:root .footer-shell {
    padding: 2rem 0 2.5rem;
    background: transparent;
    border-top: 1px solid var(--line);
}

:root .footer-meta,
:root .footer-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-faint);
}

:root .footer-link {
    text-decoration: none;
    color: var(--text-soft);
}

:root .footer-link:hover {
    color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    :root .cover-hero::before,
    :root .cover-text::after,
    main:where(.site-nav ~ *) .section::before,
    main:where(.site-nav ~ *) .page-lead::after,
    .article-detail-body::after {
        animation: none;
    }
}
