:root {
    --bg: #fff;
    --bg-secondary: #F0F0F0;
    --bg-tertiary: rgba(120, 120, 120, 0.12);
    --text: #1d1d1f;
    --text-secondary: rgba(60, 60, 67, 0.8);
    --text-tertiary: rgba(60, 60, 67, 0.75);
    --heading: #000;
    --link: #D51B32;
    --link-hover: #D51B32;
    /* Filled-heart gradient for the comments "like" indicator - a dedicated
       catalog entry so the icon isn't hardwired to the flat --link red. Lighter
       red (top) -> darker red (bottom). */
    --heart-gradient: linear-gradient(to bottom, #FF4C5F, #DE0E2B);
    /* Small text needs 4.5:1 even when bold. These link/label colors pass on
       both the white page and the #F0F0F0 secondary surface. */
    --pinned-gold: #826800;
    --border: #eee;
    /* Border for strokes drawn ON a --bg-secondary surface: --border is tuned for
       the white --bg and nearly disappears against #F2F2F2, so step it darker. */
    --border-secondary: rgba(0, 0, 0, 0.12);
    /* The hairline around images and icons (post images, galleries, app and
       company icons). Light matches the app screenshot frame (--border #eee on
       white); dark was tuned by eye on the launch hero. */
    --image-stroke: rgba(0, 0, 0, 0.067);
    --icon-filter: none;
    --capsule-bg: rgba(245, 245, 247, 0.7);
    --capsule-border: rgba(0, 0, 0, 0.06);
    --hover-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --menu-ease: cubic-bezier(0.32, 0.72, 0, 1);
    --control-hover: rgba(120, 120, 128, 0.18);
    --control-active: rgba(120, 120, 128, 0.10);
    /* Shared page gutter (overridden per breakpoint below) so the article
       container, comment dividers and footer separator all sit at one content
       width; plus the readable measure article body copy centres within. */
    --container-pad: 35px;
    --text-measure: 740px;
    /* Width for post hero images (and the Twitch live card) - a touch narrower than
       the content column, and clearly wider than --text-measure so the hero reads
       as a deliberate break-out rather than a near-miss on the text edges. */
    --media-width: 840px;
    --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* Dark palette uses a dark content surface (#141414, matching macguru.dev)
   rather than pure black, and eases primary text/headings off pure white.
   Pure #000 + ~#fff is ~20:1 and "halates" on OLED, which read as
   overpowering; lifting off black settles it. Surfaces step up #141414 →
   #1E1E20 so cards/popovers still separate without reading too bright against
   the page. Secondary/tertiary text stay alpha-based and both meet 4.5:1. */
/* Built-in controls and scrollbars follow the resolved scheme (the theme
   toggle included, which a <meta name="color-scheme"> couldn't). */
:root {
    color-scheme: light;
}

[data-color-scheme="dark"] {
    color-scheme: dark;
    --bg: #141414;
    --bg-secondary: #1F1F1F;
    --bg-tertiary: rgba(120, 120, 120, 0.24);
    --text: #E4E4EA;
    --text-secondary: rgba(235, 235, 245, 0.65);
    --text-tertiary: rgba(235, 235, 245, 0.58);
    --heading: #F5F5F7;
    --link: #FF566A;
    --link-hover: #FF566A;
    --heart-gradient: linear-gradient(to bottom, #FF6E7F, #F22F49);
    --pinned-gold: #E8B931;
    --border: #38383C;
    --border-secondary: rgba(255, 255, 255, 0.14);
    --image-stroke: rgba(255, 255, 255, 0.04);
    /* Feed post separator peak: --border pulled toward the page (see the
       article + article::before rule) so it reads quieter on near-black. */
    --post-rule: color-mix(in srgb, #38383C 60%, #141414);
    --icon-filter: invert(1);
    --capsule-bg: rgba(32, 32, 32, 0.7);
    --capsule-border: rgba(255, 255, 255, 0.08);
}

/* Dark mode: grayscale (not subpixel) smoothing - renders SF lighter/thinner;
   light text on the dark surface looks too heavy with the default smoothing. */
[data-color-scheme="dark"] body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Wide-gamut (P3) displays get a richer red than sRGB can express; the hex
   values above are the sRGB fallback. Same components, but P3's wider primaries
   render them more saturated - so the link "pops" on iPad/modern screens without
   over-blowing on sRGB. */
@supports (color: color(display-p3 1 1 1)) {
    [data-color-scheme="dark"] {
        --link: color(display-p3 1 0.34 0.42);
        --link-hover: color(display-p3 1 0.34 0.42);
        --heart-gradient: linear-gradient(to bottom, color(display-p3 1 0.45 0.52), color(display-p3 0.92 0.2 0.3));
    }
}

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

/* Keep anchor targets (e.g. #comments) clear of the sticky capsule nav when
   jumped to, rather than landing underneath it. */
html {
    scroll-padding-top: 100px;
}

/* Programmatic focus targets (tabindex="-1"), e.g. the new page's h1 that the
   collection JS swap focuses for screen readers. They aren't interactive, so
   no focus ring - Safari otherwise outlines the title after a click. */
[tabindex="-1"]:focus {
    outline: none;
}

body {
    font-family: var(--font-text);
    font-size: 18px;
    line-height: 1.6;
    /* Light mode keeps the default (auto/subpixel) smoothing; dark mode switches
       to grayscale antialiasing below, where light-on-dark subpixel rendering
       otherwise reads too heavy. macOS/WebKit only; a no-op elsewhere. */
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    color: var(--text);
    background-color: var(--bg);
    width: 100%;
    overflow-wrap: break-word;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* The native search-clear (×) button is a fixed dark glyph; invert it in dark
   mode so it stays visible against the dark field. Applies to all search inputs. */
[data-color-scheme="dark"] input[type="search"]::-webkit-search-cancel-button {
    filter: invert(1);
}

/* WebKit reserves the (invisible) clear button's width even while the field is
   empty, which clipped long placeholders on phones. Drop it until there's
   something to clear. */
input[type="search"]:placeholder-shown::-webkit-search-cancel-button {
    display: none;
}

p {
    /* ~one line-height of space between paragraphs. em (not rem) so it
       scales with the responsive body size instead of staying a fixed 40px. */
    margin: 0 auto 1.5em;
    /* Body text wraps normally - deliberately NOT `text-wrap: pretty`. Safari
       implements `pretty` by evening the rag across the whole paragraph, so it
       breaks every line early and leaves a wide gap on the right, worst in
       narrow columns (it needed per-page opt-outs before being dropped in
       2026-09). Headings keep `balance` (see h1–h6). For a one-off orphan, use
       a non-breaking space or `balance` on that element. */
}

hr {
    margin: 1.5rem auto;
    border: 0;
    border-top: 1px solid var(--border);
}

/* In-article section break - a plain solid hairline in --border-secondary.
   Deliberately NOT the fading gradient: that rule is reserved for the boundary
   BETWEEN posts on the home feed (article + article::before), so a reader can
   tell "new section" from "new post" at a glance. Scoped to the post-content
   <section> and excluding .post-comments so the <hr>s Comentario injects at
   runtime (login dialog dividers, etc.) keep their own styling. */
article > section:not(.post-comments) hr {
    height: 0;
    clear: both;
    border: 0;
    border-top: 1px solid var(--border-secondary);
    margin: 2rem auto;
}

/* Gap between the post header's badge row and the hero image below it -
   shared with .post-badges + img.hero so the header/hero rhythm stays in step
   with the feed spacing breakpoints. */
/* One vertical rhythm for the feed: the same --post-gap separates the header
   from the first post, each post from the next, and the last post from the
   footer. It used to be three unrelated numbers (50px under the header vs a
   120px inter-post gap on desktop), which a short first post made obvious. */
:root {
    --post-gap: 5.5rem;
}

article {
    --post-header-gap: 2.5rem;
    margin-top: 0;
    /* Adjacent-collapses with the inter-post margin-top below (equal, so the
       gap is exactly --post-gap). Also sets the last-article→footer gap. */
    margin-bottom: var(--post-gap);
}

/* Home feed: stacked posts are separated by whitespace alone - generous
   enough that the gap does most of the separating; a fading gradient rule
   (below) marks the boundary. Two other separators were tried and removed: a
   full-width solid hairline (2026-07) fought the floating title block, and a
   short centred 56px rule (2026-09) pulled the eye away from the next title.
   Only matches the multi-post home page (single-post pages have one
   <article>). */
/* A post with no comments yet ends on the collapsed "Add a comment" bar; the
   full --post-gap below that lone bar read as a hole above the footer. Tuck
   the footer up while Comentario's comment list is empty - the rule stops
   matching the moment a comment exists, restoring the normal gap. */
article:has(.comentario-comments:empty) {
    margin-bottom: min(var(--post-gap), 3rem);
}

article + article {
    margin-top: var(--post-gap);
    position: relative;
}

/* Post boundary: a fading gradient rule - used ONLY here, so it always means
   "new post" (in-article <hr>s are solid hairlines). It fades into the page
   at both ends, so unlike the two rejected separators (a solid hairline, a
   short centred rule) there's no hard edge under the next title block and
   nothing for the eye to snag on. Spans the text measure, centred
   in the gap. The itch it scratches: left-aligned body text followed by a
   centred date read as one block with odd alignment. */
article + article::before {
    content: '';
    position: absolute;
    left: 50%;
    top: calc(-0.5 * var(--post-gap));
    width: min(var(--text-measure), 100%);
    height: 1px;
    transform: translate(-50%, -0.5px);
    /* Peak colour: --border by default (light mode); the dark theme sets
       --post-rule to a version pulled toward the page. */
    background: linear-gradient(to right, var(--bg) 0%, var(--post-rule, var(--border)) 25%, var(--post-rule, var(--border)) 50%, var(--post-rule, var(--border)) 75%, var(--bg) 100%);
}

/* Tighten the rhythm on smaller screens; phones drop to a compact gap so the
   feed doesn't scroll like empty space. */
@media (max-width: 1000px) {
    :root {
        --post-gap: 4.5rem;
    }
    article {
        --post-header-gap: 2rem;
    }
}

@media (max-width: 720px) {
    :root {
        --post-gap: 2.5rem;
    }
    article {
        --post-header-gap: 1.5rem;
    }
}

/* Article header type scale - exactly three tiers: desktop (base) / tablet / phone.
   This is the TABLET tier (<=1000px); the phone tier (<=720px, further down) wins
   below 720. Base desktop sizes: title 2.4em (h1), date 1.25em, subtitle 1.5em. */
@media (max-width: 1000px) {
    .title {
        font-size: 2.2em;
    }
    article .date {
        font-size: 1.15em;
    }
    article .subtitle {
        font-size: 1.4em;
    }
}

article img {
    display: block;
    max-width: 100%;
    max-height: 650px;
    width: auto;
    height: auto;
    border: 1px solid var(--image-stroke);
    border-radius: 15px;
    corner-shape: squircle;
    margin: 0 auto 1.75em;
}

/* Reserve responsive inline-image space before loading, while preserving the
   existing portrait height cap. The media renderer supplies these dimensions. */
article img.post-image {
    width: min(100%, var(--image-width));
}

/* Hero image - fills the content column, with height capped by the base
   `article img` max-height (650px). When the cap bites (tall/square source
   images), the box is no longer the image's natural ratio, so object-fit is
   REQUIRED to crop instead of stretch - it is not inert here. Margins come
   from the .post-badges + img.hero rule (the badge row always precedes the
   hero). */
article img.hero {
    /* display:block / height:auto come from the base `article img` rule. */
    width: 100%;
    object-fit: cover;
    border-radius: 30px;
    corner-shape: squircle;
}

/* Thumbnail grid for runs of consecutive article images (grouped by
   ArticleShell.groupImageGrids). Cropped 4:3 thumbs at the content width -
   3-up normally, 2-up for short runs (--gallery-cols set inline). Clicking a
   thumb opens the run as a lightbox3 gallery with captions. Same border +
   squircle vocabulary as standalone article images. */
.post-gallery {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 3), 1fr);
    gap: 10px;
    margin: 0 auto 1.75em;
}

.post-gallery a {
    display: block;
    line-height: 0;
    border: 1px solid var(--image-stroke);
    border-radius: 15px;
    corner-shape: squircle;
    overflow: hidden;
}

/* Neutralise the standalone `article img` chrome - the anchor carries the
   border/rounding, and the thumb crops to a uniform 4:3 cell. */
.post-gallery img,
.post-gallery img.post-image {
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    margin: 0;
    border: 0;
    border-radius: 0;
    transition: transform 0.6s var(--hover-spring);
}

/* Gentle zoom on hover - the site's standard interactive-surface cue. */
@media (hover: hover) {
    .post-gallery a:hover img {
        transform: scale(1.04);
        transition: transform 0.15s ease-out;
    }
}

@media (prefers-reduced-motion: reduce) {
    .post-gallery img,
    .post-gallery a:hover img {
        transition: none;
        transform: none;
    }
}

/* Blur-up placeholder swap (site.js hands data-srcset over to the browser when
   the image nears the viewport). Deliberately NOT scoped to `article`: the
   collection cards use this too and have no <article> ancestor. */
img.lqip {
    transition: filter 0.4s ease-out;
}

img.lqip.loading {
    filter: blur(8px);
}

article lite-youtube {
    border-radius: 15px;
    corner-shape: squircle;
    overflow: hidden;
    margin: 0 auto 1.75em;
}

/* YouTube embeds arrive as fixed-width iframes (e.g. width="640"); without this
   they overflow narrow viewports and force the whole page to scroll sideways on
   a phone. Fill the column and hold a 16:9 box instead. Targeted by src so the
   Instagram/social iframes below keep their own sizing. */
article iframe[src*="youtube"] {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 0 auto 1.75em;
    border: 0;
    border-radius: 15px;
    corner-shape: squircle;
}

/* iPhone-class landscape: cap media so it doesn't overflow the viewport */
@media (orientation: landscape) and (max-height: 500px) {
    article img {
        max-height: 320px;
    }
    article img.post-image {
        width: min(100%, var(--image-landscape-width));
    }
    .post-gallery img.post-image {
        width: 100%;
    }
    article lite-youtube {
        max-width: calc(320px * 16 / 9);
    }
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
    color: var(--heading);
}

h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover {
    color: var(--text-secondary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading);
    /* Balance multi-line headings so they don't end in a stubby last line. */
    text-wrap: balance;
}

h1, h2, h3 {
    font-family: var(--font-display);
}

h1 {
    font-weight: 800;
    font-size: 2.4em;
    line-height: 1.2em;
    letter-spacing: -0.003em;
    margin: 0 auto 2rem;
    text-align: left;
}

/* Subheads break a post into sections: clearly more space above than the
   paragraph gap (~30px), and less below so the heading hugs the text it
   introduces. Margins are em (relative to each heading's own size), so each
   level's gap scales with it and the hierarchy of gaps stays h2 > h3 > h4. */
h2 {
    font-weight: 700;
    font-size: 1.7em;
    line-height: 1.2;
    margin-top: 2.5rem;
    margin-bottom: 0.8rem;
}

h3 {
    font-weight: 700;
    font-size: 1.2em;
    line-height: 1.3;
    margin: 1.5em auto 0.4em;
}

h4 {
    font-weight: 700;
    font-size: 1.1em;
    line-height: 1.35;
    margin: 1.5em auto 0.3em;
}

body > header {
    position: sticky;
    z-index: 10;
    width: 100%;
    top: 0;
    padding: 15px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

body > header::before {
    content: '';
    position: absolute;
    /* Extend the scrim well above the header. iOS Safari's translucent toolbar
       (compact tab bar, Stage Manager) shows the page layer that has scrolled
       past the top of the viewport, blurred - with the scrim stopping at the
       header's top edge, that's post text peeking through the chrome above
       the capsule. Painting --bg 200px further up puts plain background there
       instead. Off-screen everywhere else, so it costs nothing.
       Sideways it reaches out by the safe-area insets: the header sits inside
       the body's safe-area padding, but content that bleeds under the notch
       area in landscape (the About gallery) would otherwise show beside the
       bar instead of passing beneath it. */
    inset: -200px calc(-1 * env(safe-area-inset-right, 0px)) 0 calc(-1 * env(safe-area-inset-left, 0px));
    background-color: var(--bg);
    /* The bar is a solid plateau; the fade below it is a colour-matched
       drop shadow, not a gradient mask. A box-shadow's blur is Gaussian and
       browser-dithered, so it sheds the 8-bit banding a wide, flat
       linear-gradient alpha ramp shows. The y-offset (1st value) carries the
       solid down past the bar's zero bottom-padding; the blur (2nd) sets the
       fade length. */
    box-shadow: 0 15px 25px 15px var(--bg);
    z-index: -1;
}

/* Tablet/phone: shrink the header's colour-matched scrim so its fade doesn't
   bleed onto the live frame sitting close below it. */
@media (max-width: 1000px) {
    body > header::before {
        box-shadow: 0 5px 20px 15px var(--bg);
    }
}

#header-content {
    align-items: center;
    gap: clamp(20px, 4vw, 70px);
    margin: 0 auto;
    max-width: 1200px;
    width: 100%;
    padding: 0 48px;
    display: flex;
}

#header-content nav {
    flex: 1;
    min-width: 0;
}

#logo {
    display: flex;
}

#logo img {
    height: 24px;
    display: block;
    filter: var(--icon-filter);
    transition: transform 0.6s var(--hover-spring);
}

#logo a:hover img {
    transform: scale(1.08);
    transition: transform 0.15s ease-out;
}

