/* ==========================================================================
   brayden-beckius: cloth & selvedge
   The thread is the material, not an object on top of it. The page is a fine plain weave; craft shows at the
   edges (woven bands, fringe); essays carry a selvedge rail that is woven in as you read. Weaving vocabulary
   only: warp, weft, selvedge, fringe. No stitches.

   Source's CSS (built/screen.css) is imported into the "source" cascade layer in default.hbs, so every rule
   here wins over it whatever its specificity. Write plain selectors: no ids, no body prefix, no !important.

   1. Tokens       5. Hero               9. Invitation band and gallery   13. Essays: progress, rail, next
   2. Base         6. Buttons and links  10. Subscribe card               14. Pages
   3. Layout       7. Cloth edges        11. Footer                       15. Motion, contrast, print
   4. Header       8. Cards              12. Content (post text)

   Order matters where two rules have the same specificity: content (12) comes before the essay rail (13), which
   sits inside the post text and must win over its link styles.
   ========================================================================== */

/* 1. Tokens
   ------------------------------------------------------------------------- */
/* html:root, not :root: Ghost's head sets --ghost-accent-color on :root after this file loads */
html:root {
    /* Colour palette: the only place a colour value is written. Everything else, SVG in templates and theme.js
       included, uses these. Contrast on paper/white: ink 12.7, body 8.4, muted 5.3, moss 6.5, clay 5.1,
       river 6.0, ochre 5.4, white on moss 7.6, on-moss on moss 5.2 (all AA for body text). */
    /* stylelint-disable color-no-hex */
    /* Grounds */
    --paper: #EEEDE7;        /* chalk down: page background */
    --white: #FFFFFF;        /* cards, white bands, the phone menu */
    /* Text */
    --ink: #1F2A22;          /* headings, strong text, rules */
    --body: #3C463D;         /* running text */
    --muted: #5A6357;        /* meta, captions, labels */
    --on-moss: #CFD8C6;      /* quiet text on moss bands */
    /* Lines */
    --border: #D9D4C3;       /* hairlines and card edges (decorative) */
    --field: #838A7B;        /* control outlines: 3:1 on paper and white */
    /* Dyes: one per scale, plus moss as the site accent */
    --moss: #2F5D3A;         /* planetary; accent, buttons, links */
    --moss-dark: #24482D;    /* button hover */
    --river: #2E5E73;        /* bioregional */
    --clay: #A4482A;         /* local */
    --ochre: #7A5A0E;        /* finance */
    /* Tints: a pale ground and its edge per dye */
    --sage: #D4E5C6;         /* moss tint, also callouts and Start here */
    --sage-edge: #B4CD9F;
    --river-tint: #E3ECEC;
    --river-edge: #CADBDB;
    --clay-tint: #F6E7DC;
    --clay-edge: #EAD3C3;
    --ochre-tint: #F3EBD3;
    --ochre-edge: #E3D6B2;
    /* Undyed thread: the cloth's own colour (footer, rail warp, posts without a scale) */
    --undyed-light: #EFEADC;
    --undyed: #BDB49C;
    --undyed-dark: #8C836B;
    /* Contour lines woven into the splash (read by theme.js initContours) */
    --contour: #8FB27A;
    /* Deeper shades for the hero diagram only (with moss-dark for the planet ring) */
    --river-deep: #234A5B;
    --clay-deep: #8E3B21;
    --sage-deep: #C3D9B0;
    --river-tint-deep: #CFE0E1;
    --clay-tint-deep: #EFD7C6;
    /* stylelint-enable color-no-hex */
    /* Translucent shades: color-mix(in srgb, var(--ink) N%, transparent) */

    --serif: "Alegreya", Georgia, "Times New Roman", serif;
    --sans: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --wrap: 1180px;
    --gutter: 24px; /* page gutter: stays px so narrow screens keep room when readers enlarge text */

    /* Spacing scale: every margin, padding and gap uses one of these. rem, so spacing grows with the reader's
       text size. Source sets html to 62.5%, so 1rem = 10px here. Text inside posts keeps its em spacing. */
    --space-3xs: 0.4rem; /*  4: icon to label. Never between two tap targets */
    --space-2xs: 0.8rem; /*  8: tight stacks (tag · date · time) */
    --space-xs: 1.2rem;  /* 12: label to title inside a card */
    --space-s: 1.6rem;   /* 16: cards in a list, button rows */
    --space-m: 2.4rem;   /* 24: card padding, heading to text */
    --space-l: 3.2rem;   /* 32: wide-screen card padding, heading row to its block */
    --space-xl: 4.8rem;  /* 48: section spacing on phones */
    --space-2xl: 6.4rem; /* 64 */
    --space-3xl: 9.6rem; /* 96: section spacing on desktop */
    /* Section rhythm. Each boundary between sections has one owner, the later section's top padding, so gaps
       never add up: --section on each side of a band edge (the white and moss bands, the footer's cloth end),
       --block between sections on the same ground, --space-xl from a page heading to its content, and
       --space-m / --space-l above / below a heading's ink rule. Every page but home starts --page-top below the
       fixed header (section 3); a page's first block adds no top space of its own. */
    --section: var(--space-l);  /* 32 on phones, 96 from 768px */
    --block: var(--space-xl);   /* 48 on phones, 64 from 768px */
    --page-top: var(--space-l); /* 32 on phones (as the home splash), 48 from 768px */
    --header-h: 8.4rem;         /* the fixed header's height (about 84 on phones, 68 on wider ones; 76 from 768px); theme.js initHeader keeps it exact */

    /* Type scale: every font-size and line-height uses one of these (px at the default text size). Fluid sizes
       grow from 375 to 1200px wide. Text inside posts keeps Source's em sizes, set from --content-font-size. */
    --text-xs: 1.4rem;  /* 14: meta, labels, captions. The smallest text on the site */
    --text-s: 1.6rem;   /* 16: buttons, card excerpts, small paragraphs */
    --text-m: 1.8rem;   /* 18: body on phones, ledes */
    --text-l: 2rem;     /* 20: body from 768px, large ledes */
    --text-xl: 2.4rem;  /* 24: card titles, subheads */
    --text-2xl: clamp(2.8rem, 2.62rem + 0.485vw, 3.2rem); /* 28 → 32: small section headings, pull quotes */
    --text-3xl: clamp(3.2rem, 2.65rem + 1.455vw, 4.4rem); /* 32 → 44: section headings */
    --text-4xl: clamp(4rem, 3.27rem + 1.94vw, 5.6rem);    /* 40 → 56: page titles */
    --text-hero: clamp(3.2rem, 1.38rem + 4.85vw, 7.2rem); /* 32 → 72: the home headline */
    --leading-tight: 1.1;  /* display headings */
    --leading-snug: 1.25;  /* headings, card titles, buttons */
    --leading-body: 1.6;   /* paragraphs and UI text */
    --leading-loose: 1.75; /* long-form post text */

    /* Shape: corners, lines, shadows, focus and controls. Cloth corners are 4px, controls are pills. */
    --radius-s: 2px;       /* things inside a card: thumbnails, the progress track */
    --radius-m: 4px;       /* cloth corners: cards, panels, photos, video */
    --radius-pill: 999px;  /* buttons, chips, inputs, round icon buttons */
    --line-hair: 1px;      /* hairlines and card edges */
    --line-control: 1.5px; /* control outlines */
    --line-rule: 2px;      /* the ink rule under a section heading */
    --underline-offset: 4px; /* text underlines that mark a link or the current item */
    --track-caps: 0.08em;  /* letter-spacing for small spaced capitals (section labels, breadcrumb) */
    --line-band: 3px;      /* a scale's colour band: tag heads, card edges, blockquotes, callouts */
    --shadow-soft: 0 2px 16px color-mix(in srgb, var(--ink) 10%, transparent);    /* resting photos, cards on hover */
    --shadow-lift: 0 8px 22px color-mix(in srgb, var(--ink) 18%, transparent);    /* a selected card, floating panels and buttons */
    --shadow-press: 0 6px 14px -8px color-mix(in srgb, var(--ink) 45%, transparent); /* under a button lifting on hover */
    --focus-width: 3px;
    --focus-offset: 3px;
    --focus-colour: var(--clay); /* set to --white on moss bands */
    --control-h: 48px;     /* buttons */
    --control-h-s: 44px;   /* chips, icon buttons, segmented buttons, menu rows (still a 44px target) */

    /* Motion: hover and state changes. The hero intro keeps its own choreography (section 5). */
    --ease: cubic-bezier(0.25, 0.6, 0.3, 1);
    --duration-fast: 0.2s;  /* hover colour, small movements */
    --duration-base: 0.35s; /* buttons, reveals, word changes */
    --duration-slow: 0.6s;  /* rings, slides, fades between states */

    /* Source's own variables, pointed at the palette and fonts */
    --background-color: var(--paper);
    --ghost-accent-color: var(--moss);
    --color-darker-gray: var(--ink);
    --color-primary-text: var(--ink);
    --color-secondary-text: var(--muted);
    --color-border: var(--border);
    --color-light-gray: var(--border);
    --color-lighter-gray: color-mix(in srgb, var(--ink) 5%, transparent);
    --color-mid-gray: var(--border);
    --color-dark-gray: var(--body);
    --color-dark-border: var(--muted);
    --color-white: var(--white);
    --font-sans: var(--sans);
    --font-serif: var(--serif);
    --gh-font-heading: var(--serif);
    --gh-font-body: var(--sans);
    --container-width: var(--wrap);
}
@media (min-width: 768px) {
    html:root { --section: var(--space-3xl); --block: var(--space-2xl); --page-top: var(--space-xl); --header-h: 7.6rem; }
}
/* Reduced motion: every hover and state change becomes instant. Keyframe animations are switched off where they
   are defined. */
@media (prefers-reduced-motion: reduce) {
    html:root { --duration-fast: 0s; --duration-base: 0s; --duration-slow: 0s; }
}

