/* ==========================================================================
   TNX — "mail + console" design, grayscale.
   Tokens → base → layout (header, main, footer) → components → pages → print.
   Components are shown together on the hidden page /styleguide.
   ========================================================================== */

/* --- Fonts (self-hosted IBM Plex, SIL OFL — see assets/fonts/OFL.txt) --- */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-400-italic.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* --- Tokens: grayscale only. Light is the default; dark via system or toggle. --- */
:root {
    --bg: #ffffff;
    --surface: #f4f4f4;
    --surface-2: #e9e9e9;
    --card: #ffffff;
    --border: #dcdcdc;
    --border-strong: #a8a8a8;
    --text: #161616;
    --text-2: #3d3d3d;
    --muted: #666666;          /* 5.7:1 on white */
    --stripe-a: #161616;
    --stripe-b: #9a9a9a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px -12px rgb(0 0 0 / 0.18);

    /* The console stays dark in both themes. */
    --console-bg: #1a1a1a;
    --console-bar: #262626;
    --console-border: #333333;
    --console-text: #ececec;
    --console-muted: #a3a3a3;

    --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
    /* Widths grow with the screen: ~70 % (page) / ~65 % (articles) of a wide monitor,
       never narrower than the old 1140/740px, capped so 4K screens stay readable. */
    --container: min(1600px, max(1140px, 70vw));
    --reading: min(1400px, max(740px, 65vw));
    --gutter: clamp(16px, 4vw, 32px);
    --radius: 12px;
    --radius-sm: 7px;
    --airmail: repeating-linear-gradient(-45deg,
        var(--stripe-a) 0 10px, transparent 10px 16px,
        var(--stripe-b) 16px 26px, transparent 26px 32px);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #111111;
        --surface: #1a1a1a;
        --surface-2: #262626;
        --card: #161616;
        --border: #2e2e2e;
        --border-strong: #5c5c5c;
        --text: #eeeeee;
        --text-2: #c9c9c9;
        --muted: #9d9d9d;
        --stripe-a: #d6d6d6;
        --stripe-b: #5c5c5c;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.7);
        --console-bg: #0b0b0b;
        --console-bar: #171717;
        --console-border: #2a2a2a;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #111111;
    --surface: #1a1a1a;
    --surface-2: #262626;
    --card: #161616;
    --border: #2e2e2e;
    --border-strong: #5c5c5c;
    --text: #eeeeee;
    --text-2: #c9c9c9;
    --muted: #9d9d9d;
    --stripe-a: #d6d6d6;
    --stripe-b: #5c5c5c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.7);
    --console-bg: #0b0b0b;
    --console-bar: #171717;
    --console-border: #2a2a2a;
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    overflow-wrap: break-word;
}

h1, h2, h3 { line-height: 1.25; color: var(--text); }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); font-weight: 700; letter-spacing: -0.015em; margin: 0 0 1rem; }
h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 600; }

a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}
a:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }

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

.container { max-width: var(--container); margin: 0 auto; padding-inline: var(--gutter); }

.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -0.2em; }
.icon-sm { width: 1em; height: 1em; vertical-align: -0.12em; }

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

.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 100; padding: 0.5rem 1rem; background: var(--text); color: var(--bg); border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }

/* Grayscale "airmail" stripe — the signature border of the site. */
.airmail { height: 5px; background: var(--airmail); }

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: saturate(1.2) blur(10px);
    -webkit-backdrop-filter: saturate(1.2) blur(10px);
}
.site-header::after { content: ""; display: block; height: 4px; background: var(--airmail); }

.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); text-decoration: none; flex: none; }
.brand svg { width: 38px; height: 38px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font: 700 1.25rem/1 var(--font-mono); letter-spacing: 0.12em; }
.brand-tagline { font: 400 0.72rem var(--font-mono); color: var(--muted); margin-top: 0.2rem; }

.site-nav { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-main { display: flex; gap: 0.1rem; }
.site-nav a, .nav-more-toggle {
    display: block;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font: 500 0.92rem/1.3 var(--font-sans);
    white-space: nowrap;
}
.site-nav a:hover, .nav-more-toggle:hover { background: var(--surface); color: var(--text); }
.site-nav a.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--text); border-radius: 0; }

