/* ─────────────────────────────────────────────────────────────────────────
   Aubergine Atelier — second edition.

   Deep aubergine ink, lilac haze, one signal orange. The palette below is the
   theme's identity and is pinned by tests/AubergineThemeTest.php: do not change
   a hex. Orange is a rule, a fill and a chip; as text on paper it measures
   3.56:1 and fails AA, so orange never carries a sentence.

   No webfonts and no icon CDN: the CSP is `default-src 'self'` and the
   deployment must work offline. Icons are inline SVG symbols; type is a system
   serif + sans stack.
   ───────────────────────────────────────────────────────────────────────── */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
    /* Brand palette — pinned */
    --surface: #fcf8ff;
    --canvas: #ffffff;
    --on-surface: #1b1831;
    --muted: #57526e;
    --primary: #231753;
    --primary-hover: #392e6a;
    --secondary: #634db4;
    --accent: #ea580c;
    --border: #e6e1f2;
    --border-strong: #d6cdea;
    --border-soft: #eee9f9;
    /* DESIGN-1's own outline: the one palette value that reaches 3:1 on the
       page ground, so it is the only colour allowed to draw a control edge. */
    --outline: #797580;
    --accent-soft: #fff2e9;
    --violet-050: #f7f3ff;
    --violet-100: #efe8ff;
    --danger: #ba1a1a;
    --danger-soft: #ffdad6;

    /* Lilac tints for dividers and quiet numerals */
    --violet-200: #ded4f7;
    --violet-300: #cbbcf2;

    /* Footer band, header surface — pinned */
    --footer-bg: #231753;
    --footer-ink: #f4eeff;
    --footer-accent: #ea580c;
    --header-bg: rgba(252, 248, 255, 0.82);
    --header-line: rgba(35, 23, 83, 0.10);

    /* Ink on the dark band that is not orange: 12.48:1 */
    --footer-link: #e9dfff;

    /* Surfaces and depth */
    --page-bg: #fbf9ff;
    --radius-sm: 0.5rem;
    --radius: 0.9rem;
    --radius-lg: 1.25rem;
    --radius-pill: 999px;
    --shadow-1: 0 1px 2px rgba(28, 18, 64, 0.04), 0 14px 34px -26px rgba(28, 18, 64, 0.55);
    --shadow-2: 0 2px 4px rgba(28, 18, 64, 0.05), 0 28px 56px -32px rgba(28, 18, 64, 0.50);

    /* Type — system display serif + system sans body */
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-head: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* Rhythm — measure is pinned at 66ch */
    --measure: 66ch;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dur: 180ms;

    /* Pinned by PublicNavigationTest: header and article share this column */
    --content-max: 1140px;
    --content-pad: 1.5rem;
    --header-h: 4rem;
}

/* ── 2. Reset and base ─────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

html {
    /* The viewport scrollbar is theme furniture, not a browser default. */
    scrollbar-color: var(--violet-300) var(--violet-050);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.65;
    color: var(--on-surface);
    background-color: var(--page-bg);
    background-image:
        radial-gradient(58rem 30rem at 108% -8%, rgba(99, 77, 180, 0.09), transparent 62%),
        radial-gradient(40rem 24rem at -8% 2%, rgba(234, 88, 12, 0.045), transparent 60%);
    background-repeat: no-repeat;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
    margin: 0 0 0.5em;
    font-family: var(--font-head);
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -0.02em;
    color: var(--on-surface);
    text-wrap: balance;
}

p {
    margin: 0 0 1rem;
    text-wrap: pretty;
}

a {
    color: var(--secondary);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color 140ms var(--ease);
}

a:hover,
a:focus { color: var(--primary); }

img { max-width: 100%; height: auto; }

::selection {
    background: var(--violet-100);
    color: var(--primary);
}

/* No border-radius here: a focus ring follows the element's own shape.
   A radius declared on :focus-visible reshaped pills and cards mid-focus. */
:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 3px;
}

[id] { scroll-margin-top: calc(var(--header-h) + 1.25rem); }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 40;
    padding: 0.6rem 1rem;
    background: var(--primary);
    color: var(--canvas);
    border-radius: 0 0 var(--radius-sm) 0;
    text-decoration: none;
}

