/* ==========================================================
   Tokens
   ========================================================== */
:root {
    --color-bg:          #ede8db;
    --color-bg-surface:  #e2dace;
    --color-text:        #1a1714;
    --color-secondary:   #5c564e;
    --color-accent:      #2d7d7a;
    --color-accent-light:#3d8a87;
    --color-border:      #a89e8c;

    --font-heading: 'Fraunces', Georgia, serif;
    --font-body:    'Lora', Georgia, serif;
    --font-ui:      'Inter', system-ui, sans-serif;
    --font-mono:    ui-monospace, Menlo, Consolas, monospace;

    --space-xs: 0.5rem;
    --space-s:  0.75rem;
    --space-m:  1.5rem;
    --space-l:  3rem;
    --space-xl: 5rem;
}

/* ==========================================================
   Reset
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ==========================================================
   Base
   ========================================================== */
html { font-size: 18px; }
body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

/* Subtle aged paper texture — seamless tile on mobile, full cover on wide screens */
body::before {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1500px;
    min-width: 1200px;
    background-image: url("../images/texture-paper-tile.79fd668faf33.webp");
    background-size: 450px 450px;
    background-repeat: repeat;
    background-position: center;
    opacity: 0.8;
    pointer-events: none;
    z-index: 0;
}
@media (min-width: 1024px) {
    body::before {
        background-image: url("../images/texture-paper.d830e0b133bf.webp");
        background-size: cover;
        background-repeat: no-repeat;
    }
}

/* ==========================================================
   Page wrapper
   ========================================================== */
.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-l);
    position: relative;
    z-index: 1;
}

/* ==========================================================
   Header
   ========================================================== */
.site-header {
    padding: var(--space-l) 0 var(--space-m);
    position: relative;
    overflow: visible;
}
.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-l);
}
.site-name {
    font-family: var(--font-mono);
    font-size: clamp(1.25rem, 2.5vw, 1.7rem);
    letter-spacing: 0.08em;
    color: var(--color-text);
    opacity: 0.3;
    text-decoration: none;
    line-height: 1.05;
    text-transform: uppercase;
    display: block;
}
.page-homepage .site-name { opacity: 1; }
.site-tagline {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-secondary);
    margin-top: 0.4rem;
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1rem;
}
.site-nav a {
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    color: #f5f0e8;
    text-decoration: none;
    background: rgba(26, 16, 14, 0.3);
    padding: 0.25em 10px;
    border-radius: 2px;
}
.page-homepage .site-nav a { background: rgba(26, 16, 14, 0.9); }
.site-nav a:hover { background: rgba(30, 24, 16, 0.5); }
.site-nav .site-nav-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 2.8em;
    height: 2.8em;
    border-radius: 50%;
}
.icon-search {
    width: 2em;
    height: 2em;
    fill: currentColor;
    display: block;
}

.site-rule {
    border: none;
    border-top: 3px double var(--color-border);
    margin-bottom: var(--space-l);
}

/* Specimen illustration positioned behind the header, spilling down */
.header-specimen:not([src]) { display: none; }
.header-specimen {
    position: absolute;
    right: -240px;
    top: 20px;
    width: 800px;
    transform: rotate(140deg);
    opacity: 0.5;
    mix-blend-mode: multiply;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    filter: invert(1);
    z-index: 0;
}
.page-homepage .header-specimen {
    right: -440px;
    top: -230px;
    width: 1300px;
    opacity: 0.7;
    mix-blend-mode: screen;
    z-index: -1;
}
@media (max-width: 1023px) {
    .header-specimen { width: 600px; right: -160px; top: 15px; }
    .page-homepage .header-specimen { width: 900px; right: -300px; top: -150px; }
}
.section-index-header {
    margin-bottom: var(--space-l);
}
.section-index-header h1 {
    font-size: clamp(2.5rem, 4.5vw, 3.5rem);
    margin-bottom: var(--space-m);
}
.page-homepage .section-index-header { margin-bottom: var(--space-m); }

/* ==========================================================
   Layout — home two-column
   ========================================================== */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: var(--space-xl);
    align-items: start;
}