#logo a {
    color: var(--heading);
    text-decoration: none;
    font-size: 30px;
    font-weight: 800;
}

#menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    font-size: 1.1em;
    font-weight: 700;
    gap: 10px;
    margin: 0;
    padding: 0;
}

#menu a {
    color: var(--heading);
    text-decoration-line: none;
    display: inline-block;
    transition: transform 0.6s var(--hover-spring);
}

#menu a:hover,
.menu-closed-bar a:hover {
    color: var(--heading);
    text-decoration-line: none;
    transform: scale(1.08);
    transition: transform 0.15s ease-out;
}

#menu .menu-row-icons a:hover {
    transform: none;
}

.menu-closed-bar a {
    display: inline-block;
    transition: transform 0.6s var(--hover-spring);
}

@media (max-width: 720px) {
    #menu a:hover,
    .menu-closed-bar a:hover {
        transform: none;
    }
}

/* The 25px header glyphs: the RSS trigger's img and the theme toggle's. */
.rss-toggle-link > img,
.theme-toggle-icon {
    height: 25px;
    display: block;
    filter: var(--icon-filter);
}

/* Optically align the RSS glyph with the theme icon beside it: rss.svg fills
   its viewBox edge-to-edge while the appearance glyphs are inset, so its
   centre rides 4px high of the theme icon's (measured). */
