/* Post template (/writing/<slug>/). Built for reading on a phone first: one column, a comfortable
   measure that grows with the screen, the answer on the first screen, jump links, and the block world
   kept to the edges (the playfield header, numbered section blocks, a line of blocks between sections).
   Tokens come from world.css. */

.page-post { --post-read: clamp(17px, calc(11px + 0.6vw), 24px); }
.page-post main { background: var(--paper); }

/* ---------- Grid: header band, then the reading column with jump links beside it on wide screens ---------- */
.post-grid {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr) var(--gutter);
  font-size: var(--post-read);
  padding-bottom: 56px;
}
.post-grid > * { grid-column: 2; min-width: 0; }
.post-head { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; }
.post-head > * { grid-column: 2; }

@media (min-width: 1100px) {
  .post-grid {
    grid-template-columns: minmax(var(--gutter), 1fr) min(33em, calc(100vw - 2 * var(--gutter))) minmax(15rem, 1fr);
    column-gap: 3rem;
  }
  .post-answer { grid-row: 2; }
  .post-fig--hero { grid-row: 3; }
  .post-dek { grid-row: 4; }
  .post-body { grid-row: 5; }
  .post-end { grid-row: 6; }
  .post-toc {
    grid-column: 3; grid-row: 2 / 7; align-self: start;
    position: sticky; top: 24px; max-width: min(20rem, calc(100% - var(--gutter))); margin-top: 0;
  }
}

/* ---------- Header: the playfield's top band ---------- */
.post-head { background: var(--field); color: var(--bone); padding: 4px 0 calc(var(--cell) * 7); }
.post-crumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--bone-soft); font-size: 0.85em; font-weight: 600; }
.post-head h1 {
  margin: 4px 0 14px;
  font: 800 clamp(1.7rem, 1.2rem + 2.2vw, 3.2rem)/1.08 var(--face);
  font-stretch: 108%; letter-spacing: -0.015em; text-wrap: balance;
}
.post-dates { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 0; color: var(--bone-soft); font-size: 0.8em; }

/* ---------- The first screen: the answer, lifted out of the post ---------- */
.post-answer {
  margin-top: calc(var(--cell) * -4);
  padding: 18px 20px 6px;
  background: var(--sheet); color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--piece-o);
  position: relative;
}
.post-answer--summary { box-shadow: 6px 6px 0 var(--piece-j); }
.post-answer-label { margin: 0 0 8px; font-size: 0.8em; font-weight: 700; color: var(--ink-soft); }
.post-answer p { margin: 0 0 14px; line-height: 1.55; }
.post-answer ol, .post-answer ul { margin: 0 0 14px; padding-left: 1.3em; }
.post-answer li { margin-bottom: 4px; }
.post-answer table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 0.85em; }
.post-answer th, .post-answer td { text-align: left; padding: 7px 8px 7px 0; border-bottom: 1px solid var(--paper-line); vertical-align: top; }
.post-answer th { font-weight: 700; }

.post-dek { margin: 28px 0 0; font-size: 1.08em; line-height: 1.55; color: var(--ink); font-weight: 500; }

/* ---------- Jump links ---------- */
.post-toc { margin-top: 28px; padding: 14px 16px 8px; background: var(--sheet); border: 1px solid #c3cad3; border-radius: var(--radius); font-size: 0.82em; }
.post-toc h2 { margin: 0 0 4px; font-size: 1em; font-weight: 700; }
.post-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.post-toc li { counter-increment: toc; }
.post-toc a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0;
  color: var(--ink); text-decoration: none; line-height: 1.3;
}
.post-toc a::before {
  content: counter(toc, decimal-leading-zero);
  flex: none; display: inline-grid; place-items: center; width: 1.9em; height: 1.9em;
  background: var(--field); color: var(--bone); font-size: 0.8em; font-weight: 700; border-radius: 2px;
}
@media (hover: hover) { .post-toc a:hover { text-decoration: underline; } }