.nav-more { position: relative; padding-left: 0.5rem; margin-left: 0.25rem; border-left: 1px solid var(--border); }
.nav-more-toggle { display: inline-flex; align-items: center; gap: 0.35rem; background: none; border: 0; cursor: pointer; }
.nav-more-toggle .icon { transform: rotate(90deg); transition: transform 0.15s; }
.nav-more.open .nav-more-toggle .icon { transform: rotate(-90deg); }
.nav-private {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    min-width: 12rem;
    padding: 0.4rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.nav-more.open .nav-private { display: block; }
.nav-private a.active { box-shadow: none; background: var(--surface-2); border-radius: var(--radius-sm); }
html:not(.js) .nav-more-toggle { display: none; }
html:not(.js) .nav-private { display: flex; position: static; padding: 0; border: 0; box-shadow: none; background: none; min-width: 0; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--text);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex: none;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn .icon { grid-area: 1 / 1; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@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; }
}
html:not(.js) .theme-toggle { display: none; }

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-open .nav-toggle .icon-close { display: block; }
.nav-open .nav-toggle .icon-menu { display: none; }

@media (max-width: 1080px) {
    .nav-toggle { display: inline-grid; }
    .theme-toggle { margin-left: auto; }
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        max-height: calc(100vh - 72px);
        overflow-y: auto;
        padding: 1rem var(--gutter) 1.5rem;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    .nav-open .site-nav { display: flex; }
    html:not(.js) .site-nav { display: flex; position: static; box-shadow: none; }
    .nav-main { flex-direction: column; }
    .site-nav a { padding: 0.7rem 0.75rem; font-size: 1rem; }
    .site-nav a.active { box-shadow: inset 3px 0 0 var(--text); background: var(--surface); }
    .nav-more { border-left: 0; border-top: 1px solid var(--border); margin: 0; padding: 0.75rem 0 0; }
    .nav-more-toggle { display: none; }
    .nav-private { display: block; position: static; padding: 0; border: 0; box-shadow: none; background: none; }
    .nav-more::before { content: "Ze soukromí"; display: block; padding: 0 0.75rem 0.25rem; font: 600 0.72rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
}

@media (max-width: 420px) {
    .brand-tagline { display: none; }
}

/* --- Main --- */
.site-main { padding: clamp(1.75rem, 4vw, 3rem) 0 4.5rem; }

.layout-page .site-content,
.layout-article .site-content,
.layout-article .breadcrumb { max-width: var(--reading); margin-inline: auto; }

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

/* Lead paragraph under a page title. */
.lead { font-size: 1.2rem; color: var(--text-2); }

/* Posts on regular pages: separated by a rule. */
.site-content article { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.site-content article:last-child { border-bottom: 0; }
.site-content article > h2:first-child { margin-top: 0; }

/* Card grid pages: posts become "envelopes". */
.layout-cards .site-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}
.layout-cards .site-content > :not(article) { grid-column: 1 / -1; }
.layout-cards .site-content > article:only-of-type { grid-column: 1 / -1; }
@media (max-width: 760px) {
    .layout-cards .site-content { grid-template-columns: minmax(0, 1fr); }
}

.layout-cards .site-content > article,
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 1.6rem 1.5rem 1.35rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.layout-cards .site-content > article::before,
.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--airmail);
    opacity: 0.85;
}
.layout-cards .site-content > article:hover,
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.layout-cards .site-content > article > h2,
.card > h2 { margin: 0.25rem 0 0.6rem; font-size: 1.2rem; }
.layout-cards .site-content > article > h2 a,
.card > h2 a { text-decoration: none; }
.layout-cards .site-content > article > h2 a:hover,
.card > h2 a:hover { text-decoration: underline; }
.layout-cards .site-content > article p,
.card p { color: var(--text-2); font-size: 0.98rem; }
.layout-cards .site-content > article > .meta,
.card > .meta { width: 5.75rem; margin: auto 0 -0.25rem; align-self: flex-end; color: var(--muted); }
.layout-cards .site-content > article > p:nth-last-child(2),
.card > p:nth-last-child(2) { margin-bottom: 1.25rem; }

/* Date as a round rubber stamp (inline SVG from stamp() in includes/helpers.php):
   double ring, "TNX HOME PAGE" / "POSLEDNÍ ÚPRAVA" along the edge, date in the middle. */
.meta {
    width: 7rem;
    margin: 1.5rem 0 0.25rem;
    color: var(--text-2);
    opacity: 0.85;
    transform: rotate(-8deg);
}
.meta time { display: block; }
.stamp { display: block; width: 100%; height: auto; overflow: visible; }
.stamp circle { fill: currentColor; }
.stamp .stamp-ring { fill: none; stroke: currentColor; stroke-width: 3; }
.stamp .stamp-ring-inner { fill: none; stroke: currentColor; stroke-width: 1.2; }
.stamp text { fill: currentColor; font-family: var(--font-mono); font-weight: 600; text-anchor: middle; }
.stamp .stamp-arc { font-size: 10px; letter-spacing: 1.2px; }
.stamp .stamp-day { font-size: 16px; font-weight: 700; }
.stamp .stamp-year { font-size: 13px; letter-spacing: 1px; }