.rss-toggle-link > img {
    position: relative;
    top: 4px;
}

/* Tablet/phone: normalise all header glyphs to a single 20px height so the sun,
   moon, and RSS icons match each other and sit close to the nav text size. */
@media (max-width: 1000px) {
    .rss-toggle-link > img,
    .theme-toggle-icon {
        height: 20px;
    }
}

/* Theme toggle (the RSS feed menu shares the whole popover system - same
   wrapper behaviour, panel and row styling; see the .rss-toggle markup in
   Includes/header.html). */
.theme-toggle,
.rss-toggle {
    position: relative;
    padding: 0 15px;
    margin: 0 -15px;
}

.theme-toggle-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--heading);
    cursor: pointer;
    font: inherit;
}

/* .theme-toggle-icon base sizing lives with the header glyph rule above. */
.theme-icon-light {
    display: none;
}

[data-color-scheme="light"] .theme-icon-dark {
    display: none;
}

[data-color-scheme="light"] .theme-icon-light {
    display: block;
}

.theme-popover {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--capsule-border);
    border-radius: 16px;
    corner-shape: squircle;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
    z-index: 100;
    /* Hidden / exit state */
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
    filter: blur(8px);
    transform-origin: top center;
    transition:
        opacity 0.2s ease-out,
        transform 0.2s ease-out,
        filter 0.2s ease-out,
        display 0.2s allow-discrete;
}