/* Scale colour per tag slug: anything with data-tag / is-<slug> picks it up */
[data-tag="local"], .is-local { --scale: var(--clay); --tint: var(--clay-tint); --tint-border: var(--clay-edge); }
[data-tag="bioregional"], .is-bioregional, .is-bio { --scale: var(--river); --tint: var(--river-tint); --tint-border: var(--river-edge); }
[data-tag="planetary"], .is-planetary, .is-planet { --scale: var(--moss); --tint: var(--sage); --tint-border: var(--sage-edge); }
[data-tag="finance"], .is-finance { --scale: var(--ochre); --tint: var(--ochre-tint); --tint-border: var(--ochre-edge); }
.is-self { --scale: var(--ink); }

/* 2. Base
   ------------------------------------------------------------------------- */
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 110px; }

/* The ground: an over-under plain weave, only visible up close */
body {
    background-color: var(--paper);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Cg fill='%231F2A22' fill-opacity='.055'%3E%3Crect x='.6' y='1.4' width='3.8' height='2.2' rx='1.1'/%3E%3Crect x='6.4' y='.6' width='2.2' height='3.8' rx='1.1'/%3E%3Crect x='1.4' y='5.6' width='2.2' height='3.8' rx='1.1'/%3E%3Crect x='5.6' y='6.4' width='3.8' height='2.2' rx='1.1'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 10px 10px;
    color: var(--ink);
    font-family: var(--sans);
    /* Alegreya Sans has short lowercase letters; this sizes its x-height up so text reads at the size it is set */
    font-size-adjust: 0.5;
}

/* Alegreya for headings. Title weights (550) come from Source's serif-title rules. Serif text keeps its set size. */
h1, h2, h3, .is-title, .h1, .h2, .h3 { font-family: var(--serif); }
h1, h2, h3, h4, h5, h6, .is-title, .h1, .h2, .h3,
.date-day, .gh-card-title, .gh-container-title, .gh-article-excerpt, .gh-content > blockquote.kg-blockquote-alt,
.note.is-start .note-excerpt, .footer-name, .gh-article-author-name { font-size-adjust: none; }

a { color: var(--moss); text-underline-offset: 3px; }
a:hover { opacity: 1; color: var(--ink); }

:is(a, button, input, summary):focus-visible {
    outline: var(--focus-width) solid var(--focus-colour);
    outline-offset: var(--focus-offset);
}
/* Rounds the ring on plain links only: :where() has no specificity, so pills and cards keep their own corners */
:where(a, button, input, summary):focus-visible { border-radius: var(--radius-m); }

::selection { background: var(--sage); color: var(--ink); }
input::placeholder { color: var(--muted); opacity: 1; }

/* Visually hidden, still read out */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Skip link */
.skip-link {
    position: absolute;
    left: 16px;
    top: -80px;
    z-index: 2000;
    padding: var(--space-xs) var(--space-s);
    border-radius: var(--radius-pill);
    background: var(--ink);
    color: var(--white);
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--white); }
.content-start { display: block; height: 0; outline: none; }

/* Type helpers */
.h1 { margin: 0; font-weight: 400; font-size: var(--text-4xl); line-height: var(--leading-tight); letter-spacing: -0.02em; }
.h2 { margin: 0; font-weight: 400; font-size: var(--text-3xl); line-height: var(--leading-tight); letter-spacing: -0.01em; }
.h3 { margin: 0; font-weight: 400; font-size: var(--text-2xl); line-height: var(--leading-snug); }
.section-lede { margin: 0; max-width: 36em; font-size: var(--text-m); line-height: var(--leading-body); color: var(--body); }
.eyebrow { margin: 0; display: flex; align-items: center; gap: var(--space-2xs); font-size: var(--text-s); font-weight: 500; color: var(--muted); }
.dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--scale, var(--moss)); }

/* Scale glyph (partials/icons/scale.hbs): the scale's ring in its dye, the others as faded thread of the same dye */
.glyph { fill: none; stroke-width: 1.5; }
.glyph-off { stroke: color-mix(in srgb, var(--scale) 30%, var(--paper)); }
.glyph-on { stroke: var(--scale); stroke-width: 3; }
.glyph-on.is-fill { fill: var(--scale); stroke: none; }

/* Scroll reveal (opt-in; only hidden once theme.js confirms it can reveal) */
.has-js .reveal { transition: opacity var(--duration-base) var(--ease), transform var(--duration-base) var(--ease); }
.has-js .reveal:not(.is-in) { opacity: 0; transform: translateY(12px); }

/* 3. Layout: page width, sections and bands
   ------------------------------------------------------------------------- */
/* clip, not hidden: "hidden" turns the viewport into a scroll box and stops sticky things (progress strip, rail) sticking */
.gh-viewport { position: relative; overflow-x: clip; }
/* Every page but home (whose splash sits under the header) starts --page-top below the fixed header; Source's
   100px ignored the header's real height (76 / 96), and each page's first block used to add its own top space */
body:not(.home-template) .gh-main { padding-top: calc(var(--header-h) + var(--page-top)); }
/* When the article opens the page (posts, plain pages), the article owns the --page-top space, so its paper column
   (section 12) starts straight under the header and contains the first line, without reaching outside its own box.
   Pages that open with their own header (About, All posts, archives) keep the space on .gh-main. */
body:not(.home-template) .gh-main:has(> .gh-article:first-child) { padding-top: var(--header-h); }
.gh-main > .gh-article:first-child { padding-top: var(--page-top); }
/* Posts open with the small breadcrumb, so they start closer: --space-s to its box, which with the line's own room
   reads as ~24px of paper above the crumb's capitals, matching the crumb-to-title gap (.crumb margin, section 12) */
body.post-template { --page-top: var(--space-s); }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
    box-sizing: border-box;
}

.band-white {
    background: var(--white);
    border-top: var(--line-hair) solid var(--border);
    border-bottom: var(--line-hair) solid var(--border);
}
.section { display: flex; flex-direction: column; gap: var(--space-l); padding-block: var(--section); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-s); }
.section-head > div { display: flex; flex-direction: column; gap: var(--space-xs); max-width: 40em; }

/* A heading row closed by an ink rule (home "Latest posts", "More posts") */
.latest-head {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-xs) var(--space-l);
    margin: 0;
    padding-bottom: var(--space-m);
    border-bottom: var(--line-rule) solid var(--ink);
}
.latest-lede { margin: var(--space-2xs) 0 0; font-size: var(--text-m); color: var(--body); }
.latest-meta { margin: 0; font-size: var(--text-s); color: var(--muted); }
.latest-meta a { display: inline-block; padding-block: var(--space-3xs); margin-block: calc(-1 * var(--space-3xs)); font-weight: 600; }
@media (max-width: 560px) {
    .latest-head { padding-bottom: var(--space-s); }
}

/* Page head (events, all posts) */
.masthead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-l);
    padding-bottom: var(--space-xl);
}
.masthead-copy { flex: 1 1 460px; display: flex; flex-direction: column; gap: var(--space-s); }

/* 4. Header and phone menu
   ------------------------------------------------------------------------- */
.gh-navigation {
    padding-inline: var(--gutter);
    background-color: var(--paper);
    color: var(--ink);
    box-shadow: 0 1px 0 var(--border);
    font-family: var(--sans);
    font-size: var(--text-s);
    font-weight: 500;
}
.gh-navigation-inner { max-width: var(--wrap); margin-inline: auto; }
/* Header links take the header's ink, not the moss of links in text */
.gh-navigation :is(.gh-navigation-logo, a:not(.gh-button)) { color: inherit; }

.gh-navigation-logo { flex-direction: row; align-items: center; gap: var(--space-xs); font-size: var(--text-xl); letter-spacing: -0.01em; }
.logo-mark { flex: 0 0 auto; }
.logo-text { display: flex; flex-direction: column; gap: 2px; }
.gh-navigation-logo-name { font-size: var(--text-xl); }
/* The subtitle shows under the name wherever it fits in two lines: phones from 19em (304px at the default text size,
   so every phone, beside the menu button; in em so a reader with larger text gets the header without it, rather than
   a taller pinned header), and from 1024px.
   Between 768 and 1024 the header row has the links, so there is no room. */
.gh-navigation-logo-subtitle { display: none; font-family: var(--sans); font-size: var(--text-xs); color: var(--muted); opacity: 1; text-wrap: balance; }
@media (min-width: 19em) and (max-width: 767px), (min-width: 1024px) {
    .gh-navigation-logo-subtitle { display: block; }
}

/* Header links: the underline fades in on hover; clay under the current page; never wrap */
.gh-navigation .nav a {
    white-space: nowrap;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    transition: color var(--duration-base) var(--ease), text-decoration-color var(--duration-base) var(--ease);
}
.gh-navigation .nav a:hover { color: var(--moss); text-decoration-color: currentColor; opacity: 1; }
.gh-navigation .nav .nav-current a { text-decoration-color: var(--clay); text-underline-offset: 6px; }
.gh-navigation-members a { white-space: nowrap; }
.gh-navigation-members .gh-button { min-height: var(--control-h-s); padding: 0 var(--space-s); font-size: var(--text-s); }
/* Search and menu buttons: 44px targets; the icons stay 29px */
.gh-icon-button { width: var(--control-h-s); height: var(--control-h-s); }

@media (min-width: 768px) {
    /* Tap targets of at least 24px (WCAG 2.5.8); the negative margin keeps the header row's layout */
    .gh-navigation .nav a { display: inline-block; padding-block: var(--space-xs); margin-block: calc(-1 * var(--space-xs)); }
}

/* The header's menu button is for phones only (it opens the menu sheet below) */
.header-menu { display: none; }
@media (max-width: 767px) {
    /* The header stays pinned at the top: logo, name and subtitle, and the menu button at the right. Search is the
       first item in the menu. */
    /* Its height comes from its content (the 44px menu button, or the name with a two-line subtitle) */
    .gh-navigation { padding-block: var(--space-xs); }
    .gh-navigation-inner { grid-template-rows: auto auto auto; grid-template-columns: 1fr; gap: 0; }
    .gh-navigation-brand { display: grid; grid-template-columns: 1fr auto; grid-column-start: 1; align-items: center; gap: var(--space-xs); }
    .gh-navigation-logo { font-size: var(--text-l); }
    .logo-mark { width: 30px; height: 30px; }
    .gh-navigation-menu, .gh-navigation-actions, .gh-navigation-brand .gh-search { display: none; }
    /* 44px target; the negative margin lines the icon up with the gutter */
    .header-menu { display: inline-flex; margin-right: calc(-1 * var(--space-xs)); border-radius: var(--radius-pill); color: var(--ink); }
    .header-menu svg { width: 28px; height: 28px; }
    .header-menu:active { background-color: color-mix(in srgb, var(--ink) 8%, transparent); }
}
/* Phones turned sideways are short and often wider than 768px, so they get the tablet header: it hides on scroll
   there (theme.js initHeader), giving the page the short screen */