/* ==========================================================
   Section label
   ========================================================== */
.section-label {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-secondary);
    margin-bottom: var(--space-m);
}

/* ==========================================================
   Arrow link
   ========================================================== */
.arrow-link {
    font-family: var(--font-ui);
    font-size: inherit;
    color: var(--color-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}
.arrow-link:hover { color: var(--color-text); text-decoration: none; }
.icon-github { width: 2em; height: 2em; fill: currentColor; flex-shrink: 0; }

/* ==========================================================
   Article list (index pages)
   ========================================================== */
.article-list { list-style: none; }
.article-list li {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: var(--space-m);
    padding: var(--space-m) 0;
    border-top: 1px dashed var(--color-border);
    align-items: start;
}
.article-list li:last-child { border-bottom: 1px dashed var(--color-border); }

/* Illustration thumbnails — mix-blend-mode makes white backgrounds vanish */
.article-thumb {
    width: 80px;
    height: 80px;
    object-fit: contain;
    object-position: center;
    mix-blend-mode: multiply;
    filter: grayscale(0.9);
    opacity: 0.75;
}
.article-thumb-default {
    opacity: 0.2;
    transform: rotate(130deg);
}
.article-item-meta {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-secondary);
    margin-bottom: 0.2rem;
}
.article-item-meta .not-link,
.article-item-meta a { 
    color: inherit; 
    text-decoration: underline;
    text-decoration-color: var(--color-border);
    text-underline-offset: 0.15em;
    font-size: 0.65rem;
    opacity: 0.8;
}
.article-item-meta a:hover { text-decoration: none; }
.article-item-title,
.page-listing-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-bottom: 0.3rem;
}
.article-item-title a,
.page-listing-title a {
    color: var(--color-accent);
    text-decoration: none;
}
.article-item-title a:hover,
.page-listing-title a:hover {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-underline-offset: 3px;
}
.article-item-series {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 0.3rem;
    opacity: 0.8;
}
.article-item-series a { color: var(--color-accent); }
.article-item-summary,
.page-listing-summary {
    font-size: 0.875rem;
    color: var(--color-secondary);
    line-height: 1.55;
}
.browse-link { margin-top: var(--space-m); }

/* ==========================================================
   Page listing (index pages — no thumbnail)
   ========================================================== */
.page-listing { list-style: none; }
.page-listing li {
    padding: var(--space-m) 0;
    border-top: 1px dashed var(--color-border);
}
.page-listing li:last-child { border-bottom: 1px dashed var(--color-border); }
.series-toc { margin: var(--space-l) 0; }
.series-toc-list {
    list-style: decimal inside;
    padding: 0;
}
.series-toc-list li {
    padding: var(--space-xs) 0;
    border-top: 1px dashed var(--color-border);
}
.series-toc-list li:last-child { border-bottom: 1px dashed var(--color-border); }
.series-toc-list a {
    color: var(--color-accent);
    text-decoration: none;
}
.series-toc-list a:hover { text-decoration: underline; }
.series-toc-list .series-toc-current {
    color: var(--color-secondary);
    font-style: italic;
}

/* Sidebar variant — used on content pages */
.series-toc--sidebar {
    margin: 0 0 var(--space-m) 0;
    padding: var(--space-m);
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid white;
    border-radius: 3px;
}
.series-toc--sidebar .series-toc-list a {
    color: var(--color-accent);
    text-decoration: none;
}
.series-toc--sidebar .series-toc-list a:hover { 
    text-decoration: underline; 
}
.series-toc--sidebar .section-label {
    font-size: 0.6rem;
    margin-bottom: var(--space-xs);
}
.series-toc--sidebar .series-toc-list {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    line-height: 1.4;
}
.series-toc--sidebar .series-toc-list li {
    padding: 0.3rem 0;
}
@media (max-width: 520px) {
    .series-toc--sidebar {
        float: none;
        width: 100%;
        margin: 0 0 var(--space-m) 0;
    }
}

/* Series breadcrumb — shown in article header when page is part of a series */
.series-breadcrumb {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-secondary);
    margin-bottom: 0.3rem;
}
.series-breadcrumb a {
    color: var(--color-accent);
    text-decoration: none;
}
.series-breadcrumb a:hover { text-decoration: underline; }