.theme-popover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 12px;
}

@media (hover: hover) {
    .theme-toggle:hover .theme-popover,
    .rss-toggle:hover .theme-popover {
        display: flex;
        opacity: 1;
        transform: translateX(-50%) scale(1);
        filter: blur(0);
    }
}

.theme-popover.open {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) scale(1);
    filter: blur(0);
}

@starting-style {
    @media (hover: hover) {
        .theme-toggle:hover .theme-popover,
        .rss-toggle:hover .theme-popover {
            opacity: 0;
            transform: translateX(-50%) scale(0.9);
            filter: blur(8px);
        }
    }

    .theme-popover.open {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
        filter: blur(8px);
    }
}

/* Right-align the popover when viewport is narrow OR the device has
   horizontal safe-area insets (notch/Dynamic Island in landscape).
   The env() * 1000 trick: if inset is 0 the max-width is 0 (never matches);
   if inset > 0 it becomes a huge value (always matches). */
@media (min-width: 720.02px) and (max-width: 1049.98px),
       (min-width: 720.02px) and (max-width: calc(env(safe-area-inset-left) * 1000)),
       (min-width: 720.02px) and (max-width: calc(env(safe-area-inset-right) * 1000)) {
    .theme-popover {
        left: auto;
        right: 0;
        transform: scale(0.9);
        transform-origin: top right;
    }

    @media (hover: hover) {
        .theme-toggle:hover .theme-popover,
        .rss-toggle:hover .theme-popover {
            transform: scale(1);
        }
    }

    .theme-popover.open {
        transform: scale(1);
    }

    @starting-style {
        @media (hover: hover) {
            .theme-toggle:hover .theme-popover,
            .rss-toggle:hover .theme-popover {
                transform: scale(0.9);
            }
        }

        .theme-popover.open {
            transform: scale(0.9);
        }
    }
}

/* The RSS menu hangs off the LAST icon in the header, so it right-aligns at
   every width - the centred default pushes half its 260px past the trigger,
   which overflows the right screen edge on phones. (The theme popover only
   needs this in the narrow band above; these mirror those state overrides.) */
.rss-popover {
    left: auto;
    right: 0;
    transform: scale(0.9);
    transform-origin: top right;
}

@media (hover: hover) {
    .rss-toggle:hover .rss-popover {
        transform: scale(1);
    }
}

.rss-popover.open {
    transform: scale(1);
}

@starting-style {
    @media (hover: hover) {
        .rss-toggle:hover .rss-popover {
            transform: scale(0.9);
        }
    }

    .rss-popover.open {
        transform: scale(0.9);
    }
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 12px;
    corner-shape: squircle;
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    font-family: inherit;
}

.theme-option:hover,
.theme-option.active:hover {
    background: var(--control-hover);
}

/* The RSS menu's rows are <a>s reusing .theme-option - unlike the theme
   popover's <button>s they're caught by the header's anchor rules (`#menu a`
   sets display:inline-block at ID specificity, and the hover scale), so the
   row layout is restored behind the same ID. (The hover transform is already
   neutralised by `#menu .menu-row-icons a:hover`.) */
#menu .rss-popover .theme-option {
    display: flex;
    text-decoration: none;
}

/* The featured "Blog" row needs room for its subtitle. */
.rss-popover {
    min-width: 260px;
}

/* Section labels - bold and muted, sentence case (no small all-caps headers
   in this design system), indented to the rows' text edge. */
.rss-popover-label {
    padding: 6px 16px 2px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-tertiary);
}

/* Featured feed: RSS-orange squircle tile + title/subtitle stack. Same row
   metrics and hover fill as .theme-option so the menu reads as one system. */
#menu .rss-popover .rss-featured {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-radius: 12px;
    corner-shape: squircle;
    text-decoration: none;
    white-space: nowrap;
}

#menu .rss-popover .rss-featured:hover {
    background: var(--control-hover);
}

/* The one deliberate non-monochrome element: the classic RSS logo tile
   (rss-logo.svg ships its own orange gradient + rounded corners), constant
   across themes - it identifies a third-party convention, not site palette. */
.rss-featured-icon {
    flex: none;
    width: 40px;
    height: 40px;
}

.rss-featured-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rss-featured-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--heading);
    line-height: 1.2;
}

.rss-featured-sub {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Divider between the featured feed and the category list - inset to the
   rows' text edge, subtle enough for the --bg-secondary panel. */
.rss-popover-divider {
    height: 1px;
    margin: 6px 16px;
    background: var(--border-secondary);
}

.theme-option.active {
    font-weight: 700;
    background: var(--control-active);
}

.theme-option img {
    height: 24px;
    width: 24px;
    filter: var(--icon-filter);
}

/* The RSS category rows use sprite <use> glyphs instead of imgs - they inherit
   the row's currentColor, so no filter dance is needed. */
.theme-option svg {
    height: 24px;
    width: 24px;
    flex: none;
}

.menu-hamburger {
    display: none;
}

.menu-row-icons {
    display: contents;
}

.menu-closed-bar {
    display: none;
}


.hamburger-button {
    position: relative;
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--heading);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    corner-shape: squircle;
}

.hamburger-button svg {
    display: block;
}

.menu-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.hamburger-button .icon-close {
    position: absolute;
    inset: 6px 10px;
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.menu-toggle-input:focus-visible + .hamburger-button {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Tablet band: page content stays at the 18px base. The body drops to 17px
   here (next rule) only so the full nav fits above the hamburger breakpoint;
   letting the reading text shrink too left tablet with the smallest type above
   phone size inside the same 740px measure as desktop - up to ~91 characters
   a line. Header and footer sit outside <main>, so they keep the 17px. */
@media (min-width: 720.02px) and (max-width: 1000px) {
    main {
        font-size: 18px;
    }
    /* Match the header's 24px inner padding (max-width 1000px below), so
       content lines up with the logo - e.g. iPhone landscape and iPad. */
    :root {
        --container-pad: 24px;
    }
}

@media (max-width: 1000px) {
    /* Mid-width (tablet) scale-down: body + header drop a notch so the full nav
       isn't cramped above the 720px hamburger breakpoint (e.g. iPad mini
       portrait). Slightly below the 18px base. Page content is put back to
       18px just below (tablet band only) - the drop is for the nav's sake. */
    body {
        font-size: 17px;
    }

    body > header {
        padding: 8px 0 0;
    }


    #header-content {
        gap: clamp(12px, 3vw, 56px);
        padding: 0 24px;
    }

    #logo img {
        height: 18px;
    }

    #logo a {
        font-size: 22px;
    }

    #menu {
        font-size: 1em;
        gap: 6px;
    }

    .theme-toggle {
        padding: 0 12px;
        margin: 0 -12px;
    }
}