/* ---------- Reading ---------- */
.post-body { margin-top: 12px; line-height: 1.65; }
.post-body > p, .post-body li { overflow-wrap: break-word; }
.post-body p { margin: 0 0 1.05em; }
.post-body h2 {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 1.6em 0 0.7em; scroll-margin-top: 92px;
  font: 800 1.42em/1.18 var(--face); font-stretch: 106%; letter-spacing: -0.01em; text-wrap: balance;
}
.sec-n {
  flex: none; display: inline-grid; place-items: center; width: 1.55em; height: 1.55em; margin-top: 0.02em;
  background: var(--field); color: var(--bone); font-size: 0.62em; font-weight: 700; letter-spacing: 0;
  border-radius: 2px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35);
}
.post-body h3 { margin: 1.5em 0 0.5em; font: 700 1.12em/1.3 var(--face); }
.post-body ul, .post-body ol { margin: 0 0 1.1em; padding-left: 1.25em; }
.post-body li { margin-bottom: 0.45em; }
.post-body strong { font-weight: 700; }
.post-body a { overflow-wrap: anywhere; }

/* A line of blocks between sections. menu.js clears it as it scrolls into view (world.css has the shared styles). */
.clear-line { margin: 2.4em 0 0; }
.clear-line--end { margin: 0 0 24px; }

