:root {
    color-scheme: light dark;
    --background: #f7f4ed;
    --text: #24231f;
    --muted: #69665e;
    --border: #d9d4ca;
    --accent-decoration: color-mix(in srgb, var(--accent), var(--text) 50%);
    --code-background: #ebe7df;
    --selection: color-mix(in srgb, var(--accent) 24%, var(--background));
    --focus: #35678d;
    --content-width: 72rem;
    --reading-width: 40rem;
    --wide-width: 54rem;
    --gh-font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --gh-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-family: var(--gh-font-body);
    font-synthesis: none;
}

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

html {
    background: var(--background);
    color: var(--text);
    font-size: clamp(16px, 0.3vw + 15px, 18px);
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    line-height: 1.7;
}

::selection {
    background: var(--selection);
}

a {
    color: var(--text);
    text-decoration-color: var(--accent-decoration);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--text);
    text-decoration-thickness: 0.14em;
}

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

/* The skip link moves focus to <main> (tabindex="-1") to reposition keyboard
   users. It is a landing spot, not an interactive control, so it does not need
   a focus ring around the whole content area. */
.main-content:focus {
    outline: none;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
input,
textarea,
select {
    font: inherit;
}

/* Content for assistive technology only: removed from view but still announced
   by screen readers (e.g. a heading that gives link posts a navigable landmark). */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.55rem 0.8rem;
    transform: translateY(-200%);
    background: var(--text);
    color: var(--background);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-shell {
    width: min(calc(100% - 3rem), var(--content-width));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    padding: clamp(1.5rem, 4vw, 3rem) 0 1.25rem;
}

.site-identity {
    min-width: 0;
}

.site-title {
    color: var(--text);
    font-size: clamp(1.05rem, 1vw + 0.8rem, 1.3rem);
    font-weight: 680;
    letter-spacing: -0.025em;
    text-decoration: none;
}

.site-description {
    max-width: 38rem;
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.site-nav {
    display: flex;
    align-items: flex-start;
    gap: 1.4rem;
    flex: 0 1 auto;
    font-size: 0.82rem;
}

.site-nav .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem 1.4rem;
    margin: 0;
    padding: 0.15rem 0 0;
    list-style: none;
}

/* The member-aware control below replaces static Portal navigation entries. */
.site-nav .nav-subscribe,
.site-nav .nav > li:has(> a[href^="#/portal"]) {
    display: none;
}

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

.site-nav .nav-current a {
    color: var(--text);
    font-weight: 680;
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
    text-decoration-thickness: 0.14em;
    text-underline-offset: 0.3em;
}

.site-nav a:hover {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
    text-decoration-thickness: 0.14em;
    text-underline-offset: 0.3em;
}

.site-search,
.error-actions button {
    margin: 0;
    padding: 0.15rem 0 0;
    border: 0;
    background: transparent;
    color: var(--text);
    line-height: inherit;
    cursor: pointer;
}

.site-search:hover,
.error-actions button:hover {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
    text-decoration-thickness: 0.14em;
    text-underline-offset: 0.3em;
}

.site-nav .site-member-link {
    flex: 0 0 auto;
    padding-top: 0.15rem;
    color: var(--text);
    text-decoration: none;
}

.site-nav .site-member-link:hover {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
    text-decoration-thickness: 0.14em;
    text-underline-offset: 0.3em;
}

.mobile-menu {
    display: none;
}

.main-content {
    min-height: 55vh;
    padding-block: clamp(2.25rem, 6vw, 5rem);
}

.listing-main {
    width: min(100%, var(--wide-width));
    margin-inline: auto;
}

.archive-header {
    max-width: var(--reading-width);
    margin-bottom: clamp(1.25rem, 3vw, 2.5rem);
}

.latest-writing-header {
    width: min(100%, var(--reading-width));
    max-width: none;
    margin: 0 auto clamp(1.75rem, 4vw, 3rem);
}

.archive-header h1,
.article-header h1 {
    margin: 0;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    font-weight: 690;
    font-family: var(--gh-font-heading);
    line-height: 1.16;
    letter-spacing: -0.035em;
    /* Fill each line out to the edge while avoiding a stranded last word.
       (balance was deliberately holding the first line short to even the two
       lines, which left a lot of empty space to the right of the title.) */
    text-wrap: pretty;
}

.archive-header > p:last-child {
    margin: 0.55rem 0 0;
    color: var(--muted);
}

.archive-kicker {
    margin: 0 0 0.2rem;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.archive-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.archive-profile img {
    width: 4rem;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
}

.post-list {
    border-top: 1px solid var(--border);
}

.home-main .post-list,
.home-main .pagination {
    width: min(100%, var(--reading-width));
    margin-inline: auto;
}

.home-main .post-list {
    border-top: 0;
}

.post-list-item {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 1rem 1.75rem;
    align-items: start;
    padding: clamp(1.2rem, 2.5vw, 1.8rem) 0;
    border-bottom: 1px solid var(--border);
}

.home-main .post-list-item:last-child,
.home-main .empty-state {
    border-bottom: 0;
}

/* Start the first post flush under the heading, so content begins at the same
   position as on the About/Contact pages (their body text starts immediately
   under the title). Later posts keep their padding for even divider spacing. */
.home-main .post-list-item:first-child {
    padding-top: 0;
}

@media (min-width: 701px) {
    .home-main .post-list-item {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-main .post-list-item > time {
        grid-column: 1;
        grid-row: 1;
        padding-top: 0;
    }

    .home-main .post-list-content {
        grid-column: 1;
        grid-row: 2;
    }

}

.post-list-item > time {
    padding-top: 0.24rem;
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.post-list-content h2 {
    margin: 0;
    font-size: clamp(1.05rem, 1.1vw + 0.8rem, 1.35rem);
    font-weight: 650;
    font-family: var(--gh-font-heading);
    line-height: 1.3;
    letter-spacing: -0.02em;
}

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

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

.post-list-content p {
    max-width: 42rem;
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

/* Link posts render their commentary inline in the feed (linked-list style).
   Reusing .gh-content preserves the first-paragraph source link's bold + arrow
   treatment; this gives the commentary full-strength body text instead of the
   muted excerpt color. */
.post-list-content.gh-content > p {
    max-width: none;
    margin: 0 0 0.9em;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* In the compact feed, drop the source paragraph's divider and heavy spacing
   (that treatment belongs on the full post page, not in the list). */
.link-post .post-list-content.gh-content > p:first-child {
    margin-bottom: 0.9em;
    padding-bottom: 0;
    border-bottom: 0;
}

/* Date and permalink share one meta line above a link post's blurb. */
.post-list-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: baseline;
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.post-list-permalink {
    display: inline-block;
    padding-block: 0.25rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.empty-state {
    padding: 2rem 0;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.archive-list {
    width: min(100%, var(--reading-width));
    margin-inline: auto;
    border-top: 0;
}

.archive-list .empty-state {
    border-bottom: 0;
}

.archive-month {
    margin: 0;
    padding: 1.75rem 0 0.45rem;
    font-family: var(--gh-font-heading);
    font-size: clamp(1.1rem, 0.5vw + 1rem, 1.2rem);
    font-weight: 680;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.archive-month:first-child {
    padding-top: 0;
}

.archive-list-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.6rem;
    padding: 0.55rem 0;
}

.archive-list-item time {
    color: var(--muted);
    font-size: 0.76rem;
    white-space: nowrap;
}

.archive-list-item h3 {
    margin: 0;
    font-family: var(--gh-font-heading);
    font-size: clamp(0.95rem, 0.4vw + 0.88rem, 1.05rem);
    font-weight: 620;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

.archive-list-item h3 a {
    color: var(--text);
    text-decoration: none;
}

.archive-list-item h3 a:hover {
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
}

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.pagination a {
    text-decoration: none;
}

.pagination .older-posts {
    justify-self: end;
}

.article-header,
.gh-content {
    width: min(100%, var(--reading-width));
    margin-inline: auto;
}

.article-header {
    margin-bottom: clamp(1.75rem, 4vw, 3rem);
}

.article-kind {
    margin: 0 0 0.25rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    row-gap: 0.25rem;
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.article-meta a {
    text-decoration: none;
}

.article-meta-item {
    white-space: nowrap;
}

.article-meta-item::before {
    content: "\00b7";
    display: inline-block;
    margin-inline: 0.55rem;
    color: var(--muted);
}

.article-feature {
    width: min(100%, var(--wide-width));
    margin: 0 auto clamp(2rem, 5vw, 3.5rem);
}

.article-feature-media {
    display: flex;
    justify-content: center;
}

.article-feature-media img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 42rem;
    background: var(--code-background);
    object-fit: contain;
}

figcaption {
    margin-top: 0.6rem;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.45;
    text-align: center;
}

.article-feature figcaption {
    max-width: var(--reading-width);
    margin-inline: auto;
}

.gh-content {
    font-size: 1rem;
}

.gh-content > * {
    margin-block: 0 1.45em;
}

.gh-content > * + h2,
.gh-content > * + h3,
.gh-content > * + h4 {
    margin-top: 2.2em;
}

.gh-content h2 {
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.gh-content h3 {
    font-size: clamp(1.15rem, 1.5vw, 1.3rem);
    line-height: 1.35;
}

.gh-content h4 {
    font-size: 1rem;
}

.gh-content h2,
.gh-content h3,
.gh-content h4 {
    margin-bottom: 0.65em;
    font-weight: 680;
    font-family: var(--gh-font-heading);
    text-wrap: balance;
}

.gh-content p,
.gh-content li {
    overflow-wrap: break-word;
}

.gh-content ul,
.gh-content ol {
    padding-left: 1.35rem;
}

.gh-content li + li {
    margin-top: 0.35em;
}

.gh-content blockquote {
    margin-inline: 0;
    padding: 0.15rem 0 0.15rem 1.15rem;
    border-left: 3px solid var(--accent-decoration);
    color: var(--muted);
    font-size: 1.02rem;
}

.gh-content blockquote p:last-child {
    margin-bottom: 0;
}

.link-post .gh-content > p:first-child {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
}

.link-post .gh-content > p:first-child a {
    color: var(--text);
    font-weight: 650;
    text-decoration-color: var(--accent-decoration);
}

.link-post .gh-content > p:first-child a::after {
    /* The trailing "/ ''" gives this decorative arrow an empty accessible name,
       so screen readers do not announce it as "up-right arrow". */
    content: " \2197" / "";
}

.gh-content hr {
    width: 35%;
    margin: 3rem auto;
    border: 0;
    border-top: 1px solid var(--border);
}

.gh-content pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    background: var(--code-background);
    font-size: 0.82rem;
    line-height: 1.55;
    tab-size: 4;
}

.gh-content code,
.gh-content kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.88em;
}

.gh-content :not(pre) > code {
    padding: 0.12em 0.3em;
    background: var(--code-background);
}

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.gh-content .kg-table-card {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.gh-content .kg-table-card table {
    width: max-content;
    min-width: 100%;
}

.gh-content th,
.gh-content td {
    padding: 0.65rem;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.gh-content th {
    background: var(--code-background);
}

/* Wide Ghost editor cards leave the reading column without overwhelming it. */
.gh-content .kg-width-wide {
    width: min(var(--wide-width), calc(100vw - 3rem));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.gh-content .kg-width-full {
    width: calc(100vw - 1rem);
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.kg-image-card img,
.kg-gallery-image img {
    width: 100%;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kg-gallery-row {
    display: flex;
    gap: 0.5rem;
}

.kg-gallery-image {
    flex: 1;
}

.kg-gallery-image img {
    height: 100%;
    object-fit: cover;
}

.kg-bookmark-card a.kg-bookmark-container {
    display: flex;
    min-height: 9rem;
    overflow: hidden;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.kg-bookmark-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: 1rem;
}

.kg-bookmark-title {
    font-weight: 680;
    line-height: 1.35;
}

.kg-bookmark-description {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: auto;
    padding-top: 0.75rem;
    color: var(--muted);
    font-size: 0.72rem;
}

.kg-bookmark-icon {
    width: 1rem;
    height: 1rem;
}

.kg-bookmark-thumbnail {
    flex: 0 0 34%;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kg-embed-card {
    overflow: hidden;
}

.kg-embed-card iframe {
    max-width: 100%;
}

.kg-callout-card {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    background: var(--code-background);
}

.kg-callout-emoji {
    flex: 0 0 auto;
}

.kg-toggle-card {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.kg-toggle-heading {
    cursor: pointer;
    font-weight: 680;
}

.kg-file-card-container,
.kg-product-card-container {
    padding: 1rem;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.kg-button-card .kg-btn {
    display: inline-block;
    padding: 0.65rem 1rem;
    background: var(--text);
    color: var(--background);
    font-weight: 650;
    text-decoration: none;
}

.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: min(100%, var(--wide-width));
    margin: clamp(2.5rem, 7vw, 5rem) auto 0;
}

.post-navigation > div:last-child {
    text-align: right;
}

.post-navigation span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post-navigation a {
    display: inline-block;
    margin-top: 0.2rem;
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.4;
    text-decoration: none;
}

.post-navigation a:hover {
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
}

.site-footer {
    padding: 1.25rem 0 2.5rem;
    color: var(--muted);
    font-size: 0.76rem;
}

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

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: inherit;
}

.site-footer-primary > p a,
.site-footer-rss a {
    text-decoration: none;
}

.site-footer-primary > p a:hover,
.site-footer-rss a:hover {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
}

.site-social-links,
.author-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.site-social-links:empty,
.author-social-links:empty {
    display: none;
}

.site-social-links {
    justify-content: flex-end;
}

.site-social-links a,
.author-social-links a {
    text-decoration: none;
}

/* Give the footer links a taller tap area (>=24px) without changing their look.
   The padding is symmetric, so it does not disturb the stacked footer spacing. */
.site-social-links a,
.site-footer-rss a {
    display: inline-block;
    padding-block: 0.2rem;
}

.site-social-links a:hover,
.author-social-links a:hover {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
}

.author-social-links {
    margin-top: 0.5rem;
    font-size: 0.78rem;
}

.site-secondary-nav {
    min-width: 0;
}

.site-secondary-nav .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-secondary-nav a {
    text-decoration: none;
}

.site-secondary-nav a:hover,
.site-secondary-nav .nav-current a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
}

.site-secondary-nav .nav-current a {
    font-weight: 680;
}

.site-footer-links {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.25rem 1rem;
    margin-left: auto;
}

/* The whole picker is a <details>: a "Theme" trigger that opens a small popover
   panel holding the three control groups (appearance + light/dark flavors). */
.theme-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.theme-picker[hidden] {
    display: none;
}

/* A quiet vertical rule sets the theme control apart from the footer links. */
.theme-picker::before {
    content: "";
    width: 1px;
    height: 1em;
    margin-inline-end: 0.8rem;
    background: var(--border);
}

.theme-picker-trigger {
    display: inline-flex;
    align-items: center;
    min-height: 1.9rem;
    color: var(--muted);
    font-size: 0.72rem;
    list-style: none;
    cursor: pointer;
}

.theme-picker-trigger::-webkit-details-marker {
    display: none;
}

.theme-picker-trigger::after {
    content: " \203a" / ""; /* › — decorative; empty alt so screen readers skip it */
    margin-inline-start: 0.35rem;
    transition: transform 0.15s ease;
}

.theme-picker[open] .theme-picker-trigger,
.theme-picker-trigger:hover {
    color: var(--text);
}

.theme-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.6rem);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 12.5rem;
    padding: 0.95rem 1.05rem;
    text-align: left;
    background: var(--code-background);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.theme-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.theme-group-label {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.theme-group-options {
    display: flex;
    gap: 1rem;
}

.theme-option {
    margin: 0;
    /* Vertical padding gives each option a comfortable (>=24px) tap target. */
    padding: 0.35rem 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.2;
    cursor: pointer;
}

.theme-option:hover {
    color: var(--text);
}

.theme-option[aria-pressed="true"] {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
    text-decoration-thickness: 0.12em;
    text-underline-offset: 0.28em;
}

.error-page {
    max-width: var(--reading-width);
    margin-inline: auto;
}

.error-page h1 {
    margin: 0;
    font-family: var(--gh-font-heading);
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    line-height: 1.16;
    letter-spacing: -0.035em;
}

.error-page > p:not(.archive-kicker) {
    margin: 0.65rem 0 0;
    color: var(--muted);
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 1.5rem;
    font-size: 0.86rem;
}

.error-actions a {
    text-decoration: none;
}

.error-actions button {
    padding: 0;
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
    text-underline-offset: 0.18em;
}

.recommendations-list {
    width: min(100%, var(--reading-width));
    margin: 0;
    margin-inline: auto;
    padding: 0;
    border-top: 1px solid var(--border);
    list-style: none;
}

.recommendation-item {
    border-bottom: 1px solid var(--border);
}

.recommendation-item > a {
    display: grid;
    grid-template-columns: minmax(10rem, 0.6fr) minmax(8rem, 0.4fr) minmax(14rem, 1fr);
    gap: 1rem 1.75rem;
    align-items: baseline;
    padding: 1.1rem 0;
    color: var(--text);
    text-decoration: none;
}

.recommendation-item > a:hover .recommendation-title {
    text-decoration: underline;
    text-decoration-color: var(--accent-decoration);
}

.recommendation-title {
    font-family: var(--gh-font-heading);
    font-weight: 650;
    line-height: 1.35;
}

.recommendation-url {
    color: var(--muted);
    font-size: 0.74rem;
    overflow-wrap: anywhere;
}

.recommendation-description {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

/* The footer holds more than the nav (copyright, socials, RSS, theme toggle),
   so it needs more room before it stacks. It switches to a centered column
   earlier than the 700px nav breakpoint to avoid a cramped middle width. */
/* Phones: stack the footer into a centered column. Above this, the footer is a
   content-driven row that stays on one line until it genuinely no longer fits,
   then drops to two (copyright, then the links group) — never three. */
@media (max-width: 700px) {
    .site-footer-primary {
        flex-direction: column;
        align-items: center;
        gap: 0.65rem;
        text-align: center;
    }

    .site-secondary-nav {
        width: 100%;
    }

    .site-secondary-nav .nav {
        justify-content: center;
    }

    .site-footer-links {
        position: relative;
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        margin-left: 0;
        gap: 0.35rem 1rem;
    }

    /* Anchor the phone popover to the full footer-links row, not the small
       Theme trigger, so wrapped footer controls cannot push it off-screen. */
    .theme-picker {
        position: static;
    }

    .theme-panel {
        right: 0;
        left: 0;
        width: min(100%, 15rem);
        min-width: 0;
        margin-inline: auto;
        transform: none;
    }

    .site-social-links {
        justify-content: center;
    }
}

@media (max-width: 700px) {
    .site-shell {
        width: min(calc(100% - 2rem), var(--content-width));
    }

    /* On phones the footer links can wrap; drop the rule so a stray "|" never
       leads a wrapped line. */
    .theme-picker::before {
        display: none;
    }

    .site-header {
        position: relative;
        display: block;
        padding-top: 1.15rem;
    }

    .site-description {
        margin-top: 0.35rem;
    }

    .site-nav-desktop {
        display: none;
    }

    .mobile-menu {
        display: block;
        font-size: 0.82rem;
    }

    .mobile-menu summary {
        position: absolute;
        top: 1.15rem;
        right: 0;
        padding: 0.15rem 0;
        color: var(--text);
        cursor: pointer;
        list-style: none;
    }

    .mobile-menu summary::-webkit-details-marker {
        display: none;
    }

    .mobile-menu summary:hover {
        color: var(--muted);
    }

    .mobile-menu summary:focus-visible {
        outline: 3px solid var(--focus);
        outline-offset: 3px;
    }

    .site-nav-mobile {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.35rem;
        margin-top: 1rem;
        padding: 1rem 0 0;
    }

    .site-nav-mobile .nav {
        display: contents;
    }

    .site-nav-mobile .nav > li > a,
    .site-nav-mobile .site-search,
    .site-nav-mobile .site-member-link {
        display: inline-block;
        padding: 0.45rem 0;
        text-align: right;
    }

    .main-content {
        padding-block: 2.25rem 3.25rem;
    }

    .post-list-item {
        grid-template-columns: 1fr;
        gap: 0.2rem 1rem;
        padding-block: 1.2rem;
    }

    .post-list-item > time {
        grid-column: 1;
        grid-row: 1;
        padding: 0;
    }

    .post-list-content {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .post-list-content p {
        font-size: 0.86rem;
    }

    .archive-list-item {
        gap: 0.15rem 0.6rem;
        padding-block: 0.85rem;
    }

    .archive-month {
        margin-left: 0;
        padding-top: 1.5rem;
    }

    .archive-month:first-child {
        padding-top: 0;
    }

    .article-meta {
        font-size: 0.74rem;
    }

    .gh-content > .kg-image-card:not(.kg-width-wide):not(.kg-width-full) {
        margin-inline: 0;
    }

    .gh-content .kg-width-wide,
    .gh-content .kg-width-full {
        width: calc(100vw - 2rem);
    }

    .kg-bookmark-thumbnail {
        display: none;
    }

    .post-navigation {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .post-navigation > div:last-child {
        text-align: left;
    }

    .recommendation-item > a {
        grid-template-columns: 1fr;
        gap: 0.12rem;
        padding-block: 1rem;
    }

    .recommendation-title {
        grid-column: 1;
        grid-row: 1;
    }

    .recommendation-url {
        grid-column: 1;
        grid-row: 2;
        text-align: left;
    }

    .recommendation-description {
        grid-column: 1;
        grid-row: 3;
        margin-top: 0.2rem;
    }
}

/* ── Color palettes ───────────────────────────────────────────────────────────
   Ivory is the default light palette (declared on :root at the top of the file).
   The others are applied via data-theme, which assets/js/main.js resolves from
   the reader's mode + light flavor + dark flavor. The prefers-color-scheme block
   covers no-JS / first-paint visitors, mapping an OS dark preference to the
   default Dark palette. Variable lists repeat per selector because a media query
   and a static selector cannot share one rule. */

/* No-JS / pre-paint: follow the OS to the default Dark palette. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --background: #171816;
        --text: #e9e7e2;
        --muted: #b3afa6;
        --border: #3b3c37;
        --code-background: #242521;
        --selection: color-mix(in srgb, var(--accent) 32%, var(--background));
        --focus: #7cb7e4;
    }
}

/* Ivory (default light) — explicit selector so it pins over any prior palette;
   the color values come from :root above. */
:root[data-theme="ivory"] {
    color-scheme: light;
}

/* White (crisp pure-white light) */
:root[data-theme="white"] {
    --background: #ffffff;
    --text: #1d1d1d;
    --muted: #5f5f5f;
    --border: #e3e3e3;
    --code-background: #f2f2f2;
    --selection: color-mix(in srgb, var(--accent) 24%, var(--background));
    --focus: #35678d;
    color-scheme: light;
}

/* Dark (default dark) */
:root[data-theme="dark"] {
    --background: #171816;
    --text: #e9e7e2;
    --muted: #b3afa6;
    --border: #3b3c37;
    --code-background: #242521;
    --selection: color-mix(in srgb, var(--accent) 32%, var(--background));
    --focus: #7cb7e4;
    color-scheme: dark;
}

/* AMOLED (true black) — soft off-white text, not pure white, to avoid halation. */
:root[data-theme="amoled"] {
    --background: #000000;
    --text: #d6d6d2;
    --muted: #8a8a86;
    --border: #2a2a2a;
    --code-background: #121212;
    --selection: color-mix(in srgb, var(--accent) 32%, var(--background));
    --focus: #7cb7e4;
    color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