@media (max-width: 720px) {
    /* Body text steps down to 16px on phones once the hamburger menu takes
       over - a touch under the 17px tablet size for the narrow column. */
    body {
        font-size: 16px;
    }

    body > header::before {
        display: none;
    }

    body > header {
        padding: 12px 16px;
        min-height: 76px;
    }

    #header-content {
        background: var(--capsule-bg);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border: 1px solid var(--capsule-border);
        border-radius: 26px;
        corner-shape: squircle;
        padding: 8px 8px 8px 23px;
        gap: 12px;
        position: absolute;
        top: 12px;
        left: 16px;
        right: 16px;
        width: auto;
        margin: 0;
    }
    /* iPad only (html.is-ipad, set before first paint by theme.js): in a
       narrow iPadOS Safari window the compact toolbar can float over the top
       of the page. Reserve its worst-case overlap for the entire scroll so
       the capsule never moves as the toolbar expands or collapses. Unlike
       dvh, lvh and svh are stable while scrolling; their difference is capped
       at the measured ~20px overlap. Not applied on iPhone, whose collapsing
       chrome does not overlay the page top. */
    html.is-ipad {
        --chrome-shift: clamp(0px, calc(100lvh - 100svh), 20px);
    }
    html.is-ipad #header-content {
        top: calc(12px + var(--chrome-shift));
    }

    #menu {
        justify-content: flex-end;
        gap: 20px;
    }

    #menu > li:not(.menu-hamburger) {
        display: none;
    }

    .menu-closed-bar {
        display: flex;
        position: absolute;
        top: 8px;
        /* Right offset and inter-link gap shrink at narrow viewports.
           Right is clamped >= 56px so Archive never overlaps the
           hamburger (which spans 8-56px from the right edge). */
        right: clamp(53px, calc((100vw - 275px) / 2), 65px);
        height: 34px;
        gap: clamp(8px, calc((100vw - 365px) / 2), 20px);
        align-items: center;
        font-size: 1em;
        font-weight: 600;
    }

    .menu-closed-bar a {
        color: var(--heading);
        text-decoration: none;
    }

    .menu-hamburger {
        display: flex;
        margin-left: -15px;
    }

    #logo img {
        height: 20px;
    }

    #header-content:has(.menu-toggle-input:checked) {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding-bottom: 18px;
        padding-left: 23px;
    }

    #header-content:has(.menu-toggle-input:checked) #logo {
        padding-top: 7px;
    }

    #header-content:has(.menu-toggle-input:checked) nav {
        align-self: stretch;
    }

    #header-content:has(.menu-toggle-input:checked) #menu {
        flex-direction: column;
        align-items: flex-end;
        gap: 0;
        font-size: 2.2em;
        font-weight: 600;
        line-height: 1.5;
        width: 100%;
        padding-right: 20px;
    }

    #header-content:has(.menu-toggle-input:checked) #menu > li {
        display: flex;
    }

    /* iPod touch landscape special case: split menu into 2 columns
       since 320px height can't fit the full list. */
    @media (max-height: 360px) {
        #header-content:has(.menu-toggle-input:checked) #menu {
            display: grid;
            grid-template-columns: 1fr 1fr;
            grid-auto-flow: column;
            grid-template-rows: repeat(4, auto);
            column-gap: 64px;
            width: 100%;
            justify-items: end;
        }
    }

    #header-content:has(.menu-toggle-input:checked) .menu-closed-bar {
        opacity: 0;
        pointer-events: none;
    }

    #header-content:has(.menu-toggle-input:checked) .menu-row-icons {
        position: absolute;
        top: 8px;
        /* Right offset and inter-icon gap shrink at narrow viewports
           so the logo keeps ~30px of breathing room from the icons. */
        right: clamp(48px, calc(100vw - 256px), 72px);
        height: 34px;
        display: flex;
        gap: clamp(8px, calc(100vw - 320px), 22px);
        align-items: center;
    }

    #header-content:has(.menu-toggle-input:checked) .menu-row-icons .theme-toggle {
        margin: 0;
        padding: 0;
    }

    #header-content:has(.menu-toggle-input:checked) .menu-row-icons .theme-toggle-icon,
    #header-content:has(.menu-toggle-input:checked) .menu-row-icons .rss-toggle-link > img {
        height: 26px;
        opacity: 0.8;
    }

    /* The compact icon row is flex-centred, so the desktop-only optical nudge
       on the RSS glyph (see .rss-toggle-link > img above) would push it low. */
    #header-content:has(.menu-toggle-input:checked) .menu-row-icons .rss-toggle-link > img {
        top: 0;
    }

    #header-content:has(.menu-toggle-input:checked) .menu-hamburger {
        position: absolute;
        top: 8px;
        right: 8px;
        margin-left: 0;
    }

    #header-content:has(.menu-toggle-input:checked) .icon-hamburger {
        opacity: 0;
        transform: scale(0);
    }

    #header-content:has(.menu-toggle-input:checked) .icon-close {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }

    #header-content:has(.menu-toggle-input:checked) .hamburger-button {
        background: var(--bg-tertiary);
    }

    :root {
        --container-pad: 20px;
    }

    h1 {
        font-size: 2.0em;
    }

    /* Article header type scale - PHONE tier (<=720px). */
    .title {
        font-size: 1.9em;
    }

    article .subtitle {
        font-size: 1.35em;
        margin-top: 0.15rem;
    }

    article .date {
        font-size: 1.05em;
    }
}

@media (max-width: 389px) {
    .menu-closed-bar {
        display: none;
    }

    /* Smallest phones: tighter content inset. (Title + date use the phone tier.) */
    :root {
        --container-pad: 16px;
    }
}

.container {
    margin: clamp(30px, 4dvh, 56px) auto 30px;
    /* Content-column width; article body text caps narrower via --text-measure.
       Pages that need a wider column set --page-width on <body> via a
       body:has(.page-root) rule in their own stylesheet - the footer's
       .container picks up the same value, so they stay edge-aligned for free. */
    max-width: var(--page-width, 950px);
    /* Gutter driven by --container-pad (set on :root, overridden per breakpoint)
       so the footer separator and comment dividers line up with the content. */
    padding: 0 var(--container-pad);
    position: relative;
}

