/* Article pages (built by tools/articles.py), on top of theme.css. The body's shelf class sets
   --c, the shelf's colour from the articles catalog. */

.shelf-why { --c: var(--tint-cyan); }
.shelf-metagame { --c: var(--tint-magenta); }
.shelf-craft { --c: var(--tint-green); }
.shelf-ethics { --c: var(--tint-orange); }
.shelf-beyond { --c: var(--tint-blue); }
.shelf-deep { --c: var(--tint-yellow); }
.shelf-guest { --c: var(--tint-red); }

.article-head { position: relative; padding: clamp(2.5rem, 7vw, 4.5rem) 0 1.6rem; max-width: 980px; }
.article-head .bg-icon { right: -40px; top: 0; --size: 340px; --tint: var(--c); }
.article-head > * { position: relative; }
.article-head .eyebrow a { color: var(--c); text-decoration: none; }
.article-head .eyebrow a:hover { text-decoration: underline; }
.article-head h1 { font-size: clamp(1.8rem, 1.1rem + 2.8vw, 3.2rem); margin-bottom: 0.7em; }
.article-head .meta-line a { color: var(--text-dim); }

/* One reading column; on wide screens the contents list becomes a sticky sidebar beside it. */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.6rem; max-width: 780px; }
@media (min-width: 1140px) {
    .article-layout { grid-template-columns: minmax(0, 780px) 280px; gap: 1.6rem 3rem; max-width: none; }
    .article-layout > .toc { grid-column: 2; grid-row: 1 / span 2; align-self: start; position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
    .article-layout > :not(.toc) { grid-column: 1; }
}

.summary { --edge: var(--line-bright); background-color: var(--surface-solid); box-shadow: inset 3px 0 0 var(--c); font-size: 1.1rem; color: #e1eef9; }
.summary.bracketed::before, .summary.bracketed::after { border-color: var(--c); }
.summary .label { color: var(--c); }
.summary p:last-child, .summary ul:last-child { margin-bottom: 0; }

.toc { padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); }
.toc .label { color: var(--c); margin-bottom: 0.6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin: 0; }
.toc a {
    display: grid; grid-template-columns: 2.1em 1fr; padding: 0.32rem 0;
    color: var(--text-dim); text-decoration: none; font-size: 0.92rem; line-height: 1.35;
    border-top: 1px solid var(--line);
}
.toc li:first-child a { border-top: 0; }
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--font-ui); font-weight: 600; font-size: 0.8rem; color: var(--c); padding-top: 0.1em; }
.toc a:hover { color: #fff; }

.article-main .prose { max-width: none; }
.prose h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.7rem); }
.prose h2::before { content: ""; display: block; width: 48px; height: 3px; margin-bottom: 0.7em; background: var(--c); box-shadow: 0 0 12px var(--c); }
.prose h3 { color: var(--c); }
.prose h4, .prose h5 { font-size: 1rem; margin-top: 1.6em; color: #fff; }
.prose li::marker { color: var(--c); }
.prose a { overflow-wrap: anywhere; }
.prose em { color: #fff; }
.prose figure.narrow { margin-inline: auto; }
.prose figure img { height: auto; background: var(--bg-2); border: 3px solid var(--c); box-sizing: border-box; }
.prose figcaption { font-family: var(--font-body); font-size: 0.95rem; line-height: 1.5; letter-spacing: 0; color: var(--text-dim); padding-left: 0.8rem; border-left: 2px solid var(--c); margin-top: 0.7em; }

.closing { margin-top: 3.5rem; --edge: var(--line-bright); }
.closing h2 { font-size: 1.3rem; }
.closing .section-mark .icon { color: var(--c); }
.closing p { color: var(--text-dim); max-width: 64ch; }
.closing-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.2rem 0 0; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 1.6rem; }
.pager-link {
    display: flex; flex-direction: column; gap: 0.3rem;
    padding: 1rem 1.2rem; text-decoration: none;
    background: var(--surface-solid); border: 1px solid var(--line);
    transition: border-color .2s, box-shadow .2s;
}
.pager-link:hover { border-color: var(--c); box-shadow: 0 0 26px -10px var(--c); }
.pager-link .label { color: var(--c); margin: 0; }
.pager-title { color: #fff; font-weight: 600; line-height: 1.35; }
.pager-link.next { text-align: right; grid-column: 2; }
@media (max-width: 620px) { .pager { grid-template-columns: 1fr; } .pager-link.next { grid-column: 1; } }

.back { margin: 1.4rem 0 0; }

.guest { margin-top: 1.4rem; max-width: 780px; --edge: var(--line-bright); background-color: var(--surface-solid); box-shadow: inset 3px 0 0 var(--c); color: #d3e4f2; }
.guest .label { color: var(--c); }
.guest p:last-child { margin-bottom: 0; }
.guest-note { color: var(--text-dim); }

.toc ol ol { margin: 0 0 0.3rem 2.1em; counter-reset: none; }
.toc ol ol li { counter-increment: none; }
.toc ol ol a { grid-template-columns: 1fr; padding: 0.18rem 0; border-top: 0; font-size: 0.86rem; color: var(--text-faint); }
.toc ol ol a::before { content: none; }

.prose .see-page { margin: -0.4em 0 1.4em; }
.prose .see-page .btn { text-decoration: none; }