@media (min-width: 768px) and (max-height: 500px) {
    .gh-navigation { transition: transform var(--duration-base) var(--ease), box-shadow var(--duration-base) var(--ease); }
    .gh-navigation.is-tucked:not(:focus-within) { transform: translateY(-100%); box-shadow: none; }
}

/* The dock (partials/components/dock.hbs): on phones, the floating layer at the bottom of the screen, in thumb
   reach: the "next section" arrow (theme.js initSkip) at the right and, on the home splash, Subscribe beside it until
   the reader scrolls (theme.js initDockCta). With the header that's the page's two fixed layers. */
.dock, .sheet { display: none; }
@media (max-width: 767px) {
    html { scroll-padding-bottom: 96px; } /* keyboard focus stops above the dock (WCAG 2.4.11) */
    .dock {
        position: fixed;
        left: var(--space-s);
        right: var(--space-s);
        bottom: calc(var(--space-s) + env(safe-area-inset-bottom, 0px));
        z-index: 40;
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        pointer-events: none; /* only the buttons take taps; the gap between them doesn't block the page */
        transition: opacity var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
    }
    .dock > * { pointer-events: auto; }
    .dock.is-hidden { opacity: 0; transform: translateY(12px); }
    .dock.is-hidden > * { pointer-events: none; }
    .dock .skipnext {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 56px;
        height: 56px;
        padding: 0;
        border: var(--line-control) solid var(--moss);
        border-radius: var(--radius-pill);
        background: var(--white);
        color: var(--moss);
        box-shadow: var(--shadow-lift);
        cursor: pointer;
        margin-left: auto;
    }
    .dock-cta {
        flex: 1 1 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 56px;
        border-radius: var(--radius-pill);
        background: var(--moss);
        color: var(--white);
        font-size: var(--text-s);
        font-weight: 600;
        text-decoration: none;
        box-shadow: var(--shadow-lift);
        transition: opacity var(--duration-base) var(--ease), transform var(--duration-base) var(--ease), visibility 0s;
    }
    /* Once the reader scrolls off the splash it slides away; visibility (after the fade) takes it out of the tab
       order and the accessibility tree too */
    .dock.is-past-splash .dock-cta {
        opacity: 0;
        transform: translateY(var(--space-s));
        visibility: hidden;
        pointer-events: none;
        transition: opacity var(--duration-base) var(--ease), transform var(--duration-base) var(--ease), visibility 0s var(--duration-base);
    }
    .dock :is(.dock-cta, .skipnext):active { background-color: var(--moss-dark); color: var(--white); }
    .dock :is(.dock-cta, .skipnext):focus-visible { outline: var(--focus-width) solid var(--ink); outline-offset: var(--focus-offset); } /* ink: it floats over any band, clay included */

    /* The menu: a sheet dropping from the top of the screen, from the header's menu button (a modal <dialog>,
       theme.js initSheet), with a woven bottom edge. Close and Subscribe sit at its foot. */
    .sheet[open] {
        position: fixed;
        inset: 0 0 auto;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: none;
        max-height: min(600px, 88svh);
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0 0 var(--radius-m) var(--radius-m);
        background: var(--white);
        color: var(--ink);
        box-shadow: var(--shadow-lift);
        overflow: hidden;
    }
    .sheet[open]::after { /* the woven edge */
        content: "";
        flex: 0 0 6px;
        background-color: var(--moss);
        background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--white) 40%, transparent) 0 1px, transparent 1px 3px);
    }
    .sheet::backdrop { background: color-mix(in srgb, var(--ink) 40%, transparent); }
    html:has(.sheet[open]) { overflow: hidden; } /* the page behind doesn't scroll */
    .sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-top: calc(var(--space-s) + env(safe-area-inset-top, 0px)); }
    /* Looks like a field, is a button: Ghost's search opens in its own window */
    .sheet-search {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        width: calc(100% - 2 * var(--gutter));
        min-height: var(--control-h-s);
        margin: 0 var(--gutter) var(--space-s);
        padding: 0 var(--space-s);
        border: var(--line-control) solid var(--field);
        border-radius: var(--radius-pill);
        background: var(--white);
        color: var(--muted);
        font: 500 var(--text-s) / 1 var(--sans);
        cursor: pointer;
    }
    .sheet-search svg { flex: 0 0 auto; width: 18px; height: 18px; }
    .sheet-nav .nav { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
    .sheet-nav .nav:first-child { border-top: var(--line-hair) solid var(--border); }
    .sheet-nav .nav a {
        position: relative;
        display: flex;
        align-items: center;
        min-height: 52px;
        padding: 0 var(--gutter);
        border-bottom: var(--line-hair) solid var(--border);
        color: var(--ink);
        font-size: var(--text-m);
        font-weight: 500;
        text-decoration: none;
    }
    .sheet-nav .nav-current a { font-weight: 700; }
    .sheet-nav .nav-current a::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: var(--line-band); background: var(--clay); }
    .sheet-foot {
        flex: 0 0 auto;
        display: flex;
        gap: var(--space-xs);
        padding: var(--space-xs) var(--space-s) var(--space-s);
        border-top: var(--line-hair) solid var(--border);
    }
    .sheet-close, .sheet-cta {
        flex: 1 1 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2xs);
        min-height: 56px;
        border-radius: var(--radius-pill);
        font: 600 var(--text-s) / 1 var(--sans);
        text-decoration: none;
        cursor: pointer;
    }
    .sheet-close { border: var(--line-control) solid var(--field); background: var(--white); color: var(--ink); }
    .sheet-close svg { width: 20px; height: 20px; }
    .sheet-cta { background: var(--moss); color: var(--white); }
    .sheet :is(a, button):focus-visible { outline: var(--focus-width) solid var(--focus-colour); outline-offset: calc(-1 * var(--focus-width)); }
    @keyframes sheet-down { from { transform: translateY(-100%); } }
    @keyframes sheet-fade { from { opacity: 0; } }
    @media (prefers-reduced-motion: no-preference) {
        .sheet[open] { animation: sheet-down var(--duration-base) var(--ease); }
        .sheet[open]::backdrop { animation: sheet-fade var(--duration-base) var(--ease); }
    }
}

/* 5. Hero (home splash): headline, diagram, scale buttons, the loom intro
   ------------------------------------------------------------------------- */
/* The hero fills the screen at every size; 130px clears the transparent fixed header */
.hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    gap: var(--space-xl);
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100svh;
    /* stylelint-disable-next-line declaration-property-value-disallowed-list -- clears the transparent header, not spacing */
    padding-top: 130px;
    padding-bottom: var(--section);
}
.hero-copy { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-m); }
.hero-title { margin: 0; font-weight: 400; font-size: var(--text-hero); line-height: var(--leading-tight); letter-spacing: -0.02em; text-wrap: balance; }
/* The subtitle sits on a plain paper patch that hugs the text, so the weave and contour lines don't run behind it */
.hero-lede {
    width: fit-content;
    max-width: 100%;
    margin: 0 0 0 calc(-1 * var(--space-xs));
    padding: var(--space-3xs) var(--space-xs);
    border-radius: var(--radius-m);
    background-color: var(--paper);
    font-size: var(--text-l);
    line-height: var(--leading-body);
    color: var(--body);
}
.hero .actions .btn { justify-content: center; }
/* "Get new posts by email": an outlined button on paper */
.hero .actions .arrow {
    min-height: var(--control-h);
    padding: 0 var(--space-m);
    border: var(--line-control) solid var(--moss);
    border-radius: var(--radius-pill);
    background-color: var(--paper);
    text-decoration: none transparent;
}
.hero .actions .arrow:hover { background-color: var(--moss); color: var(--white); }
/* Outlined buttons get the paper fill so the weave and contour lines don't show through */
.hero .btn-outline, .hero .pause { background-color: var(--paper); }
.hero .btn-outline:hover { background-color: var(--moss); }

/* Diagram */
.diagram { flex: 1 1 380px; margin: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-s); }
.diagram svg { width: 100%; max-width: 460px; height: auto; max-height: max(260px, calc(100svh - 330px)); overflow: visible; }
.ring { cursor: pointer; transition: opacity var(--duration-slow) var(--ease); }
.ring .stroke { transition: stroke-width var(--duration-slow) var(--ease); }
.diagram.has-focus .ring { opacity: 0.4; }
.diagram.has-focus .ring.is-on { opacity: 1; }
.ring.is-on .stroke { stroke-width: 4; }
.diagram-labels { pointer-events: none; }
.diagram-labels textPath { text-anchor: middle; }
.river { pointer-events: none; }

/* Bursts from Self play once on load (and again when a scale is tapped). --burst-to / --burst-time are set by
   theme.js replay(): a chosen ring keeps the burst inside it. Two identical keyframes so a replay restarts. */
@keyframes ripple-a { 0% { transform: scale(1); opacity: 0.55; } 75% { opacity: 0.3; } 100% { transform: scale(var(--burst-to, 9)); opacity: 0; } }
@keyframes ripple-b { 0% { transform: scale(1); opacity: 0.55; } 75% { opacity: 0.3; } 100% { transform: scale(var(--burst-to, 9)); opacity: 0; } }
.ripple {
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    pointer-events: none;
    animation: ripple-a var(--burst-time, 5s) cubic-bezier(0.2, 0.6, 0.3, 1) 1 both;
}
.ripple.is-again { animation-name: ripple-b; }
.diagram.is-offscreen .ripple { animation-play-state: paused; } /* class set by theme.js */