/* Series prev/next nav */
.series-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-m);
    max-width: 68ch;
    margin: var(--space-l) auto;
    padding: var(--space-m) 0;
    border-top: 1px dashed var(--color-border);
    border-bottom: 1px dashed var(--color-border);
}
.series-nav-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-decoration: none;
    flex: 1;
}
.series-nav-prev { text-align: left; }
.series-nav-next { text-align: right; }
.series-nav-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-secondary);
}
.series-nav-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--color-accent);
    line-height: 1.3;
}
.series-nav-item:hover .series-nav-title { text-decoration: underline; }

/* ==========================================================
   Sidebar
   ========================================================== */
.sidebar { display: flex; flex-direction: column; gap: var(--space-m); }
.sidebar-heading {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-s);
}
.topic-list { list-style: none; }
.topic-list li {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    padding: 0.4rem 0;
    border-top: 1px dashed var(--color-border);
    font-family: var(--font-ui);
    font-size: 0.875rem;
}
.topic-list li:last-child { border-bottom: 1px dashed var(--color-border); }
.topic-name { flex: 1; }
a.topic-name { color: inherit; text-decoration: none; }
.topic-list li:hover .topic-name { color: var(--color-accent); }
.topic-list li.is-active .topic-name { color: var(--color-accent); font-weight: 500; }
.topic-count { font-size: 0.8rem; color: var(--color-secondary); }
.sidebar-blurb {
    font-size: 0.875rem;
    color: var(--color-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-s);
}
.project-list { list-style: none; display: flex; flex-direction: column; }
.project-list a {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--color-secondary);
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--color-border);
}
.project-list a:hover { color: var(--color-accent); }

/* ==========================================================
   Article page
   ========================================================== */
