/* One writing topic (/writing/<topic>/). The topic color connects the header, first read,
   article path and matching work. */

:root { --piece-x: #9aa1ad; }

.page-topic main {
  background: var(--paper);
  padding-bottom: 56px;
}
.topic { display: grid; grid-template-columns: minmax(0, 1fr); }

.topic-head { background: var(--field); color: var(--bone); padding: 4px var(--gutter) 0; }
.topic-head-in { max-width: var(--max); margin-inline: auto; padding-bottom: 28px; position: relative; }
.topic-head::after { content: ""; display: block; height: 18px; max-width: var(--max); margin-inline: auto;
  background: linear-gradient(90deg, var(--tile) 0 18px, transparent 18px 20px) 0 0 / 20px 18px repeat-x; }
.topic-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; color: var(--bone-soft); font-size: 0.9rem; font-weight: 600; }
.topic-crumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--bone-soft); }
.topic-title { display: flex; align-items: center; gap: 14px; margin: 4px 0 10px; }
.topic-mark { flex: none; display: grid; place-items: center; width: 64px; height: 64px; background: var(--field-2); border-radius: 4px; box-shadow: inset 0 0 0 2px #3a3f4b, inset 0 -5px 0 rgba(0, 0, 0, 0.4); }
.topic-mark .topic-icon { width: 44px; height: 44px; }
.topic-head h1 { margin: 0; font: 800 var(--h1-page)/1.04 var(--face); font-stretch: 112%; letter-spacing: -0.025em; }
.topic-line { margin: 0 0 12px; color: var(--tile); font-size: clamp(1.2rem, 1rem + 1vw, 1.9rem); font-weight: 800; line-height: 1.2; font-stretch: 106%; }
.topic-lede { margin: 0 0 10px; color: var(--bone-soft); font-size: 1rem; line-height: 1.55; }
.topic-count { margin: 0; color: var(--bone-soft); font-size: 0.95rem; }
.topic-count strong { color: var(--bone); }
@media (min-width: 900px) {
  .topic-head-in { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0 clamp(32px, 5vw, 96px); align-items: end; padding-bottom: 36px; }
  .topic-crumb, .topic-title { grid-column: 1 / -1; }
  .topic-mark { width: 88px; height: 88px; }
  .topic-mark .topic-icon { width: 60px; height: 60px; }
  .topic-line { grid-column: 1; grid-row: 3 / span 2; margin: 0; }
  .topic-lede, .topic-count { grid-column: 2; }
}
.px-ink { fill: #8a909c; }
.px-tile { fill: var(--tile); }
.px-white { fill: var(--bone); }

.topic-h { margin: 0 0 14px; font: 800 clamp(1.3rem, 1.1rem + 0.9vw, 1.9rem)/1.15 var(--face); font-stretch: 108%; }

/* Body follows one reading path. A distinct first article gives the list an entry point. */
.topic-start, .topic-posts, .topic-note, .topic-bridge, .topic-others { width: min(100% - 2 * var(--gutter), var(--measure)); margin-inline: auto; }
.topic-start { margin-top: 32px; padding: 20px 20px 22px; background: var(--field); color: var(--bone); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 6px 6px 0 var(--tile); }
.topic-start-label { display: flex; align-items: center; gap: 8px; color: var(--tile); font: 800 .78rem/1.2 var(--face); letter-spacing: .06em; text-transform: uppercase; }
.topic-start-piece { display: block; width: 24px; height: 12px; background: var(--tile); box-shadow: 12px 0 0 var(--tile), 12px 12px 0 var(--tile); margin-right: 12px; }
.topic-start h2 { margin: 20px 0 10px; font: 800 clamp(1.45rem, 1.1rem + 1.4vw, 2.15rem)/1.13 var(--face); letter-spacing: -.02em; }
.topic-start h2 a { color: var(--bone); text-decoration-color: var(--tile); text-decoration-thickness: 3px; text-underline-offset: .16em; }
.topic-start p { margin: 0 0 16px; color: var(--bone-soft); line-height: 1.5; }
.topic-start-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--tile); font-weight: 800; }
.topic-posts { margin-top: 42px; }
.topic-posts-intro { margin: -5px 0 18px; color: var(--ink-soft); }

