/* ===========================================================================
   just a TV — "Bench Lamp"

   The look comes from one place: a neighbourhood electronics repair bench at
   night. A television opened up, its service sticker peeling, an anglepoise
   lamp, a printed service manual held open with a screwdriver.

   Collision: 1980s service manual meets serious newspaper editorial. Hairline
   rules and monospaced labels from the first; an editorial serif and long
   measure from the second.

   Deliberately NOT: a "hacking" site (black background, matrix green), a
   wellness app, or anything with a purple gradient.

   Palette "Bench Lamp", taken from that bench rather than from a swatch file:
     paper   manual stock, warm and slightly aged
     ink     printing ink on cheap paper — warm black, never blue-black
     board   the green of a bare printed circuit board, desaturated
     amber   the standby LED on the front of a set: off, but not really off
     rule    the hairline of a technical drawing
   =========================================================================== */

:root {
    /* --- Bench Lamp, lit ------------------------------------------------
       Same bench, but with the lamp on. The greens and ambers are pushed up
       to where they read as colour rather than as tint, and a fourth accent
       joins them: the cyan glow of a screen that is actually switched on.
       That one is what stops the palette reading as sepia.                */
    --paper: #faf7ef;
    --paper-sunk: #f0ebdd;
    --paper-raised: #fffefa;
    --ink: #14120d;
    --ink-soft: #4e4838;
    --ink-faint: #7d7460;

    --board: #0e7c5a;          /* circuit-board green, saturated */
    --board-bright: #14a978;
    --board-wash: #d9f2e7;

    --amber: #d97706;          /* the standby LED, properly lit */
    --amber-bright: #f59e0b;
    --amber-wash: #fdeed6;

    --signal: #0e7490;         /* a screen that is on */
    --signal-bright: #0ea5c4;
    --signal-wash: #d7eef4;

    --alarm: #c02a1e;
    --alarm-wash: #fbe0dc;

    --rule: #e3dcc8;
    --rule-strong: #c6b99a;

    --measure: 36rem;
    --shell: 78rem;

    --radius: 4px;

    --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font-body: 'Familjen Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

    color-scheme: light;
}

/* Dark tokens live in a single place and are applied by either the OS
   preference or the explicit toggle, so the two can never drift apart. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --paper: #12110d;
        --paper-sunk: #0d0c09;
        --paper-raised: #1b1913;
        --ink: #f2ede0;
        --ink-soft: #b3a992;
        --ink-faint: #857c67;

        --board: #2fd39c;
        --board-bright: #4ee7b4;
        --board-wash: #0c2b21;

        --amber: #f0a13a;
        --amber-bright: #fbbf24;
        --amber-wash: #33210b;

        --signal: #38bdd8;
        --signal-bright: #56d4ec;
        --signal-wash: #0a2830;

        --alarm: #f0705f;
        --alarm-wash: #34120e;

        --rule: #2e2a20;
        --rule-strong: #46402f;

        color-scheme: dark;
    }
}

:root[data-theme='dark'] {
    --paper: #12110d;
    --paper-sunk: #0d0c09;
    --paper-raised: #1b1913;
    --ink: #f2ede0;
    --ink-soft: #b3a992;
    --ink-faint: #857c67;

    --board: #2fd39c;
    --board-bright: #4ee7b4;
    --board-wash: #0c2b21;

    --amber: #f0a13a;
    --amber-bright: #fbbf24;
    --amber-wash: #33210b;

    --signal: #38bdd8;
    --signal-bright: #56d4ec;
    --signal-wash: #0a2830;

    --alarm: #f0705f;
    --alarm-wash: #34120e;

    --rule: #2e2a20;
    --rule-strong: #46402f;

    color-scheme: dark;
}

/* ===========================================================================
   Base
   =========================================================================== */

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: clamp(1rem, 0.97rem + 0.15vw, 1.075rem);
    line-height: 1.65;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* The standby LED: a warm dot pinned to the top of every page. The light that
   means the set is off but not really off — the whole problem, in one colour. */