.article-page {
    position: relative;
}
.article-page-inner {
    max-width: 68ch;
    margin: 0 auto;
}
.article-header {
    margin-bottom: var(--space-m);
    padding-bottom: var(--space-l);
    border-bottom: 1px dashed var(--color-border);
}
.article-resources, .article-meta {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-secondary);
    display: flex;
    gap: var(--space-s);
    align-items: center;
    margin-bottom: var(--space-m);
    flex-wrap: wrap;
}
.article-resources { margin-bottom: var(--space-s); }
.article-meta .tag,
.article-item-meta .tag {
    background-color: rgba(255, 255, 255, 0.4);
    opacity: 0.9;
    color: var(--color-accent);
    padding: 0.2em 0.55em;
    border-radius: 2px;
    text-transform: none;
    letter-spacing: 0.01em;
    font-size: 0.75rem;
    text-decoration: none;
}
.article-meta .tag:hover,
.article-item-meta .tag:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 2px;
}
h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4.5vw, 2.75rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-s);
}
h1 span {
    font-weight: normal;
}
.article-summary {
    font-size: 1.1rem;
    line-height: 1.65;
    color: var(--color-secondary);
    font-style: italic;
}
.page-homepage .article-summary { font-size: 1.4rem; }
.page-homepage .article-body { padding-top: 0; }
.page-homepage h2 {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1.3em;
    margin-bottom: var(--space-m);
}
.page-toolindexpage .article-body { padding-top: 0; }
.article-body { padding-top: var(--space-m); font-size: 0.95rem; }
.article-body--narrow { max-width: 68ch; }
.article-body h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.015em;
    margin: var(--space-l) 0 var(--space-s);
}
.article-body > h2:first-child,
.article-body > *:first-child > h2:first-child,
.article-body > *:first-child > *:first-child > h2:first-child {
    margin-top: 0;
}
.article-body h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: var(--space-l) 0 var(--space-s);
}
.article-body h4 {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-secondary);
    margin: var(--space-l) 0 var(--space-s);
}
.article-body p { margin-bottom: var(--space-m); }
.article-body img { max-width: 100%; height: auto; }
.article-body img.richtext-image.left {
    float: left;
    margin: 0 var(--space-m) var(--space-s) 0;
    max-width: 50%;
}
.article-body img.richtext-image.right {
    float: right;
    margin: 0 0 var(--space-s) var(--space-m);
    max-width: 50%;
}
.article-body img.richtext-image.fullwidth {
    display: block;
    width: 100%;
}
.embed-block {
    position: relative;
    margin: var(--space-l) 0;
    aspect-ratio: 16 / 9;
}
.embed-block iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
@supports not (aspect-ratio: 16 / 9) {
    .embed-block {
        padding-bottom: 56.25%;
        height: 0;
        overflow: hidden;
    }
}
.article-body ul,
.article-body ol {
    padding-left: 1.5em;
    margin-bottom: var(--space-m);
}
.article-body li { margin-bottom: var(--space-s); }
.article-body li:last-child { margin-bottom: 0; }
.article-body a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-color: var(--color-accent-light);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.article-body a:hover {
    text-decoration-color: var(--color-accent);
    color: #1f5856;
}
.article-body .arrow-link { text-decoration: none; }
.article-body blockquote {
    border-left: 2px solid var(--color-accent-light);
    margin: var(--space-l) 0;
    padding: var(--space-s) 0 var(--space-s) var(--space-m);
    color: var(--color-secondary);
    font-style: italic;
}
.article-body blockquote p { margin: 0; }
.article-body blockquote p + p { margin-top: var(--space-s); }
.article-body blockquote cite {
    display: block;
    margin-top: var(--space-s);
    font-style: normal;
    font-size: 0.9em;
    color: var(--color-secondary);
}
.callout {
    font-family: var(--font-ui);
    background: rgba(255, 255, 255, 0.2);
    border: 2px double;
    border-radius: 4px;
    margin: var(--space-l) 0;
    padding: var(--space-s) var(--space-m);
}
.callout__body { font-size: 0.85em; color: var(--color-secondary);}
.callout__header {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-s);
}
.callout__icon { font-style: normal; }
.callout--info  { border-color: #4a9cc7; }
.callout--info .callout__header { color: #2a6a8f; }
.callout--info .callout__icon::before { content: "ℹ"; }
.callout--warning  { border-color: #c97d2a; }
.callout--warning .callout__header { color: #8f4e0f; }
.callout--warning .callout__icon::before { content: "⚠"; }
.callout--tip  { border-color: #4a9c6a; }
.callout--tip .callout__header { color: #2a6a45; }
.callout--tip .callout__icon::before { content: "✦"; }
.callout__body > p { margin: 0; }
.callout__body > p + p { margin-top: var(--space-s); }
.article-body table {
    border-collapse: collapse;
    width: 100%;
    margin: var(--space-m) 0;
    font-size: 0.9em;
    overflow-x: auto;
    display: block;
}
.article-body th,
.article-body td {
    text-align: left;
    padding: var(--space-xs) var(--space-s);
    border: 1px solid var(--color-border);
}
.article-body th {
    background: var(--color-bg-surface);
    font-weight: 600;
}
.article-body tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.025);
}
.article-body code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-bg-surface);
    padding: 0.15em 0.35em;
    border-radius: 2px;
}
.article-body pre {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: var(--space-m);
    overflow-x: auto;
    margin: var(--space-m) 0;
    opacity: 0.95;
}
.article-body pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Prism syntax highlighting — structural overrides only, Tomorrow Night theme handles colours */
.article-body code[class*="language-"],
.article-body pre[class*="language-"] {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    text-shadow: none;
}
.article-body pre[class*="language-"] {
    border-radius: 3px;
    margin: var(--space-m) 0;
    background: rgba(0,0,0,0.75);
}

/* Article illustration — larger, floated decoratively */
.article-illustration {
    float: right;
    width: 120px;
    margin: 0 0 var(--space-m) var(--space-l);
    mix-blend-mode: multiply;
    opacity: 0.7;
}

/* ==========================================================
   StreamField blocks
   ========================================================== */
.block-image figure {
    margin: 0 auto;
}

/* ==========================================================
   Series page
   ========================================================== */
.series-page .article-body { padding-top: 0; }

/* ==========================================================
   Two columns block
   ========================================================== */
.two-columns {
    display: grid;
    grid-template-columns: calc(var(--left-size) / 12 * 100%) 1fr;
    gap: var(--space-m) var(--space-m);
    margin: var(--space-m) 0;
}
@media (max-width: 700px) {
    .two-columns { grid-template-columns: 1fr; }
}
.two-columns table {margin: 0; width: 100%; }
.two-columns__left,
.two-columns__right { min-width: 0; }
.two-columns pre[class*="language-"] { margin: 0; width: 100%; }

/* ==========================================================
   Tool page
   ========================================================== */
.tool-embed {
    width: 100%;
    border: 1px dashed var(--color-border);
    border-radius: 3px;
    margin-bottom: var(--space-m);
}

/* ==========================================================
   Stretched link — makes entire card clickable
   ========================================================== */
.stretched-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}
.card:has(.stretched-link):hover {
    background-color: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
    margin-top: var(--space-xl);
    padding: var(--space-l) 0;
    border-top: 3px double var(--color-border);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-secondary);
    letter-spacing: 0.03em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-footer-left {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-s);
}
.site-credit {
    font-size: 0.65rem;
    color: var(--color-border);
}
.site-credit a {
    color: inherit;
    text-decoration: none;
}
.site-credit a:hover {
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: var(--space-s);
    align-items: center;
}

