/* ==========================================================================
   blog-type.css: the blog made of its own words. The front page is a field of
   post titles and post text spanning the whole page, with gears made of type
   that some of the text runs through (drawn by static/js/blog-type.js into
   [data-bt-field]), with the posts scattered on top
   as an ordered list of links. A post has its title set the same way, its own
   field and gear in the margins, and one plain reading column.
   The blog's only stylesheet: the frame and reading text come first, then the front page,
   then a post's own page.
   ========================================================================== */

body.blog-page {
    --bt-ink: #efe9f7;
    --bt-muted: var(--muted);
    --bt-lit: #b45dfd;
    --bt-rule: rgba(239, 233, 247, .22);
    /* the soft patch behind each post so the field never runs through it */
    --bt-patch: rgba(7, 5, 9, .76);
    /* a solid version of the page's background, for the search slot */
    --bt-solid: #070509;
    --bt-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    /* the machine's typewriter: the gears and the field behind the page */
    --bt-type: "Courier Prime", "Courier New", Courier, monospace;
    /* the front, in the newer pages' type (home, projects, the sidebar): Archivo for anything
       big, a plain mono for the small labels */
    --bt-display: "Archivo", "Arial Black", "Helvetica Neue", Arial, sans-serif;
    --bt-mono: Consolas, "SFMono-Regular", "Cascadia Mono", monospace;
    background: #070509;
    overflow-x: clip;
    /* the page scrolls, not the body: html clips sideways (below), which stops the body's
       overflow passing up to the window, so an "auto" here made the body a second scroll box
       with its own scrollbar, which narrowed the page as soon as the field was drawn */
    overflow-y: visible;
}

html.theme-light body.blog-page {
    --bt-ink: #141118;
    --bt-lit: #8b2fd6;
    --bt-rule: rgba(20, 17, 24, .25);
    --bt-patch: rgba(241, 238, 231, .84);
    --bt-solid: #f1eee7;
    background: #f1eee7;
}

html:has(body.blog-page) {
    overflow-x: clip;
}

/* words, not a night sky */
body.blog-page .sky {
    display: none;
}

/* ---- the frame: the blog beside the sidebar ---------------------------------------------- */

body.blog-page {
    /* the reading text: a little softer than the titles' ink */
    --bt-text: #d9d2e3;
    --ink: var(--bt-ink);
    min-height: 100vh;
}

html.theme-light body.blog-page {
    --bt-text: #333;
}

.blog-shell {
    position: relative;
    z-index: 1;
    min-height: 100svh;
    margin-left: 3.75rem;
    padding: 0 clamp(1.5rem, 5vw, 5rem);
    transition: margin-left .35s cubic-bezier(.3, .5, .25, 1);
}

.site-sidebar-expanded .blog-shell {
    margin-left: 16rem;
}

.blog-index,
.article-shell {
    width: min(100%, var(--page-width));
    margin: 0 auto;
    padding-top: clamp(1.5rem, 3vh, 2.75rem);
}

.article-shell {
    padding-bottom: 4rem;
}

.article-shell > article {
    margin: 0 auto;
}

/* the list page's search and tags (their look is further down) */
.blog-search {
    position: relative;
    display: grid;
    gap: 1rem;
}

.blog-search-row {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) auto auto;
    gap: .55rem;
    align-items: stretch;
}

.blog-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.blog-tag-filter {
    display: flex;
    min-width: 0;
    gap: .8rem 1.1rem;
    align-items: flex-start;
    margin: 0;
    padding: 0;
    border: 0;
}

.blog-tag-options {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: .4rem;
}

.blog-tag-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.post-list,
.article-tags {
    margin: 0;
    padding: 0;
    list-style: none;
}

.post-card-tags,
.article-tags {
    display: flex;
    flex-wrap: wrap;
}

.article-tags li::before {
    content: "#";
    color: var(--bt-lit);
}

/* ---- a post: its header, contents list and reading text ---------------------------------- */

.article-header {
    position: relative;
}

.article-back {
    text-decoration: none;
}

.article-hero img {
    display: block;
    width: 100%;
    max-height: 42rem;
    object-fit: cover;
}

/* the contents list: numbered sections in the small mono type */
.article-toc > p {
    margin: 0 0 .8rem;
}

.article-toc ol {
    display: grid;
    margin: 0;
    padding: 0;
    gap: .45rem;
    counter-reset: section;
    list-style: none;
}

.article-toc li {
    counter-increment: section;
}

.article-toc li:is(.is-level-3, .is-level-4) {
    padding-left: 1.25rem;
}

.article-toc a {
    display: grid;
    grid-template-columns: 1.7rem minmax(0, 1fr);
    color: var(--bt-ink);
    font-family: var(--bt-mono);
    line-height: 1.45;
    text-decoration: none;
}

.article-toc a::before {
    content: counter(section, decimal-leading-zero);
    color: color-mix(in srgb, var(--bt-ink) 45%, var(--bt-solid));
}

.article-toc a:is(:hover, :focus-visible) {
    color: var(--bt-lit);
    outline: none;
}

/* the reading text: the site's serif, in its ink and greys; purple only for pointing at things */
.blog-content {
    position: relative;
    max-width: 100%;
    color: var(--bt-text);
    font-family: var(--bt-serif);
    line-height: 1.78;
    overflow-wrap: anywhere;
}

.blog-content > :first-child {
    margin-top: 0;
}

.blog-content :is(p, ul, ol, blockquote, pre, table, figure) {
    margin-block: 1.65em;
}

.blog-content :is(h2, h3, h4) {
    color: var(--bt-ink);
    line-height: 1.08;
    text-wrap: balance;
    scroll-margin-top: 2rem;
}

.blog-content h2 {
    margin: 2.45em 0 .75em;
}

.blog-content h3 {
    margin: 2.1em 0 .65em;
}

.blog-content .heading-permalink {
    display: inline-block;
    margin-left: .5rem;
    color: color-mix(in srgb, var(--bt-ink) 45%, var(--bt-solid));
    font-family: var(--bt-mono);
    font-size: .48em;
    opacity: 0;
    text-decoration: none;
    translate: 0 -.08em;
    transition: opacity .18s ease;
}

.blog-content :is(h2, h3, h4):hover .heading-permalink,
.blog-content .heading-permalink:focus-visible {
    opacity: 1;
}