.skip-link:focus {
    left: 0;
    color: var(--canvas);
}

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

/* The inline <symbol> sprite. It must stay in the layout box: display:none
   breaks <use> in some engines. */
.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ── 3. Shell ──────────────────────────────────────────────────────────── */
.layout {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 1.35rem var(--content-pad) 3.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.25rem;
    flex: 1 0 auto;
}

.main {
    min-width: 0;
    order: 1;
}

.sidebar {
    min-width: 0;
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 0;
    font-size: 0.9375rem;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.sidebar--rail { order: 2; }

@media (min-width: 1024px) {
    /* One rail, on the right: the article keeps the first track and the rail
       takes a fixed second track, so the reading column never shifts left.
       This rule is the exact string PublicSidebarTest pins. */
    .layout:has(.sidebar--rail) { grid-template-columns: minmax(0, 1fr) 300px; }

    .sidebar--rail {
        position: sticky;
        top: calc(var(--header-h) + 1.25rem);
        align-self: start;
    }
}

/* ── 4. Header ─────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    backdrop-filter: blur(18px) saturate(1.25);
    -webkit-backdrop-filter: blur(18px) saturate(1.25);
    border-bottom: 1px solid var(--header-line);
    /* Contact shadow + soft ambient falloff: the bar reads as a raised plane
       without a hard drop shadow. */
    box-shadow:
        0 1px 2px rgba(35, 23, 83, 0.06),
        0 10px 24px -18px rgba(35, 23, 83, 0.55);
}

.header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0.85rem var(--content-pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    min-height: var(--header-h);
}

.site-title {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    max-width: 30rem;
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--on-surface);
    text-decoration: none;
}

/* Brand tile: a violet-to-indigo square with one diagonal highlight. Pure CSS,
   so it needs no asset and cannot 404. */
.site-title::before {
    content: "";
    width: 2rem;
    height: 2rem;
    flex: none;
    border-radius: 0.62rem;
    background:
        linear-gradient(135deg, transparent 43%, rgba(255, 255, 255, 0.92) 43% 57%, transparent 57%),
        linear-gradient(140deg, var(--primary) 0%, var(--secondary) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 18px -10px rgba(35, 23, 83, 0.9);
}

.site-title:hover,
.site-title:focus { color: var(--primary); }

.site-nav {
    margin-left: auto;
    min-width: 0;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
}

.site-nav li { position: relative; }

.site-nav a {
    display: inline-block;
    padding: 0.45rem 0.8rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--on-surface);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    border-radius: 999px;
    transition: color 150ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease);
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--primary);
    background: var(--violet-050);
    border-bottom-color: var(--accent);
}

.site-nav ul ul {
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.35rem 0 0.2rem 0.85rem;
    border-left: 2px solid var(--header-line);
}

.site-nav ul ul a {
    font-size: 0.8375rem;
    font-weight: 500;
    color: var(--muted);
}

@media (min-width: 1024px) {
    .site-nav ul ul {
        position: absolute;
        top: calc(100% + 0.6rem);
        right: 0;
        min-width: 13.5rem;
        margin: 0;
        padding: 0.5rem;
        gap: 0.1rem;
        background: var(--canvas);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-2);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
        transition: opacity 150ms var(--ease), transform 150ms var(--ease), visibility 150ms;
        z-index: 30;
    }

    .site-nav li:hover > ul,
    .site-nav li:focus-within > ul {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .site-nav ul ul a {
        display: block;
        width: 100%;
        border-radius: var(--radius-sm);
        border-bottom-color: transparent;
    }
}

/* Below the rail breakpoint the menu takes its own row, left-aligned under the
   brand, with a hairline that makes the second row deliberate. */
@media (max-width: 1023px) {
    .header-inner { padding: 0.7rem var(--content-pad); gap: 0.15rem 1rem; }
    .site-nav {
        margin-left: 0;
        width: 100%;
        border-top: 1px solid var(--border);
        padding-top: 0.35rem;
    }
    .site-nav ul { justify-content: flex-start; gap: 0.15rem; }
    .site-nav ul ul {
        align-items: flex-start;
        border-left: 0;
        border-right: 0;
        padding: 0.3rem 0 0.2rem 0.85rem;
        border-left: 2px solid var(--header-line);
    }
}

