@font-face {
    font-family: "Source Serif 4";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/source-serif-4/SourceSerif4-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "Source Serif 4";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/source-serif-4/SourceSerif4-Italic.woff2") format("woff2");
}

@font-face {
    font-family: "Source Serif 4";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/source-serif-4/SourceSerif4-Bold.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/inter/Inter-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/inter/Inter-Italic.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/inter/Inter-Bold.woff2") format("woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/jetbrains-mono/JetBrainsMono-Italic.woff2") format("woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/jetbrains-mono/JetBrainsMono-Bold.woff2") format("woff2");
}

:root {
    --bg: #fcfcfc;
    --fg: #141414;
    --accent-source: #141414;
    --accent: var(--accent-source);
    --accent-soft: #f1f0ee;
    --accent-line: #d9d7d3;
    --accent-ink: var(--accent-ink-light, #ffffff);
    --surface: #f7f6f2;
    --code-bg: #141414;
    --code-fg: #fcfcfc;
    /* Syntax colours for the always-dark code block. These are fallbacks for
       engines without color-mix; the @supports block near .prose pre adds a
       subtle tint from the user's accent. */
    --code-keyword: #e6b86a;
    --code-string: #a8c7a1;
    --code-number: #d9a066;
    --code-function: #86b9dc;
    --code-variable: #d7a6c4;
    --code-comment: #8a9698;
    --code-punct: #b4b4b4;
    --code-error: #e08585;
    --post-font: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
    --font-size: 17px;
    --content-width: 44rem;
    --muted: rgba(20, 20, 20, 0.62);
    --line: #141414;
    --button-bg: var(--accent);
    --button-fg: var(--accent-ink);
    --button-border: var(--accent);
    --button-hover-bg: var(--accent-soft);
    --button-hover-fg: var(--accent);
    --button-hover-border: var(--accent);
    --control-bg: var(--bg);
    --control-border: var(--line);
    --control-fg: var(--fg);
    --control-hover-bg: var(--accent-soft);
    --control-hover-border: var(--accent);
    --control-hover-fg: var(--accent);
    --link: var(--accent);
    --link-hover: var(--accent);
    --focus-ring: var(--accent);
    /* One radius scale for the whole site: `sm` for inline code, `md` for every
       surface and control, `pill` for badges and tags. */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-pill: 999px;
    --control-height: 2.75rem;
}

:root[data-theme="dark"] {
    --bg: #121212;
    --fg: #e9e7e3;
    --accent: color-mix(in srgb, var(--accent-source) 55%, #ffffff);
    --accent-soft: #1c1c1c;
    --accent-line: #3a3a3a;
    --accent-ink: var(--accent-ink-dark, #141414);
    --surface: #1b1b1b;
    --code-bg: #0b0b0b;
    --code-fg: #e9e7e3;
    --muted: rgba(233, 231, 227, 0.62);
    --line: #3b3b3b;
    --button-bg: #e9e7e3;
    --button-fg: #121212;
    --button-border: #e9e7e3;
    --button-hover-bg: #ffffff;
    --button-hover-fg: #121212;
    --button-hover-border: #ffffff;
    --control-bg: #222222;
    --control-border: #4a4a4a;
    --control-fg: var(--fg);
    --control-hover-bg: #2e2e2e;
    --control-hover-border: var(--accent);
    --control-hover-fg: var(--fg);
    --link: color-mix(in srgb, var(--accent) 55%, #ffffff);
    --link-hover: color-mix(in srgb, var(--accent) 30%, #ffffff);
    --focus-ring: #e9e7e3;
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --bg: #121212;
        --fg: #e9e7e3;
        --accent: color-mix(in srgb, var(--accent-source) 55%, #ffffff);
        --accent-soft: #1c1c1c;
        --accent-line: #3a3a3a;
        --accent-ink: var(--accent-ink-dark, #141414);
        --surface: #1b1b1b;
        --code-bg: #0b0b0b;
        --code-fg: #e9e7e3;
        --muted: rgba(233, 231, 227, 0.62);
        --line: #3b3b3b;
        --button-bg: #e9e7e3;
        --button-fg: #121212;
        --button-border: #e9e7e3;
        --button-hover-bg: #ffffff;
        --button-hover-fg: #121212;
        --button-hover-border: #ffffff;
        --control-bg: #222222;
        --control-border: #4a4a4a;
        --control-fg: var(--fg);
        --control-hover-bg: #2e2e2e;
        --control-hover-border: var(--accent);
        --control-hover-fg: var(--fg);
        --link: color-mix(in srgb, var(--accent) 55%, #ffffff);
        --link-hover: color-mix(in srgb, var(--accent) 30%, #ffffff);
        --focus-ring: #e9e7e3;
    }
}

/* Tinted surfaces derived from the chosen accent. Kept behind @supports so
   older engines keep the neutral fallbacks declared above. */
@supports (color: color-mix(in srgb, red, blue)) {
    :root {
        --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--bg));
        --accent-line: color-mix(in srgb, var(--accent) 32%, var(--bg));
    }
}

/* Older engines without color-mix fall back to a readable neutral accent
   instead of keeping the (usually dark) configured colour on a dark page. */
@supports not (color: color-mix(in srgb, red, blue)) {
    :root[data-theme="dark"] {
        --accent: #e9e7e3;
        --accent-ink: #141414;
        --link: #e9e7e3;
        --link-hover: #ffffff;
        --focus-ring: #e9e7e3;
    }

    @media (prefers-color-scheme: dark) {
        :root[data-theme="auto"] {
            --accent: #e9e7e3;
            --accent-ink: #141414;
            --link: #e9e7e3;
            --link-hover: #ffffff;
            --focus-ring: #e9e7e3;
        }
    }
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    scrollbar-color: var(--fg) var(--bg);
}

html[data-theme="dark"] {
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        color-scheme: dark;
    }
}

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

::placeholder {
    color: var(--muted);
    opacity: 1;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.65;
    /* Sticky footer: on short pages (empty blog, login, 404) the footer stays
       at the bottom of the viewport instead of floating mid-page. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* The font chosen in the admin settings is the reading font of the public
   site: titles, dates, navigation, footer and excerpts all follow it. The
   admin keeps the UI font. */
.area-public {
    font-family: var(--post-font);
    font-size: var(--font-size, 17px);
}

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--link-hover);
    text-decoration-thickness: 2px;
}

.wrap {
    width: min(100% - 2.5rem, var(--content-width, 44rem));
    margin-inline: auto;
}

/* Admin has an editor and a table, so it gets a wider canvas than the blog. */
.area-admin .wrap {
    width: min(100% - 2.5rem, 72rem);
}

.context-bar {
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 0.85rem;
}

.context-inner {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: space-between;
    padding-block: 0.5rem;
}

.context-admin {
    background: var(--fg);
    color: var(--bg);
}

.context-auth {
    background: var(--fg);
    border-bottom: 1px solid var(--line);
    color: var(--bg);
}

.context-preview {
    background: var(--fg);
    border-bottom: 1px solid var(--line);
    color: var(--bg);
}

.context-bar a {
    color: inherit;
}

.context-label {
    align-items: center;
    display: flex;
    gap: 0.5rem;
}

.context-badge {
    background: var(--bg);
    border: 1px solid currentColor;
    border-radius: var(--radius-pill);
    color: var(--fg);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.08rem 0.5rem;
    text-transform: uppercase;
}

.context-auth .context-badge,
.context-preview .context-badge {
    background: var(--bg);
    color: var(--fg);
}

.site-header {
    border-bottom: 1px solid var(--accent-line);
    margin-bottom: 3rem;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 1.1rem;
}

.brand {
    align-items: center;
    color: var(--fg);
    display: inline-flex;
    gap: 0.7rem;
    text-decoration: none;
}

.brand-text {
    display: inline-grid;
    gap: 0.1rem;
    grid-template-columns: max-content;
}

.brand-title {
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.brand-tagline {
    color: var(--muted);
    display: flex;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.56rem;
    font-weight: 400;
    justify-content: space-between;
    line-height: 1.2;
}

.brand-avatar {
    background: var(--accent);
    border: 1px solid var(--accent-line);
    border-radius: 50%;
    display: block;
    flex: 0 0 auto;
    height: 48px;
    padding: 3px;
    width: 48px;
}

.area-public .header-inner {
    padding-block: 0.75rem;
}

@media (max-width: 40rem) {
    .area-public .header-inner {
        padding-block: 0.6rem;
    }
}

nav {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.95rem;
}

.site-nav {
    align-items: center;
    margin-left: auto;
}

.site-nav a {
    align-items: center;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-pill);
    color: var(--fg);
    display: inline-flex;
    font-weight: 500;
    line-height: 1.2;
    padding: 0.3rem 0.7rem;
    text-decoration: none;
}

.site-nav a:hover {
    border-color: var(--accent);
    color: var(--link-hover);
    text-decoration: none;
}

.site-nav a[aria-current="page"] {
    background: var(--button-bg);
    border-color: var(--button-border);
    color: var(--button-fg);
}

.nav-links {
    display: contents;
}

.header-tools {
    align-items: center;
    align-self: center;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.95rem;
    gap: 0.85rem;
}

.header-tools .inline-form {
    display: inline-flex;
    margin: 0;
}

.header-tools .link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    display: inline-flex;
    font-weight: 500;
    line-height: 1.2;
    padding: 0.3rem 0.7rem;
    text-decoration: none;
    white-space: nowrap;
}

.header-tools .link:hover {
    border-color: var(--accent-line);
    color: var(--link-hover);
    text-decoration: none;
}

.locale-select-form {
    display: inline-flex;
    margin: 0;
}

.locale-select {
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: inline-flex;
    font-weight: 500;
    line-height: 1.2;
    padding: 0.3rem 0.7rem;
    position: relative;
    user-select: none;
}

.locale-select:hover {
    border-color: var(--accent-line);
    color: var(--link-hover);
}

.locale-select:focus-within {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.locale-select-text {
    pointer-events: none;
}

.locale-select select {
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    font-size: 1rem;
    height: 100%;
    inset: 0;
    min-height: 0;
    opacity: 0;
    padding: 0;
    position: absolute;
    width: 100%;
    z-index: 1;
}

.locale-fallback {
    align-items: center;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.locale-fallback a {
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.7rem;
    text-decoration: none;
}

.locale-fallback a:hover {
    background: var(--accent-soft);
}

.inline-form {
    display: inline;
    margin: 0;
}

button.link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--fg);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

button.danger {
    font-weight: 700;
}

main {
    /* Fill the space between the header and footer so short pages do not
       leave a gap below the footer. */
    flex: 1 0 auto;
    padding-bottom: 4rem;
}

.intro {
    margin-bottom: 2.5rem;
}

.intro h1,
h1 {
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin: 0 0 0.5rem;
}

.intro p {
    color: var(--muted);
    margin: 0;
}

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

.post-list li {
    border-top: 1px solid var(--line);
    padding-block: 1.4rem;
}

.post-list li:first-child {
    border-top: 0;
    padding-top: 0;
}

.post-list h2 {
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 0 0 0.25rem;
}

.post-list h2 a {
    color: var(--fg);
    text-decoration: none;
}

.post-list h2 a:hover {
    color: var(--link-hover);
    text-decoration: underline;
    text-decoration-color: var(--link-hover);
}

.post-list p {
    margin: 0.35rem 0 0;
}

.post-list .excerpt {
    font-family: var(--post-font);
}

.archive-link {
    margin-top: 2rem;
}

.table-search.search-form {
    margin: 0 0 2rem;
}

.search-results-title {
    font-size: 1.1rem;
    line-height: 1.3;
    margin: 0 0 0.25rem;
}

.search-results .meta {
    margin: 0 0 1rem;
}

.pagination {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.9rem;
    gap: 0.75rem 1rem;
    justify-content: space-between;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
}

.pagination a {
    font-weight: 600;
}

.pagination-count {
    background: var(--accent-soft);
    border-radius: var(--radius-pill);
    color: var(--accent);
    font-weight: 600;
    padding: 0.15rem 0.7rem;
}

.meta {
    color: var(--muted);
    font-size: 0.875rem;
}

.post header {
    margin-bottom: 2rem;
}

.post h1 {
    margin-bottom: 0.4rem;
}

.prose {
    font-family: var(--post-font);
    font-size: 1.06rem;
    overflow-wrap: break-word;
}

.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    line-height: 1.25;
    margin: 2.2rem 0 0.7rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre {
    margin: 0 0 1.15rem;
}

.prose blockquote {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--muted);
    margin-left: 0;
    padding: 0.85rem 1rem;
}

.prose img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0.35rem 0 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.post-cover {
    margin: 0 0 2rem;
}

.post-cover img {
    display: block;
    width: 100%;
    height: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.cover-preview {
    margin: 0.25rem 0 0.75rem;
}

.cover-preview img {
    display: block;
    width: 100%;
    max-width: 24rem;
    height: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.prose code {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--fg);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    padding: 0.12em 0.32em;
}

.prose pre {
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--code-fg);
    overflow-x: auto;
    padding: 1rem;
}

.prose pre code {
    background: none;
    border: 0;
    color: inherit;
    padding: 0;
    font-size: 0.85rem;
}

/* Prism tokens. A muted but clearly separated palette: gold keywords, sage
   strings, orange numbers, blue functions, rose variables and slate comments.
   Each hue gets a light tint from the site accent, so custom accents still
   influence the code without turning it into a stock rainbow theme. Scoped to
   prose so inline code and the admin guide are untouched. */
@supports (color: color-mix(in srgb, red, blue)) {
    :root {
        --code-keyword: color-mix(in srgb, var(--accent-source) 10%, #e6b86a);
        --code-string: color-mix(in srgb, var(--accent-source) 10%, #a8c7a1);
        --code-number: color-mix(in srgb, var(--accent-source) 10%, #d9a066);
        --code-function: color-mix(in srgb, var(--accent-source) 10%, #86b9dc);
        --code-variable: color-mix(in srgb, var(--accent-source) 10%, #d7a6c4);
    }
}

.prose pre .token.comment,
.prose pre .token.prolog,
.prose pre .token.doctype,
.prose pre .token.cdata,
.prose pre .token.shebang {
    color: var(--code-comment);
    font-style: italic;
}

.prose pre .token.punctuation,
.prose pre .token.operator {
    color: var(--code-punct);
}

.prose pre .token.keyword,
.prose pre .token.tag,
.prose pre .token.selector,
.prose pre .token.atrule,
.prose pre .token.builtin {
    color: var(--code-keyword);
}

.prose pre .token.string,
.prose pre .token.char,
.prose pre .token.attr-value,
.prose pre .token.regex,
.prose pre .token.entity,
.prose pre .token.url {
    color: var(--code-string);
}

.prose pre .token.number,
.prose pre .token.boolean,
.prose pre .token.constant,
.prose pre .token.symbol {
    color: var(--code-number);
}

.prose pre .token.function,
.prose pre .token.class-name,
.prose pre .token.attr-name {
    color: var(--code-function);
}

.prose pre .token.property,
.prose pre .token.variable,
.prose pre .token.parameter {
    color: var(--code-variable);
}

.prose pre .token.deleted {
    color: var(--code-error);
    text-decoration: line-through;
}

.prose pre .token.inserted {
    color: var(--code-string);
}

.prose pre .token.important,
.prose pre .token.bold {
    color: var(--code-keyword);
    font-weight: 700;
}

.prose pre .token.namespace {
    color: var(--code-comment);
}

.prose pre .token.italic {
    font-style: italic;
}

.prose hr {
    border: 0;
    border-top: 1px solid var(--accent-line);
    margin: 2rem 0;
}

.prose li::marker {
    color: var(--accent);
}

.back {
    margin-top: 3rem;
}

.flash {
    border-radius: var(--radius-md);
    margin: 0 0 2rem;
    padding: 0.8rem 1rem;
}

.flash-error {
    background: var(--fg);
    border: 1px solid var(--fg);
    color: var(--bg);
}

.flash-notice {
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--fg);
}

.error-list {
    margin: 0;
    padding-left: 1.2rem;
}

.empty {
    color: var(--muted);
    padding-block: 2rem;
}

.narrow {
    max-width: 24rem;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1.5rem;
}

.form-meta {
    align-items: start;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-meta-field {
    display: flex;
    flex: 1 1 12rem;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.form-meta-language {
    flex: 0 1 14rem;
}

.stack > label:not(.check),
.form-meta-field label {
    font-size: 0.9rem;
    font-weight: 600;
}

.translation-picker {
    margin: 0;
}

.translation-picker select {
    width: 100%;
}

.stack input[type="text"],
.stack input[type="password"],
.stack input[type="date"],
.stack select,
.stack textarea {
    width: 100%;
}

input,
select,
textarea {
    accent-color: var(--accent);
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    color: var(--control-fg);
    font: inherit;
    padding: 0.55rem 0.65rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
select {
    height: var(--control-height);
    line-height: 1.2;
    min-height: var(--control-height);
    padding-block: 0;
}

input:disabled {
    background: var(--accent-soft);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 1;
    -webkit-text-fill-color: var(--muted);
}

input[type="file"] {
    max-width: 100%;
}

::-webkit-calendar-picker-indicator {
    filter: grayscale(1);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
    -webkit-text-fill-color: var(--fg);
    caret-color: var(--fg);
}

textarea {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.55;
    resize: none;
    scrollbar-color: var(--muted) transparent;
    scrollbar-width: thin;
}

.textarea-ui {
    font: inherit;
}

textarea::-webkit-scrollbar {
    width: 0.65rem;
}

textarea::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-corner {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background: var(--muted);
    background-clip: content-box;
    border: 0.2rem solid transparent;
    border-radius: var(--radius-pill);
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

button,
.button {
    align-self: flex-start;
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    border-radius: var(--radius-md);
    color: var(--button-fg);
    cursor: pointer;
    display: inline-block;
    font: inherit;
    padding: 0.55rem 0.9rem;
    text-decoration: none;
}

button:hover,
.button:hover {
    background: var(--button-hover-bg);
    border-color: var(--button-hover-border);
    color: var(--button-hover-fg);
}

.button-secondary {
    background: var(--control-bg);
    border-color: var(--control-border);
    color: var(--control-fg);
}

.button-secondary:hover {
    background: var(--control-hover-bg);
    border-color: var(--control-hover-border);
    color: var(--control-hover-fg);
}

button.link:hover {
    background: none;
    color: var(--fg);
    text-decoration-thickness: 2px;
}

.form-actions {
    align-items: center;
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

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

.editor {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.editor-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.editor-toolbar-tools {
    display: none;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}

.editor-toolbar.is-enhanced .editor-toolbar-tools {
    display: flex;
}

.editor-toolbar .editor-js-only {
    display: none;
}

.editor-toolbar.is-enhanced .editor-js-only {
    display: inline-block;
}

.editor-toolbar button {
    align-self: auto;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    color: var(--control-fg);
    font-size: 0.82rem;
    line-height: 1.2;
    padding: 0.35rem 0.55rem;
}

.editor-toolbar button:hover {
    background: var(--control-hover-bg);
    border-color: var(--control-hover-border);
    color: var(--control-hover-fg);
    opacity: 1;
}

.editor-toolbar .editor-preview-post {
    background: var(--button-bg);
    border-color: var(--button-border);
    color: var(--button-fg);
}

.editor-toolbar.is-enhanced .editor-preview-post {
    margin-left: auto;
}

.editor-toolbar .editor-preview-post:hover {
    background: var(--button-hover-bg);
    border-color: var(--button-hover-border);
    color: var(--button-hover-fg);
    opacity: 1;
}

.editor-guide-panel {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
}

.editor-guide-panel[hidden] {
    display: none;
}

.editor-guide-panel:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.editor-guide-panel h2 {
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
}

.guide-list {
    display: grid;
    font-size: 0.9rem;
    gap: 0.35rem 1rem;
    grid-template-columns: 13rem minmax(0, 1fr);
    margin: 0 0 0.75rem;
}

.guide-list dt {
    overflow-wrap: normal;
    white-space: nowrap;
}

.guide-list dd {
    color: var(--muted);
    margin: 0;
}

.editor-guide-panel code {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--fg);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    padding: 0.1em 0.3em;
}

.editor-guide-panel .hint {
    margin-top: 0.5rem;
}

@media (max-width: 40rem) {
    .guide-list {
        gap: 0.15rem;
        grid-template-columns: 1fr;
    }

    .guide-list dd {
        margin-bottom: 0.4rem;
    }
}

.editor-source {
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    display: flex;
    height: 32rem;
    min-height: 0;
    overflow: hidden;
}

.editor-source textarea {
    border: 0;
    border-radius: 0;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    resize: none;
    width: 100%;
}

.editor-source:focus-within {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.editor-source textarea:focus {
    outline: none;
}

.editor-workspace {
    align-items: stretch;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.editor-preview {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    height: 32rem;
    min-height: 0;
    overflow: hidden;
}

.editor-preview-head {
    align-items: baseline;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.35rem 0.75rem;
    justify-content: space-between;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.8rem;
    text-transform: uppercase;
}

.editor-status {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.editor-status.is-error {
    color: var(--fg);
    font-weight: 700;
    text-decoration: underline;
}

.editor-preview-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
}

.editor-preview-body .prose {
    font-size: 1rem;
}

.editor-preview-body .prose > :first-child {
    margin-top: 0;
}

.editor-preview-body .prose > :last-child {
    margin-bottom: 0;
}

.preview-empty {
    color: var(--muted);
    font-style: italic;
    margin: 0;
}

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

    .editor-source {
        height: 28rem;
    }

    .editor-preview {
        height: 24rem;
    }
}

.admin-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-head h1 {
    margin: 0;
}

.admin-head .hint {
    margin-top: 0.25rem;
}

.admin-section {
    margin-top: 2.75rem;
}

.admin-section-head {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.admin-section-head h2 {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    margin: 0;
    text-transform: uppercase;
}

.admin-section-actions {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    justify-content: flex-end;
    min-width: 0;
}

.table-tools {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.table-search {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin: 0;
    min-width: 0;
}

.table-search input[type="search"] {
    flex: 1 1 14rem;
    min-width: 0;
}

.table-search select {
    flex: 0 1 auto;
    max-width: 12rem;
    min-width: 0;
}

.table-search select,
.table-search input[type="search"],
.table-search button {
    box-sizing: border-box;
    height: var(--control-height);
    min-height: var(--control-height);
    padding-block: 0;
}

.table-search select,
.table-search input[type="search"] {
    padding-inline: 0.55rem;
}

.table-search button {
    align-items: center;
    align-self: stretch;
    display: inline-flex;
    justify-content: center;
    padding-inline: 0.7rem;
}

.admin-head-title {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.admin-count {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.pagination .page-disabled {
    color: var(--muted);
}

.admin-cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--fg);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    height: 100%;
    padding: 1.15rem 1.2rem;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-card:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--fg);
    text-decoration: none;
}

.admin-card-kicker {
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.admin-card-meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.admin-card-desc {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 0.15rem;
}

.admin-table {
    border-collapse: collapse;
    font-size: 0.95rem;
    width: 100%;
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.65rem 0.5rem;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-table tbody tr:hover {
    background: var(--accent-soft);
}

.admin-table td:first-child {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin: 0;
    padding: 1rem 1.2rem 1.25rem;
}

.settings-fieldset legend {
    font-weight: 700;
    padding: 0 0.4rem;
}

.settings-fieldset > .hint {
    margin-top: 0.2rem;
}

.font-options {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    margin-top: 0.9rem;
}

.font-option {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: block;
    padding: 0.85rem 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.font-option:hover {
    border-color: var(--accent);
}

.font-option:has(input:checked) {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.font-option input {
    accent-color: var(--accent);
    margin-right: 0.35rem;
}

.font-option-name {
    font-weight: 700;
}

.font-option-preview {
    display: block;
    font-size: 1.05rem;
    line-height: 1.45;
    margin: 0.5rem 0 0.35rem;
}

.font-option .hint {
    display: block;
}

.color-row {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    margin-top: 0.9rem;
}

.color-row input[type="color"] {
    cursor: pointer;
    height: 2.75rem;
    padding: 0.2rem;
    width: 4.75rem;
}

.color-value {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
}

.language-options {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    margin-top: 0.9rem;
}

.language-options .check {
    align-items: center;
    display: flex;
    gap: 0.45rem;
}

.language-options input {
    accent-color: var(--accent);
}

.settings-nav {
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1.5rem 0 1rem;
    padding: 0.6rem 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.settings-nav a {
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--fg);
    font-size: 0.85rem;
    padding: 0.25rem 0.7rem;
    text-decoration: none;
}

.settings-nav a:hover {
    background: var(--button-bg);
    border-color: var(--button-border);
    color: var(--button-fg);
}

.settings-locale {
    align-items: center;
    display: flex;
    font-size: 0.85rem;
    gap: 0.45rem;
    margin-left: auto;
}

.settings-locale select {
    padding: 0.3rem 0.55rem;
}

.nav-block + .nav-block {
    margin-top: 0.9rem;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    scroll-margin-top: 4.5rem;
}

.settings-section > h2 {
    color: var(--accent);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    margin: 1rem 0 0;
    text-transform: uppercase;
}

.settings-grid {
    display: grid;
    gap: 0.9rem 1rem;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    margin-top: 0.9rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.field > span:first-child {
    font-size: 0.9rem;
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
}

.field-wide {
    grid-column: 1 / -1;
}

.field-inline {
    margin-top: 1rem;
    max-width: 24rem;
}

.check-grid {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    margin-top: 1rem;
}

.check {
    align-items: center;
    display: flex;
    gap: 0.45rem;
}

.check input {
    accent-color: var(--accent);
}

.settings-advanced-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    margin-top: 1rem;
}

.settings-advanced-grid .settings-fieldset {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.settings-advanced-grid h3 {
    font-size: 1rem;
    margin: 0;
}

.settings-advanced-grid .button,
.settings-advanced-grid button {
    align-self: flex-start;
}

.stat-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.stat {
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
}

.stat-value {
    color: var(--accent);
    display: block;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.stat-value-small {
    font-size: 1.05rem;
    padding-top: 0.45rem;
}

.stat-label {
    color: var(--muted);
    display: block;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.table-wrap {
    overflow-x: auto;
}

.posts {
    border-collapse: collapse;
    font-size: 0.95rem;
    width: 100%;
}



.posts th,
.posts td {
    border-bottom: 1px solid var(--line);
    padding: 0.7rem 0.5rem;
    text-align: left;
    vertical-align: middle;
}

.posts th {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.posts th:first-child {
    width: 55%;
}

.posts tbody tr:hover {
    background: var(--accent-soft);
}

.posts .actions {
    text-align: right;
    white-space: nowrap;
}

.posts .actions form {
    display: inline;
}

.posts .actions a,
.posts .actions button {
    align-items: center;
    align-self: center;
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-md);
    color: var(--control-fg);
    display: inline-flex;
    font-size: 0.85rem;
    justify-content: center;
    line-height: 1.2;
    min-height: 2.1rem;
    padding: 0.35rem 0.75rem;
    text-decoration: none;
}

.posts .actions a:hover,
.posts .actions button:hover {
    background: var(--control-hover-bg);
    border-color: var(--control-hover-border);
    color: var(--control-hover-fg);
    text-decoration: none;
}

.posts .actions .danger {
    font-weight: 700;
}

.posts .actions a + form {
    margin-left: 0.5rem;
}

.media-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
}

.media-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem;
}

.media-thumb {
    aspect-ratio: 16 / 9;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    display: block;
    overflow: hidden;
}

.media-thumb img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.media-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.media-kind {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.media-name {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.media-url {
    display: flex;
    gap: 0.4rem;
}

.media-url input {
    flex: 1 1 auto;
    font-size: 0.78rem;
    min-width: 0;
    padding: 0.35rem 0.45rem;
}

.media-url button[hidden] {
    display: none;
}

.media-delete {
    margin: 0;
}

.media-upload-form {
    margin: 0;
}

.media-upload-form.is-uploading {
    opacity: 0.6;
    pointer-events: none;
}

.media-modal {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--fg);
    max-height: min(80vh, 46rem);
    max-height: min(80dvh, 46rem);
    overflow: hidden;
    padding: 0;
    width: min(100% - 2rem, 52rem);
}

.media-modal[open] {
    display: flex;
    flex-direction: column;
}

.media-modal::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

.media-modal-inner {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 0;
    overflow: hidden;
    padding: 1rem;
}

.media-modal-head {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.media-modal-head h2 {
    font-size: 1.1rem;
    margin: 0;
}

.media-modal-head .link {
    font-size: 1.4rem;
    line-height: 1;
    text-decoration: none;
}

.media-picker {
    flex: 1 1 auto;
    min-height: 5rem;
    overflow-y: auto;
}

.media-picker-grid {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
}

.media-pick {
    align-self: stretch;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--fg);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.35rem;
    text-align: left;
}

.media-pick:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--fg);
}

.media-pick img {
    aspect-ratio: 16 / 9;
    display: block;
    height: auto;
    object-fit: cover;
    width: 100%;
}

.media-pick span {
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

.media-status.is-error {
    color: var(--fg);
    font-weight: 700;
}

.media-modal-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
}

.preview-confirm {
    width: min(100% - 2rem, 32rem);
}

.preview-confirm p {
    margin: 0;
}

.preview-confirm .media-modal-actions {
    justify-content: flex-end;
}

.site-footer {
    border-top: 2px solid var(--accent-line);
    color: var(--muted);
    font-size: 0.875rem;
    padding-block: 1.5rem;
    margin-top: 2rem;
}

.site-footer .wrap {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-social {
    align-items: baseline;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.footer-feed-group {
    align-items: baseline;
    display: inline-flex;
    gap: 0.5rem;
}

/* Keep the footer compact on phones: drop the "Built with …" note and the
   RSS link (with its separator). */
@media (max-width: 40rem) {
    .footer-note,
    .footer-note + span,
    .footer-feed-group {
        display: none;
    }
}

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

/* The admin header switches to two rows before the links would wrap: brand and
   account tools on top, then every section visible at once as a grid of large
   tap targets. No horizontal scrolling, so no link ends up off-screen. */
@media (max-width: 55rem) {
    .area-admin .header-inner {
        align-items: center;
        display: grid;
        gap: 0.4rem 0.75rem;
        grid-template-areas:
            "brand tools"
            "nav nav";
        grid-template-columns: minmax(0, 1fr) auto;
        padding-block: 0.7rem;
    }

    .area-admin .brand {
        grid-area: brand;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .area-admin .site-nav {
        grid-area: nav;
        margin-left: 0;
        min-width: 0;
        width: 100%;
    }

    .area-admin .header-tools {
        flex-wrap: nowrap;
        font-size: 0.9rem;
        gap: 0.4rem;
        grid-area: tools;
    }

    .area-admin .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        min-width: 0;
    }

    .area-admin .nav-links a,
    .area-admin .header-tools .locale-select,
    .area-admin .header-tools .link {
        align-items: center;
        display: inline-flex;
        min-height: 2.5rem;
    }

    .area-admin .nav-links a {
        background: var(--accent-soft);
        flex: 1 1 7rem;
        justify-content: center;
        padding: 0.35rem 0.55rem;
        text-align: center;
        white-space: nowrap;
    }

    .area-admin .nav-links a[aria-current="page"] {
        background: var(--button-bg);
    }
}

/* -------------------------------------------------------------------------
 * Small screens
 * ---------------------------------------------------------------------- */

@media (max-width: 40rem) {
    .wrap {
        width: min(100% - 2rem, 44rem);
    }

    /* The context bar keeps only the badge and a proper button: the long
       description wrapped under the link and made both hard to tap. */
    .context-inner {
        gap: 0.5rem;
        padding-block: 0.45rem;
    }

    /* Visually hidden, not removed: screen readers still announce the state. */
    .context-text {
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        height: 1px;
        overflow: hidden;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }

    .context-bar a {
        align-items: center;
        border: 1px solid currentColor;
        border-radius: var(--radius-pill);
        display: inline-flex;
        flex: 0 0 auto;
        justify-content: center;
        min-height: 2.25rem;
        padding: 0.1rem 0.8rem;
        text-decoration: none;
        white-space: nowrap;
    }

    /* Settings section index: six balanced tap targets in two rows instead of
       a sticky bar that wrapped into three cramped lines and covered the form.
       It is a static index on phones, so the sections keep the whole screen. */
    .settings-nav {
        display: grid;
        gap: 0.4rem;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin: 1.25rem 0 0.5rem;
        padding-block: 0.5rem;
        position: static;
    }

    .settings-nav a {
        align-items: center;
        background: var(--accent-soft);
        border-color: transparent;
        display: inline-flex;
        font-size: 0.82rem;
        justify-content: center;
        min-height: 2.5rem;
        padding: 0.3rem 0.25rem;
        text-align: center;
        white-space: nowrap;
    }

    .settings-locale {
        flex-wrap: wrap;
        grid-column: 1 / -1;
        justify-content: space-between;
        margin-left: 0;
        margin-top: 0.2rem;
    }

    .settings-locale select {
        flex: 1 1 8rem;
    }

    .settings-section {
        scroll-margin-top: 1rem;
    }

    .site-header {
        margin-bottom: 2rem;
    }

    .header-inner {
        gap: 0.4rem 1rem;
        padding-block: 0.75rem;
    }

    nav {
        gap: 0.15rem 0.85rem;
    }

    /* iOS zooms the page when a field below 16px gets focus: the editor and
       the media URLs are the only small fields on the site. */
    textarea,
    .media-url input {
        font-size: 1rem;
    }

    button,
    .button,
    summary,
    nav a,
    .pagination a,
    .posts .actions a,
    .posts .actions button,
    .media-url button {
        touch-action: manipulation;
    }

    /* Comfortable touch targets. Nav links can be slightly shorter than
       buttons so the header does not take over the screen. */
    nav a,
    nav button.link,
    .admin-section-actions > a,
    .locale-select,
    .back a,
    .archive-link a {
        align-items: center;
        display: inline-flex;
        min-height: 2.5rem;
    }

    button.link,
    .editor-toolbar button,
    .posts .actions a,
    .posts .actions button,
    .media-url button,
    .pagination a,
    .form-actions a,
    .form-actions button {
        align-items: center;
        display: inline-flex;
        min-height: 2.75rem;
    }

    .admin-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-head .button {
        text-align: center;
        width: 100%;
    }

    .table-tools,
    .admin-section-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 0.5rem;
    }

    .table-search {
        align-items: stretch;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
    }

    .table-search-filter {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .table-search select {
        max-width: 9rem;
        width: 100%;
    }

    .table-search input[type="search"] {
        flex-basis: auto;
        width: 100%;
    }

    .table-search a {
        grid-column: 1 / -1;
    }

    .editor {
        position: relative;
    }

    .editor-source {
        height: 24rem;
    }

    .editor-source textarea {
        padding-bottom: 3.75rem;
    }

    .editor-preview {
        display: none;
    }

    .editor-toolbar .editor-preview-post {
        bottom: 0.75rem;
        margin-left: 0;
        position: absolute;
        right: 0.75rem;
        z-index: 2;
    }

    .editor-toolbar button,
    .media-modal-head .link {
        justify-content: center;
        min-width: 2.75rem;
    }

    .editor-toolbar button {
        padding: 0.55rem 0.65rem;
    }

    .editor-preview-body,
    .media-picker {
        overscroll-behavior: contain;
    }

    /* Four table columns cannot breathe on a phone: each post becomes a card
       with labelled rows for date and status. */
    .posts thead {
        display: none;
    }

    .posts,
    .posts tbody,
    .posts tr,
    .posts td {
        display: block;
        width: 100%;
    }

    .posts tr {
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        margin-bottom: 0.9rem;
        padding: 0.9rem 1rem;
    }

    .posts td {
        border: 0;
        display: grid;
        gap: 0.5rem;
        grid-template-columns: 5.25rem minmax(0, 1fr);
        padding: 0.2rem 0;
    }

    .posts td::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        padding-top: 0.12rem;
        text-transform: uppercase;
    }

    .posts td:first-child {
        color: var(--fg);
        font-size: 1.05rem;
        font-variant-numeric: normal;
        line-height: 1.3;
        padding-bottom: 0.55rem;
        white-space: normal;
    }

    .posts td:first-child::before {
        content: none;
    }

    .posts td:first-child a {
        font-weight: 700;
    }

    .posts .actions {
        align-items: stretch;
        border-top: 1px solid var(--line);
        display: flex;
        gap: 0.5rem;
        justify-content: stretch;
        margin-top: 0.55rem;
        padding-top: 0.55rem;
        text-align: left;
        white-space: normal;
    }

    .posts .actions::before {
        content: none;
    }

    .posts .actions > a,
    .posts .actions > form {
        flex: 1 1 0;
        min-width: 0;
    }

    .posts .actions > form button {
        width: 100%;
    }

    .posts .actions a + form {
        margin-left: 0;
    }

    .form-meta {
        align-items: stretch;
        flex-direction: column;
    }

    .form-meta-field {
        flex: 0 0 auto;
    }

    .form-actions {
        align-items: center;
        flex-wrap: wrap;
        gap: 0.75rem 1rem;
    }
}

@media (max-width: 34rem) {
    .header-inner {
        align-items: center;
        flex-wrap: wrap;
    }

    nav {
        flex-wrap: wrap;
    }
}

/* -------------------------------------------------------------------------
 * Home: terminal hero and sidebar
 * ---------------------------------------------------------------------- */

/* Subtle accent glow in the dark theme. */
:root[data-theme="dark"] body.area-public {
    background-image: radial-gradient(circle at 100% 100%, rgba(175, 175, 255, 0.08) 0%, transparent 45%);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

@media (max-width: 40rem) {
    :root[data-theme="dark"] body.area-public {
        background-attachment: scroll;
    }
}

.terminal {
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.55);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    margin: 0 0 3rem;
    overflow: hidden;
}

.terminal__bar {
    background: var(--code-bg);
    border-bottom: 1px solid var(--accent-line);
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
}

.terminal__dot {
    border-radius: 50%;
    height: 11px;
    width: 11px;
}

.bg-red { background: #ff5f56; }
.bg-yellow { background: #ffbd2e; }
.bg-green { background: #27c93f; }

.terminal__body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.1rem 1.15rem 1.25rem;
}

.cmd-line {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.cmd-prompt {
    color: var(--accent);
    font-weight: 700;
}

.cmd-input {
    animation: typing 1s steps(12, end) forwards, caret 0.75s step-end 2 forwards;
    border-right: 0.6em solid currentColor;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
}

.cmd-output {
    animation: fade-in 0.6s ease forwards;
    animation-delay: 1.5s;
    opacity: 0;
}

.cmd-output p {
    margin: 0 0 0.75rem;
}

.terminal-list {
    color: var(--muted);
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.terminal-list li {
    line-height: 1.7;
}

.cursor-block {
    animation: blink 1s infinite;
    background: var(--fg);
    display: inline-block;
    height: 1.1em;
    width: 0.55em;
}

.cmd-line[hidden] {
    display: none;
}

.cmd-command-text {
    color: var(--fg);
    min-width: 0;
    overflow-wrap: anywhere;
}

@keyframes typing {
    from { width: 0; }
    to { width: 12ch; }
}

@keyframes caret {
    from, to { border-color: transparent; }
    50% { border-color: currentColor; }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .cmd-input,
    .cmd-output,
    .cursor-block {
        animation: none;
        border-right: 0;
        opacity: 1;
        width: auto;
    }
}

.home-grid {
    display: grid;
    gap: 3rem;
    grid-template-columns: minmax(0, 1fr);
}

.home-main {
    min-width: 0;
}

.home-heading {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 1.1rem;
    text-transform: uppercase;
}

.home-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 56rem) {
    .home-grid {
        gap: 2.5rem;
        grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr);
    }

    .home-sidebar {
        align-self: start;
        position: sticky;
        top: 1.5rem;
    }
}

.panel {
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
}

.panel-header {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
}

.panel-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.panel-list a {
    text-decoration: none;
}

.panel-list a:hover {
    text-decoration: underline;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.badge {
    background: var(--bg);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-pill);
    color: var(--muted);
    display: inline-block;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    padding: 0.18rem 0.55rem;
}

/* Compact search card in the home sidebar. */
.home-search {
    margin: 0;
    padding: 0.85rem 1rem;
}

.home-search-form {
    display: flex;
    gap: 0.5rem;
    margin: 0;
}

.home-search-form input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
}

.home-search-form input,
.home-search-form button {
    height: var(--control-height);
    min-height: var(--control-height);
}

.home-search-form button {
    align-self: stretch;
}

.home-search-submit {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
    padding: 0;
    width: var(--control-height);
}

.home-search-submit svg {
    display: block;
    height: 1.1rem;
    width: 1.1rem;
}