/* Top gap for article-bearing pages (home feed + posts + tag/archive). With no
   live card showing, the first post sits --post-gap below the header - the same
   gap that separates the posts from each other, so the feed's rhythm starts at
   the top. When the live card IS showing, it keeps its tighter tuck: on desktop
   just enough to clear the sticky header's fade gradient (which hazes the top
   of the dark card); the header and its gradient shrink on smaller screens, so
   the tuck tightens too - 50 desktop / 35 tablet / 5 iPhone. Scoped to main's
   .container (the footer also uses .container). */
body:has(article) main .container {
    margin-top: var(--post-gap);
    padding-top: 0;
}
body:has(article) main .container:has(.twitch-live:not([hidden])) {
    margin-top: 50px;
}

/* Tablet band: pull the feed/post content 25px closer to the header - at
   these widths the header sits taller under Safari's own chrome and the full
   --post-gap read as too much dead space above the first title. */
@media (min-width: 720.02px) and (max-width: 1000px) {
    body:has(article) main .container {
        margin-top: calc(var(--post-gap) - 25px);
    }
}

@media (max-width: 1000px) {
    body:has(article) main .container:has(.twitch-live:not([hidden])) { margin-top: 35px; }
}
@media (max-width: 720px) {
    /* The iPhone has no compact-toolbar overlap to reserve, so tuck the first
       post 20px closer to the header. Keep --post-gap itself unchanged: it
       still controls the rhythm between posts and remains untouched on iPad. */
    html:not(.is-ipad) body:has(article) main .container {
        margin-top: calc(var(--post-gap) - 20px);
    }

    body:has(article) main .container:has(.twitch-live:not([hidden])) { margin-top: 5px; }
}

/* The body section (and permalink row) caps at the readable measure and centres.
   Narrowing the whole SECTION - not individual elements - is deliberate: markdown
   leaves text unwrapped (bare text nodes) after block-level embeds like YouTube,
   and only a section-level cap reins those in too. The hero breaks out wider
   below. Applies to every article - single posts and the home feed (same
   structure); other pages don't use <article>. */
article > section:not(.post-comments),
article > .post-links {
    max-width: var(--text-measure);
    margin-inline: auto;
}

/* Heroes fill a --media-width-wide box at their natural aspect ratio, centred;
   height is capped by the base `article img` max-height (650px), which object-fit
   crops only when a tall/square source would overshoot. Body text stays narrower. */
article > img.hero {
    max-width: var(--media-width);
    margin-inline: auto;
}

.title {
    text-align: center;
    text-wrap: balance;
    margin: 0;
    /* Matches the feed title-link's hover-surface inset so the header looks
       identical on the home page and the post page. */
    padding: 0.1em 0.4em;
}

.date {
    display: block;
    color: var(--text-secondary);
    /* Deliberately large - the date is part of the title block's look, not a
       small label. Tried at ~17px (2026-09) and reverted. */
    font-size: 1.25em;
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.2rem;
    line-height: 100%;
}

.subtitle {
    font-weight: 500;
    font-size: 1.5em;
    margin: 0.1rem auto 0;
    text-align: center;
    text-wrap: balance;
    color: var(--text-secondary);
}

/* (article's own margins live with the feed rhythm rules near the top of the
   file - they collapse with the inter-post gap, so they're tuned together.) */

article section {
    margin-top: 1rem;
}

/* No hero: the body follows the badge row directly, so give it the same gap
   the hero gets (--post-header-gap) instead of the 1rem section default -
   a short image-less post otherwise sits visibly tighter under its pills. */
article > .post-badges + section {
    margin-top: var(--post-header-gap);
}

article ul,
article ol {
    margin-block: 1.5em;
    padding-inline-start: 1.4em;
}

article li {
    margin-block: 0.55em;
    padding-inline-start: 0.25em;
    line-height: 1.65;
}

article li:last-child {
    margin-bottom: 0;
}

article li::marker {
    font-size: 0.8em;
}

/* Code in posts (migrated gists, config snippets): a scrolling card on the
   secondary surface, so long lines scroll inside it instead of widening the
   page. Monospace is the one exception to the no-monospace rule - code needs
   aligned columns - in the same stack the Comentario code blocks use. */
article pre {
    /* Code breaks out of the reading column (up to 980px) so more of each
       line is visible, staying inside the page gutters on narrow screens. */
    width: min(980px, 100vw - 2 * var(--container-pad));
    margin: 0 0 1.5em 50%;
    transform: translateX(-50%);
    padding: 1em 1.25em;
    background: var(--bg-secondary);
    border-radius: 12px;
    corner-shape: squircle;
    overflow-x: auto;
    font-size: 0.78em;
    line-height: 1.55;
    tab-size: 4;
}

article pre code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Syntax colours (CodeHighlighter.swift) - Xcode's default palettes. */
:root {
    --hl-keyword: #9B2393;
    --hl-string: #C41A16;
    --hl-comment: #5D6C79;
    --hl-number: #1C00CF;
    --hl-type: #3900A0;
    --hl-pre: #643820;
}
[data-color-scheme="dark"] {
    --hl-keyword: #FC5FA3;
    --hl-string: #FC6A5D;
    --hl-comment: #8A96A3;
    --hl-number: #D0BF69;
    --hl-type: #AE7CF0;
    --hl-pre: #FD8F3F;
}
.hl-keyword { color: var(--hl-keyword); font-weight: 600; }
.hl-string { color: var(--hl-string); }
.hl-comment { color: var(--hl-comment); }
.hl-number { color: var(--hl-number); }
.hl-type { color: var(--hl-type); }
.hl-pre { color: var(--hl-pre); }

blockquote {
    /*font-style: italic;*/
    color: color-mix(in srgb, var(--text-secondary) 50%, var(--text));
    padding: 0.4rem 0 0.4rem 1.5rem;
    margin: 0 0 1.5em;
    position: relative;
}

blockquote::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--text-secondary);
    border-radius: 999px;
    corner-shape: squircle;
}

footer {
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.5em;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.78em;
}

footer .container {
    /* Width comes from the base .container rule (and --page-width on pages
       that widen), so the footer always aligns with the content above it. */
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 20px;
    width: 100%;
    border-top: 1px solid var(--border);
}

.footer-byline,
.footer-credit {
    flex: 1;
    margin: 0;
}

.footer-byline {
    text-align: left;
}

.footer-credit {
    text-align: right;
}

.footer-byline a,
.footer-credit a {
    color: var(--heading);
    font-weight: 600;
    text-decoration: none;
}

.footer-byline a:hover,
.footer-credit a:hover {
    text-decoration: underline;
}