@media (pointer: coarse) {
    .site-nav a { min-height: 2.75rem; display: inline-flex; align-items: center; }
}

/* ── 5. Announcement ───────────────────────────────────────────────────── */
.announcement {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem max(var(--content-pad), calc((100% - var(--content-max)) / 2));
    background: linear-gradient(90deg, var(--accent-soft) 0%, var(--violet-050) 65%);
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.9rem;
    color: var(--on-surface);
}

.announcement::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    flex: none;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.12);
}

/* ── 6. Masthead and hero ──────────────────────────────────────────────── */
.masthead {
    /* The opening is the page's one display moment: it gets the air to read
       as one, and the stream below keeps its tighter rhythm. */
    /* 1.1rem under the band matches the band's own 1.1rem above the counts, so
       the strip sits centred between its two hairlines. */
    padding: 3.25rem 0 1.1rem;
    margin: 0 0 1.75rem;
    border-bottom: 1px solid var(--border);
}

.masthead__title {
    margin: 0 0 0.7rem;
    /* DESIGN.md's Display role: 2.4-3.5rem, line-height 1.03, -0.035em, 22ch.
       The theme used to stop at 3.2rem, five pixels under its own ceiling. */
    max-width: 22ch;
    font-size: clamp(2.4rem, 5vw, 3.5rem);
    line-height: 1.03;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.masthead__lead {
    max-width: 52ch;
    margin: 0;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--muted);
}

.masthead__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.75rem;
    margin: 1.5rem 0 0;
    padding: 1.1rem 0 0;
    border-top: 1px solid var(--border);
}

/* A hairline between the pairs, so the band reads as a dateline strip rather
   than two words that happen to sit near each other. */
.masthead__stat + .masthead__stat {
    padding-left: 1.75rem;
    border-left: 1px solid var(--border);
}

.masthead__stat {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0;
}

.masthead__stat dt {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.masthead__stat dd {
    margin: 0;
    font-family: var(--font-head);
    font-size: 1.0625rem;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.hero {
    padding: 2rem 0 1.75rem;
    margin: 0 0 1.75rem;
    border-bottom: 1px solid var(--border);
    background-image: radial-gradient(30rem 11rem at 4% 0%, rgba(99, 77, 180, 0.16), transparent 70%);
    background-repeat: no-repeat;
}

.hero h1 {
    margin: 0 0 0.85rem;
    max-width: 22ch;
    font-size: clamp(2.4rem, 5vw, 3.5rem);
    line-height: 1.03;
    letter-spacing: -0.035em;
}

.hero p {
    margin: 0;
    max-width: 56ch;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--muted);
}

/* ── 7. Index: stream and cards ────────────────────────────────────────── */
.page-stream {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.15rem;
    align-items: stretch;
}

.page-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.45rem;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color 220ms var(--ease);
}

/* The signature: a violet-to-orange hairline that wakes up on hover. */
.page-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(90deg, var(--primary), var(--secondary) 55%, var(--accent));
    opacity: 0;
    transition: opacity 220ms var(--ease);
}

.page-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-2);
}

.page-card:hover::before { opacity: 1; }

/* The first entry is the lead: it spans the stream and carries larger type. */
.page-card:first-child {
    grid-column: 1 / -1;
    padding: 1.75rem 1.85rem;
}

.page-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 1.35rem;
}

.page-card__index {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    word-spacing: 0.2em;
}