/* Scale buttons: one joined control */
.scale-buttons {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    border: var(--line-control) solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--paper);
}
.scale-btn {
    min-height: var(--control-h-s);
    padding: 0 var(--space-s);
    border: 0;
    border-radius: 0;
    background-color: var(--paper);
    color: var(--scale);
    font-family: var(--sans);
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.scale-btn + .scale-btn { box-shadow: inset 1.5px 0 0 var(--border); }
.scale-btn:hover { background: color-mix(in srgb, var(--scale) 10%, transparent); }
.scale-btn[aria-pressed="true"] { background: var(--scale); color: var(--white); box-shadow: none; }
.scale-btn:focus-visible { outline-offset: calc(-1 * var(--focus-width)); border-radius: var(--radius-pill); }

/* One link under the diagram to the detail below; it fades between scales (theme.js setLink) */
.diagram-link { display: flex; justify-content: center; align-items: center; min-height: var(--control-h); margin: var(--space-3xs) 0 0; }
.diagram-link .btn-outline { min-width: 240px; justify-content: center; }
.diagram-link .btn-outline.is-swapping { opacity: 0; }

/* Splash contour lines woven into the ground (theme.js initContours draws them on this canvas, behind the hero) */
.contours {
    position: absolute;
    left: 0;
    top: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity calc(2 * var(--duration-slow)) var(--ease) var(--duration-slow); /* a slow first fade-in */
}
.contours.is-on { opacity: 1; }

/* Headline in motion: the second line moves through each scale. All words share one grid cell, so the line never
   changes size. */
.weave-title .line { display: block; position: relative; width: fit-content; max-width: 100%; }
.weave-title .ink { display: block; }
.weft {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.06em;
    height: 4px;
    opacity: 0;
    transform-origin: 0 50%;
    pointer-events: none;
    background-color: var(--c);
    background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--white) 45%, transparent) 0 1px, transparent 1px 3px);
}
.words { display: inline-grid; justify-items: start; }
.word { grid-area: 1 / 1; color: var(--ink); opacity: 0; transition: opacity var(--duration-base) var(--ease); }
.word[data-scale="local"] { color: var(--clay); }
.word[data-scale="bio"] { color: var(--river); }
.word[data-scale="planet"] { color: var(--moss); }
.word.is-on { opacity: 1; }
.words-ctl { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-xs); color: var(--muted); }
.words-ctl[hidden] { display: none; }
.pause {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-h-s);
    height: var(--control-h-s);
    padding: 0;
    border: var(--line-control) solid var(--field);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}
.pause:hover { border-color: var(--ink); }
.pause .icon-play, .pause.is-paused .icon-pause { display: none; }
.pause.is-paused .icon-play { display: block; }
.shuttle { opacity: 0; pointer-events: none; offset-path: path("M70 250 C 120 215, 165 270, 220 256 S 330 205, 380 232"); offset-rotate: auto; }

/* Loom intro: first visit in a session only (intro is set inline in the hero partial). Weft threads pull each
   headline line through, the rings draw outward from Self, a shuttle carries the river; then Self bursts. */
@keyframes word-in { from { opacity: 0; transform: translateY(0.28em); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes wipe { from { clip-path: inset(-0.25em 100% -0.35em 0); } to { clip-path: inset(-0.25em 0 -0.35em 0); } }
@keyframes weft { 0% { transform: scaleX(0); opacity: 1; } 72% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes shuttle { 0% { offset-distance: 0%; opacity: 0; } 10% { opacity: 1; } 88% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
    .word.is-on { animation: word-in 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
    .intro .hero .stroke { stroke-dasharray: 1; animation: draw 0.85s cubic-bezier(0.55, 0.1, 0.3, 1) var(--d) both; }
    .intro .hero .river-draw { animation-duration: 1.15s; }
    .intro .hero :is(.fill, .fade) { animation: fadein 0.6s ease var(--d) both; }
    .intro .hero .rise { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) var(--d) both; }
    .intro .hero .ink { animation: wipe 0.8s cubic-bezier(0.6, 0.05, 0.35, 1) var(--d) both; }
    .intro .hero .weft { animation: weft 1.1s cubic-bezier(0.6, 0.05, 0.35, 1) var(--d) both; }
    .intro .hero .shuttle { animation: shuttle 1.15s cubic-bezier(0.45, 0, 0.4, 1) var(--d) both; }
    .intro .hero .ripple { animation-delay: 2.3s; } /* Self bursts once the loom is drawn */
}

/* Tablets and phones: one column that still fits one screen */
@media (max-width: 899px) {
    .hero { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: var(--space-m); padding-top: var(--space-3xl); }
    .hero-copy { flex: 0 0 auto; gap: var(--space-s); }
    .hero-lede { font-size: var(--text-s); }
    .hero .actions { gap: var(--space-3xs) var(--space-m); }
    .hero .diagram { flex: 0 0 auto; gap: var(--space-xs); }
    /* Fill what the copy leaves on screen, but never shrink so far that the labels can't be read */
    .hero .diagram svg { height: clamp(200px, calc(100svh - 580px), 380px); max-height: none; }
    .scale-buttons { display: grid; width: 100%; max-width: 420px; }
    .scale-btn { padding: 0 var(--space-2xs); }
    .diagram-link { margin-top: 0; }
    .diagram-link .btn-outline { min-height: var(--control-h-s); }
}
/* Tablets: make room for the pause row */
@media (min-width: 768px) and (max-width: 899px) {
    .hero:has(.words-ctl:not([hidden])) .diagram svg { height: clamp(190px, calc(100svh - 640px), 380px); }
}
/* Phones: the pause button is just the icon, tucked into the empty top-right corner beside "Weaving"; the hint
   stays for screen readers */
.phone-break { display: none; }
@media (max-width: 767px) {
    /* Headline, rings and scale buttons fill the first screen; the subtitle moves to its own band below (the intro
       band, after this); the hero's own buttons give way to the dock (Subscribe, and the arrow does "Learn more"). */
    /* The headline starts --space-s below the pinned header (about 23px to the top of "Weaving", with the line's own
       room). The rings' height still allows for the old --section gap, so the space saved goes to the scale link's
       clearance above the dock's Subscribe button rather than to bigger rings. */
    .hero { position: relative; gap: var(--space-s); padding-top: calc(var(--header-h) + var(--space-s)); }
    .hero-copy { display: contents; }
    .hero-title { order: 1; }
    .hero .diagram { order: 2; }
    .hero-lede, .hero .actions { display: none; }
    .hero .diagram svg { height: clamp(150px, calc(100svh - 456px - var(--section)), 340px); }
    .diagram-labels textPath { font-size: var(--text-s); } /* the rings are ~300px here: 16 units keeps the labels near 11px */ /* keeps the scale buttons and link clear of the dock; 150px when Safari's bars leave a short screen (iPhone SE) */
    .phone-break { display: inline; }
    .words-ctl { position: absolute; top: calc(var(--header-h) + var(--space-s)); right: var(--gutter); }
    .words-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .pause { border-color: var(--border); color: var(--muted); }
}
/* Phones: the hero's subtitle as its own band right under the splash (home.hbs), on sage with a woven moss edge top
   and bottom, its text set like the other bands'; the dock arrow's first stop, so a reader who taps through always meets it.
   From 768px the subtitle stays in the hero and this band is hidden. */
.intro-band { display: none; }
@media (max-width: 767px) {
    .intro-band { --edge: var(--moss); display: block; background-color: var(--sage); }
    .intro-band .wrap { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-m); padding-block: var(--space-xl); }
    .intro-band-text { margin: 0; max-width: 34em; font-size: var(--text-m); line-height: var(--leading-body); color: var(--body); } /* as the invite band's text */
}
/* Short phone screens (iPhone SE with Safari's bars: 547px): the scale link would sit behind the dock, so it gives
   way; the scale buttons above it do the same job, and the next-section arrow leads on to the scales */
@media (max-width: 767px) and (max-height: 600px) {
    .hero .diagram-link { display: none; }
    /* and the gap under the header narrows to 12px, so the 150px rings and the scale buttons still clear the dock */
    .hero { padding-top: calc(var(--header-h) + var(--space-xs)); }
    .words-ctl { top: calc(var(--header-h) + var(--space-xs)); }
}
/* Phones: stack the actions full width, primary filled, secondary outlined, same height */
@media (max-width: 599px) {
    .hero .actions { flex-direction: column; align-items: stretch; gap: var(--space-xs); }
    .hero .actions .btn { width: 100%; }
    .hero .actions .arrow { justify-content: center; }
}
@media (max-width: 359px) {
    .scale-btn { padding: 0 var(--space-3xs); }
}
@media (prefers-reduced-motion: reduce) {
    .ripple { animation: none; opacity: 0; }
}
@media (prefers-contrast: more) {
    .contours { display: none; }
}

/* 6. Buttons and links
   ------------------------------------------------------------------------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-m); }

/* Buttons ease in their colour and rise 1px with a soft shadow on hover */
.btn, .gh-button, .btn-outline, .scale-btn, .pause, .gh-icon-button, .hero .actions .arrow {
    transition: background-color var(--duration-base) var(--ease), color var(--duration-base) var(--ease), border-color var(--duration-base) var(--ease),
                box-shadow var(--duration-base) var(--ease), transform var(--duration-base) var(--ease), opacity var(--duration-fast) var(--ease);
}
.btn:hover, .gh-button:hover, .btn-outline:hover, .scale-btn:hover, .hero .actions .arrow:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-press);
}
.btn:active, .gh-button:active, .btn-outline:active, .scale-btn:active, .hero .actions .arrow:active {
    transform: translateY(0);
    box-shadow: none;
    transition-duration: calc(var(--duration-fast) / 2);
}
@media (prefers-reduced-motion: reduce) {
    .btn:hover, .gh-button:hover, .btn-outline:hover, .scale-btn:hover, .hero .actions .arrow:hover { transform: none; }
}