body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--amber-bright) 0, var(--amber) 4rem,
        var(--board-bright) 9rem, var(--signal) 15rem,
        var(--rule) 22rem);
    z-index: 60;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.015em;
    text-wrap: balance;
    margin: 0 0 0.6em;
}

h1 { font-size: clamp(2rem, 1.35rem + 2.7vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.85vw, 1.85rem); }
h3 { font-size: 1.2rem; }

p, li { text-wrap: pretty; }

a { color: var(--board); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--amber); }

:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
    border-radius: 2px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    background: var(--paper-sunk);
    border: 1px solid var(--rule);
    padding: 0.1em 0.35em;
    border-radius: var(--radius);
    word-break: break-word;
}

pre {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    overflow-x: auto;
    padding: 1rem 1.1rem;
    background: var(--paper-sunk);
    border: 1px solid var(--rule);
    border-left: 2px solid var(--board);
    border-radius: var(--radius);
}

pre code { background: none; border: 0; padding: 0; }

/* ===========================================================================
   Layout
   =========================================================================== */

main {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 5rem;
}

.skip-link {
    position: absolute;
    left: -9999px;
    background: var(--ink);
    color: var(--paper);
    padding: 0.6rem 1rem;
}

.skip-link:focus { position: static; display: inline-block; }

/* ===========================================================================
   Header — a manual's running head: rules, not a bar
   =========================================================================== */

.site-header {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 1.4rem 1.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.4rem;
    border-bottom: 1px solid var(--rule);
}

.brand { display: inline-flex; line-height: 0; margin-right: auto; }
.logo { height: 30px; width: auto; color: var(--ink); }

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem;
    font-size: 0.86rem;
}

.site-header nav a {
    color: var(--ink-soft);
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.site-header nav a:hover { color: var(--ink); border-bottom-color: var(--board); }

/* ===========================================================================
   Live presence — up top, where people look first
   =========================================================================== */

.presence {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--paper-raised);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    color: var(--ink-soft);
    white-space: nowrap;
}

.presence [data-presence-count] { color: var(--ink); font-weight: 500; }

.presence-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--board-bright);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--board-bright) 65%, transparent);
    animation: pulse 2.6s var(--ease) infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--board-bright) 55%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* ===========================================================================
   Hero
   =========================================================================== */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
    padding: clamp(1.5rem, 5vw, 3.5rem) 0 2.5rem;
    border-bottom: 1px solid var(--rule);
}

.hero h1 { margin-bottom: 0.45em; }

.hero .lead {
    max-width: var(--measure);
    font-size: clamp(1.05rem, 1rem + 0.4vw, 1.2rem);
    color: var(--ink-soft);
    margin: 0 0 1.5rem;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--board);
    margin: 0 0 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.eyebrow::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rule);
}

/* Reassurances answering the two objections that actually stop people:
   "will I break it" and "is this legal". */
.hero-assurances {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.4rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.hero-assurances li { display: flex; align-items: baseline; gap: 0.45rem; }
.hero-assurances li::before { content: "—"; color: var(--board); }

@media (max-width: 52rem) {
    .hero { grid-template-columns: 1fr; }
}

/* --- The service sticker: the object at the centre of this whole project --- */
.service-label {
    position: relative;
    padding: 1rem 1.1rem 1.1rem;
    background: var(--paper-raised);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--ink-soft);
    box-shadow: 0 1px 0 var(--rule);
    transform: rotate(-0.6deg);
}

.service-label::before {
    content: "";
    position: absolute;
    inset: 0.35rem;
    border: 1px dashed var(--rule);
    border-radius: 2px;
    pointer-events: none;
}

.service-label dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 1rem;
    margin: 0.7rem 0 0;
}

.service-label dt { color: var(--ink-faint); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.68rem; }
.service-label dd { margin: 0; color: var(--ink); }
.service-label .label-title { letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.68rem; color: var(--ink-faint); }
.service-label .label-note { margin: 0.85rem 0 0; font-size: 0.7rem; color: var(--ink-faint); }