/* Small uppercase label above an article title, styled as a prompt. */
.kicker { margin: 0 0 0.4rem; font: 500 0.8rem var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.kicker::before { content: "> "; color: var(--text); }

.section-title { display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0 0; font: 600 0.8rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    font: 600 0.95rem/1.2 var(--font-sans);
    color: var(--text);
    text-decoration: none;
    background: var(--card);
    border: 1.5px solid var(--text);
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { color: var(--bg); background: var(--text); }
.btn-primary:hover { background: var(--text-2); border-color: var(--text-2); }

/* --- Hero (homepage) --- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
    padding: clamp(0.5rem, 3vw, 2rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}
/* The page's <h1> (for search engines/screen readers), sized like a regular h2 on purpose. */
.hero h1 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; margin: 2rem 0 0.75rem; }
.hero .lead { margin: 0 0 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }
.hero .console { margin: 0; box-shadow: var(--shadow); }
@media (max-width: 860px) {
    .hero { grid-template-columns: minmax(0, 1fr); }
}

.hero-prompt { margin: 0 0 0.75rem; font: 500 0.85rem var(--font-mono); color: var(--muted); }
.hero-prompt::after { content: ""; display: inline-block; width: 0.55em; height: 1.1em; margin-left: 0.2em; vertical-align: -0.2em; background: var(--text); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* --- Console window (code blocks) ---
   Legacy content marks code as <div class="code"> (with <br>) or <pre>. site.js wraps each in
   .console with a title bar + copy button; without JS they still render as dark blocks. */
.site-content .code,
.site-content pre {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    font: 400 0.86rem/1.65 var(--font-mono);
    color: var(--console-text);
    background: var(--console-bg);
    border: 1px solid var(--console-border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    overflow-wrap: normal;
}
.site-content .code { white-space: nowrap; }
.site-content :not(pre) > code { padding: 0.1em 0.4em; font: 0.9em var(--font-mono); background: var(--surface-2); border-radius: 4px; }
.site-content .code pre { margin: 0.5rem 0; padding: 0; border: 0; background: none; overflow: visible; }
.site-content .code a { color: inherit; }

.console {
    margin: 1.5rem 0;
    color: var(--console-text);
    background: var(--console-bg);
    border: 1px solid var(--console-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.console-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.5rem 0.4rem 0.8rem;
    font: 500 0.72rem var(--font-mono);
    letter-spacing: 0.04em;
    color: var(--console-muted);
    background: var(--console-bar);
    border-bottom: 1px solid var(--console-border);
}
.console-dots {
    width: 44px;
    height: 10px;
    flex: none;
    background:
        radial-gradient(circle at 5px 5px, #8f8f8f 4.5px, transparent 5px),
        radial-gradient(circle at 22px 5px, #6c6c6c 4.5px, transparent 5px),
        radial-gradient(circle at 39px 5px, #4d4d4d 4.5px, transparent 5px);
}
.console-label { flex: 1; }
.site-content .console > .code,
.site-content .console > pre,
.console > pre {
    margin: 0;
    padding: 1rem 1.25rem;
    border: 0;
    border-radius: 0;
    background: none;
    font: 400 0.86rem/1.65 var(--font-mono);
    color: var(--console-text);
    overflow-x: auto;
}
.console > pre { white-space: pre; }
.console .prompt { color: var(--console-muted); }

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    font: 500 0.72rem var(--font-mono);
    color: var(--console-muted);
    background: none;
    border: 1px solid var(--console-border);
    border-radius: 5px;
    cursor: pointer;
}
.copy-btn:hover { color: var(--console-text); border-color: var(--console-muted); }
.copy-btn:focus-visible { outline-color: var(--console-text); }
.copy-btn .icon-check { display: none; }
.copy-btn.copied .icon-check { display: block; }
.copy-btn.copied .icon-copy { display: none; }

/* --- Media in content --- */
.site-content img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.site-content a:has(> img) { display: inline-block; margin: 0.5rem 0; border-radius: var(--radius-sm); }
.site-content a:has(> img):hover img { border-color: var(--border-strong); box-shadow: var(--shadow); }
.site-content iframe {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 1rem 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.site-content table { border-collapse: collapse; margin: 1.5rem 0; font-size: 0.95rem; }
.site-content td, .site-content th { padding: 0.4rem 0.75rem; border: 1px solid var(--border); vertical-align: top; }
.site-content ul, .site-content ol { padding-left: 1.4rem; }
.site-content li { margin: 0.25rem 0; }

/* --- Article pages --- */
.breadcrumb { margin-bottom: 1.75rem; font: 400 0.8rem var(--font-mono); color: var(--muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; list-style: none; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 0.5rem; color: var(--border-strong); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--text-2); }

.layout-article .site-content > article { padding-bottom: 2.5rem; border-bottom: 1px solid var(--border); }
.layout-article .site-content > article > h1 { margin-bottom: 1.5rem; }

.series-progress { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.25rem; font: 500 0.78rem var(--font-mono); color: var(--muted); }
.series-progress progress {
    flex: 1;
    height: 6px;
    appearance: none;
    border: 0;
    border-radius: 99px;
    background: var(--surface-2);
    overflow: hidden;
}
.series-progress progress::-webkit-progress-bar { background: var(--surface-2); }
.series-progress progress::-webkit-progress-value { background: var(--text); border-radius: 99px; }
.series-progress progress::-moz-progress-bar { background: var(--text); border-radius: 99px; }

.series-nav { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.series-nav a {
    padding: 0.6rem 1rem;
    font: 500 0.9rem var(--font-sans);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.series-nav a:hover { border-color: var(--text); background: var(--surface); }

/* --- 404 --- */
.not-found .console { margin-bottom: 2rem; }

/* --- Footer --- */
.site-footer { background: var(--surface); color: var(--text-2); font-size: 0.92rem; }
.site-footer::before { content: ""; display: block; height: 5px; background: var(--airmail); }
.footer-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
    gap: 2rem 3rem;
    padding-block: 2.5rem 2rem;
}
.footer-brand p { margin: 0.75rem 0 0; max-width: 32ch; color: var(--muted); }
.footer-brand .brand svg { width: 30px; height: 30px; }
.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.footer-nav h2 { margin: 0 0 0.6rem; font: 600 0.72rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.footer-nav ul { list-style: none; margin: 0; padding: 0; }
.footer-nav li { margin: 0.3rem 0; }
.footer-nav a, .footer-copy a { color: var(--text-2); text-decoration: none; }
.footer-nav a:hover, .footer-copy a:hover { color: var(--text); text-decoration: underline; }
.footer-copy { grid-column: 1 / -1; margin: 0; padding-top: 1.25rem; border-top: 1px solid var(--border); font: 400 0.78rem var(--font-mono); color: var(--muted); }
@media (max-width: 700px) {
    .footer-inner { grid-template-columns: minmax(0, 1fr); }
}

/* --- Styleguide page --- */
.sg-section { margin: 3rem 0; }
.sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; }
.sg-swatch { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; font: 400 0.72rem/1.4 var(--font-mono); }
.sg-swatch span { display: block; height: 56px; }
.sg-swatch code { display: block; padding: 0.4rem 0.5rem; color: var(--text-2); }
.sg-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.75rem; }
.sg-icons figure { margin: 0; padding: 1rem 0.5rem 0.6rem; text-align: center; border: 1px solid var(--border); border-radius: var(--radius-sm); font: 400 0.7rem var(--font-mono); color: var(--muted); }
.sg-icons .icon { display: block; width: 28px; height: 28px; margin: 0 auto 0.5rem; color: var(--text); }
.sg-logos { display: flex; flex-wrap: wrap; align-items: center; gap: 2rem; }
.sg-logos > svg { width: 96px; height: 96px; color: var(--text); }
.sg-logos img { width: 64px; height: 64px; border: 0; background: none; }
.sg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.sg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 760px) { .sg-grid { grid-template-columns: minmax(0, 1fr); } }

/* --- Motion & print --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .layout-cards .site-content > article:hover, .card:hover { transform: none; }
}

@media print {
    .site-header, .site-footer, .breadcrumb, .series-nav, .copy-btn, .skip-link, .theme-toggle { display: none !important; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .layout-cards .site-content { display: block; }
    .layout-cards .site-content > article, .card { break-inside: avoid; border: 0; padding: 0; }
    .layout-cards .site-content > article::before, .card::before { display: none; }
    .site-content .code, .site-content pre, .console { color: #000; background: #fff; border: 1px solid #999; }
    .console-bar { display: none; }
    .meta { transform: none; box-shadow: none; }
    a { color: #000; }
}