/* Filled pill */
.btn,
.gh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-height: var(--control-h);
    padding: 0 var(--space-m);
    border: 0;
    border-radius: var(--radius-pill);
    background-color: var(--moss);
    color: var(--white);
    font-family: var(--sans);
    font-size: var(--text-s);
    font-weight: 600;
    line-height: var(--leading-snug);
    text-decoration: none;
    cursor: pointer;
}
.btn:hover, .gh-button:hover { background-color: var(--moss-dark); color: var(--white); opacity: 1; }
.btn .icon { width: 18px; height: 18px; }
.btn.is-light { background: var(--paper); color: var(--ink); }
.btn.is-light:hover { background: var(--white); color: var(--ink); }
.gh-form, .gh-form-input { border-radius: var(--radius-pill); }

/* Outlined pill */
.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    min-height: var(--control-h);
    padding: 0 var(--space-m);
    border: var(--line-control) solid var(--moss);
    border-radius: var(--radius-pill);
    color: var(--moss);
    font-weight: 600;
    font-size: var(--text-s);
    text-decoration: none;
    white-space: nowrap;
}
.btn-outline:hover { background: var(--moss); color: var(--white); }

/* Text link with an arrow: the underline fades in rather than appearing */
.arrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: var(--space-xs) 0;
    color: var(--moss);
    font-size: var(--text-s);
    font-weight: 600;
    text-decoration: underline transparent;
    text-underline-offset: 4px;
    transition: color var(--duration-base) var(--ease), text-decoration-color var(--duration-base) var(--ease);
}
.arrow:hover { color: var(--ink); text-decoration-color: currentColor; }
.arrow span { transition: transform var(--duration-base) var(--ease); }
.arrow:hover span { transform: translateX(3px); }
.arrow.is-light { color: var(--paper); }
.arrow.is-light:hover { color: var(--white); }

/* 7. Cloth edges: woven bands and the fringe
   ------------------------------------------------------------------------- */
/* A narrow band of weft along the top and bottom of a piece of cloth, in --edge */
.scale-card, .subscribe-card, .intro-band { position: relative; overflow: hidden; }
.scale-card::before, .scale-card::after,
.subscribe-card::before, .subscribe-card::after,
.intro-band::before, .intro-band::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background-color: var(--edge);
    background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--white) 40%, transparent) 0 1px, transparent 1px 3px);
    pointer-events: none;
}
.scale-card::before, .subscribe-card::before, .intro-band::before { top: 0; }
.scale-card::after, .subscribe-card::after, .intro-band::after { bottom: 0; }

/* One fringe for the whole site: assets/images/fringe.svg (a 768px tile of threads 8px apart, random lengths
   10-34px) used as a mask, so each use only sets its colour (--fringe-colour) and size. Used by the invitation
   band (moss), the footer's cloth end (undyed) and the end of the essay rail (scaled to the rail's 3.25px warp). */
.fringe,
.gh-footer.footer::after,
.rail-fringe {
    background-color: var(--fringe-colour, var(--moss));
    -webkit-mask: url("../images/fringe.svg") repeat-x 0 0 / 768px 36px;
    mask: url("../images/fringe.svg") repeat-x 0 0 / 768px 36px;
}
.fringe { position: absolute; left: 0; right: 0; bottom: -35px; height: 36px; pointer-events: none; }

/* 8. Cards: nested scales, posts, events
   ------------------------------------------------------------------------- */
/* Nested scales: click a card's title (a toggle over the whole card) to highlight it, one at a time */
.scale-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-s); }
.scale-card {
    --edge: var(--scale);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-l) var(--space-m);
    background: var(--tint);
    border: var(--line-hair) solid var(--tint-border);
    border-radius: var(--radius-m);
    transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}
.scale-card:hover { border-color: var(--ink); }
/* Followed from the hero diagram, or the toggle focused: ring the card in its scale colour */
.scale-card:target,
.scale-card:has(.scale-toggle:focus-visible) { outline: var(--focus-width) solid var(--scale); outline-offset: var(--focus-offset); }
.scale-card.is-selected { border-color: var(--scale); box-shadow: inset 0 0 0 2px var(--scale), var(--shadow-lift); transform: translateY(-4px); }
.scale-label { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-xs); font-weight: 600; color: var(--scale); }
.scale-title { margin: 0; font-size: var(--text-2xl); font-weight: 600; line-height: var(--leading-snug); }
.scale-text { margin: 0; font-size: var(--text-s); line-height: var(--leading-body); color: var(--body); }
.desc ~ .fallback, .desc ~ .desc { display: none; } /* page excerpt, then tag description, then fallback */
.scale-toggle { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.scale-toggle::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius-m); }
.scale-toggle:focus-visible { outline: none; }
.scale-card:hover .scale-toggle { text-decoration: underline; text-decoration-color: var(--scale); text-decoration-thickness: 2px; text-underline-offset: 5px; }
/* Scale glyph: draw the highlighted ring on hover */
@keyframes glyph { 0% { opacity: 0.2; } 100% { opacity: 1; } }
.scale-card:hover .glyph-on { animation: glyph 0.6s ease; }
.section-next { display: flex; justify-content: center; }
@media (prefers-reduced-motion: reduce) {
    .scale-card.is-selected { transform: none; }
    .scale-card:hover .glyph-on { animation: none; }
}

/* Post cards (home, all posts, more posts): a white card with a woven band down the left edge in the post's
   scale colour, and a faint patch of the splash's contour thread fading out before the text */
.notes-label { margin: 0 0 var(--space-xs); font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.note-list { display: flex; flex-direction: column; gap: var(--space-s); }
.note {
    /* Posts without a scale tag get an undyed wool edge, so they don't echo the moss subscribe card */
    --edge: var(--scale, var(--undyed-dark));
    --tag-ink: var(--scale, var(--ink));
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-start;
    gap: var(--space-m);
    padding: var(--space-m) var(--space-m) var(--space-m) var(--space-l);
    background: var(--white);
    border: var(--line-hair) solid var(--border);
    border-radius: var(--radius-m);
    transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.note::before {
    content: "";
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -1px;
    width: 6px;
    border-radius: var(--radius-m) 0 0 var(--radius-m);
    background-color: var(--edge);
    background-image: repeating-linear-gradient(0deg, color-mix(in srgb, var(--white) 40%, transparent) 0 1px, transparent 1px 3px);
}
/* assets/images/contours-woven.png is the contour map already cut into weave floats (black = thread), used as a mask */
.note::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: var(--radius-m);
    pointer-events: none;
    background-color: var(--edge);
    opacity: 0.22;
    -webkit-mask-image: url("../images/contours-woven.png"), linear-gradient(to right, transparent 30%, var(--ink) 75%);
    mask-image: url("../images/contours-woven.png"), linear-gradient(to right, transparent 30%, var(--ink) 75%);
    -webkit-mask-size: 1280px 720px, 100% 100%;
    mask-size: 1280px 720px, 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: var(--patch, -420px -200px), 0 0;
    mask-position: var(--patch, -420px -200px), 0 0;
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
    transition: opacity var(--duration-base) var(--ease);
}
/* subtle-featured (note-row.hbs markFeatured=true): a featured post among ordinary cards stays a white card, with a
   moss title, a moss woven edge (and contour patch), and a "Featured" label so it isn't told by colour alone */
.note.subtle-featured { --edge: var(--moss); }
.note.subtle-featured .note-title a { color: var(--moss); }
.note-flag { font-weight: 700; color: var(--moss); }
.note-flag::after { content: "·"; margin-left: var(--space-2xs); font-weight: 500; color: var(--muted); } /* the tag's own dot stands where the separator would */
.subtle-featured .note-tag::before { background: var(--scale, var(--undyed-dark)); } /* the tag keeps its own colour */
/* each card gets a different stretch of the map */
.note-list > .note:nth-child(4n+1) { --patch: -560px -470px; }
.note-list > .note:nth-child(4n+2) { --patch: -120px -470px; }
.note-list > .note:nth-child(4n+3) { --patch: -620px -230px; }
.note-list > .note:nth-child(4n+4) { --patch: -260px -560px; }
.note:hover { border-color: var(--ink); box-shadow: var(--shadow-soft); }
.note:hover::after { opacity: 0.4; }
.note:has(.note-title a:focus-visible) { outline: var(--focus-width) solid var(--focus-colour); outline-offset: var(--focus-offset); }
.note-text { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2xs); }
.note-title { margin: 0; font-size: var(--text-xl); font-weight: 600; line-height: var(--leading-snug); }
.note-title a { color: var(--ink); text-decoration: none; }
.note-title a:focus-visible { outline: none; }
.note-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius-m); } /* the title link covers the card */
.note:hover .note-title a { text-decoration: underline; text-decoration-color: var(--edge); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.note-meta { order: -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2xs); margin: 0; font-size: var(--text-xs); color: var(--muted); }
.note-meta > :not(:first-child, .note-tag)::before { content: "·"; margin-right: var(--space-2xs); }
.note-tag { display: inline-flex; align-items: center; gap: var(--space-2xs); font-weight: 700; text-transform: capitalize; color: var(--tag-ink); }
.note-tag::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--edge); }
.note-excerpt {
    display: -webkit-box;
    overflow: hidden;
    max-width: 62ch;
    margin: 0;
    font-size: var(--text-s);
    line-height: var(--leading-body);
    color: var(--body);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.note-img { position: relative; z-index: 1; flex: 0 0 auto; display: block; width: 132px; aspect-ratio: 4 / 3; }
.note-img img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-s); }
/* Video posts: a round play mark on the thumbnail */
.play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40px;
    height: 40px;
    translate: -50% -50%; /* centred at any size (52px on the large card) */
    border-radius: 50%;
    background: color-mix(in srgb, var(--ink) 72%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M5 3.2v9.6L12.8 8z' fill='%23fff'/%3E%3C/svg%3E") 55% 50% / 16px 16px no-repeat;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--white) 85%, transparent);
    transition: transform var(--duration-fast) var(--ease);
}
.note:hover .play { transform: scale(1.08); }

/* Start here: the same card, larger, on moss tint */
.note.is-start {
    --edge: var(--moss);
    --tag-ink: var(--moss);
    --patch: -300px -170px;
    margin-bottom: var(--space-l);
    padding: var(--space-l);
    background: var(--sage);
    border-color: var(--sage-edge);
}
.note.is-start::before { width: 8px; }
.note.is-start::after { opacity: 0.28; }
.note.is-start:hover::after { opacity: 0.45; }
.note.is-start .note-title { font-size: var(--text-2xl); }
.note.is-start .note-tag { text-transform: none; }
.note.is-start .note-excerpt { font-family: var(--serif); font-style: italic; font-size: var(--text-l); color: var(--moss); -webkit-line-clamp: 3; }
.note.is-start .note-img { width: 200px; }
.note.is-start .play { width: 52px; height: 52px; background-size: 20px 20px; }