.social-links a {
    display: flex;
    color: var(--color-secondary);
    transition: color 0.15s;
}

.social-links a:hover {
    color: var(--color-text);
}

.social-links svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: currentColor;
}

/* ==========================================================
   Search page
   ========================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
.search-form {
    margin-bottom: var(--space-l);
}
.search-input-row {
    display: flex;
    gap: var(--space-s);
}
.search-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.5em 0.75em;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.search-input:focus {
    outline: none;
    border-color: var(--color-accent-light);
    background: rgba(255, 255, 255, 0.65);
}
.search-submit {
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #f5f0e8;
    background: var(--color-accent);
    border: none;
    border-radius: 3px;
    padding: 0.55em 1.25em;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.search-submit:hover { background: var(--color-accent-light); }
.search-summary {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--color-secondary);
    margin-bottom: var(--space-m);
}
.search-count {
    font-weight: 500;
}
.search-results { margin-bottom: var(--space-l); }
.search-pagination {
    display: flex;
    gap: var(--space-m);
    align-items: center;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--color-secondary);
}
.search-pagination a {
    color: var(--color-accent);
    text-decoration: none;
}
.search-pagination a:hover { text-decoration: underline; }
.search-results .article-item-meta .tag { margin-right: 0.5rem; }
.search-results .page-listing-summary { margin-bottom: 0.3rem; }
/* ==========================================================
   Comments
   ========================================================== */
.comments-section {
    max-width: 68ch;
    margin: var(--space-xl) auto 0;
    padding: var(--space-m);
    border: 3px double var(--color-border);
    background-color: rgba(0,0,0,0.05);
}
.comments-heading {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.015em;
    margin-bottom: var(--space-m);
}
.comments-count {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--color-secondary);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 2em;
    padding: 0.1em 0.6em;
    vertical-align: middle;
    letter-spacing: 0;
}

/* Moderate link — staff only, next to heading */
.comments-moderate-link {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    font-weight: normal;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-accent);
    text-decoration: none;
    border: 1px solid var(--color-accent);
    border-radius: 2px;
    padding: 0.15em 0.5em;
    vertical-align: middle;
    margin-left: var(--space-s);
}
.comments-moderate-link:hover { color: var(--color-secondary); border-color: var(--color-border); }
.comment-moderate-link {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--color-secondary);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.1em 0.45em;
    margin-left: auto;
}
.comment-moderate-link:hover { color: var(--color-text); border-color: var(--color-secondary); }