/* ===========================================================================
   Terminal — the signature motion: it types the command out
   =========================================================================== */

.terminal {
    margin: 1.6rem 0 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-sunk);
    overflow: hidden;
}

.terminal-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.8rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.terminal-head::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
}

.terminal-body {
    margin: 0;
    padding: 0.9rem 1rem;
    font-family: var(--font-mono);
    font-size: clamp(0.72rem, 0.6rem + 0.4vw, 0.83rem);
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-body .prompt { color: var(--board); user-select: none; }
.terminal-body .comment { color: var(--ink-faint); }
.terminal-body .ok { color: var(--board-bright); }

.caret {
    display: inline-block;
    width: 0.55em;
    height: 1.05em;
    margin-left: 0.1em;
    background: var(--amber);
    vertical-align: text-bottom;
    animation: blink 1.05s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ===========================================================================
   Sections and rules — the manual's numbered structure
   =========================================================================== */

.section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--rule);
}

.section:last-of-type { border-bottom: 0; }

.section > h2 {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
}

.section > h2::before {
    content: attr(data-index);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: var(--board);
    flex: none;
}

.section > p { max-width: var(--measure); color: var(--ink-soft); }

/* --- Scope: what we do, and what we refuse to do -------------------------- */
.scope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.5rem 2.5rem;
    margin-top: 1.5rem;
}

.scope-list { list-style: none; padding: 0; margin: 0.6rem 0 0; }

.scope-list li {
    position: relative;
    padding: 0.5rem 0 0.5rem 1.5rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.94rem;
}

.scope-list li::before {
    position: absolute;
    left: 0;
    top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.scope-does li::before { content: "+"; color: var(--board); }
.scope-refuses li::before { content: "×"; color: var(--alarm); }

.scope-head {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0;
}

/* ===========================================================================
   Form
   =========================================================================== */

.signup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: start;
}

@media (max-width: 52rem) { .signup { grid-template-columns: 1fr; } }

.form-row {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-row label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

input[type='text'], input[type='email'] {
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--paper-raised);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

input[type='text']:focus, input[type='email']:focus {
    outline: 0;
    border-color: var(--board);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--board) 18%, transparent);
}

/* Symfony renders the label before the widget; `order` puts the box on the
   left visually without disturbing the reading order. */
.form-row:has(input[type='checkbox']) {
    flex-direction: row;
    align-items: start;
    gap: 0.55rem;
}

.form-row input[type='checkbox'] {
    order: -1;
    flex: none;
    margin-top: 0.3rem;
    width: 1rem;
    height: 1rem;
    accent-color: var(--board);
}

.form-row:has(input[type='checkbox']) label {
    font-family: var(--font-body);
    font-size: 0.88rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-soft);
}

button[type='submit'] {
    width: 100%;
    padding: 0.85rem 1.4rem;
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.14s var(--ease), background 0.18s var(--ease);
}

button[type='submit']:hover { background: var(--board); border-color: var(--board); transform: translateY(-1px); }
button[type='submit']:active { transform: translateY(0); }

.fineprint, .form-help {
    color: var(--ink-faint);
    font-size: 0.82rem;
}

/* The honeypot: out of sight and out of the accessibility tree, still a real
   input a bot will happily fill in. */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===========================================================================
   The post it started from
   =========================================================================== */

.origin-tweet {
    margin: 1.2rem 0 0;
    padding: 1.2rem 1.3rem;
    border: 1px solid var(--rule);
    border-left: 2px solid var(--amber);
    border-radius: var(--radius);
    background: var(--paper-raised);
    max-width: var(--measure);
}

.origin-tweet blockquote { margin: 0; font-size: 0.96rem; }
.origin-tweet blockquote p:first-child { margin-top: 0; }
.origin-tweet blockquote p:last-child { margin-bottom: 0; }