.footer-social {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-row {
    display: flex;
    gap: 25px;
    align-items: center;
    justify-content: center;
}

.icon-row a {
    text-decoration-line: none;
}

.icon-row svg {
    width: 25px;
    height: 25px;
    color: var(--text);
    fill: none;
    stroke: currentColor;
    display: block;
    transition: transform 0.6s var(--hover-spring);
}

.icon-row a:hover svg {
    transform: scale(1.15);
    transition: transform 0.15s ease-out;
}

@media (max-width: 519.98px) {
    /* Compact layout: icons on their own row at top, then byline + credit
       wrap onto a shared row beneath, separated by a bullet pseudo. */
    footer .container {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 14px;
        column-gap: 0;
        text-align: center;
    }

    .footer-social {
        flex: 1 0 100%;
        order: -1;
    }

    .footer-byline,
    .footer-credit {
        flex: 0 0 auto;
        text-align: center;
    }

    .footer-byline::after {
        content: " \2022 ";
        padding: 0 0.4em 0 0.2em;
        color: var(--text-secondary);
    }
}

@media (max-width: 374.98px) {
    body {
        font-size: 15.5px;
    }

    body > header {
        padding-left: 8px;
        padding-right: 8px;
    }

    #header-content {
        left: 8px;
        right: 8px;
    }

    :root {
        --container-pad: 8px;
    }
}

/* ---------- Page header (shared by sub-pages: archive, about, etc.) ---------- */

.page-title {
    text-align: center;
    font-size: 2.7em;
    line-height: 1.1;
    margin: 0 auto 0.4rem;
}

.page-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin: 0 auto 1.6rem;
}

/* Text-colored link: blends in with body text, underlines on hover. Use
   outside article prose where the default red link color would feel
   intrusive (archive rows, lists, future sub-pages). Only recolors - the
   no-underline base and hover underline come from the `a` rules above. */
.text-link,
.text-link:hover {
    color: var(--text);
}

/* Shared "no results" empty state for filterable listings (archive search,
   talks filters - both toggled by site.js). */
.archive-empty,
.talks-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 2em 0;
    margin: 0;
}

/* Tech-Specs-style hairline key/value list - used by the collection detail
   sidebars (Apps/Code/Art/Talks) and the About colophon. The Contact card's
   list is deliberately decoupled (larger type/looser rows - see contact.css). */
/* A heading above a rounded card (About's Colophon, the detail pages'
   Details), outside it like an iOS grouped-table header: inset by the card's
   own side padding so it lines up with the text inside. */
.card-heading {
    display: block;
    padding: 0 28px;
    margin: 0 0 0.4em;
    /* The detail pages' size, matching their "Links" header; About sets its
       own, larger one. */
    font-size: 1.2em;
    font-weight: 700;
    color: var(--heading);
}

@media (max-width: 720px) {
    .card-heading {
        padding: 0 20px;
    }
}

/* Links beneath a rounded card (About's legal pages, then Acknowledgements):
   quiet secondary text, centred under the card in two short lines that fit
   any phone. Links on the same line are dot-separated like the site footer;
   the dots are drawn in CSS so screen readers just hear the links. */
.card-footer {
    margin: 1.1em 0 0;
    text-align: center;
    font-size: 0.95em;
    line-height: 1.7;
}

.card-footer a,
.card-footer a:hover {
    color: var(--text-secondary);
}

.card-footer a + a::before {
    content: "·";
    display: inline-block;
    margin: 0 0.6em;
    color: var(--text-tertiary);
    /* The dot isn't part of the link's underline on hover. */
    text-decoration: none;
}

.spec-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    /* No column-gap: a real gap would break the row hairline between the two
       cells. The label/value spacing is recreated as dt padding-right below,
       which the border-top spans - so the line reads as one continuous rule. */
    column-gap: 0;
    row-gap: 0.45em;
    margin: 0;
    /* Label and value share a baseline per row, so a multi-line value lines up
       with its label on the first line instead of centring against it. */
    align-items: baseline;
}

/* Subtle hairline between spec rows (every row but the first), spanning both
   columns so the eye can track a label across to its value. The row-gap sits
   over the line and the padding-top below it, keeping the hairline centred in
   the gap without growing the card much. */
.spec-list dd + dt,
.spec-list dd:not(:first-of-type) {
    /* Every spec list sits on a --bg-secondary card, where --border vanishes
       in light mode. */
    border-top: 1px solid var(--border-secondary);
    padding-top: 0.45em;
}

.spec-list dt {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-secondary);
    /* Stands in for the removed column-gap, but sits inside the cell so the
       hairline runs unbroken across to the value column. */
    padding-right: 1.5em;
    /* Labels are a word or two. Safari sizes the max-content column a hair
       short and wraps multi-word labels ("Original name") despite free room;
       the value column does the wrapping instead. */
    white-space: nowrap;
}

.spec-list dd {
    margin: 0;
    text-align: right;
    font-size: 0.9em;
    color: var(--text);
}

@media (max-width: 720px) {
    .page-title {
        font-size: 2.4em;
    }
}

/* Back-to-top - a fixed button that fades in after scrolling down, scrolls to
   the top on click. Shown/hidden by the .visible class (toggled in site.js).
   Reusable on any long page that renders the button. */
.back-to-top {
    position: fixed;
    bottom: 24px;
    /* Sit just outside the content column's right edge when the window is wide
       enough (the collection pages cap at 1650px → half is 825px; +44px button
       +~11px gap). On narrower windows clamp to a 24px edge margin. */
    right: max(24px, calc(50vw - 880px));
    width: 44px;
    height: 44px;
    border-radius: 50%;
    corner-shape: round;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    /* Hidden means out of the tab order too: visibility flips after the
       fade-out finishes, and straight away on the way in. */
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
    z-index: 20;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top,
    .back-to-top.visible {
        transition: none;
    }
}

/* ---------- Feed badge row (above the hero) ---------- */

/* Row of dim capsule badges above the hero image: comments · link · share. */
.post-badges {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
    /* Tight top gap so the badges read as part of the title/date block; the
       hero's margin (below) sets the gap to the image. */
    margin: 0.35em 0 0;
    font-size: 0.95em;
    font-weight: 500;
}

/* Feed hero (preceded by the badge row). Top gap is the shared header-frame
   token - see --post-header-gap where the feed spacing is defined. */
.post-badges + img.hero {
    /* auto inline margins keep the capped (max-width:750px) hero centred. */
    margin: var(--post-header-gap) auto 1.8em;
}

/* Dim capsule badge, 30px tall - reads as a clickable control. */
.post-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 0.7em;
    border-radius: 999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    border: none;
    font: inherit;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

/* Hover lifts text to the strongest foreground and deepens the capsule. */
.post-badge:hover,
.post-badge:focus-visible {
    color: var(--heading);
    background: var(--control-hover);
    text-decoration: none;
}

/* Copy confirmation: the share badge's icon swaps to a check in site.js when it
   falls back to copying the link. */
.post-badge.is-copied {
    color: var(--heading);
}