/* Phones: a small square thumbnail beside the text keeps the list short; Start here keeps a wide image on top */
@media (max-width: 560px) {
    .note { gap: var(--space-s); padding: var(--space-s) var(--space-s) var(--space-s) var(--space-m); }
    .note-img { width: 84px; aspect-ratio: 1; }
    .note-title { font-size: var(--text-l); }
    .note-excerpt { -webkit-line-clamp: 3; }
    .note.is-start { flex-direction: column; padding: var(--space-m); }
    .note.is-start .note-img { order: -1; width: 100%; aspect-ratio: 16 / 9; }
}
@media (prefers-contrast: more) {
    .note::after { display: none; }
}

/* Events ("Come along" on home, the events page): a date tile beside each event */
.event-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-s); }
.event-list[hidden], .event[hidden] { display: none; }
.event-link { display: flex; gap: var(--space-s); align-items: flex-start; color: var(--ink); text-decoration: none; }
.event-link:hover { color: var(--ink); }
.event-link:hover h3 { text-decoration: underline; text-decoration-color: var(--scale, var(--clay)); text-underline-offset: 4px; }
.event-body { display: flex; flex-direction: column; gap: var(--space-3xs); min-width: 0; }
.event-body h3 { margin: 0; font-family: var(--sans); font-variation-settings: normal; font-size: var(--text-m); font-size-adjust: 0.5; font-weight: 600; line-height: var(--leading-snug); }
.event-desc, .event-when { font-size: var(--text-xs); line-height: var(--leading-body); color: var(--body); }
.event-when { color: var(--muted); }
.event-scale { display: none; align-items: center; gap: var(--space-2xs); font-size: var(--text-xs); font-weight: 600; color: var(--scale); }
.event[data-tag] .event-scale { display: flex; }
.date-tile {
    flex: 0 0 62px;
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: var(--radius-m);
}
.date-mon { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--scale, var(--clay)); }
.date-day { font-family: var(--serif); font-size: var(--text-xl); font-weight: 600; line-height: var(--leading-tight); }
.date-tile.is-tbc .date-day { font-size: var(--text-s); }
/* The full list on the events page */
.event-list.is-full { gap: 0; }
.event-list.is-full .event-link { padding: var(--space-m) 0; border-bottom: var(--line-hair) solid var(--border); gap: var(--space-m); }
.event-list.is-full .date-tile { flex-basis: 72px; height: 80px; border: var(--line-hair) solid var(--border); }
.event-list.is-full .event-body h3 { font-family: var(--serif); font-variation-settings: "SOFT" 70, "WONK" 0; font-size: var(--text-xl); font-size-adjust: none; }
/* Past events are marked by the "Recently" heading and the plain date tile, not by fading the text (fading took the
   date line below 4.5:1) */
.event-list.is-past .date-tile { background: var(--paper); border: var(--line-hair) solid var(--border); }
.past { display: flex; flex-direction: column; gap: var(--space-2xs); margin-top: var(--space-l); }
.past[hidden] { display: none; }

/* 9. Invitation band (moss) and its photo gallery
   ------------------------------------------------------------------------- */
.invite { --focus-colour: var(--white); position: relative; overflow: hidden; background: var(--moss); color: var(--paper); }
.invite.fringed { overflow: visible; margin-bottom: var(--space-l); }
.invite-inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: var(--space-xl);
    padding-block: var(--section);
}
.invite-inner:not(:has(.gallery)) { grid-template-columns: 1fr; }
.invite-text { display: flex; flex-direction: column; gap: var(--space-m); }
.invite-copy { flex: none; display: flex; flex-direction: column; gap: var(--space-s); }
.invite-copy .h2 { color: var(--paper); }
.invite-copy p { margin: 0; max-width: 34em; font-size: var(--text-m); line-height: var(--leading-body); color: var(--on-moss); }
@media (max-width: 899px) {
    .invite-inner { grid-template-columns: 1fr; gap: var(--space-l); }
}

/* Gallery (gallery.hbs, theme.js initGallery): all photos share one grid cell and cross-fade; hidden ones are
   visibility: hidden so they aren't read out */
.gallery { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.gallery:focus-visible { outline: var(--focus-width) solid var(--white); outline-offset: calc(2 * var(--focus-offset)); border-radius: var(--radius-m); }
.gallery-track { display: grid; }
.slide {
    grid-area: 1 / 1;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-slow) var(--ease), visibility 0s step-end var(--duration-slow);
}
.slide.is-on { opacity: 1; visibility: visible; transition: opacity var(--duration-slow) var(--ease), visibility 0s step-end; }
.slide img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: 50% 30%; /* keeps faces in frame on the taller photos */
    border-radius: var(--radius-m);
    background: var(--moss-dark);
}
.slide figcaption { font-size: var(--text-xs); line-height: var(--leading-body); color: var(--on-moss); text-align: left; }
.gallery-ctl { display: flex; align-items: center; gap: var(--space-xs); }
.gallery-ctl[hidden] { display: none; }
.gallery-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-h-s);
    height: var(--control-h-s);
    padding: 0;
    border: var(--line-control) solid color-mix(in srgb, var(--white) 45%, transparent);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--white);
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
}
.gallery-btn:hover { border-color: var(--white); background: color-mix(in srgb, var(--white) 8%, transparent); }
.gallery-btn[data-gallery="pause"] { margin-right: auto; }
.gallery-btn .icon-play, .gallery-btn.is-paused .icon-pause { display: none; }
.gallery-btn.is-paused .icon-play { display: block; }
.gallery-count { min-width: 3.2em; text-align: center; font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--on-moss); }
@media (max-width: 899px) {
    .slide img { aspect-ratio: 3 / 2; }
}

/* 10. Subscribe card (subscribe-cta.hbs: home, About, events, posts): one button that opens Ghost's sign-up popup
   ------------------------------------------------------------------------- */
.subscribe { padding-block: var(--block); }
/* Before a band edge (the invitation band) or the footer's cloth end: the band-edge space */
.subscribe:has(+ .invite, + .gallery),
.subscribe:last-child { padding-bottom: var(--section); }
.subscribe-card {
    --edge: var(--moss);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-l);
    padding: var(--space-l) var(--space-m);
    background: var(--white);
    border: var(--line-hair) solid var(--border);
    border-radius: var(--radius-m);
}
.subscribe-copy { flex: 1 1 380px; display: flex; flex-direction: column; gap: var(--space-xs); }
.subscribe-copy p { margin: 0; font-size: var(--text-s); line-height: var(--leading-body); color: var(--body); }
.subscribe-action { flex: 0 0 auto; }
.subscribe-action .btn { min-height: var(--control-h); padding: 0 var(--space-l); }
/* Card padding steps rather than flowing through in-between values */
@media (min-width: 768px) {
    .subscribe-card { padding: var(--space-xl); }
}
@media (min-width: 1024px) {
    .subscribe-card { padding: var(--space-2xl) var(--space-xl); }
}
@media (max-width: 767px) {
    .subscribe-action { flex: 1 1 100%; }
    .subscribe-action .btn { width: 100%; justify-content: center; }
}

/* 11. Footer: on most pages it opens with the end of a piece of cloth, a narrow undyed band and its loose warp
   ends; on home the invitation band's fringe marks the boundary instead
   ------------------------------------------------------------------------- */
.gh-footer.footer { position: relative; margin: 0; padding: 0; background: transparent; color: var(--muted); border-top: 0; }
.footer a { color: inherit; text-decoration: none; }
.gh-footer.footer::before,
.gh-footer.footer::after { content: ""; position: absolute; left: 0; right: 0; pointer-events: none; }
.gh-footer.footer::before {
    top: 0;
    height: 4px;
    background-color: var(--undyed);
    background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--white) 40%, transparent) 0 1px, transparent 1px 3px);
}
.gh-footer.footer::after { --fringe-colour: var(--undyed); top: 3px; height: 36px; }
.fringed + .gh-footer.footer::before,
.fringed + .gh-footer.footer::after { display: none; }

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-l) var(--space-xl);
    justify-content: space-between;
    align-items: flex-start;
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-xl);
    font-size: var(--text-s);
}
/* Phones: the last line clears the dock (section 4: 56px tall, 16px off the bottom) */
@media (max-width: 767px) {
    /* stylelint-disable-next-line declaration-property-value-disallowed-list -- the dock's height, not spacing */
    .footer-inner { padding-bottom: calc(var(--space-xl) + 72px + env(safe-area-inset-bottom, 0px)); }
}
.fringed + .gh-footer.footer .footer-inner { padding-top: var(--space-xl); }
.footer-brand { flex: 1 1 260px; display: flex; flex-direction: column; gap: var(--space-2xs); }
.footer-name { font-family: var(--serif); font-variation-settings: "SOFT" 70; font-size: var(--text-l); font-weight: 600; color: var(--ink); }
.footer-tag { font-size: var(--text-xs); color: var(--muted); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-xl); }
.footer-nav > div { display: flex; flex-direction: column; }
.footer-head { padding-bottom: 2px; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.footer-nav a { padding: var(--space-xs) 0; color: var(--ink); text-decoration: none; }
.footer-nav a:hover { color: var(--moss); text-decoration: underline; }
.to-top { align-self: flex-end; }
.footer-small { flex-basis: 100%; margin: 0; font-size: var(--text-xs); color: var(--muted); }
.footer-small a { padding: 0; color: var(--ink); text-decoration: underline; }

/* 12. Content: post and page text (Source's .gh-content), the article header, Source's archive cards
   ------------------------------------------------------------------------- */
/* Long-form reading sits on plain paper; the weave stays in the margins. Reading measure: Alegreya Sans is narrow,
   so posts and pages use a 620px column with 20px text from tablets up (~74 characters a line); phones keep 18px.
   --content-width also places the paper column behind the text and the reading progress strip. */
.post-template, .page-template { --content-width: 620px; }
.post-template .gh-article,
.page-template .gh-article { position: relative; isolation: isolate; }
.post-template .gh-article::before,
.page-template .gh-article::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    z-index: -1;
    width: min(100%, calc(var(--content-width, 720px) + 48px));
    transform: translateX(-50%);
    background: var(--paper);
}