.origin-tweet figcaption {
    margin-top: 0.9rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--rule);
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: baseline;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-faint);
}

.origin-author { font-weight: 500; color: var(--ink); }
.origin-metrics { font-variant-numeric: tabular-nums; }

.embed-blocked {
    margin: 0.8rem 0 0;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--rule);
}

:root[data-consent-embeds='granted'] .embed-blocked { display: none; }
.origin-tweet.is-loaded { border: 0; padding: 0; background: none; }
.origin-tweet.is-loaded figcaption { display: none; }

/* ===========================================================================
   Language switcher, breadcrumbs, footer
   =========================================================================== */

.language-switcher ul {
    display: flex;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.language-switcher a { color: var(--ink-faint); text-decoration: none; }
.language-switcher a:hover { color: var(--board); }
.language-switcher [aria-current] { color: var(--ink); font-weight: 500; }

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-faint);
}

.breadcrumbs li + li::before { content: "/"; margin-right: 0.35rem; opacity: 0.55; }
.breadcrumbs a { color: var(--ink-faint); text-decoration: none; }
.breadcrumbs a:hover { color: var(--board); }

.site-footer {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    border-top: 1px solid var(--rule);
    color: var(--ink-faint);
    font-size: 0.82rem;
    display: grid;
    gap: 0.9rem;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--board); text-decoration: underline; }

/* ===========================================================================
   Directory and articles
   =========================================================================== */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

th, td {
    text-align: left;
    padding: 0.7rem 0.6rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}

th {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-bottom-color: var(--rule-strong);
}

caption { text-align: left; padding-bottom: 0.6rem; color: var(--ink-faint); font-size: 0.82rem; }

.risk-safe { color: var(--board); }
.risk-caution { color: var(--amber); }
.risk-risky { color: var(--amber); font-weight: 500; }
.risk-critical { color: var(--alarm); font-weight: 600; }

.wall {
    padding: 1.3rem 1.4rem;
    border: 1px solid var(--rule);
    border-left: 2px solid var(--board);
    border-radius: var(--radius);
    background: var(--paper-raised);
}

.article-list { list-style: none; padding: 0; }

.article-list > li {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--rule);
}

.article-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 1.3rem;
    align-items: start;
}

.article-body > :last-child { margin-bottom: 0; }

.article-card h2 { font-size: 1.18rem; margin: 0 0 0.3rem; }
.article-card h2 a { color: var(--ink); text-decoration: none; }
.article-card h2 a:hover { color: var(--board); }
.article-card p { margin: 0 0 0.4rem; color: var(--ink-soft); font-size: 0.94rem; }

.article-thumb {
    display: block;
    padding: 0.6rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-sunk);
    color: var(--ink-soft);
    transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.article-card:hover .article-thumb { border-color: var(--rule-strong); transform: translateY(-2px); }
.article-thumb img { display: block; width: 100%; height: auto; }

@media (max-width: 34rem) {
    .article-card { grid-template-columns: 1fr; }
    .article-thumb { max-width: 200px; }
}

.category-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 2rem; }

.category-nav a {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--paper-raised);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-soft);
    text-decoration: none;
    transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.category-nav a:hover { border-color: var(--board); color: var(--board); }

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.4rem; }
.prose h3 { margin-top: 1.7rem; }
.prose > p, .prose > ul, .prose > ol { font-size: 1.02rem; }

.prose blockquote {
    margin: 1.5rem 0;
    padding: 0.2rem 0 0.2rem 1.1rem;
    border-left: 2px solid var(--amber);
    color: var(--ink-soft);
    font-style: italic;
}

.prose table { display: block; overflow-x: auto; }

.article-hero, .diagram {
    margin: 1.8rem 0;
    padding: 1.2rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-sunk);
    color: var(--ink);
    overflow-x: auto;
}

.article-hero { margin-top: 0; }
.article-hero img, .diagram svg {
    display: block;
    width: 100%;
    max-width: 460px;
    height: auto;
    margin: 0 auto;
}