.blog-content a {
    color: var(--bt-ink);
    text-decoration-color: color-mix(in srgb, var(--bt-ink) 40%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: .2em;
}

.blog-content a:is(:hover, :focus-visible) {
    color: var(--bt-lit);
    text-decoration-color: currentColor;
}

.blog-content strong {
    color: var(--bt-ink);
}

/* a quote: set in from the text, bigger and in italics, without a line beside it */
.blog-content blockquote {
    margin-inline: 0;
    padding: 0 0 0 clamp(1.5rem, 4vw, 3rem);
    color: color-mix(in srgb, var(--bt-ink) 80%, var(--bt-solid));
    font-size: 1.25em;
    font-style: italic;
    line-height: 1.5;
}

/* code: solid blocks of a lighter ink, square, no outline; its colours are the page's ink and
   greys with one purple */
.blog-content code {
    background: color-mix(in srgb, var(--bt-ink) 9%, var(--bt-solid));
    color: var(--bt-ink);
    font-family: var(--bt-mono);
    font-size: .82em;
}

.blog-content :not(pre) > code {
    padding: .12em .35em;
    background: color-mix(in srgb, var(--bt-ink) 15%, var(--bt-solid));
}

.blog-content pre {
    max-width: 100%;
    padding: 1.25rem 1.4rem;
    overflow-x: auto;
    background: color-mix(in srgb, var(--bt-ink) 6%, var(--bt-solid));
    line-height: 1.65;
    /* the site's purple scrollbar would show under every block; keep it in the code's greys */
    scrollbar-color: color-mix(in srgb, var(--bt-ink) 30%, var(--bt-solid)) transparent;
    scrollbar-width: thin;
}

.blog-content pre code {
    padding: 0;
    background: none;
}

.blog-content .highlight {
    position: relative;
}

.blog-content .highlight :is(.c, .cm, .c1, .cs) {
    color: color-mix(in srgb, var(--bt-ink) 45%, var(--bt-solid));
    font-style: italic;
}

.blog-content .highlight :is(.k, .kd, .kn, .kr, .kc) {
    color: var(--bt-lit);
}

.blog-content .highlight :is(.s, .s1, .s2, .sb, .sd, .m, .mi, .mf) {
    color: color-mix(in srgb, var(--bt-ink) 72%, var(--bt-solid));
}

/* lists of things to do */
.blog-content .task-list {
    padding-left: 0;
    list-style: none;
}

.blog-content .task-list-item {
    position: relative;
    padding-left: 1.7rem;
}

.blog-content .task-list-control {
    position: absolute;
    top: .4em;
    left: 0;
}

.blog-content .task-list-control input {
    position: absolute;
    opacity: 0;
}

.blog-content .task-list-indicator {
    display: grid;
    width: .9rem;
    height: .9rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--bt-ink) 50%, transparent);
    border-radius: 50%;
}

.blog-content .task-list-control input:checked + .task-list-indicator::after {
    width: .38rem;
    height: .38rem;
    border-radius: 50%;
    background: var(--bt-ink);
    content: "";
}

/* footnotes: small grey text under a plain line */
.blog-content .footnote {
    color: color-mix(in srgb, var(--bt-ink) 60%, var(--bt-solid));
    font-size: .85em;
}

.blog-content .footnote-backref {
    margin-left: .25rem;
    text-decoration: none;
}

.blog-content .footnote hr {
    margin-top: 3rem;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--bt-ink) 20%, transparent);
}

/* images: as wide as the text column by default and lined up with its edges, no frame;
   ![description|356](images/x.png) sets a width (kept within the column), and a title,
   ![description](images/x.png "a caption"), becomes a small caption underneath (blog.py
   wraps each image standing on its own in a figure) */
.blog-content :is(img, video, iframe) {
    display: block;
    max-width: 100%;
    height: auto;
}

.blog-content img[width] {
    width: min(100%, var(--post-image-width, 100%));
}

.blog-content figure {
    margin-inline: 0;
}

.blog-content figure img {
    width: 100%;
}

.blog-content figure.has-width {
    width: min(100%, var(--post-image-width, 100%));
}

/* an image written straight under a line of text (no blank line between) still gets room */
.blog-content p > img {
    margin-block: 1.25rem;
}

.blog-content figcaption {
    margin-top: .75rem;
    color: color-mix(in srgb, var(--bt-ink) 60%, var(--bt-solid));
    font-family: var(--bt-mono);
    font-size: .8rem;
    line-height: 1.6;
}

/* a table: the post's serif, its head as a lowercase mono label over one line */
.blog-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95em;
}

.blog-content :is(th, td) {
    padding: .6rem 1rem .6rem 0;
    text-align: left;
    vertical-align: top;
}

.blog-content th {
    border-bottom: 1px solid color-mix(in srgb, var(--bt-ink) 35%, transparent);
    color: color-mix(in srgb, var(--bt-ink) 60%, var(--bt-solid));
    font-family: var(--bt-mono);
    font-size: .8rem;
    font-weight: 400;
}

@media (max-width: 760px) {
    .blog-shell,
    .site-sidebar-expanded .blog-shell {
        margin-left: 0;
        padding-inline: 1.25rem;
    }
}

@media (max-width: 700px) {
    .blog-search-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .blog-search-clear {
        grid-column: 1 / -1;
    }

    .blog-tag-filter {
        display: grid;
    }
}

@media (prefers-reduced-motion: reduce) {
    .blog-shell {
        transition: none;
    }
}

/* ---- the list page's frame -------------------------------------------------------------
   the list sits in a 68rem column in the middle of the page; the moving field behind still
   spans the whole page (placed by script) */

body.blog-log-page {
    overflow-x: hidden;
}

.blog-page .sky {
    opacity: .72;
}

body.blog-log-page .blog-index {
    width: min(100%, 68rem);
    margin-inline: auto;
    padding-bottom: clamp(3.5rem, 8vh, 6rem);
}

body.blog-log-page .blog-index-deck {
    padding-top: .25rem;
}

body.blog-log-page .blog-search {
    margin-top: clamp(2.25rem, 5vw, 4rem);
    padding: 1rem 0 .9rem;
    font-family: var(--font-sans, "Avenir Next", Avenir, "Century Gothic", sans-serif);
}

body.blog-log-page .blog-search-submit {
    align-items: center;
    justify-content: center;
}

body.blog-log-page .post-card-link {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr) 2rem;
    gap: clamp(1rem, 3vw, 2.5rem);
    align-items: start;
}

/* ---- front page ------------------------------------------------------------------------- */

.blog-index.bt-front {
    position: relative;
    max-width: none;
    width: 100%;
    padding: clamp(1.25rem, 4vh, 2.5rem) 0 26vh;
    /* the page ends where the blog does: the slower layer of big words at the back is pushed
       down as you scroll, and would otherwise hang past the end and lengthen the page (side to
       side stays open, the field spans wider than this column) */
    overflow-x: visible;
    overflow-y: clip;
}

/* the field: placed by script so it spans the whole page, not just this column */
.bt-field {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    /* cut at the page's edges: the big words drawn near the bottom would otherwise hang past
       the end of the page and make it longer (empty scrolling below the last post) */
    overflow: hidden;
    pointer-events: none;
}

.bt-field text {
    fill: var(--bt-ink);
}

/* the canvas version of the field (blog-type.js, ?field=canvas): a strip of canvases down the page */
.bt-field-canvas canvas {
    position: absolute;
    left: 0;
    display: block;
}

/* hover fades run on these layers' opacity, which the compositor animates without redrawing */
.bt-field-layer {
    position: absolute;
    inset: 0;
    transition: opacity .45s ease;
}