/* Comment list */
.comment-list {
    list-style: none;
    margin-bottom: var(--space-l);
}
.comment-list .comment {
    padding: var(--space-m) 0;
    border-top: 1px dashed var(--color-border);
}
.comment-list .comment:last-child {
    border-bottom: 1px dashed var(--color-border);
}
.comment-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-s);
    margin-bottom: var(--space-xs);
}
.comment-author {
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.9rem;
}
.comment-author a {
    color: var(--color-accent);
    text-decoration: none;
}
.comment-author a:hover { text-decoration: underline; }
.comment-date {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-secondary);
}
.comment-body {
    font-size: 0.9rem;
    line-height: 1.6;
}
.comment-body p {
    margin: 0 0 var(--space-s);
}
.comment-body p:last-child { margin-bottom: 0; }
.comment-body code {
    font-family: var(--font-mono);
    font-size: 0.8em;
    background: rgba(255, 255, 255, 0.4);
    padding: 0.15em 0.35em;
    border-radius: 2px;
}
.comment-body pre {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: var(--space-s) var(--space-m);
    overflow-x: auto;
    margin: var(--space-s) 0;
}
.comment-body pre code {
    background: none;
    padding: 0;
    font-size: 0.7125rem;
    line-height: 1.6;
}
.comment-body blockquote {
    border-left: 2px solid var(--color-accent-light);
    margin: var(--space-s) 0;
    padding: var(--space-xs) 0 var(--space-xs) var(--space-m);
    color: var(--color-secondary);
    font-style: italic;
}
.comment-body blockquote p { margin: 0; }
.comment-body blockquote p + p { margin-top: var(--space-xs); }
.comment-body ul,
.comment-body ol {
    margin: var(--space-xs) 0 var(--space-s) var(--space-m);
}
.comment-body li { margin-bottom: 0.25rem; }
.comment-body a {
    color: var(--color-accent);
    text-decoration: underline;
}
.comment-body a:hover { text-decoration: none; }

/* Comment form */
.comment-form {
    margin-bottom: var(--space-s);
}
.comment-field {
    margin-bottom: var(--space-m);
}
.comment-field label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-secondary);
    margin-bottom: 0.35rem;
}
.comment-field input,
.comment-field textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.5em 0.75em;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.comment-field input:focus,
.comment-field textarea:focus {
    outline: none;
    border-color: var(--color-accent-light);
    background: rgba(255, 255, 255, 0.65);
}
.comment-field textarea { resize: vertical; min-height: 8rem; }
.comment-field-help {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-secondary);
    margin-top: 0.35rem;
}
.comment-field-help a {
    color: var(--color-accent);
    text-decoration: underline;
}
.comment-field-help a:hover { text-decoration: none; }
.comment-field-help code {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background-color: rgba(255, 255, 255, 0.3);
    padding: 1px 4px;
}
.comment-field-error {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: #b84040;
    margin-top: 0.35rem;
}
.comment-submit {
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #f5f0e8;
    background: var(--color-accent);
    border: none;
    border-radius: 3px;
    padding: 0.55em 1.25em;
    cursor: pointer;
    transition: background 0.15s ease;
}
.comment-submit:hover { background: var(--color-accent-light); }
.comment-moderation-note {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-secondary);
    margin-top: var(--space-s);
    font-style: italic;
}

/* ==========================================================
   Form page
   ========================================================== */
.form-field {
    margin-bottom: var(--space-m);
}
.form-field label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-secondary);
    margin-bottom: 0.35rem;
}
.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.5em 0.75em;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--color-accent-light);
    background: rgba(255, 255, 255, 0.65);
}
.form-field textarea { resize: vertical; min-height: 8rem; }
.form-field-help {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-secondary);
    margin-top: 0.35rem;
}
.form-field-error {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: #b84040;
    margin-top: 0.35rem;
}
.form-submit {
    font-family: var(--font-ui);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #f5f0e8;
    background: var(--color-accent);
    border: none;
    border-radius: 3px;
    padding: 0.55em 1.25em;
    cursor: pointer;
    transition: background 0.15s ease;
}
.form-submit:hover { background: var(--color-accent-light); }

/* ==========================================================
   Toast notifications
   ========================================================== */