.article-footer {
    margin-top: 2.5rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--rule);
}

.specs {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 1.2rem;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.specs dt {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    align-self: baseline;
}

.specs dd { margin: 0; }

/* ===========================================================================
   Consent
   =========================================================================== */

.consent {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 100;
    background: var(--paper-raised);
    border-top: 1px solid var(--rule-strong);
    box-shadow: 0 -10px 40px rgb(0 0 0 / 0.14);
    animation: rise 0.35s var(--ease) both;
}

@keyframes rise { from { transform: translateY(100%); } }

.consent[hidden] { display: none; }

.consent-inner { max-width: var(--shell); margin: 0 auto; padding: 1.3rem 1.5rem; }
.consent h2 { font-size: 1.05rem; margin: 0 0 0.35rem; }
.consent p { margin: 0 0 0.8rem; font-size: 0.88rem; color: var(--ink-soft); max-width: 46rem; }

.consent-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

.consent button {
    padding: 0.6rem 1.15rem;
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s var(--ease);
}

.consent button:hover { background: var(--board); border-color: var(--board); }

.consent .consent-secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.consent .consent-secondary:hover { background: var(--paper-sunk); border-color: var(--ink-faint); }

.consent .consent-link {
    background: none;
    border: 0;
    color: var(--board);
    text-decoration: underline;
    padding: 0.6rem 0.2rem;
    font-weight: 500;
}

.consent-details ul { list-style: none; padding: 0; margin: 0 0 0.6rem; }
.consent-details li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }

.consent-details label {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem 0.6rem;
    align-items: start;
    font-size: 0.86rem;
    cursor: pointer;
}

.consent-details input { grid-row: span 2; margin-top: 0.25rem; accent-color: var(--board); }
.consent-details span { color: var(--ink-faint); grid-column: 2; font-size: 0.82rem; }

/* ===========================================================================
   Entrance motion — deliberate, never showy, and off on request
   =========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    .reveal {
        animation: reveal 0.6s var(--ease) both;
        animation-timeline: view();
        animation-range: entry 0% entry 42%;
    }

    @keyframes reveal {
        from { opacity: 0; transform: translateY(14px); }
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .presence-dot, .caret, .consent { animation: none; }
    * { transition-duration: 0.01ms !important; }
}

/* ===========================================================================
   Colour, applied
   ---------------------------------------------------------------------------
   Everything below exists so the palette reads as colour rather than as a tint
   over beige. Each accent has a job: green for what is safe and reversible,
   amber for what needs care, cyan for what is live right now, red for what we
   refuse to do.
   =========================================================================== */

.eyebrow { color: var(--board); }

.eyebrow::after {
    background: linear-gradient(90deg, var(--board) 0, var(--rule) 6rem);
    opacity: 0.7;
}

.hero-assurances li::before { content: "✓"; color: var(--board); font-weight: 700; }

/* Section numbers cycle through the accents rather than all being one colour. */
.section:nth-of-type(4n+1) > h2::before { color: var(--board); }
.section:nth-of-type(4n+2) > h2::before { color: var(--amber); }
.section:nth-of-type(4n+3) > h2::before { color: var(--signal); }
.section:nth-of-type(4n+4) > h2::before { color: var(--alarm); }

.presence {
    border-color: color-mix(in srgb, var(--signal) 32%, var(--rule));
    background: var(--signal-wash);
    color: var(--ink-soft);
}