.page-card__date {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.page-card__title {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    /* A title can be one long token (a code, a compound noun). Without this a
       single unbroken word pushes the card wider than its grid track and the
       whole page scrolls sideways on a phone. */
    overflow-wrap: anywhere;
}

.page-card:first-child .page-card__title {
    max-width: 26ch;
    font-size: clamp(1.6rem, 3vw, 2.15rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.page-card__title a {
    color: var(--on-surface);
    text-decoration: none;
}

/* One link per card covers the whole card: no duplicate tab stops. */
.page-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
}

.page-card__title a:hover { color: var(--primary); }

.page-card__title a:focus-visible { outline: none; }

.page-card__title a:focus-visible::after {
    outline: 2px solid var(--secondary);
    outline-offset: 3px;
}

.page-card__summary {
    max-width: 58ch;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.page-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.page-card__tag {
    padding: 0.16rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--violet-050);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.page-card__more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--secondary);
}

.page-card__more .icon { transition: transform 180ms var(--ease); }

.page-card:hover .page-card__more .icon { transform: translate(3px, -1px); }

/* Featured is a styling modifier only. The lead is the first entry
   (`:first-child`, full width with larger type); a featured page always sorts
   first, so it always lands on that lead. A track-spanning rule used to live
   here and could never apply: `:first-child` outranks it and sets 1 / -1. */
.page-card--featured {
    background: linear-gradient(135deg, #ffffff 0%, var(--violet-050) 55%, #f4ecff 100%);
    border-color: var(--border-strong);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border: 1px solid rgba(234, 88, 12, 0.25);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: #b4450a;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.empty-state {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0;
    padding: 2.25rem 1.75rem;
    background: var(--canvas);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--muted);
}

.empty-state p { margin: 0; }

.empty-state__icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--secondary);
}

/* ── 8. Article ────────────────────────────────────────────────────────── */
.page-content { max-width: var(--measure); }

.article-head {
    margin: 0 0 1.9rem;
    padding: 0 0 1.3rem;
    border-bottom: 1px solid var(--border);
}

/* The reading time is a fact about the page, so it sits under the heading
   with the other facts, not above it as a label. */
.article-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.7rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--muted);
}

.article-meta .icon {
    width: 0.9rem;
    height: 0.9rem;
}

.page-content h1 {
    margin: 0;
    font-size: clamp(2.05rem, 4vw, 2.9rem);
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
}

.page-content h2 {
    margin: 2.4rem 0 0.8rem;
    font-size: clamp(1.4rem, 2.4vw, 1.75rem);
}

.page-content h3 {
    margin: 1.85rem 0 0.55rem;
    font-size: 1.25rem;
}

.page-content > p:not(.page-meta),
.page-content li {
    font-size: 1.125rem;
    line-height: 1.7;
}

.page-content > p:not(.page-meta) { margin: 0 0 1.25rem; }

/* A true lede: only when the body opens with a paragraph. */
.page-content > .article-head + p {
    font-size: 1.15rem;
    line-height: 1.65;
    color: var(--muted);
}

/* A violet drop cap on that opening paragraph. */
.page-content > .article-head + p::first-letter {
    float: left;
    padding: 0.06em 0.12em 0 0;
    font-family: var(--font-head);
    font-size: 3.3em;
    line-height: 0.84;
    color: var(--primary);
}