.toast-list {
    position: fixed;
    bottom: var(--space-m);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    pointer-events: none;
}
.toast {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--color-text);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: 3px;
    padding: 0.65em 1em;
    display: flex;
    align-items: center;
    gap: var(--space-m);
    pointer-events: all;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    animation: toast-in 0.2s ease;
}
.toast--hiding {
    animation: toast-out 0.3s ease forwards;
}
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--color-secondary);
    padding: 0;
    flex-shrink: 0;
}
.toast-close:hover { color: var(--color-text); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(8px); }
}

/* ==========================================================
   Home page
   ========================================================== */
.home-latest-explorations {
    margin-bottom: var(--space-xl);
}
.home-latest-explorations > .arrow-link {
    margin-top: var(--space-m);
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.9rem;
    font-weight: 500;
}
.home-latest-explorations > .arrow-link::before,
.home-latest-explorations > .arrow-link::after {
    content: "→";
    font-style: normal;
}
.home-latest-explorations > .arrow-link::before {
    opacity: 0;
    transform: translateX(-0.4em);
    transition: opacity 0.2s, transform 0.2s;
}
.home-latest-explorations > .arrow-link::after {
    transition: transform 0.2s;
}
.home-latest-explorations > .arrow-link:hover::before {
    opacity: 1;
    transform: translateX(0);
}
.home-latest-explorations > .arrow-link:hover::after {
    transform: translateX(0.3em);
}

/* Call to action blocks */
.home-cta {
    padding: var(--space-m) var(--space-s);
    text-align: center;
    border: 2px double var(--color-border);
    border-radius: 10px;
}
.home-cta:first-child {
    margin-top: var(--space-l);
}
.home-cta-image {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto var(--space-s);
    mix-blend-mode: multiply;
    opacity: 0.85;
}
.home-cta-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-xs);
}
.home-cta-text {
    font-size: 0.85rem;
    color: var(--color-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-s);
}
.home-cta .arrow-link {
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: underline;
}
/* ==========================================================
   Home page topic cloud
   ========================================================== */
.home-topic-cloud {
    text-align: center;
}
.topic-cloud-label {
    width: 100%;
}
.topic-cloud-label h2 {
    font-family: var(--font-ui);
    font-size: 0.6875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-secondary);
    font-weight: normal;
    margin-bottom: var(--space-s);
}
.topic-cloud {
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-s);
    justify-content: center;
}
.topic-cloud .tag {
    font-family: var(--font-ui);
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.15s;
    padding: 0.25em 0.5em;
    line-height: 1.5em;
    background-color: rgba(255, 255, 255, 0.3);
    border: 2px dotted var(--color-accent);
    mix-blend-mode: luminosity;
    border-radius: 50px;
}
.topic-cloud .tag:hover { color: var(--color-text); }
.topic-cloud .tag-1  { font-size: 0.75rem;  opacity: 0.55; }
.topic-cloud .tag-2  { font-size: 0.8rem;   opacity: 0.6; }
.topic-cloud .tag-3  { font-size: 0.875rem; opacity: 0.7; }
.topic-cloud .tag-4  { font-size: 0.95rem;  opacity: 0.75; }
.topic-cloud .tag-5  { font-size: 1.05rem;  opacity: 0.85; }
.topic-cloud .tag-6  { font-size: 1.15rem;  opacity: 0.9; }
.topic-cloud .tag-7  { font-size: 1.3rem; }
.topic-cloud .tag-8  { font-size: 1.45rem; }
.topic-cloud .tag-9  { font-size: 1.6rem;   font-weight: 500; }
.topic-cloud .tag-10 { font-size: 1.8rem;   font-weight: 500; }

/* ==========================================================
   Homepage intro — 2-column layout
   ========================================================== */
.home-intro {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--space-l);
    align-items: start;
    margin-bottom: var(--space-l);
}
.home-intro-main {
    align-self: center;
}

/* ==========================================================
   Homepage featured section card grid
   ========================================================== */
.home-featured-section {
    margin-bottom: var(--space-l);
}
.card-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-s);
}
.card {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.95);
    background-color: rgba(255, 255, 255, 0.2);
    padding: var(--space-m);
    text-align: center;
    position: relative;
    overflow: hidden;
}
/* Rotate each card slightly for a casual, "scattered" effect.
   7-step cycle: prime length avoids visually repeating across rows in 2-, 3-, or 4-column grids. */