.presence [data-presence-count] { color: var(--signal); font-weight: 600; }
.presence-dot { background: var(--signal-bright); }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal-bright) 70%, transparent); }
    70% { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.terminal {
    border-color: color-mix(in srgb, var(--board) 26%, var(--rule));
    background: var(--paper-sunk);
}

.terminal-head {
    background: var(--board-wash);
    border-bottom-color: color-mix(in srgb, var(--board) 26%, var(--rule));
    color: var(--board);
}

.terminal-head::before { background: var(--amber-bright); }
.terminal-body .prompt { color: var(--board); }
.terminal-body .ok { color: var(--board-bright); font-weight: 500; }
.terminal-body .comment { color: var(--amber); }
.caret { background: var(--amber-bright); }

.service-label {
    background: linear-gradient(160deg, var(--amber-wash) 0, var(--paper-raised) 55%);
    border-color: color-mix(in srgb, var(--amber) 30%, var(--rule-strong));
}

.service-label::before { border-color: color-mix(in srgb, var(--amber) 34%, var(--rule)); }
.service-label .label-title { color: var(--amber); }

.scope-does li::before { content: "✓"; color: var(--board); font-weight: 700; }
.scope-refuses li::before { content: "✕"; color: var(--alarm); font-weight: 700; }
.scope-does li { border-bottom-color: color-mix(in srgb, var(--board) 16%, var(--rule)); }
.scope-refuses li { border-bottom-color: color-mix(in srgb, var(--alarm) 16%, var(--rule)); }

.origin-tweet {
    border-left-color: var(--signal);
    background: linear-gradient(200deg, var(--signal-wash) 0, var(--paper-raised) 60%);
}

/* Metrics X's own widget does not show, kept as our own line. */
.origin-metrics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    margin: 0.85rem 0 0;
    padding-top: 0.7rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-faint);
}

.origin-metrics-row b {
    color: var(--ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.origin-metrics-row li { list-style: none; }
.origin-metrics-row .metric-views b { color: var(--signal); }

button[type='submit'] {
    background: linear-gradient(180deg, var(--board-bright) 0, var(--board) 100%);
    border-color: var(--board);
    color: #fff;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 18%, transparent);
}

button[type='submit']:hover {
    background: linear-gradient(180deg, var(--board) 0, var(--board-bright) 100%);
    transform: translateY(-1px);
}

.category-nav a:nth-child(6n+1):hover { border-color: var(--board); color: var(--board); background: var(--board-wash); }
.category-nav a:nth-child(6n+2):hover { border-color: var(--amber); color: var(--amber); background: var(--amber-wash); }
.category-nav a:nth-child(6n+3):hover { border-color: var(--signal); color: var(--signal); background: var(--signal-wash); }
.category-nav a:nth-child(6n+4):hover { border-color: var(--alarm); color: var(--alarm); background: var(--alarm-wash); }
.category-nav a:nth-child(6n+5):hover { border-color: var(--board); color: var(--board); background: var(--board-wash); }
.category-nav a:nth-child(6n+6):hover { border-color: var(--signal); color: var(--signal); background: var(--signal-wash); }

.article-thumb { background: linear-gradient(150deg, var(--board-wash) 0, var(--paper-sunk) 70%); }
.article-card:nth-child(3n+2) .article-thumb { background: linear-gradient(150deg, var(--amber-wash) 0, var(--paper-sunk) 70%); }
.article-card:nth-child(3n+3) .article-thumb { background: linear-gradient(150deg, var(--signal-wash) 0, var(--paper-sunk) 70%); }

.article-hero { background: linear-gradient(150deg, var(--board-wash) 0, var(--paper-sunk) 65%); }
.diagram { background: var(--paper-sunk); border-left: 2px solid var(--signal); }

.wall { border-left-color: var(--amber); background: linear-gradient(160deg, var(--amber-wash) 0, var(--paper-raised) 60%); }

.risk-safe { color: var(--board); font-weight: 600; }
.risk-caution { color: var(--amber); font-weight: 600; }
.risk-risky { color: var(--amber-bright); font-weight: 600; }
.risk-critical { color: var(--alarm); font-weight: 700; }

pre { border-left-color: var(--board); }
code { border-color: color-mix(in srgb, var(--board) 18%, var(--rule)); }
.prose blockquote { border-left-color: var(--amber); }

/* ===========================================================================
   Header controls: theme toggle and language menu
   =========================================================================== */

.header-tools { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-raised);
    color: var(--ink-soft);
    cursor: pointer;
    transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}

.theme-toggle:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-wash); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Only one icon shows: whichever the current theme is not. */
.theme-toggle .icon-moon { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-moon,
:root:not([data-theme='light']) .theme-toggle .icon-moon { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-sun { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme='light']) .theme-toggle .icon-moon { display: none; }
}