.article { position: relative; }
.gh-article .gh-article-header { margin-top: 0; margin-bottom: var(--space-xl); } /* the top comes from --page-top */
/* Breadcrumb as a thread: spaced capitals like the hero diagram's ring labels, joined by a short dotted thread like
   its river. "Posts" is muted; the tag is heavier, in its scale colour (ink without a scale), and underlined. */
.crumb { margin: 0 0 var(--space-2xs); } /* + the line's and title's own room: ~24px from crumb capitals to title */
.crumb ol { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; }
.crumb li { display: flex; flex: none; align-items: center; margin: 0; }
/* one line at any width: a long tag name is cut with an ellipsis rather than wrapping under the thread */
.crumb li:last-child { flex: 0 1 auto; min-width: 0; }
.crumb .crumb-tag span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.crumb li + li::before { /* the thread: round dots 6.5 apart, the hero river's dash pattern */
    content: "";
    flex: none;
    width: var(--space-m);
    height: var(--space-3xs);
    margin-inline: var(--space-2xs);
    background: radial-gradient(circle, var(--muted) 1.2px, transparent 1.6px) 0 50% / 6.5px 100% repeat-x;
    opacity: 0.7;
}
.crumb a {
    display: inline-flex;
    align-items: center;
    min-height: var(--space-m); /* 24: WCAG 2.5.8 target size */
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: var(--track-caps);
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: var(--line-rule);
    text-underline-offset: var(--underline-offset);
    transition: color var(--duration-fast) var(--ease), text-decoration-color var(--duration-fast) var(--ease);
}
.crumb a:hover { color: var(--ink); text-decoration-color: currentcolor; }
/* the current tag: heavier, in its scale colour, on a soft underline of the same dye that firms up on hover */
.crumb .crumb-tag { min-width: 0; font-weight: 800; color: var(--scale, var(--ink)); text-decoration-color: color-mix(in srgb, var(--scale, var(--ink)) 35%, transparent); }
.crumb .crumb-tag:hover { color: var(--scale, var(--ink)); text-decoration-color: currentcolor; }
/* phones: --control-h-s (44) tap targets, pulled back by their extra height so the line keeps its 24px place */
@media (max-width: 767px) {
    .crumb a { min-height: var(--control-h-s); margin-block: calc((var(--space-m) - var(--control-h-s)) / 2); }
}
.gh-article-title { font-size: var(--text-4xl); line-height: var(--leading-tight); letter-spacing: -0.02em; text-wrap: balance; }
.gh-article-excerpt {
    font-family: var(--serif);
    font-style: italic;
    font-variation-settings: "SOFT" 100, "WONK" 1;
    font-size: var(--text-m);
    line-height: var(--leading-body);
    color: var(--body);
}
/* The byline's author name is a paragraph, not an h4 (an h4 straight after the post's h1 skipped two levels) */
.gh-article-author-name { font-family: var(--sans); }
p.gh-article-author-name { margin: 0; line-height: var(--leading-snug); }
.gh-article-author-name a { display: inline-block; padding-block: var(--space-3xs); margin-block: calc(-1 * var(--space-3xs)); }
.gh-article-meta-content { font-size: var(--text-xs); }
.gh-article-image img { border-radius: var(--radius-m); }
@media (min-width: 768px) {
    .gh-article-excerpt { font-size: var(--text-l); }
}

.gh-content { --content-font-size: var(--text-m); font-family: var(--sans); color: var(--body); }
.gh-content > p, .gh-content > ul, .gh-content > ol { line-height: var(--leading-loose); }
.gh-content > p:empty { display: none; } /* an empty paragraph left at the end of a post would add a 28px gap */
.gh-content strong { color: var(--ink); }
.gh-content :is(h2, h3) { color: var(--ink); scroll-margin-top: 110px; }
/* Headings pasted from a doc arrive wrapped in <strong>/<b>, which pushed them to Alegreya's 900 Black. Bold inside a
   heading keeps the heading's own weight. */
.gh-content > :is(h2, h3, h4, h5, h6) :is(strong, b) { font-weight: inherit; }
.gh-content a { color: var(--moss); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--moss) 45%, transparent); }
.gh-content a:hover { color: var(--ink); text-decoration-color: currentColor; }
.gh-content > blockquote:not([class]),
.gh-content > blockquote.kg-blockquote-alt {
    margin-block: var(--space-l);
    padding: 0 0 0 var(--space-m);
    border-left: var(--line-band) solid var(--clay);
    font-family: var(--serif);
    font-style: italic;
    font-size: var(--text-2xl);
    line-height: var(--leading-snug);
    color: var(--moss);
    font-variation-settings: "SOFT" 100, "WONK" 1;
}
.gh-content > blockquote.kg-blockquote-alt { border-left: 0; padding: 0; text-align: center; }
.gh-content .kg-callout-card { border-radius: var(--radius-m); border-left: var(--line-band) solid var(--river); background: var(--river-tint); color: var(--ink); }
.gh-content :is(.kg-image-card, .kg-gallery-card) img { border-radius: var(--radius-m); }
.gh-content figcaption { color: var(--muted); font-size: var(--text-xs); }
@media (min-width: 768px) {
    .gh-content { --content-font-size: var(--text-l); }
}

/* Video posts: the embed full width at 16:9, its caption underneath */
.gh-video-post-embed { margin-top: var(--space-2xs); }
.gh-video-post-embed .kg-embed-card { margin: 0; height: auto; padding-bottom: 0; overflow: visible; background: none; border-radius: 0; }
.gh-video-post-embed iframe {
    position: static;
    inset: auto;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: var(--radius-m);
    background: var(--ink);
}
.gh-video-post-embed .kg-embed-card figcaption { margin-top: var(--space-xs); }

/* After the post: the reply line, then the subscribe card */
.article-end { margin: var(--block) 0 0; padding-bottom: 0; }
.reply { margin: 0; padding-top: var(--space-m); border-top: var(--line-hair) solid var(--border); font-size: var(--text-s); line-height: var(--leading-body); color: var(--body); }

/* Source's archive cards (tag and author pages) */
.gh-card-tag { display: inline-flex; align-items: center; gap: var(--space-2xs); color: var(--scale, var(--moss)); font-family: var(--sans); letter-spacing: 0; text-transform: none; font-weight: 600; }
.gh-card-title { font-family: var(--serif); font-size: var(--text-xl); line-height: var(--leading-snug); }
.gh-card-link:hover .gh-card-title { opacity: 1; text-decoration: underline; text-decoration-color: var(--clay); text-underline-offset: 4px; }
.gh-card-excerpt { font-size: var(--text-s); line-height: var(--leading-body); }
:is(.gh-card-featured-label, .gh-card-tag, .gh-card-meta, .gh-card-author, .gh-card-date) { font-size: var(--text-xs); }
.gh-card-image img { border-radius: var(--radius-m); }
.gh-container-title { font-family: var(--serif); font-weight: 400; font-size: var(--text-3xl); text-transform: none; letter-spacing: 0; }

/* 13. Essays: reading progress, the selvedge rail, the phones' "next section" button
   ------------------------------------------------------------------------- */
/* Reading progress (posts only): a woven moss strip just outside the right edge of the essay's paper column. It runs
   the height of the article and stays in view while you read (the track is sticky); it fills as you read and keeps
   the furthest point reached, so scrolling back up doesn't empty it (theme.js initProgress). */
.progress {
    position: absolute;
    top: 0;
    bottom: 0;
    left: min(calc(50% + (var(--content-width, 720px) + 48px) / 2 + 12px), calc(100% - 12px));
    z-index: 1;
    width: 6px;
    pointer-events: none;
}
.progress-track {
    position: sticky;
    top: 100px;
    height: calc(100vh - 160px);
    overflow: hidden;
    border-radius: var(--radius-s);
    background: color-mix(in srgb, var(--moss) 12%, transparent);
}
.progress span {
    display: block;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(0deg, color-mix(in srgb, var(--white) 35%, transparent) 0 1px, transparent 1px 3px),
        linear-gradient(var(--moss), var(--moss));
    transform: scaleY(var(--read, 0));
    transform-origin: 50% 0;
    transition: transform var(--duration-fast) linear;
}
@media (max-width: 767px) {
    .progress { width: 4px; left: calc(100% - 10px); }
}

/* The selvedge rail (wide screens, built by theme.js initToc from the post's h2s): each section a length of warp that
   is woven in as you read. Where it shows it is the progress marker, so the right-hand strip hides. */