/* Ranked list (personal audit): numbered blocks; an item linked from another page lights up. */
.post-body .ranked { list-style: none; padding: 0; counter-reset: rank; }
.post-body .ranked li { counter-increment: rank; position: relative; padding: 10px 10px 10px 2.7em; margin: 0 0 6px; border-radius: var(--radius); scroll-margin-top: 16px; }
.post-body .ranked li::before {
  content: counter(rank); position: absolute; left: 6px; top: 12px;
  display: grid; place-items: center; width: 1.6em; height: 1.6em;
  background: var(--piece-z); color: var(--ink); font-size: 0.85em; font-weight: 800; border-radius: 2px;
}
.post-body .ranked li:target { background: #fff3cf; box-shadow: 0 0 0 2px var(--piece-o); }

/* Tables: a sheet with ruled rows; on phones each row stacks with its column names. */
.post-table { margin: 0 0 1.4em; overflow-x: auto; }
.post-table table { width: 100%; border-collapse: collapse; font-size: 0.86em; line-height: 1.45; background: var(--sheet); }
.post-table th, .post-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--paper-line); }
.post-table thead th { background: var(--field); color: var(--bone); font-weight: 700; }
.post-table tbody td:first-child { font-weight: 700; }
@media (max-width: 699px) {
  .post-table table, .post-table tbody, .post-table tr, .post-table td { display: block; }
  .post-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .post-table tr { padding: 10px 12px; border: 1px solid #c3cad3; border-radius: var(--radius); margin-bottom: 8px; background: var(--sheet); }
  .post-table td { padding: 3px 0; border: 0; }
  .post-table td::before { content: attr(data-label); display: block; font-size: 0.8em; font-weight: 700; color: var(--ink-soft); }
  .post-table tbody td:first-child { font-size: 1.05em; }
  .post-table tbody td:first-child::before { display: none; }
}

/* Dungeon data: the green boxes the recommendation post refers to. */
.post-data {
  margin: 1.6em 0; padding: 16px 18px 4px;
  background: #eef3e3; border: 2px solid #5f7f22; border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--piece-s); font-size: 0.94em;
}
.post-data-label { margin: 0 0 8px !important; font-size: 0.82em; font-weight: 800; color: #3f5814; }

/* His aside, in his words: on the playfield. */
.post-aside { margin: 1.4em 0 1.8em; padding: 18px 20px 6px; background: var(--field); color: var(--bone); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--piece-o); }
.post-aside a { color: var(--bone); }
.post-aside-label { margin: 0 0 8px !important; font-size: 0.82em; font-weight: 800; color: inherit; }

/* Side-by-side comparison (mention and citation; filler and a quotable line). */
.post-compare { display: grid; gap: 14px; margin: 1.2em 0 1.6em; }
@media (min-width: 700px) { .post-compare { grid-template-columns: 1fr 1fr; } }
.post-compare-item { padding: 14px 16px 2px; background: var(--sheet); border: 1px solid #c3cad3; border-radius: var(--radius); font-size: 0.92em; }
.post-compare-item:last-child { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--piece-i); }
.post-compare-label { margin: 0 0 8px !important; font-size: 0.85em; color: var(--ink-soft); }
.post-compare blockquote { margin: 0 0 12px; font-weight: 600; font-size: 1.05em; line-height: 1.45; }
.post-compare blockquote p { margin: 0; }

/* A sourced figure, set large next to its source. */
.post-stat { margin: 1.4em 0; padding: 14px 0 2px; border-top: 2px solid var(--ink); border-bottom: 1px solid #c3cad3; }
.post-stat-n { display: block; font-size: 2.8em; font-weight: 800; line-height: 1; color: var(--number-ink); font-stretch: 112%; margin-bottom: 6px; }

/* Intent cards (search intent post). */
.intent-cards { display: grid; gap: 16px; margin: 1.2em 0 1.8em; }
@media (min-width: 760px) { .intent-cards { grid-template-columns: 1fr 1fr; } }
.intent-card { background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--radius); font-size: 0.9em; overflow: hidden; }
.intent-card > * { margin-inline: 16px !important; }
.post-body .intent-card h3 { margin: 0 !important; padding: 12px 16px; font-size: 1.2em; background: var(--tile); color: var(--ink); }
.intent-card h3 span { display: block; font-size: 0.72em; font-weight: 600; }
.intent-card--i { --tile: var(--piece-i); }
.intent-card--o { --tile: var(--piece-o); }
.intent-card--j { --tile: var(--piece-j); }
.intent-card--z { --tile: var(--piece-z); }
.intent-card > p:first-of-type { margin-top: 12px; }
.intent-q-label { margin-bottom: 4px !important; font-size: 0.85em; font-weight: 700; color: var(--ink-soft); }
.post-body .intent-q { list-style: none; padding: 0; display: grid; gap: 4px; }
.post-body .intent-q li { margin: 0; padding: 4px 10px; border: 1px solid #c3cad3; border-radius: 2px; background: #fff; font-family: ui-monospace, monospace; font-size: 0.9em; }

/* ---------- Figures: the old posts' images, framed as blocks (world.css .pframe grammar) ----------
   A dark playfield frame and a hard offset shadow in a piece color: amber for the hero, moss for
   diagrams, sky for screenshots and illustrations (posts.js sets them). Width and height on every
   image hold the space, so nothing shifts as they load. */
.post-fig { margin: 2em 12px 2.2em 0; }
.post-fig .pframe-img { padding: 6px; border-radius: 2px; }
.post-fig .pframe-img img { border-radius: 1px; background: #fff; }
.post-fig figcaption { margin-top: 20px; font-size: 0.8em; line-height: 1.5; color: var(--ink-soft); }
.post-fig-n {
  display: inline-block; margin-right: 6px; padding: 1px 7px;
  background: var(--field); color: var(--bone); font-weight: 700; font-size: 0.92em; border-radius: 2px;
}
.post-fig-full { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--work-ink); }
.post-fig--hero { margin-top: 30px; margin-bottom: 0; }
/* Several images in one frame: a grid of cells with the frame color as the grout. */
.post-fig--pair .post-fig-frame, .post-fig--surfaces .post-fig-frame { display: grid; gap: 6px; align-items: start; }
@media (min-width: 700px) {
  .post-fig--pair .post-fig-frame { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .post-fig--pair .post-fig-pic { background: #fff; }
  .post-fig--surfaces .post-fig-frame { grid-template-columns: 1fr 1fr; }
  .post-fig--surfaces .post-fig-pic:nth-child(-n+2) { grid-column: 1 / -1; }
}
.post-fig--surfaces .post-fig-pic:nth-child(n+3) img { background: #1b1b1f; }
.post-fig-pic { display: block; }

/* ---------- The end: where it came from, and where to go next ---------- */
.post-end { margin-top: 2.4em; }
.post-origin { margin: 0 0 24px; font-size: 0.82em; line-height: 1.5; color: var(--ink-soft); }
.post-next { padding: 18px 20px 20px; background: var(--field); color: var(--bone); border-radius: var(--radius); }
.post-next-label { margin: 0 0 10px; font-weight: 700; color: var(--bone-soft); font-size: 0.85em; }
.post-next .btn { min-height: 52px; padding: 10px 22px; line-height: 1.25; text-align: left; font-size: 0.95em; }
.post-related { margin-top: 24px; font-size: 0.9em; }
.post-related h2 { margin: 0 0 4px; font-size: 1em; font-weight: 700; }
.post-related ul { margin: 0; padding: 0; list-style: none; }
.post-related a { display: inline-flex; align-items: center; min-height: 44px; }

/* Author card: who wrote this, and the two ways to keep up. */
.post-author { display: grid; grid-template-columns: 112px 1fr; gap: 22px; align-items: start; margin: 8px 0 28px; padding: 22px; background: var(--sheet, #fff);
  border-top: 6px solid var(--piece-i); border-radius: 3px; box-shadow: 0 1px 0 var(--paper-line), 0 10px 24px rgba(20, 22, 28, .08); }
.post-author-photo .pframe-img { padding: 5px; box-shadow: 7px 7px 0 var(--frame-shadow); }
.post-author-photo .pframe-egg { top: auto; bottom: -22px; right: -10px; min-height: 44px; font-size: .78rem; padding: 0 10px; }
.post-author-text p { margin: 0 0 10px; line-height: 1.55; }
.post-author-name { font-weight: 800; font-size: 1.1rem; }
.post-author-name a, .post-author-links a:not(.btn) { color: var(--work-ink); font-weight: 700; }
.post-author-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 4px; }
.post-author-links a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 520px) { .post-author { grid-template-columns: 84px 1fr; gap: 16px; padding: 18px; } }
.post-by a { font-weight: 700; color: inherit; text-underline-offset: .18em; }
.post-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 22px; }
.post-share-label { margin: 0 6px 0 0; font-weight: 800; }

/* Breadcrumb trail and "Filed under" topic links (2026-10-11). */
.post-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.post-crumb span { color: var(--bone-soft); font-size: .85em; }
.post-topics { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 14px 0 0; }
.post-topics-label { margin-right: 4px; color: var(--bone-soft); font-size: .8em; font-weight: 700; }
.post-topics a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 8px; background: var(--field-2); color: var(--bone);
  font-size: .82em; font-weight: 700; text-decoration: none; border-radius: 3px; box-shadow: inset 0 -3px 0 var(--tile), inset 0 0 0 1px #3a3f4b; }
@media (hover: hover) { .post-topics a:hover { background: #2c303b; } }
.post-topic-icon { display: inline-grid; width: 22px; height: 22px; }
.post-topic-icon svg { width: 100%; height: 100%; }
.post-body table { display: block; max-width: 100%; overflow-x: auto; }
.post-since { margin: 20px 0 0; padding: 14px 16px; background: #f3f0e8; border-radius: 3px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.06); color: var(--ink); line-height: 1.6; }
.post-since p { margin: 0; }
.post-since span { display: block; font-size: .82rem; font-weight: 800; color: var(--ink-soft); }
.post-since a { color: var(--work-ink); font-weight: 700; }
/* 2026-10-12: on phones the "Filed under" chips stacked one per line and pushed the short answer down. */
@media (max-width: 640px) { .post-topics { gap: 8px; } .post-topics a { min-height: 36px; padding: 0 10px 0 6px; font-size: .85rem; } .post-topics .post-topic-icon { transform: scale(.85); } }
@media (min-width: 900px) { .post-body :is(h2, h3)[id] { scroll-margin-top: 106px; } }