:root[data-theme='light'] .theme-toggle .icon-sun { display: none; }
:root[data-theme='light'] .theme-toggle .icon-moon { display: block; }

@media (prefers-color-scheme: light) {
    :root:not([data-theme='dark']) .theme-toggle .icon-sun { display: none; }
    :root:not([data-theme='dark']) .theme-toggle .icon-moon { display: block; }
}

.lang {
    position: relative;
    font-size: 0.8rem;
}

.lang > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-raised);
    color: var(--ink-soft);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.lang > summary::-webkit-details-marker { display: none; }
.lang > summary:hover { border-color: var(--signal); color: var(--signal); }
.lang[open] > summary { border-color: var(--signal); color: var(--signal); }

.lang .chev { width: 10px; height: 10px; transition: transform 0.18s var(--ease); }
.lang[open] .chev { transform: rotate(180deg); }

.lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    z-index: 50;
    min-width: 11rem;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    background: var(--paper-raised);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.16);
    animation: drop 0.16s var(--ease) both;
}

@keyframes drop { from { opacity: 0; transform: translateY(-5px); } }

.lang-menu a,
.lang-menu span {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 0.6rem;
    border-radius: 3px;
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
}

.lang-menu a:hover { background: var(--signal-wash); color: var(--signal); }
.lang-menu [aria-current] { color: var(--ink); font-weight: 600; background: var(--paper-sunk); }
.lang-flag { font-size: 1.05rem; line-height: 1; }
.lang-code { margin-left: auto; font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); }

/* ===========================================================================
   Hero: the post that started it sits alongside, at the top
   =========================================================================== */

.hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
.hero-aside { display: grid; gap: 1.4rem; align-content: start; }
.hero-aside .origin-tweet { margin: 0; max-width: none; }

.hero-aside .origin-heading {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--signal);
    margin: 0 0 0.6rem;
}

@media (max-width: 60rem) {
    .hero { grid-template-columns: 1fr; }
}

/* ===========================================================================
   Article context imagery
   =========================================================================== */

.article-photo {
    margin: 2rem 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper-sunk);
}

.article-photo img { display: block; width: 100%; height: auto; }

.article-photo figcaption {
    padding: 0.6rem 0.9rem;
    border-top: 1px solid var(--rule);
    font-size: 0.78rem;
    color: var(--ink-faint);
}

.prose .article-photo { max-width: none; }

/* ===========================================================================
   Article measure
   ---------------------------------------------------------------------------
   The shell is wide, but running text is not: the column stays at a readable
   measure and is centred, while figures and photographs bleed wider than it.
   That is the ordinary editorial arrangement and it stops the page looking
   like a narrow strip pinned to the left edge.
   =========================================================================== */

.prose,
.article-footer,
.prose + aside {
    margin-inline: auto;
}

.prose + aside { max-width: var(--measure); }

.prose > .article-photo,
.prose > .diagram,
.prose > .article-hero,
.prose > figure {
    --bleed: min(50rem, 100% + 12rem, calc(100vw - 3rem));
    width: var(--bleed);
    max-width: none;
    margin-inline: calc((100% - var(--bleed)) / 2);
}

.prose > .article-photo img { max-height: 26rem; object-fit: cover; }

/* Breadcrumbs and the article header line up with the text column. */
.article-page .breadcrumbs ol { max-width: var(--measure); margin-inline: auto; }

@media (max-width: 56rem) {
    .prose > .article-photo,
    .prose > .diagram,
    .prose > .article-hero,
    .prose > figure {
        --bleed: 100%;
        margin-inline: 0;
    }
}