.post-badge .post-icon-glyph {
    width: 1.1em;
    height: 1.1em;
}

/* Comentario keeps the count element present even at zero, so :empty can't tell
   whether a number is shown - site.js adds .has-count when one actually is.
   Hidden otherwise, so the bubble stays centred on posts with no comments. */
.post-badge comentario-count {
    display: none;
}

.post-badge comentario-count.has-count {
    display: inline-block;
    margin-left: 0.175em;
    font-weight: 600;
    /* Comentario resolves the count after paint; .has-count reveals it. Rather
       than snap in, fade+grow the number and pop the bubble beside it. */
    animation: post-count-in 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes post-count-in {
    from { opacity: 0; transform: scale(0.4); }
    to   { opacity: 1; transform: scale(1); }
}
/* The comment bubble does a little grow-pop the moment its count arrives. */
.post-badge:has(comentario-count.has-count) .post-icon-glyph {
    animation: post-bubble-pop 0.42s ease;
}
@keyframes post-bubble-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .post-badge comentario-count.has-count,
    .post-badge:has(comentario-count.has-count) .post-icon-glyph {
        animation: none;
    }
}

/* Feed title links to the post. On hover the (possibly wrapped) title is
   enclosed in a rounded surface that fades in - the same effect as the
   Apps/Code cards. Constant padding + rounding are always present so the
   surface fades in with no layout shift. */
.post-title-link {
    display: block;
    text-align: center;
    color: inherit;
    text-decoration: none;
}

/* Beat the global a:hover underline so the title never gets the link underline. */
.post-title-link:hover,
.post-title-link:focus-visible {
    text-decoration: none;
}

.post-title-link .title {
    display: inline-block;
    border-radius: 0.3em;
    corner-shape: squircle;
    background: transparent;
    transition: background 0.2s ease,
                transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* hover:hover so the surface doesn't stick after a tap on touch devices. */
@media (hover: hover) {
    .post-title-link:hover .title,
    .post-title-link:focus-visible .title {
        background: var(--bg-secondary);
        transform: scale(1.02);
    }
}

/* Reduced motion: keep the surface fade, drop the zoom (mirrors the cards).
   Must sit AFTER the transition + hover rules above - same specificity, so
   source order is what lets these win. */
@media (prefers-reduced-motion: reduce) {
    .post-title-link .title {
        transition: background 0.2s ease;
    }
    .post-title-link:hover .title,
    .post-title-link:focus-visible .title {
        transform: none;
    }
}

/* Phones: drop the title's hover surface entirely - a mouseover affordance
   makes no sense on touch screens, and its padding wastes width. Width-based
   (not hover-based) so it also holds in responsive previews. (After the rules
   above so it wins on source order.) */
@media (max-width: 720px) {
    .title {
        padding: 0;
    }
    .post-title-link:hover .title,
    .post-title-link:focus-visible .title {
        background: transparent;
        transform: none;
    }
}

/* Shared sprite glyph sizing (badges and end-of-article links override the em). */
.post-icon-glyph {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

/* ---------- End-of-article links (feed): permalink · share · comments ---------- */

/* Small, secondary text+icon links, left-aligned with the body. */
/* Opt-in excerpt on the home feed (a `<!--more-->` line in the post): the
   cut copy fades out over its last lines, then a full-width rounded block
   links to the whole post. */
.post-excerpt {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 7em), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 7em), transparent);
}

.post-excerpt > :last-child {
    margin-bottom: 0;
}

.post-continue {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: var(--text-measure);
    margin: 1.25em auto 0;
    padding: 1.1em 1.5em;
    background-color: var(--bg-secondary);
    border-radius: 18px;
    corner-shape: squircle;
    color: var(--heading);
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

/* Hover fades the block to a lighter shade. */
.post-continue:hover {
    color: var(--heading);
    text-decoration: none;
    background-color: color-mix(in srgb, var(--bg-secondary), #fff 50%);
}

[data-color-scheme="dark"] .post-continue:hover {
    background-color: color-mix(in srgb, var(--bg-secondary), #fff 7%);
}

/* Tabler chevron-right, drawn in the text colour. */
.post-continue-chevron {
    width: 1.1em;
    height: 1.1em;
    /* The glyph sits in the middle of its 24px box; pull it in so the visible
       gap to the text is about a third of an em. */
    margin-left: -0.05em;
    /* Centre on the lowercase letters (the label is mostly x-height), not the
       capital height flex centring lines it up with: ~1px lower. */
    position: relative;
    top: 0.06em;
    transition: transform 0.2s ease;
}

.post-continue:hover .post-continue-chevron {
    transform: translateX(2px);
}

.post-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75em;
    /* Matches the inter-paragraph gap (p margin-bottom). */
    margin-top: 1.5em;
    font-size: 0.85em;
    font-weight: 600;
}

.post-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    color: var(--text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    transition: color 0.15s ease;
}

.post-link:hover,
.post-link:focus-visible {
    color: var(--heading);
    text-decoration: none;
}

.post-link .post-icon-glyph {
    width: 1.15em;
    height: 1.15em;
}

/* Comments section on the standalone post page (Comentario mounts inside).
   position:relative so Comentario's login bar can anchor to the heading row. */
.post-comments {
    margin-top: 2.5em;
    padding-top: 2em;
    position: relative;
}

/* Section divider drawn full-bleed (out to the container box edge, matching the
   footer separator and the wide media) via ::before, so it stays off the box and
   the absolutely positioned profile bar / "Sign in" anchor is unaffected. */
.post-comments::before {
    content: "";
    position: absolute;
    top: 0;
    left: calc(-1 * var(--container-pad));
    right: calc(-1 * var(--container-pad));
    border-top: 1px solid var(--border);
}

/* Vertical breathing room around the Comentario widget. Styled here in the
   page CSS (not the css-override file, which only reaches the widget internals)
   and display:block so the vertical padding applies - the custom element is
   inline by default. */
comentario-comments {
    display: block;
    /* Top only - the article's 60px bottom margin already spaces the end. */
    padding: 1.2em 0 0;
}

.post-comments-title {
    display: flex;
    align-items: center;
    gap: 0.25em;
    margin: 0;
    font-weight: 700;
}

/* Comment count in the heading - revealed by site.js once Comentario loads it (the
   element stays empty until then). */
.post-comments-count {
    display: none;
    color: var(--text-secondary);
    font-weight: 700;
}

/* Shown as a small capsule badge beside "Comments" instead of the old "· N". Uses the
   same --bg-tertiary fill as the post-badges under the article title and the inline
   Sign-in button. */
.post-comments-count.has-count {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.65em;
    border-radius: 999px;
    background: var(--bg-tertiary);
    font-size: 0.6em;
    line-height: 1.4;
}