.page-content a {
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.page-content ul,
.page-content ol {
    margin: 0 0 1.2rem;
    padding-left: 1.35rem;
}

.page-content li + li { margin-top: 0.35rem; }

.page-content li::marker { color: var(--secondary); }

.page-content hr {
    margin: 2.75rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.page-content img { border-radius: var(--radius); }

.page-content figure { margin: 1.9rem 0; }

.page-content figcaption {
    margin-top: 0.55rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--muted);
}

.page-content table {
    width: 100%;
    margin: 1.6rem 0;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.page-content caption {
    margin-bottom: 0.55rem;
    font-size: 0.8125rem;
    text-align: left;
    color: var(--muted);
}

.page-content th {
    padding: 0.62rem 0.75rem;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
    color: var(--muted);
    background: var(--violet-050);
    border-bottom: 1px solid var(--border);
}

.page-content td {
    padding: 0.62rem 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.page-content tbody tr:hover { background: var(--surface); }

.page-content pre {
    margin: 1.5rem 0;
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    background: #1b1436;
    color: #efeaff;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.page-content code {
    padding: 0.1em 0.35em;
    background: var(--violet-050);
    border: 1px solid var(--border-soft);
    border-radius: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.875em;
}

.page-content pre code {
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font-size: inherit;
}

/* Pull quote: the orange rule and the lilac ground are the theme's voice. */
.page-content blockquote {
    margin: 1.9rem 0;
    padding: 1rem 1.3rem;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--violet-050);
    font-family: var(--font-head);
    font-size: 1.0625rem;
    line-height: 1.55;
}

.page-content blockquote p { margin: 0 0 0.55rem; }
.page-content blockquote p:last-child { margin: 0; }

.page-content cite {
    display: block;
    margin-top: 0.35rem;
    font-family: var(--font-head);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--muted);
}

/* The publication date sits after the body by contract; dress it as a footer
   rail for the article instead of a stray grey line. */
.page-meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 2.5rem 0 0;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.page-meta::before {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    flex: none;
    border-radius: 50%;
    background: var(--accent);
}

/* ── 9. Actions and challenge ──────────────────────────────────────────── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.7rem 1.15rem;
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), #33236e);
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 10px 24px -14px rgba(35, 23, 83, 0.9);
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

.button:hover,
.button:focus-visible {
    background: linear-gradient(135deg, var(--primary-hover), #3f2d84);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 16px 30px -16px rgba(35, 23, 83, 0.9);
}

.challenge {
    max-width: 26rem;
    padding: 2rem;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
}

.challenge h1 { margin: 0 0 0.35rem; font-size: 1.6rem; }

.challenge__lock {
    display: block;
    width: 2.4rem;
    height: 2.4rem;
    margin: 0 0 0.9rem;
    color: var(--secondary);
}

.challenge label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.challenge input[type="password"] {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font: inherit;
    color: var(--on-surface);
}

.challenge input[type="password"]:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(99, 77, 180, 0.16);
    outline: none;
}

.challenge button {
    margin-top: 1rem;
    padding: 0.7rem 1.15rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms var(--ease);
}

.challenge button:hover { background: var(--primary-hover); }

.challenge__error {
    margin: 0 0 1rem;
    padding-left: 0.75rem;
    color: #8c2f2a;
    border-left: 3px solid currentColor;
}

/* ── 10. Block library and the rail ────────────────────────────────────── */
/* One visual contract for all ten block types. The renderer emits
   .block.block--<type>; never add a second wrapper. */
.block {
    min-width: 0;
    overflow-wrap: anywhere;
}

.block > h2 {
    margin: 0 0 0.65rem;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--secondary);
}

.block ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.block li + li { margin-top: 0.4rem; }

.block a { color: var(--secondary); }

/* The sprite is inline <svg>: without a size it claims 300x150 or 0x0. */
.icon {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.18em;
    fill: currentColor;
    flex: none;
}

/* The rail is one panel with hairline sections, not four floating boxes. */
.sidebar .block {
    margin: 0;
    padding: 1.15rem 1.25rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.sidebar .block + .block { border-top: 1px solid var(--border-soft); }

.sidebar .block > h2 {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-soft);
}

.block--menu ul ul { padding-left: 0.9rem; }

.block--menu a { text-decoration: none; }

.block--menu a:hover,
.block--menu a:focus-visible {
    color: var(--primary);
    text-decoration: underline;
}

.block--social ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.block--social li + li { margin-top: 0; }

.block--social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--violet-050);
    color: var(--primary);
    transition: color 150ms var(--ease), border-color 150ms var(--ease), background 150ms var(--ease);
}

.block--social a:hover,
.block--social a:focus-visible {
    border-color: var(--secondary);
    background: var(--violet-100);
    color: var(--primary);
}

.rss-chicklet {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(234, 88, 12, 0.25);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: #b4450a;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
}

.rss-chicklet:hover,
.rss-chicklet:focus-visible {
    background: var(--canvas);
    color: var(--primary);
}

.rss-chicklet .icon { color: var(--accent); }

.block--facts li {
    position: relative;
    padding-left: calc(1.15rem + 0.35rem);
}

.block--facts li::before {
    content: "•";
    position: absolute;
    left: 0;
    width: 1.15rem;
    overflow: hidden;
    white-space: nowrap;
    color: var(--accent);
}

.block--facts li[data-bullet]::before { content: attr(data-bullet); }