.topic-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 2px solid var(--ink); }
.topic-list > li { border-bottom: 1px solid var(--paper-line); }
.entry { padding: 18px 0 20px; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; color: var(--ink-soft); font-size: 0.85rem; font-weight: 700; }
.entry h3 { margin: 4px 0 6px; font: 800 clamp(1.15rem, 1rem + 0.5vw, 1.45rem)/1.25 var(--face); font-stretch: 104%; }
.entry h3 a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration-color: var(--tile); text-decoration-thickness: 3px; text-underline-offset: 0.18em; }
@media (hover: hover) { .entry h3 a:hover { text-decoration-thickness: 5px; } }
.entry-line { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.entry-also { margin: 8px 0 0; color: var(--ink-soft); font-size: 0.88rem; }
.entry-also a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink); font-weight: 700; }
.entry-also i { display: inline-block; width: 12px; height: 12px; background: var(--tile); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }

.topic-note { margin-top: 48px; padding: 22px 0 0; border-top: 6px solid var(--tile); }
.topic-note p { margin: 0 0 14px; font-size: 1.02rem; line-height: 1.65; }
.topic-note .topic-note-src { color: var(--ink-soft); font-size: 0.88rem; }
.topic-bridge { margin-top: 32px; padding: 18px 18px 20px; background: var(--field); color: var(--bone); border-radius: var(--radius); box-shadow: 6px 6px 0 var(--tile); }
.topic-bridge .topic-h { color: var(--bone); font-size: 1.25rem; }
.topic-bridge p { margin: 0 0 14px; color: var(--bone-soft); }
.topic-bridge .btn { min-height: 48px; padding: 10px 18px; line-height: 1.25; text-align: left; }
.topic-others { margin-top: 48px; }
.topic-others ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 900px) { .topic-others ul { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; } }
.topic-others a { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 10px; min-height: 56px; height: 100%; padding: 8px 10px; background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 4px 4px 0 var(--tile); color: var(--ink); text-decoration: none; font-weight: 700; line-height: 1.25; }
.topic-others a > span:nth-child(2) { text-decoration: underline; text-decoration-color: var(--tile); text-decoration-thickness: 3px; text-underline-offset: 0.18em; }
.topic-mini { grid-row: 1 / span 2; display: grid; place-items: center; width: 36px; height: 36px; background: var(--field); border-radius: 3px; }
.topic-mini .topic-icon { width: 24px; height: 24px; }
.topic-mini-n { grid-column: 2; color: var(--ink-soft); font-size: 0.82rem; font-weight: 600; }
.topic-all a { grid-template-columns: 1fr; justify-items: start; box-shadow: 4px 4px 0 var(--ink); }
@media (hover: hover) { .topic-others a:hover { background: #ffffff; } }
.topic-mini-n { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 360px) { .topic-mini-list a, [class*="topic-mini"] { min-width: 0; } [class*="topic"] a > span { overflow-wrap: anywhere; } }
@media (max-width: 360px) { .topic-others ul { grid-template-columns: 1fr; } }
/* 2026-10-12: "SEO measurement" ran past its chip at 390 (the viewport check's clipped rule). Long words hyphenate. */
.topic-others a > span:nth-child(2) { hyphens: auto; -webkit-hyphens: auto; }
@media (max-width: 430px) { .topic-others a { gap: 2px 8px; padding: 8px; font-size: .95rem; } }
.topic-also { width: min(100% - 2 * var(--gutter), var(--measure)); margin: 32px auto 0; }
.topic-also > :is(h2, p, ul) { max-width: var(--measure); margin-inline: auto; } .topic-also-list { display: grid; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; } .topic-also-list a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; text-underline-offset: .2em; }