.card-grid--wonky .card { transform: rotate(var(--card-rotate, 0deg)); }
.card-grid--wonky .card:nth-child(7n+1) { --card-rotate:  2deg; }
.card-grid--wonky .card:nth-child(7n+2) { --card-rotate: -1.5deg; }
.card-grid--wonky .card:nth-child(7n+3) { --card-rotate:  1.5deg; }
.card-grid--wonky .card:nth-child(7n+4) { --card-rotate: -2deg; }
.card-grid--wonky .card:nth-child(7n+5) { --card-rotate:  1deg; }
.card-grid--wonky .card:nth-child(7n+6) { --card-rotate: -2.5deg; }
.card-grid--wonky .card:nth-child(7n)   { --card-rotate:  2.5deg; }

.card .article-item-series {
    line-height: 1.3;
    margin-bottom: var(--space-s);
}
.card .article-item-meta {
    margin-top: var(--space-s);
    font-size: 0.8rem;
    color: var(--color-secondary);
    line-height: 1.3;
}


.card-image img {
    max-width: 200px;
    height: 80px;
    opacity: 0.7;
    filter: grayscale(0.9);
}
.card-body {
    flex: 1;
    padding: var(--space-s) 0;
}
.card-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.2;
    margin: 0 0 var(--space-xs);
}
.card-title a {
    color: var(--color-accent);
    text-decoration: none;
}
.card-title a:hover { text-decoration: underline; }
.card-description {
    font-size: 0.9rem;
    line-height: 1.3;
    color: var(--color-secondary);
    margin: 0;
    font-style: italic;
}
.card-label {
    position: absolute;
    top:15px;
    right:-50px;
    width: 180px;
    padding: 4px 0;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    transform: rotate(37deg);
    transform-origin: center;
    pointer-events: none;
}
.card-label--tutorial { background: rgba(45, 125, 122, 0.3); border: 1px solid rgba(45, 125, 122, 0.6); color: var(--color-accent); }

/* ==========================================================
   Responsive — narrow screens
   ========================================================== */
@media (max-width: 900px) {
    .home-layout {
        gap: var(--space-m);
    }
}

@media (max-width: 700px) {
    .page-wrap {
        padding: 0 var(--space-m);
    }
    .site-header {
        padding: var(--space-m) 0;
    }
    .site-header-inner {
        flex-direction: column;
        gap: var(--space-s);
    }
    .site-nav {
        flex-wrap: wrap;
        padding-top: 0;
    }

    /* Homepage */
    .home-layout {
        grid-template-columns: 1fr;
        gap: var(--space-s);
    }
    .home-intro {
        grid-template-columns: 1fr;
    }
    .home-featured-section h2 {
        font-size: 1.1rem;
    }
    .home-latest-explorations {
        margin-bottom: var(--space-m);
    }
    .topic-cloud {
        border-radius: 0;
        aspect-ratio: auto;
        align-items: baseline;
        justify-content:space-around;
    }

    /* CTAs: show side-by-side when stacked below the explorations list */
    .sidebar {
        display: flex;
        gap: var(--space-s);
        margin-bottom: var(--space-m);
    }
    .home-cta {
        flex: 1 1 180px;
    }
    .home-cta:first-child {
        margin-top: 0;
    }

    /* Article list — collapse thumbnail grid to stacked on very narrow */
    .article-list li {
        grid-template-columns: 1fr;
        gap: var(--space-s);
    }
    .article-list .article-thumb {
        display: none;
    }

    /* Rich text floated images */
    .article-body img.richtext-image.left,
    .article-body img.richtext-image.right {
        float: none;
        display: block;
        max-width: 100%;
        margin: 0 0 var(--space-m) 0;
    }

    /* Footer */
    .site-footer {
        flex-direction: column;
        gap: var(--space-m);
        text-align: center;
    }

    /* Card grid — single column */
    .card-grid {
        grid-template-columns: 1fr;
    }

    /* Series nav */
    .series-nav {
        flex-direction: column;
        gap: var(--space-s);
    }
    .series-nav-next {
        text-align: left;
    }
}