.rail { display: none; }
@media (min-width: 1200px) {
    .rail {
        display: block;
        grid-column: wide-start / main-start;
        grid-row: 1 / span 400;
        align-self: start;
        justify-self: end;
        position: sticky;
        top: 120px;
        width: 220px;
        margin: 0 var(--space-l) 0 0;
        font-size: var(--text-xs);
        /* Its own scroll area when taller than the screen (theme.js follow): the wheel over it scrolls only the rail.
           The edges fade where there is more to scroll to. 2px leaves room for the scrollbar. */
        max-height: calc(100vh - 152px);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: color-mix(in srgb, var(--moss) 35%, transparent) transparent;
        padding-right: 2px;
    }
    .rail.can-down { -webkit-mask-image: linear-gradient(var(--ink) calc(100% - 48px), transparent); mask-image: linear-gradient(var(--ink) calc(100% - 48px), transparent); }
    .rail.can-up { -webkit-mask-image: linear-gradient(transparent, var(--ink) 48px); mask-image: linear-gradient(transparent, var(--ink) 48px); }
    .rail.can-up.can-down { -webkit-mask-image: linear-gradient(transparent, var(--ink) 48px, var(--ink) calc(100% - 48px), transparent); mask-image: linear-gradient(transparent, var(--ink) 48px, var(--ink) calc(100% - 48px), transparent); }
    .rail ol { margin: 0; padding: 0; list-style: none; }
    .rail li { display: grid; grid-template-columns: 1fr 14px; gap: var(--space-s); min-height: 76px; margin: 0; padding: 0; font-size: var(--text-xs); line-height: var(--leading-snug); }
    .rail li + li { margin-top: var(--space-2xs); }
    .rail a { padding: 2px 0 var(--space-xs); text-align: right; color: var(--muted); text-decoration: none; }
    .rail a:hover { color: var(--ink); text-decoration: underline; }
    .rail li.is-current a { color: var(--ink); font-weight: 600; }
    .warp {
        position: relative;
        display: block;
        background-color: var(--undyed-light);
        background-image: repeating-linear-gradient(90deg, var(--undyed) 0 1px, transparent 1px 3.25px);
    }
    .cloth {
        --weft-2: color-mix(in srgb, var(--weft), var(--white) 12%); /* every other pick a shade lighter */
        position: absolute;
        inset: 0;
        transform: scaleY(0);
        transform-origin: 50% 0;
        transition: transform var(--duration-fast) linear;
        background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--white) 28%, transparent) 0 1px, transparent 1px 3.25px),
            repeating-linear-gradient(0deg, var(--weft) 0 3px, var(--weft-2) 3px 6px);
    }
    .rail .is-moss { --weft: var(--moss); }
    .rail .is-river { --weft: var(--river); }
    .rail .is-clay { --weft: var(--clay); }
    .rail .is-ochre { --weft: var(--ochre); }
    .rail-end {
        display: grid;
        grid-template-columns: 1fr 14px;
        gap: var(--space-s);
        margin: 0;
        font-size: var(--text-xs);
        text-align: right;
        color: var(--undyed);
        transition: color var(--duration-base) var(--ease);
    }
    .rail.is-done .rail-end { color: var(--undyed-dark); }
    .rail-fringe {
        --fringe-colour: currentColor;
        display: block;
        grid-column: 2;
        width: 14px;
        height: 36px;
        /* 8px thread spacing scaled to the warp's 3.25px; drawn twice, 0.4px apart, so the narrowed threads keep ~1px width */
        -webkit-mask: url("../images/fringe.svg") -1px 0 / 312px 36px repeat-x, url("../images/fringe.svg") -0.6px 0 / 312px 36px repeat-x;
        mask: url("../images/fringe.svg") -1px 0 / 312px 36px repeat-x, url("../images/fringe.svg") -0.6px 0 / 312px 36px repeat-x;
    }
    .article:has(.rail) .progress { display: none; }
}

/* Phones: the round "next section" button (theme.js initSkip) sits in the dock (section 4); it steps down through
   the page's sections and points up at the end (back to top) */
.skipnext { display: none; }
@media (max-width: 767px) {
    .skipnext { transition: background-color var(--duration-fast) var(--ease); }
    .skipnext-label { display: none; } /* arrow only; the button's aria-label names the destination */
    .skipnext svg { width: 22px; height: 22px; transition: transform var(--duration-fast) var(--ease); }
    .skipnext.is-top svg { transform: rotate(180deg); }
}

/* 14. Pages
   ------------------------------------------------------------------------- */
/* Home: About the author, between the nested scales and Latest posts */
.about-author {
    display: grid;
    grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-l) var(--space-2xl);
    padding-top: var(--section);
    padding-bottom: 0;
}
.about-author-photo { max-width: 340px; margin: 0; }
.about-author-photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-m); box-shadow: var(--shadow-soft); }
.about-author-text { display: flex; flex-direction: column; gap: var(--space-s); max-width: 620px; }
.about-author-text > p:not(.eyebrow) { margin: 0; font-size: var(--text-m); line-height: var(--leading-body); color: var(--body); }
.about-author-text .actions { margin-top: var(--space-2xs); }
@media (max-width: 767px) {
    .about-author { grid-template-columns: 1fr; gap: var(--space-m); }
    .about-author-photo { max-width: 240px; }
}

/* Home: Latest posts beside "Come along" (the events column sits straight on the woven ground) */
.latest { display: flex; flex-wrap: wrap; gap: var(--space-l) var(--space-xl); padding-top: var(--block); padding-bottom: 0; }
.latest-list { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.latest-list .all-writing { align-self: flex-start; padding-top: var(--space-m); }
.events-aside { flex: 1 1 340px; align-self: flex-start; display: flex; flex-direction: column; gap: var(--space-s); padding: 0; border: 0; border-radius: var(--radius-m); }
.events-aside .h2 { font-size: var(--text-2xl); }
.events-empty { margin: 0; font-size: var(--text-s); color: var(--body); }
.events-img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 30% 30%; border-radius: var(--radius-s); }
.events-all { align-self: flex-start; }

/* Post page: "More posts" as home's post cards (replacing Source's related-post grid) */
.more-posts { padding-bottom: var(--space-3xl); }
.more-posts .latest-head { margin-bottom: var(--space-m); }
@media (max-width: 767px) {
    .more-posts { padding-bottom: var(--space-2xl); }
}

/* About: intro header in the home page's style, closed by the ink rule; real section headings; the rail */
.about-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 400px);
    align-items: start; /* the title starts level with the portrait's top, not centred against it */
    gap: var(--space-m) var(--space-2xl);
    padding-bottom: 0;
}
.about-intro::after { content: ""; grid-column: 1 / -1; height: var(--line-rule); background: var(--ink); }
.about-copy { flex: 999 1 420px; display: flex; flex-direction: column; gap: var(--space-m); max-width: 640px; }
.about-copy .section-lede { font-size: var(--text-l); }
.about-copy .note.is-start { margin-bottom: 0; }
.about-portrait { margin: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.about-portrait img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-m); box-shadow: var(--shadow-soft); }
.about-portrait figcaption { font-size: var(--text-xs); color: var(--muted); }
.about .gh-article { margin-bottom: 0; padding-top: var(--space-l); }
.about .gh-content:only-child > :first-child:not(.kg-width-full) { margin-top: 0; }
.about .gh-content > h2 {
    padding-top: var(--space-m);
    border-top: var(--line-hair) solid var(--border);
    font-size: var(--text-3xl);
    line-height: var(--leading-tight);
}
.about .gh-content > h2:first-child { margin-top: 0; }
/* Subheadings (made by theme.js from bold one-line paragraphs); scale names get a woven band in their colour */
.about .gh-content > .subhead {
    position: relative;
    margin-top: 1.6em;
    margin-bottom: -0.4em;
    font-family: var(--gh-font-heading, serif);
    font-size: var(--text-xl);
    line-height: var(--leading-snug);
    color: var(--ink);
}
.about .gh-content > .subhead[data-tag] { padding-left: var(--space-s); }
.about .gh-content > .subhead[data-tag]::before {
    content: "";
    position: absolute;
    top: 0.1em;
    bottom: 0.1em;
    left: 0;
    width: 6px;
    border-radius: var(--radius-s);
    background-color: var(--scale);
    background-image: repeating-linear-gradient(0deg, color-mix(in srgb, var(--white) 40%, transparent) 0 1px, transparent 1px 3px);
}
@media (max-width: 767px) {
    .about-intro { grid-template-columns: 1fr; gap: var(--space-m); }
    .about-portrait { order: -1; }
    .about-portrait img { aspect-ratio: 3 / 2; object-position: 50% 30%; }
    .about-copy .section-lede { font-size: var(--text-m); }
}

/* Events page: contact buttons in the page head, then the list */
.events-contact { gap: var(--space-xs) var(--space-m); margin-top: var(--space-3xs); }
.events-contact .btn-outline svg { flex: none; width: 18px; height: 18px; }
.events-body { display: flex; flex-direction: column; gap: var(--space-m); padding-bottom: 0; }

/* All posts (posts.hbs, route /posts/): the heading and the list as one centred 820px column */
.posts-page .masthead { justify-content: center; }
.posts-page .masthead-copy { flex: 0 1 820px; }
.posts-body { padding-bottom: var(--section); }
.posts-body .note-list,
.posts-body > p { max-width: 820px; margin-inline: auto; }
.posts-body > p { margin-top: var(--space-m); }

/* Tag and author archives: the scale's band under a tag's heading; Source's archive spacing on the scale */
.archive-kicker { display: flex; align-items: center; gap: var(--space-xs); margin: 0 0 var(--space-xs); font-size: var(--text-xs); font-weight: 600; color: var(--scale, var(--muted)); }
.archive-kicker:not(:has(svg)) { gap: 0; }
.archive-head[data-tag] .gh-article-title { color: var(--ink); }
.archive-head:is(.is-local, .is-bioregional, .is-planetary, .is-finance) { border-bottom: var(--line-band) solid var(--scale); padding-bottom: var(--space-l); }
.gh-archive { margin-block: 0; }
.gh-archive-inner { padding-bottom: var(--space-m); }
.gh-archive + .gh-container,
.gh-archive + .gh-container .gh-container-inner { padding-top: 0; margin-top: 0; }
.gh-archive + .gh-container .gh-main { padding-top: 0; }
.gh-archive + .gh-container .gh-feed { padding-top: var(--space-l); }

/* Page not found */
.lost { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-l) var(--space-2xl); padding-bottom: var(--space-3xl); }
.lost svg { flex: 0 1 300px; width: 100%; max-width: 300px; height: auto; }
.lost-copy { flex: 1 1 360px; display: flex; flex-direction: column; gap: var(--space-s); }
.lost-code { margin: 0; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; color: var(--clay); }
.lost-copy p { margin: 0; font-size: var(--text-m); line-height: var(--leading-body); color: var(--body); }
@keyframes unravel { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: no-preference) {
    .lost-strand { stroke-dasharray: 900; stroke-dashoffset: 900; animation: unravel 2.4s ease-out 0.2s forwards; }
}

/* 15. Motion, contrast, print: what can't be expressed through the tokens
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .has-js .reveal, .has-js .reveal:not(.is-in) { opacity: 1; transform: none; }
}
@media (prefers-contrast: more) {
    body { background-image: none; }
}
@media print {
    body { background-image: none; }
    .progress, .rail, .fringe, .skipnext { display: none; }
}