.block--images {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.block--images img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* The renderer emits <h2> and <img> as siblings, so the heading is a grid item
   and would take the first image cell. Span it across the row. */
.block--images > h2 { grid-column: 1 / -1; }

.block--blurb figure { margin: 0 0 0.65rem; }

.block--blurb figure img {
    width: 4.4rem;
    height: 4.4rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 4px var(--violet-050);
}

.block--blurb p { margin: 0; line-height: 1.6; }

.block--address {
    font-style: normal;
    line-height: 1.6;
    white-space: pre-line;
}

.block--copyright {
    font-size: 0.8125rem;
    color: var(--muted);
}

.block--custom { line-height: 1.6; }

.block--custom a { text-decoration: underline; }

.block--links a { text-decoration: none; }

.block--links a:hover,
.block--links a:focus-visible { text-decoration: underline; }

.block--rss {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Blocks keep the theme's own hover colour: a blanket .block a rule has the
   same specificity as a:hover and would win on source order. */
.block a:hover,
.block a:focus-visible { color: var(--primary); }

/* ── 11. Footer ────────────────────────────────────────────────────────── */
.site-footer {
    margin-top: 4rem;
    /* The band is full-bleed; its content still starts on the page column. */
    padding: 2.75rem max(var(--content-pad), calc((100% - var(--content-max)) / 2 + var(--content-pad))) 1.75rem;
    background: var(--footer-bg);
    background-image:
        radial-gradient(46rem 18rem at 10% 0%, rgba(99, 77, 180, 0.45), transparent 70%),
        radial-gradient(30rem 16rem at 96% 2%, rgba(59, 40, 120, 0.55), transparent 72%);
    color: var(--footer-ink);
    border-top: 1px solid var(--footer-accent);
}

.site-footer .block {
    margin-bottom: 0;
    font-size: 0.9375rem;
    line-height: 1.65;
}

.site-footer .block > h2 {
    display: block;
    margin: 0 0 0.8rem;
    color: var(--footer-ink);
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.82;
}

.site-footer a {
    color: var(--footer-link);
    font-weight: 600;
    text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--canvas);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 0.2em;
}

.site-footer :focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 2px;
}

.site-footer__blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem 3rem;
    align-items: flex-start;
    justify-content: space-between;
    max-width: 72rem;
    margin: 0 auto;
    text-align: start;
}

.site-footer__blocks > .block {
    flex: 1 1 12rem;
    min-width: 0;
    margin-bottom: 0;
}

.site-footer__tagline {
    max-width: 72rem;
    margin: 2.25rem auto 0;
    font-family: var(--font-head);
    font-size: 1.05rem;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: var(--footer-ink);
}

.site-footer__copyright {
    max-width: 72rem;
    margin: 2rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(244, 238, 255, 0.18);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(244, 238, 255, 0.82);
}

/* ── 12. Contact form ──────────────────────────────────────────────────── */
/* One shared partial styled by every theme. The card rule order is pinned:
   padding, border, radius, canvas. */
.contact-form {
    max-width: 40rem;
    margin-top: 2.5rem;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--canvas);
    box-shadow: var(--shadow-1);
}

.contact-form > h2 { margin: 0 0 0.35rem; font-size: 1.5rem; }

.contact-form__intro {
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.contact-form__form { margin: 0; }

.contact-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}

.contact-form__field { margin: 0; min-width: 0; }

.contact-form__field--full,
.contact-form__actions { grid-column: 1 / -1; }

.contact-form__actions { margin: 0.25rem 0 0; }

.contact-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--on-surface);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--on-surface);
    background: var(--violet-050);
    /* --border measures 1.28:1 on the card: an edge nobody can see. --outline
       is the palette's only value that clears the 3:1 non-text minimum. */
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    caret-color: var(--primary);
    transition: border-color 150ms var(--ease), background 150ms var(--ease);
}

.contact-form textarea {
    min-height: 9rem;
    resize: vertical;
    line-height: 1.6;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
    background: var(--canvas);
    border-color: var(--secondary);
    outline: none;
}

.contact-form input[type="text"]:focus-visible,
.contact-form input[type="email"]:focus-visible,
.contact-form textarea:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 1px;
}