.bt-field .is-outline text {
    fill: none;
    stroke: var(--bt-ink);
    stroke-opacity: .32;
    stroke-width: 1.2;
}

.bt-field g[data-bt-slug] {
    transition: opacity .45s ease;
}

/* hovering a post lights its words up and dims everyone else's */
.bt-field.has-hot g[data-bt-slug]:not(.is-hot) {
    opacity: .25;
}

.bt-field g.is-hot text {
    fill: var(--bt-lit);
}

.bt-field g.is-hot.is-outline text {
    fill: none;
    stroke: var(--bt-lit);
    stroke-opacity: .8;
}

/* the mechanisms: gears made of type, each in its own layer so turning is cheap */
.bt-mech {
    position: absolute;
    top: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bt-cog {
    position: absolute;
    overflow: visible;
    transform-origin: 50% 50%;
    will-change: transform;
    transition: opacity .45s ease;
}

.bt-cog-face {
    display: block;
    overflow: visible;
}

.bt-cog text {
    fill: var(--bt-ink);
}

.bt-cog-teeth { fill-opacity: .5; }
.bt-cog-rim { fill-opacity: .28; }
.bt-cog-text { fill-opacity: .3; }
.bt-cog-spoke { fill-opacity: .22; }
.bt-cog-hub { fill-opacity: .55; }

.bt-mech.has-hot .bt-cog:not(.is-hot) {
    opacity: .3;
}

.bt-cog.is-hot text {
    fill: var(--bt-lit);
}

/* nothing found: the abyss (buildAbyss in blog-type.js). Quieter than the field: the broken gear
   a touch dimmer than a working one, your search a faint outline far back */
.bt-abyss-word,
.bt-abyss-fall {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.bt-abyss-word text {
    fill: none;
    stroke: var(--bt-ink);
    stroke-width: 1.2;
    stroke-opacity: .13;
}

.bt-cog-broken {
    opacity: .8;
}

.bt-cog-broken .bt-cog-crack {
    fill: var(--bt-lit);
    fill-opacity: .75;
}

/* the paper running round the drums: typed letters a touch brighter than the loose ones */
.bt-field .is-fed .is-typed text {
    fill: var(--bt-ink);
}

.bt-field g.is-hot.is-fed .is-typed text {
    fill: var(--bt-lit);
}

.bt-head,
.bt-posts,
.bt-front .blog-pagination,
.bt-empty {
    position: relative;
    z-index: 1;
}

.bt-head {
    --bt-title-size: clamp(8rem, 18vw, 16rem);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0 clamp(1rem, 2vw, 1.75rem);
    align-items: start;
}

.bt-front .bt-title {
    max-width: none;
    margin: 0;
    color: var(--bt-ink);
    font-family: var(--bt-display);
    font-size: var(--bt-title-size);
    font-weight: 800;
    font-stretch: 112%;
    line-height: .8;
    letter-spacing: -.05em;
    white-space: nowrap;
}

.bt-title-letters span {
    display: inline-block;
}

.bt-title-letters span:nth-child(1) {
    transform: rotate(-7deg) translateY(.06em);
}

.bt-title-letters span:nth-child(2) {
    color: transparent;
    transform: rotate(5deg) translateY(-.1em);
    -webkit-text-stroke: 2px var(--bt-ink);
}

.bt-title-letters span:nth-child(3) {
    color: var(--bt-lit);
    font-style: italic;
    transform: rotate(-3deg) translateY(.12em);
}

.bt-title-letters span:nth-child(4) {
    transform: rotate(10deg) translateY(.02em) scale(.9);
}

/* the tagline is set big, a line of the page's own words that keeps talking after the title,
   wrapping over a few lines beside it with its last line on the title's baseline; the search
   gets a full-width row of its own under both */
.bt-side {
    display: contents;
}

.bt-head .bt-deck {
    /* a block, not the flex row it was, so its last baseline is its last line's */
    display: block;
    justify-self: start;
    max-width: 11em;
    margin: 0;
    font-size: clamp(1.7rem, 2.6vw, 2.7rem);
    line-height: 1.02;
    /* on the block: balance does nothing on the inline span inside */
    text-wrap: balance;
}

.bt-head .bt-deck .blog-index-deck {
    max-width: none;
    margin: 0;
    color: var(--bt-muted);
    font: inherit;
    font-family: var(--bt-serif);
    font-style: italic;
    letter-spacing: -.015em;
}

.bt-front .bt-title,
.bt-head .bt-deck {
    align-self: last baseline;
}

/* the count is in the search's placeholder; after a search, how many it found sits on a line
   of its own under the search and its tags, right above the posts it counts, set like a post's
   summary (the search line and tags never move for it) */
.bt-search .blog-search-status {
    position: static;
    /* closer to the posts than to the tags, so it reads as the head of the results: it takes
       its room out of the gap between the search and the posts */
    margin: 3rem 0 -5.2rem;
    text-wrap: balance;
    color: var(--bt-muted);
    font-family: var(--bt-serif);
    font-size: 1.1rem;
    font-style: italic;
    letter-spacing: 0;
    line-height: 1.4;
    text-transform: none;
}

/* hidden when not searching: out of the flow, or it still takes its line */
.bt-search .blog-search-status.sr-only {
    position: absolute;
    margin: 0;
}

/* the column beside the title gets too narrow before the phone layout starts (the sidebar takes
   its share): the tagline goes on its own lines under the title */
@media (max-width: 860px) {
    .bt-head {
        grid-template-columns: 1fr;
    }

    .bt-front .bt-title,
    .bt-head .bt-deck {
        align-self: start;
    }

    .bt-head .bt-deck {
        max-width: 14em;
        margin: 1.4rem 0 0;
        /* never bigger than beside the title (1.7rem at 860px) */
        font-size: clamp(1.4rem, 5vw, 1.7rem);
    }
}

/* ---- the controls: typed on the same machine as the gears ------------------------------- */

.bt-deck {
    background: var(--bt-patch);
    box-shadow: 0 0 30px 22px var(--bt-patch);
}

/* the search sits on solid page colour, so the field of words fades out around it instead of
   showing through it */
.bt-side .bt-search {
    background: var(--bt-solid);
    box-shadow: 0 0 44px 38px var(--bt-solid);
}

/* the search is set like another line of the page's type: a big serif line on a clear patch,
   one rule under it, no box */
.bt-search {
    grid-column: 1 / -1;
    margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
    padding: .6rem 0 1.1rem;
    border: 0;
    font-family: var(--bt-mono);
}

.bt-search .blog-search-row {
    display: flex;
    gap: 1.2rem;
    align-items: baseline;
    border-bottom: 1px solid color-mix(in srgb, var(--bt-ink) 48%, transparent);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.bt-search .blog-search-row:hover {
    border-bottom-color: color-mix(in srgb, var(--bt-ink) 70%, transparent);
}

.bt-search .blog-search-row:focus-within {
    border-bottom-color: var(--bt-lit);
    box-shadow: 0 1px 0 var(--bt-lit);
}

.bt-search .blog-search-field,
.bt-search .blog-search-field:focus-within {
    display: flex;
    flex: 1;
    gap: .55rem;
    align-items: center;
    min-width: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.bt-search .bt-prompt {
    display: none;
}

.bt-prompt {
    color: var(--bt-lit);
    font-size: clamp(1.3rem, 2.4vw, 1.9rem);
    transition: translate .2s ease;
}

.bt-search .blog-search-field:focus-within .bt-prompt {
    translate: .2rem 0;
}

.bt-search input[type="search"] {
    width: 100%;
    min-width: 0;
    padding: .6rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--bt-ink);
    caret-color: var(--bt-lit);
    font-family: var(--bt-display);
    font-size: clamp(1.9rem, 3.6vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    text-transform: none;
    box-shadow: none;
    outline: none;
}

.bt-search input[type="search"]::placeholder {
    color: color-mix(in srgb, var(--bt-ink) 62%, transparent);
    font-style: normal;
    letter-spacing: -.02em;
    text-transform: none;
    opacity: 1;
}

.bt-search input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

/* search and clear: plain words, no button chrome */
.bt-search .blog-search-submit,
.bt-search .blog-search-clear {
    display: inline-flex;
    min-width: 0;
    padding: .3rem 0;
    border: 0;
    background: none;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 1.05rem;
    letter-spacing: 0;
    text-decoration: none;
    text-transform: none;
    white-space: pre;
    cursor: pointer;
}

/* search: one heavy purple word at the end of the line; clear sits beside it, quieter */
.bt-search .blog-search-submit,
.bt-search .blog-search-clear {
    padding: 0;
    font-family: var(--bt-display);
    font-size: 1.2rem;
    font-weight: 800;
}

.bt-search .blog-search-submit {
    color: var(--bt-lit);
}

.bt-search .blog-search-submit:hover,
.bt-search .blog-search-submit:focus-visible {
    border: 0;
    background: none;
    color: var(--bt-lit);
    text-decoration: underline;
    text-underline-offset: .2em;
}

.bt-search .blog-search-clear:hover,
.bt-search .blog-search-clear:focus-visible {
    border: 0;
    background: none;
    color: var(--bt-lit);
}

.bt-search .blog-search-submit:focus-visible,
.bt-search .blog-search-clear:focus-visible,
.bt-pages a:focus-visible {
    outline: 1px solid var(--bt-lit);
    outline-offset: 3px;
}

/* tags: plain typed words under the search; a chosen one is struck, like a pressed key, and
   the ones belonging to the post you're pointing at light up */
.bt-search .blog-tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .5rem;
    align-items: baseline;
    /* tucked under the box and lined up with the typed text, so box and tags read as one */
    margin: .7rem 0 0 -.3rem;
    padding: 0;
    border: 0;
}

.bt-search .blog-tag-filter legend {
    float: left;
    margin-right: .4rem;
    padding: 0;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: .78rem;
    letter-spacing: 0;
    text-transform: none;
}

.bt-search .blog-tag-options {
    display: contents;
}

.bt-search .blog-tag-option {
    position: relative;
    display: inline-flex;
    gap: 0;
    align-items: baseline;
    padding: .05rem .3rem;
    border: 0;
    border-radius: 0;
    background: none;
    /* full ink and a touch bigger: the mono's strokes are thin, and these sit over the busy field */
    color: var(--bt-ink);
    font-family: var(--bt-mono);
    font-size: 1rem;
    letter-spacing: 0;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.bt-search .blog-tag-option:hover,
.bt-search .blog-tag-option:focus-within {
    border: 0;
    background: none;
    color: var(--bt-lit);
}

.bt-search .blog-tag-option:focus-within {
    outline: 1px solid var(--bt-lit);
    outline-offset: 2px;
}

.bt-search .blog-tag-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.bt-search .blog-tag-option.is-selected {
    background: var(--bt-lit);
    color: #000;
}

html.theme-light .bt-search .blog-tag-option.is-selected {
    color: #fff;
}

.bt-search .blog-tag-option.is-lit:not(.is-selected) {
    color: var(--bt-lit);
}

/* ---- the posts ---------------------------------------------------------------------------- */

.bt-front .post-card,
.bt-front .post-card-link,
.bt-front .post-card-link:hover,
.bt-front .post-card-link:focus-visible {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.bt-front .post-card::before,
.bt-front .post-card::after,
.bt-front .post-card-link::before,
.bt-front .post-card-link::after {
    display: none;
}

/* under the description, one smaller line of details: date and reading time as one group,
   then the tags (links, so purple) a little further off */
.bt-front .post-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.1rem;
    align-items: baseline;
    margin-top: .45rem;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: .76rem;
    letter-spacing: 0;
}

.bt-front .post-card-when {
    display: inline-flex;
    gap: .55rem;
}

.bt-front .draft-badge {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bt-lit);
    font: inherit;
    letter-spacing: 0;
    text-transform: none;
}

.bt-front .post-card-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .2rem .55rem;
    margin: 0;
}

.bt-front .post-card-tags a {
    color: var(--bt-lit);
    text-decoration: none;
}

.bt-front .post-card-tags a:hover {
    text-decoration: underline;
    text-underline-offset: .2em;
}

/* scattered down the page, alternating sides and type, still one ordered list */
.bt-posts {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    row-gap: clamp(2.5rem, 6vw, 5rem);
    margin: clamp(3rem, 7vw, 6rem) 0 0;
    padding: 0;
    list-style: none;
}

/* the patch and tilt sit on the card rather than the link, so the tag links under it move with it */
.bt-front .bt-post .post-card {
    padding: 1.1rem 1.4rem;
    background: var(--bt-patch);
    box-shadow: 0 0 44px 30px var(--bt-patch);
    transform: rotate(var(--tilt, 0deg));
    transition: transform .35s ease;
}

.bt-front .bt-post .post-card:hover,
.bt-front .bt-post .post-card:focus-within {
    transform: rotate(0deg) scale(1.02);
}

.bt-front .bt-post .post-card-link,
.bt-front .bt-post .post-card-link:hover,
.bt-front .bt-post .post-card-link:focus-visible {
    display: block;
    color: var(--bt-ink);
    text-decoration: none;
}

.bt-front .bt-post .post-card-link:focus-visible,
.bt-front .post-card-tags a:focus-visible {
    outline: 2px solid var(--bt-lit);
    outline-offset: 4px;
}

.bt-front .bt-post .post-card-title {
    display: block;
    max-width: none;
    margin: .35rem 0 .55rem;
    color: inherit;
    font-weight: 400;
    line-height: .95;
    letter-spacing: -.02em;
    transition: color .25s;
}

.bt-front .bt-post .post-card-link:hover .post-card-title,
.bt-front .bt-post .post-card-link:focus-visible .post-card-title {
    color: var(--bt-lit);
    -webkit-text-stroke-color: var(--bt-lit);
}

.bt-front .bt-post .post-card-summary {
    display: block;
    max-width: 34rem;
    margin: 0;
    color: var(--bt-muted);
    font-family: var(--bt-serif);
    font-size: 1.08rem;
    font-style: italic;
    line-height: 1.5;
}

/* where each post sits and how it looks are worked out on the server (front_page_layout in
   blog.py): posts take turns left and right, their column, width and tilt come in as custom
   properties, their look as a class. Every post is the same size. */
.bt-post {
    grid-column: var(--column, 1) / span var(--span, 7);
}

.bt-front .bt-post .post-card-title {
    font-size: clamp(2.5rem, 4.2vw, 4.2rem);
}

.bt-front .bt-post.is-look0 .post-card-title,
.bt-article.is-look0 .article-title,
.bt-article .article-neighbours a.is-look0 strong {
    font-family: var(--bt-display);
    font-weight: 800;
}

.bt-front .bt-post.is-look1 .post-card-title,
.bt-article.is-look1 .article-title,
.bt-article .article-neighbours a.is-look1 strong {
    font-family: var(--bt-display);
    font-weight: 900;
    font-stretch: 62%;
    letter-spacing: -.02em;
}

.bt-front .bt-post.is-look2 .post-card-title,
.bt-article.is-look2 .article-title,
.bt-article .article-neighbours a.is-look2 strong {
    font-family: var(--bt-display);
    font-weight: 300;
    font-stretch: 125%;
}

.bt-front .bt-post.is-look3 .post-card-title,
.bt-article.is-look3 .article-title,
.bt-article .article-neighbours a.is-look3 strong {
    color: transparent;
    font-family: var(--bt-display);
    font-weight: 800;
    font-stretch: 112%;
    -webkit-text-stroke: 1.2px var(--bt-ink);
}

.bt-front .bt-post.is-look3 .post-card-link:hover .post-card-title,
.bt-front .bt-post.is-look3 .post-card-link:focus-visible .post-card-title {
    color: transparent;
}

/* page numbers on a typed rule: ── « ‹ 01 · [02] · 03 › » ── */
.bt-pages {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .9rem;
    align-items: center;
    justify-content: center;
    margin-top: clamp(3rem, 7vw, 5rem);
    padding: .6rem 1rem;
    background: var(--bt-patch);
    box-shadow: 0 0 30px 20px var(--bt-patch);
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: .9rem;
}

.bt-pages::before,
.bt-pages::after {
    content: "";
    flex: 1 1 2rem;
    min-width: 1.5rem;
    border-top: 1px dashed var(--bt-muted);
    opacity: .55;
}

.bt-pages-list {
    display: flex;
    flex: 0 1 auto;
    gap: .2rem .9rem;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bt-pages a {
    color: var(--bt-ink);
    text-decoration: none;
    transition: color .15s ease;
}

.bt-pages a:hover {
    color: var(--bt-lit);
}

.bt-pages a[aria-current="page"] {
    padding: .05rem .3rem;
    background: var(--bt-lit);
    color: #000;
}

.bt-pages-arrow {
    padding: 0 .15rem;
    font-size: 1.15rem;
    line-height: 1;
}

.bt-pages-arrow.is-off {
    opacity: .3;
}

html.theme-light .bt-pages a[aria-current="page"] {
    color: #fff;
}

/* nothing to show: set like a post on the page (a big title on a tilted patch, an italic line
   under it) instead of a centred box between two rules */
.bt-front .bt-empty {
    display: block;
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    margin: clamp(3rem, 7vw, 6rem) 0 clamp(4rem, 10vw, 8rem);
    padding: 1.1rem 1.4rem;
    border: 0;
    background: var(--bt-patch);
    box-shadow: 0 0 44px 30px var(--bt-patch);
    color: var(--bt-ink);
    text-align: left;
    transform: rotate(-1.5deg);
}

.bt-front .bt-empty p {
    margin: 0;
    font-family: var(--bt-display);
    font-size: clamp(2.5rem, 4.2vw, 4.2rem);
    font-weight: 800;
    line-height: .95;
    letter-spacing: -.02em;
}

.bt-front .bt-empty .bt-empty-hint,
.bt-front .bt-empty a {
    display: inline-block;
    margin-top: .8rem;
    color: var(--bt-muted);
    font-family: var(--bt-serif);
    font-size: 1.08rem;
    font-style: italic;
    letter-spacing: 0;
    line-height: 1.5;
}

/* the way out: the heavy purple word the search line uses */
.bt-front .bt-empty a {
    color: var(--bt-lit);
    font-family: var(--bt-display);
    font-size: 1.2rem;
    font-style: normal;
    font-weight: 800;
    text-decoration: none;
}

.bt-front .bt-empty a:hover,
.bt-front .bt-empty a:focus-visible {
    text-decoration: underline;
    text-underline-offset: .2em;
}

.bt-front .bt-empty a:focus-visible {
    outline: 1px solid var(--bt-lit);
    outline-offset: 3px;
}

@media (max-width: 760px) {
    /* phones: only a hint of the tilt, like the posts */
    .bt-front .bt-empty {
        transform: rotate(-.5deg);
    }
}

/* ---- changing page or searching (site.js adds these to the blog's view) ------------------- */

/* out: the old words and posts fade and sink a little while the gears spin up */
.bt-front .bt-field,
.bt-front .bt-mech,
.bt-front .bt-motion,
.bt-front .bt-posts,
.bt-front .bt-pages {
    transition: opacity .28s ease, translate .28s ease;
}

/* (with the mockup's mouse lean, those layers' translate is set every frame: no transition on it) */
body.bt-moving .bt-front .bt-field,
body.bt-moving .bt-front .bt-mech,
body.bt-moving .bt-front .bt-motion,
body.bt-moving .bt-front .bt-posts {
    transition: opacity .28s ease;
}

.is-machine-out .bt-front .bt-field,
.is-machine-out .bt-front .bt-mech,
.is-machine-out .bt-front .bt-motion {
    opacity: 0;
}

.is-machine-out .bt-front .bt-posts,
.is-machine-out .bt-front .bt-pages,
.is-machine-out .bt-front .bt-empty {
    opacity: 0;
    translate: 0 .6rem;
}

.bt-front .bt-empty {
    transition: opacity .28s ease, translate .28s ease;
}

/* in: the new words fade up and the posts arrive one after another */
.is-machine-in .bt-front .bt-field,
.is-machine-in .bt-front .bt-mech,
.is-machine-in .bt-front .bt-motion,
.is-machine-in .bt-front .bt-pages {
    animation: bt-arrive-fade .6s ease both;
}

.is-machine-in .bt-front .bt-post {
    animation: bt-arrive .6s cubic-bezier(.2, .7, .2, 1) both;
}

.is-machine-in .bt-front .bt-post:nth-child(2) { animation-delay: .07s; }
.is-machine-in .bt-front .bt-post:nth-child(3) { animation-delay: .14s; }
.is-machine-in .bt-front .bt-post:nth-child(4) { animation-delay: .21s; }
.is-machine-in .bt-front .bt-post:nth-child(5) { animation-delay: .28s; }

/* nothing found: the patch arrives like a post, a little slower, and the line under it follows */
.is-machine-in .bt-front .bt-empty {
    animation: bt-arrive .85s cubic-bezier(.2, .7, .2, 1) .05s both;
}

/* (site.js takes is-machine-in off after 1s, so both end inside that) */
.is-machine-in .bt-front .bt-empty > :last-child {
    animation: bt-arrive-fade .6s ease .35s both;
}

/* (with the mockup's motion on, the moving streams play out the swap themselves: they leave and
   arrive letter by letter, so they're left out of the fades) */
body.bt-moving .is-machine-out .bt-front .bt-motion {
    opacity: 1;
}

body.bt-moving .is-machine-in .bt-front .bt-motion {
    animation: none;
}

@keyframes bt-arrive-fade {
    from { opacity: 0; }
}

@keyframes bt-arrive {
    from { opacity: 0; translate: 0 1.2rem; }
}

/* ---- a post ------------------------------------------------------------------------------ */

/* the running head: the masthead in small, back to the front page */
.bt-masthead-small,
.bt-masthead-small:hover,
.bt-masthead-small:focus-visible {
    display: block;
    margin-bottom: 2.5rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--bt-ink);
    color: var(--bt-ink);
    font-family: var(--bt-display);
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    translate: none;
}

.bt-masthead-small span {
    display: inline-block;
    color: var(--bt-muted);
    font-size: .7em;
    transition: translate .2s;
}

.bt-masthead-small:hover span,
.bt-masthead-small:focus-visible span {
    color: var(--bt-lit);
    translate: -.25rem 0;
}

/* a post's small labels and the links to the next and previous posts, in the same type as the
   list page (the post's own text stays a reading serif) */
.bt-article .article-meta,
.bt-article .article-tags li,
.bt-article .article-toc > p,
.bt-article .article-updated,
.bt-article .article-neighbours span {
    font-family: var(--bt-mono);
}

/* ---- a post's own page: the front page's voice --------------------------------------------
   Its title big and tilted in the same look it has on the list (post_look in blog.py), the
   summary in big italics, its gear turning to the right of them (blog-type.js) on a field of the
   post's own words. The field stays in the margins: it fades out by the same distance either
   side of the reading column, all the way down (blog-type.js gives it the column's edges), so
   nothing sits behind the text and no block cuts its own shape out of the field.
   The page is balanced on its reading column, which sits in the middle of the page. The title,
   summary, the line of details under it (date, read time, tags) and the text share its left
   edge.
   Narrow (the page under 58rem wide): that one column (--bt-col), the contents list above the
   text.
   Wide: a grid of three, the text between two equal side columns. The header runs across the
   text and the right column, so the title can be bigger; a long post's contents list sits in the
   left column, staying in view as you read; the next and previous posts run the grid's width. */
main.article-shell.bt-article {
    /* the reading column: wide, to match the page around it */
    --bt-col: 54rem;
    --bt-rail: 12rem;
    --bt-gap: clamp(2rem, 3vw, 4rem);
    position: relative;
    box-sizing: border-box;
    /* just the grid's width, centred in the page (.article-shell, top of this file), so the text is in the middle */
    width: min(100%, calc(var(--bt-rail) * 2 + var(--bt-col) + var(--bt-gap) * 2));
    /* at least the window's height, so on a short post the field reaches the bottom of the
       window instead of stopping in a line across it */
    min-height: 100svh;
    /* room under the next and previous posts for the big word sunk into the page's bottom edge
       (blog-type.js) */
    padding-bottom: clamp(9rem, 16vh, 13rem);
    /* the slow layer of big words at the back would otherwise hang past the end of the page */
    overflow-x: visible;
    overflow-y: clip;
    /* the grid below goes by the page's own width (so the sidebar opening counts), not the
       window's */
    container: bt-post / inline-size;
}

.bt-article > article {
    width: 100%;
}

/* the field fades out either side of the reading column: clear between the edges blog-type.js
   gives each layer (just outside the text, or the contents list), back to full over the next
   280px on an eased curve (an even fade shows where it starts, as a line), the same all the way
   down whatever the text's size or length */
.bt-article > :is(.bt-field, .bt-motion) {
    --bt-fade: 280px;
    --bt-across: linear-gradient(90deg,
        #000 calc(var(--bt-clear-l, -9999px) - var(--bt-fade) * 1),
        rgba(0, 0, 0, 0.8) calc(var(--bt-clear-l, -9999px) - var(--bt-fade) * 0.8),
        rgba(0, 0, 0, 0.5) calc(var(--bt-clear-l, -9999px) - var(--bt-fade) * 0.6),
        rgba(0, 0, 0, 0.22) calc(var(--bt-clear-l, -9999px) - var(--bt-fade) * 0.4),
        rgba(0, 0, 0, 0.06) calc(var(--bt-clear-l, -9999px) - var(--bt-fade) * 0.2),
        transparent var(--bt-clear-l, -9999px),
        transparent var(--bt-clear-r, -9999px),
        rgba(0, 0, 0, 0.06) calc(var(--bt-clear-r, -9999px) + var(--bt-fade) * 0.2),
        rgba(0, 0, 0, 0.22) calc(var(--bt-clear-r, -9999px) + var(--bt-fade) * 0.4),
        rgba(0, 0, 0, 0.5) calc(var(--bt-clear-r, -9999px) + var(--bt-fade) * 0.6),
        rgba(0, 0, 0, 0.8) calc(var(--bt-clear-r, -9999px) + var(--bt-fade) * 0.8),
        #000 calc(var(--bt-clear-r, -9999px) + var(--bt-fade) * 1));
    -webkit-mask-image: var(--bt-across);
    mask-image: var(--bt-across);
}

/* and the still layers fade in and out down the page too, on the same eased curve: in over
   220px below the header, out over 220px above the next and previous posts, back after them
   (for the word sunk into the page's bottom edge), so nothing in the field starts or stops in a
   hard line */
.bt-article > .bt-field {
    --bt-fade-down: 220px;
    --bt-down: linear-gradient(180deg,
        transparent var(--bt-in, -9999px),
        rgba(0, 0, 0, 0.06) calc(var(--bt-in, -9999px) + var(--bt-fade-down) * 0.2),
        rgba(0, 0, 0, 0.22) calc(var(--bt-in, -9999px) + var(--bt-fade-down) * 0.4),
        rgba(0, 0, 0, 0.5) calc(var(--bt-in, -9999px) + var(--bt-fade-down) * 0.6),
        rgba(0, 0, 0, 0.8) calc(var(--bt-in, -9999px) + var(--bt-fade-down) * 0.8),
        #000 calc(var(--bt-in, -9999px) + var(--bt-fade-down) * 1),
        #000 calc(var(--bt-out, 99999px) - var(--bt-fade-down) * 1),
        rgba(0, 0, 0, 0.8) calc(var(--bt-out, 99999px) - var(--bt-fade-down) * 0.8),
        rgba(0, 0, 0, 0.5) calc(var(--bt-out, 99999px) - var(--bt-fade-down) * 0.6),
        rgba(0, 0, 0, 0.22) calc(var(--bt-out, 99999px) - var(--bt-fade-down) * 0.4),
        rgba(0, 0, 0, 0.06) calc(var(--bt-out, 99999px) - var(--bt-fade-down) * 0.2),
        transparent var(--bt-out, 99999px),
        transparent var(--bt-back, 99999px),
        #000 var(--bt-back, 99999px));
    -webkit-mask-image: var(--bt-across), var(--bt-down);
    -webkit-mask-composite: source-in;
    mask-image: var(--bt-across), var(--bt-down);
    mask-composite: intersect;
}

.bt-article .bt-post-head,
.bt-article .article-toc,
.bt-article .bt-read,
.bt-article .article-hero,
.bt-article .article-neighbours {
    position: relative;
    z-index: 1;
}

.bt-article .bt-post-head {
    max-width: min(100%, var(--bt-col));
    margin: 0 auto clamp(3.5rem, 8vw, 6rem);
}

/* (with the contents list, the text follows a little sooner) */
.bt-article .bt-post-head:has(~ .article-toc) {
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.bt-article .article-back {
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.bt-article .article-title {
    max-width: 13ch;
    margin: 0;
    color: var(--bt-ink);
    font-size: clamp(3.2rem, 6.6vw, 6.6rem);
    font-weight: 400;
    line-height: .92;
    letter-spacing: -.02em;
    text-wrap: balance;
    transform: rotate(var(--tilt, 0deg));
    transform-origin: 0 50%;
}

.bt-article .article-summary {
    max-width: 22em;
    /* (further down when the title's tilt drops its right end towards it) */
    margin: calc(clamp(1.4rem, 2.6vw, 2rem) + var(--drop, 0) * .55rem) 0 0;
    color: color-mix(in srgb, var(--bt-ink) 80%, var(--bt-solid));
    font-family: var(--bt-serif);
    font-size: clamp(1.35rem, 2.1vw, 2.05rem);
    font-style: italic;
    line-height: 1.15;
    letter-spacing: -.01em;
    text-wrap: balance;
}

/* the details: on one line under the summary, the date in the text's colour */
.bt-article .article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.1rem;
    align-items: baseline;
    margin: clamp(1.25rem, 2.4vw, 1.75rem) 0 0;
}

.bt-article .article-meta time {
    color: var(--bt-ink);
}

.bt-article .article-meta .draft-badge {
    font-size: .7rem;
}

.bt-article .article-meta .article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .8rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* the contents list: above the text (beside it, in the left margin, in the grid below) */
.bt-article .article-toc {
    width: min(100%, var(--bt-col));
    margin: 0 auto clamp(2.5rem, 5vw, 3.5rem);
}

/* the contents list at a readable size */
.bt-article .article-toc a {
    font-size: .875rem;
}

.bt-article .article-toc a::before {
    font-size: .7rem;
}

/* the reading column: a plain serif column, wide like the page around it; the field is faded
   out either side of it */
.bt-article .bt-read {
    width: min(100%, var(--bt-col));
    margin: 0 auto;
    padding-bottom: 3.5rem;
}

.bt-article .blog-content {
    font-size: 1.125rem;
}

/* headings inside a post, in the titles' type, so a long post has landmarks (regular weight
   at the end of this file, as the titles are serifs) */
.bt-article .blog-content :is(h2, h3) {
    color: var(--bt-ink);
    font-family: var(--bt-display);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.02em;
}

.bt-article .blog-content h2 {
    font-size: clamp(1.9rem, 3vw, 2.6rem);
}

.bt-article .blog-content h3 {
    font-size: clamp(1.4rem, 2.2vw, 1.8rem);
}

/* the next and previous posts, set like posts on the list: big titles in their own looks, side
   by side across the page (a long title wraps rather than pushing the other down; one above the
   other only on a phone) */
.bt-article .article-neighbours {
    display: grid;
    width: min(100%, var(--bt-col));
    margin: clamp(4rem, 7vw, 6rem) auto 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
    align-items: start;
    border: 0;
}

.bt-article .article-neighbours a,
.bt-article .article-neighbours a + a {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    text-decoration: none;
}

.bt-article .article-neighbours span {
    display: block;
    /* (room for a tilted title to rise towards its label) */
    margin-bottom: 1.1rem;
}

.bt-article .article-neighbours strong {
    display: block;
    color: var(--bt-ink);
    font-size: clamp(1.9rem, 3vw, 2.8rem);
    font-weight: 400;
    line-height: .95;
    letter-spacing: -.02em;
    text-wrap: balance;
    transform: rotate(var(--tilt, 0deg));
    transform-origin: 0 50%;
    transition: color .25s;
}

.bt-article .article-neighbours a:hover strong,
.bt-article .article-neighbours a:focus-visible strong {
    color: var(--bt-lit);
    -webkit-text-stroke-color: var(--bt-lit);
}

.bt-article .article-neighbours a:focus-visible {
    outline: 2px solid var(--bt-lit);
    outline-offset: 6px;
}

.bt-article .article-neighbour-older,
.bt-article .article-neighbour-older:only-child {
    grid-column: 2;
    text-align: right;
}

.bt-article .article-neighbour-older strong {
    transform-origin: 100% 50%;
}

/* an outlined title stays outlined when pointed at, as on the list (only its outline lights) */
.bt-article .article-neighbours a.is-look3:is(:hover, :focus-visible) strong {
    color: transparent;
}

/* the grid, once the page has room for the rail, the text and some margin */
@container bt-post (min-width: 58rem) {
    .bt-article > article {
        display: grid;
        grid-template-columns: var(--bt-rail) minmax(30rem, var(--bt-col)) var(--bt-rail);
        grid-template-areas:
            ".   head head"
            ".   hero ."
            "toc read .";
        column-gap: var(--bt-gap);
        align-items: start;
    }

    /* the header over the text and the right column, so the title can be bigger and wider,
       starting on the text's left edge */
    .bt-article .bt-post-head,
    .bt-article .bt-post-head:has(~ .article-toc) {
        grid-area: head;
        max-width: none;
        margin: 0 0 clamp(3.5rem, 5vw, 5rem);
    }

    /* the rule under "← blog" the text's width, starting and ending with it */
    .bt-article .bt-post-head .article-back {
        width: calc(100% - var(--bt-rail) - var(--bt-gap));
    }

    .bt-article .article-title {
        max-width: 15ch;
        font-size: clamp(4.5rem, 8.6cqi, 6.6rem);
    }

    .bt-article .article-summary {
        max-width: 32em;
    }

    .bt-article .article-hero {
        grid-area: hero;
        width: 100%;
        margin: 0 0 clamp(3rem, 5vw, 4rem);
        translate: none;
    }

    /* a long post's contents list in the left margin, level with the start of the text and
       staying in view down the post */
    .bt-article .article-toc {
        grid-area: toc;
        position: sticky;
        top: 2rem;
        width: auto;
        max-height: calc(100svh - 4rem);
        margin: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .bt-article .bt-read {
        grid-area: read;
        width: 100%;
        margin: 0;
    }

    /* the next and previous posts across the whole grid, lined up with its outer edges */
    .bt-article .article-neighbours {
        width: 100%;
        margin-inline: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--bt-gap);
        align-items: start;
    }

    .bt-article .article-neighbours strong {
        font-size: clamp(2.6rem, 3.6cqi, 3.8rem);
    }

    .bt-article .article-neighbour-older,
    .bt-article .article-neighbour-older:only-child {
        grid-column: 2;
        text-align: right;
    }

    .bt-article .article-neighbour-older strong {
        transform-origin: 100% 50%;
    }
}

@media (max-width: 760px) {
    /* a phone: just the reading column; no field, gear or moving words behind it */
    .bt-article :is(.bt-field, .bt-mech, .bt-motion, .bt-depth, .bt-field-canvas) {
        display: none;
    }

    main.article-shell.bt-article {
        padding-bottom: 3rem;
    }

    /* "← blog" clear of the sidebar's menu button in the top corner */
    .bt-article .article-back {
        margin-top: 2.25rem;
    }

    .bt-article .article-title {
        font-size: clamp(2.6rem, 11vw, 3.6rem);
        transform: rotate(calc(var(--tilt, 0deg) * .5));
    }

    .bt-article .blog-content {
        font-size: 1.0625rem;
    }

    .bt-article .article-neighbours {
        grid-template-columns: minmax(0, 1fr);
        gap: 2.5rem;
    }

    .bt-article .article-neighbour-older,
    .bt-article .article-neighbour-older:only-child {
        grid-column: 1;
        text-align: left;
    }

    .bt-article .article-neighbour-older strong {
        transform-origin: 0 50%;
    }
}

/* ---- phones ------------------------------------------------------------------------------ */

@media (max-width: 760px) {
    .bt-head {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .bt-head {
        --bt-title-size: clamp(6rem, 34vw, 9rem);
    }

    .bt-side {
        padding-top: 1.5rem;
    }

    .bt-posts {
        grid-template-columns: 1fr;
    }

    /* one column on a phone: keep each post's look, but only a hint of its tilt */
    .bt-post {
        grid-column: 1;
    }

    .bt-front .bt-post .post-card {
        transform: rotate(calc(var(--tilt, 0deg) * .35));
    }

}

/* MOCKUP (?motion=on, blog-type.js): the flowing streams, on a strip of canvas that scrolls with
   the page (blog-type.js moves it down the page as you go) */
.bt-motion {
    position: absolute;
    top: 0;
    z-index: 0;
    pointer-events: none;
}

/* MOCKUP (?motion=on): the huge titles at the back fall a fifth behind the scroll (parallax). Run
   by the page's scroll itself, so it never lags; held still with the animations switch off */
.bt-depth {
    will-change: transform;
    animation: bt-depth linear both;
    animation-timeline: scroll(root);
}

@keyframes bt-depth {
    from {
        transform: translateY(calc(var(--bt-lag, 0px) * -.5));
    }

    to {
        transform: translateY(calc(var(--bt-lag, 0px) * .5));
    }
}

body.animations-disabled .bt-depth {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .bt-depth {
        animation: none;
    }
}

/* MOCKUP (?motion=on): the layers that lean with the mouse */
body.bt-moving .bt-field-canvas,
body.bt-moving .bt-mech,
body.bt-moving .bt-posts,
body.bt-moving .bt-head,
.bt-motion {
    will-change: translate;
}

/* (and the ones a search fades: kept ready as layers, so a search doesn't start with a stall while
   the browser sets them up) */
body.bt-moving .bt-field-canvas,
body.bt-moving .bt-mech,
body.bt-moving .bt-posts,
body.bt-moving .bt-pages {
    will-change: translate, opacity;
}

body.bt-moving .bt-depth {
    will-change: transform, translate, opacity;
}

/* ---- the blog's colours and the posts' small labels --------------------------------------- */

/* a post's small labels as on the list page: lowercase, untracked, readable sizes */
html:root .bt-article .article-meta,
html:root .bt-article .article-tags li,
html:root .bt-article .article-toc > p,
html:root .bt-article .article-updated,
html:root .bt-article .article-neighbours span {
    /* lighter than the page's muted grey: the thin typewriter type at this size needs it */
    color: color-mix(in srgb, var(--bt-ink) 74%, var(--bt-solid));
    font-size: .875rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

html:root .bt-article .article-tags li {
    font-size: .9rem;
}

html:root .bt-article .article-neighbours span {
    font-size: .95rem;
}

html:root .bt-article .article-tags li::before {
    color: var(--bt-lit);
}

/* the contents list without the old rounded panel */
html:root .bt-article .article-toc {
    padding-inline: 0;
    border: 0;
    border-radius: 0;
    background: none;
}

/* light mode: the page's own violet and the site's light ground (theme.css), not the old mauve
   and warm paper */
html.theme-light:root body.blog-page {
    --bt-patch: rgba(244, 242, 246, .84);
    --bt-solid: #f4f2f6;
    background: #f4f2f6;
}

/* ---- the old type: the titles, search and headings in the site's serif and the labels in its
   typewriter type (the blog's colours stay the newer ones) ------------------------------------- */

html:root body.blog-page {
    --bt-display: var(--font-display);
    --bt-mono: var(--bt-type);
}

html:root .bt-front .bt-title {
    font-weight: 400;
    font-stretch: normal;
    letter-spacing: -.04em;
}

html:root .bt-search input[type="search"] {
    font-weight: 400;
}

html:root .bt-search input[type="search"]::placeholder {
    font-style: italic;
}

html:root .bt-search .blog-search-submit,
html:root .bt-search .blog-search-clear,
html:root .bt-front .bt-empty a {
    font-size: 1.35rem;
    font-style: italic;
    font-weight: 400;
}

html:root .bt-front .bt-post.is-look0 .post-card-title,
html:root .bt-front .bt-post.is-look3 .post-card-title,
html:root .bt-article.is-look0 .article-title,
html:root .bt-article .article-neighbours a.is-look0 strong,
html:root .bt-article.is-look3 .article-title,
html:root .bt-article .article-neighbours a.is-look3 strong {
    font-weight: 400;
    font-stretch: normal;
}

html:root .bt-front .bt-post.is-look1 .post-card-title,
html:root .bt-article.is-look1 .article-title,
html:root .bt-article .article-neighbours a.is-look1 strong {
    font-family: var(--font-body);
    font-weight: 800;
    font-stretch: normal;
    letter-spacing: -.05em;
}

html:root .bt-front .bt-post.is-look2 .post-card-title,
html:root .bt-article.is-look2 .article-title,
html:root .bt-article .article-neighbours a.is-look2 strong {
    font-style: italic;
    font-weight: 400;
    font-stretch: normal;
}

html:root .bt-front .bt-empty p,
html:root .bt-masthead-small,
html:root .bt-article .blog-content :is(h2, h3) {
    font-weight: 400;
    letter-spacing: normal;
}