.contact-form__honeypot {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.contact-form button {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    color: var(--canvas);
    background: var(--primary);
    border: 0;
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms var(--ease);
}

.contact-form button:hover,
.contact-form button:focus-visible { background: var(--primary-hover); }

.contact-form__saved,
.contact-form__error {
    margin: 0 0 1.25rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid currentColor;
    font-size: 0.9375rem;
    color: var(--on-surface);
}

.contact-form__saved {
    background: var(--accent-soft);
    border-left-color: var(--primary);
}

.contact-form__error {
    background: var(--danger-soft);
    border-left-color: var(--danger);
}

/* ── 13. Not found and fatal ───────────────────────────────────────────── */
.not-found {
    max-width: 36rem;
    margin: 0.5rem auto;
    padding: clamp(2rem, 4vw, 2.85rem);
    text-align: center;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
}

.not-found__code {
    margin: 0;
    font-family: var(--font-head);
    font-size: clamp(3.5rem, 9vw, 5.25rem);
    line-height: 1;
    letter-spacing: -0.05em;
    color: var(--violet-200);
}

.not-found h1 {
    margin: 0.35rem 0 0.65rem;
    font-size: clamp(1.5rem, 3vw, 1.9rem);
}

.not-found__text {
    max-width: 46ch;
    margin: 0 auto 1.5rem;
    color: var(--muted);
}

.not-found__actions { margin: 0; }

.not-found__actions .icon { width: 1rem; height: 1rem; }

.fatal-page {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--surface);
}

.fatal {
    max-width: 30rem;
    padding: 2.5rem;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
}

.fatal h1 { margin: 0 0 0.75rem; font-size: 1.75rem; }

.fatal p { margin: 0 0 1rem; color: var(--muted); }

.fatal code {
    padding: 0.1em 0.4em;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--violet-050);
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--on-surface);
}

.fatal a { font-weight: 600; }

/* ── 14. Small screens ─────────────────────────────────────────────────── */
@media (max-width: 759px) {
    :root { --content-pad: 1.25rem; }

    .layout {
        padding-top: 1rem;
        padding-bottom: 3rem;
        gap: 1.75rem;
    }

    .masthead,
    .hero {
        padding-top: 1.6rem;
        padding-bottom: 1.4rem;
        margin-bottom: 1.5rem;
    }

    .page-card:first-child { padding: 1.45rem 1.3rem; }

    .page-card:first-child .page-card__title { font-size: 1.65rem; }

    .page-content h1 { font-size: 1.95rem; }

    .site-footer {
        margin-top: 3rem;
        padding: 2.25rem 1.25rem 1.5rem;
    }

    .site-footer__blocks { flex-direction: column; gap: 1.75rem; }

    /* flex-basis applies to the block axis in a column: reset it. */
    .site-footer__blocks > .block { flex: 0 0 auto; width: 100%; }

    .contact-form { padding: 1.35rem; }
}

@media (max-width: 640px) {
    .contact-form__grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
}

@media (max-width: 479px) {
    .site-title { font-size: 1rem; }
    /* The band wraps here, so a leading rule would hang on a new line. */
    .masthead__stat + .masthead__stat { padding-left: 0; border-left: 0; }
    .page-card { padding: 1.2rem; }
    .badge { letter-spacing: 0.06em; }
}

/* ── 15. Motion and print ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }

    .page-card:hover,
    .button:hover,
    .contact-form button:hover { transform: none; }

    .page-card:hover .page-card__more .icon { transform: none; }
}

@media print {
    .site-header,
    .site-nav,
    .sidebar,
    .site-footer,
    .announcement,
    .skip-link,
    .page-card__more,
    .contact-form,
    .button { display: none !important; }

    body {
        background: #ffffff;
        color: #000000;
    }

    .layout {
        display: block;
        max-width: none;
        padding: 0;
    }

    .page-content { max-width: none; }

    a { color: #000000; text-decoration: underline; }

    .page-content h1 { font-size: 22pt; }

    .page-content > p,
    .page-content li { font-size: 11pt; }
}
