/* Codegent round 4: the blog (Thinking). Loaded after codegent.css on every page under /blog/. */

/* On blog pages the header sits on its own black bar rather than over a cover. */
/* The header is fixed (codegent.css), so blog pages start below it */
#main { padding-top: var(--top-h); }
main { background: var(--white); color: var(--ink); }

/* A short dash, as on the deck */
.dash::after, .post__title::after, .bhead__title::after {
  content: ""; display: block; width: 28px; height: 4px; background: currentColor; margin-top: clamp(16px, 2vw, 24px);
}

/* ---------- Post ---------- */
.post__head { background: var(--grey); }
.post__head .col { padding-top: clamp(40px, 6vw, 88px); padding-bottom: clamp(32px, 4vw, 56px); }
.col { max-width: 800px; margin: 0 auto; }
.post__title {
  font-size: clamp(36px, 5.4vw, 68px); font-weight: 800; line-height: 1; letter-spacing: -.045em;
  text-wrap: balance; overflow-wrap: break-word; hyphens: manual;
}
.post__meta {
  display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: clamp(18px, 2vw, 24px);
  font-size: 16px; line-height: 1.4; color: var(--muted);
}
.post__by { font-weight: 700; color: var(--ink); }
.post__meta a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.post__meta a:hover { color: var(--rasp); }

.post__body { padding-top: clamp(32px, 4vw, 56px); }
.post__media { margin: 0 0 clamp(28px, 3.4vw, 44px); }
.post__media img { width: auto; max-width: 100%; height: auto; background: var(--grey); }
.post__media video { width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--black); }

/* The reading column */
.prose { font-size: clamp(18px, 1.35vw, 20px); line-height: 1.6; max-width: 38em; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure, .prose .table-scroll { margin: 0 0 1.1em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { color: var(--black); letter-spacing: -.02em; text-wrap: balance; margin: 1.6em 0 .5em; }
.prose h1, .prose h2 { font-size: 1.45em; font-weight: 800; line-height: 1.15; letter-spacing: -.03em; }
.prose h3 { font-size: 1.2em; font-weight: 800; line-height: 1.25; }
.prose h4, .prose h5, .prose h6 { font-size: 1em; font-weight: 700; line-height: 1.35; }
.prose a { color: var(--rasp); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong, .prose b { font-weight: 700; }
.prose ul { list-style: disc; padding-left: 1.3em; }
.prose ol { list-style: decimal; padding-left: 1.5em; }
.prose li { margin-bottom: .35em; }
.prose li::marker { color: var(--rasp); }
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin: .35em 0 0; }
.prose blockquote { border-left: 4px solid var(--rasp); padding: .1em 0 .1em 1em; color: var(--ink); font-style: italic; }
.prose blockquote > :last-child { margin-bottom: 0; }
/* Old images are often small and soft: show them at no more than their own width. */
.prose img { max-width: 100%; height: auto; margin: 1.4em 0; }
.prose p img, .prose a img { margin: .4em 0; }
.prose img[align="left"] { float: left; max-width: 45%; margin: .3em 1.2em .8em 0; }
.prose img[align="right"] { float: right; max-width: 45%; margin: .3em 0 .8em 1.2em; }
.prose img[align="center"] { margin-left: auto; margin-right: auto; }
.prose::after { content: ""; display: table; clear: both; }
.prose iframe { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; margin: 1.4em 0; background: var(--black); }
.prose video { width: 100%; height: auto; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: var(--grey); padding: .1em .3em; }
.prose pre { overflow-x: auto; background: var(--grey); padding: 1em; font-size: .85em; line-height: 1.5; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 2px solid var(--grey); margin: 2em 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; font-size: .9em; }
.prose td, .prose th { vertical-align: top; padding: .4em .6em; }
.prose table img { margin: 0; }
.prose .twitter-tweet { border-left: 4px solid var(--grey); padding-left: 1em; }

/* Tags as small grey chips */
.post__tags { margin-top: clamp(28px, 3vw, 40px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a {
  display: inline-block; background: var(--grey); color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 500; line-height: 1.2; padding: 8px 12px;
  transition: background-color .2s ease, color .2s ease;
}
.chips a:hover, .chips a:focus-visible { background: var(--rasp); color: var(--white); }

/* Previous and next */
.post__foot { padding-top: clamp(48px, 6vw, 80px); padding-bottom: clamp(56px, 7vw, 104px); }
.pn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 3vw, 40px); }
.pn__link {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--black);
  border-top: 3px solid var(--black); padding-top: 14px;
}
.pn__link--next { grid-column: 2; text-align: right; align-items: flex-end; }
.pn__dir { font-size: 14px; font-weight: 700; color: var(--rasp); }
.pn__title { font-size: clamp(20px, 2vw, 28px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; text-wrap: balance; }
.pn__date { font-size: 14px; color: var(--muted); }
.pn__link:hover .pn__title, .pn__link:focus-visible .pn__title { color: var(--rasp); }
.post__more .more { margin-top: clamp(36px, 4vw, 56px); }
.post__note, .bpage__note {
  margin-top: clamp(36px, 4vw, 56px); padding-top: 16px; border-top: 1px solid #cfcfcf;
  font-size: 14px; line-height: 1.5; color: var(--muted);
}
.post__note a, .bpage__note a { color: var(--ink); }

/* ---------- Blog index ---------- */
.bhead { background: var(--rasp); color: var(--white); }
.bhead > .wrap { padding-top: clamp(48px, 7vw, 112px); padding-bottom: clamp(40px, 5vw, 72px); }
.bhead__title { font-size: clamp(64px, 12vw, 184px); font-weight: 800; letter-spacing: -.055em; line-height: .86; margin-left: -.04em; }
.bhead__note { margin-top: clamp(24px, 3vw, 40px); max-width: 40em; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.45; }
.bhead__note p + p { margin-top: 6px; font-size: .86em; }
.bhead__note a { color: var(--white); text-underline-offset: 3px; }
.bhead__note a:hover { text-decoration-thickness: 2px; }

.bpage { padding-top: clamp(32px, 4vw, 56px); padding-bottom: clamp(64px, 8vw, 120px); }

/* Categories as a row of links */
.cats { padding-bottom: clamp(28px, 3.4vw, 44px); border-bottom: 2px solid var(--black); }
.cats__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 24px; }
.cats__label { font-size: 14px; font-weight: 700; color: var(--rasp); }
.cats__all, .cats__tt { font-size: 16px; font-weight: 800; text-decoration: none; border-bottom: 2px solid transparent; padding: 4px 0; }
.cats__tt { color: var(--rasp); }
.cats__all:hover, .cats__tt:hover, .cats__all[aria-current] { border-color: currentColor; }
.cats__groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px clamp(16px, 2.4vw, 36px); margin-top: clamp(18px, 2vw, 28px); }
.cats__group { border-top: 2px solid var(--black); padding-top: 10px; }
.cats__head { font-size: 13px; font-weight: 800; letter-spacing: .02em; color: var(--muted); margin-bottom: 8px; }
.cats__list { display: grid; gap: 2px; }
.cats__list a { font-size: 16px; font-weight: 700; text-decoration: none; letter-spacing: -.01em; display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 0; border-bottom: 2px solid transparent; }
.cats__list a:hover { border-color: currentColor; }
.cats__list a[aria-current] { color: var(--rasp); border-color: currentColor; }
.cats__n { font-size: 13px; font-weight: 500; color: var(--muted); }
@media (max-width: 900px) { .cats__groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(40px, 4vw, 64px) clamp(16px, 2.2vw, 32px); margin-top: clamp(32px, 4vw, 56px); }
.card { display: flex; flex-direction: column; }
.card__link { display: flex; flex-direction: column; text-decoration: none; color: var(--black); }
.card__media { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--grey); margin-bottom: 16px; container-type: inline-size; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card__num { display: flex; align-items: flex-end; padding: 0 0 4cqi 5cqi; }
.card__num b { font-size: 33cqi; font-weight: 500; letter-spacing: -.065em; line-height: .78; font-variant-numeric: lining-nums; }
.card__num--rasp { background: var(--rasp); color: var(--white); }
.card__num--grey { background: var(--grey); color: var(--black); }
.card__date { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.card__title { font-size: clamp(21px, 1.8vw, 26px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; text-wrap: balance; overflow-wrap: break-word; }
.card__link:hover .card__title, .card__link:focus-visible .card__title { color: var(--rasp); }
.card__link:hover .card__media img { transform: scale(1.03); }
.card__sum { font-size: 16px; line-height: 1.5; margin-top: 10px; color: var(--ink); text-wrap: pretty; }
.card__by { font-size: 14px; font-weight: 700; margin-top: 10px; }

/* Pagination: deck-style square tiles */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-top: clamp(56px, 6vw, 88px); border-top: 2px solid var(--black); padding-top: 20px; }
.pager__nums { display: flex; flex-wrap: wrap; gap: 6px; }
.pager__nums a, .pager__nums span, .pager__gap {
  display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 6px;
  font-size: 16px; font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums;
}
.pager__nums a { background: var(--grey); color: var(--black); transition: background-color .2s ease, color .2s ease; }
.pager__nums a:hover, .pager__nums a:focus-visible { background: var(--black); color: var(--white); }
.pager__nums [aria-current] { background: var(--rasp); color: var(--white); }
.pager__gap { min-width: 20px; color: var(--muted); }
.pager__dir { font-size: 16px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; padding: 10px 0; }
.pager__dir::before { content: ""; width: 14px; height: 3px; background: currentColor; }
.pager__dir--older::before { order: 2; }
a.pager__dir:hover { color: var(--rasp); }
.pager__dir.is-off { color: #767676; }

/* ---------- Category and tag pages ---------- */
.bhead--term { background: var(--grey); color: var(--black); }
.bhead__title--term { font-size: clamp(44px, 7.4vw, 112px); line-height: .92; letter-spacing: -.05em; text-wrap: balance; overflow-wrap: break-word; }
.bhead__count { margin-top: clamp(16px, 2vw, 24px); font-size: clamp(17px, 1.4vw, 20px); color: var(--muted); }

.rows { max-width: 1000px; }
.row { display: grid; grid-template-columns: 11em minmax(0, 1fr); gap: 8px clamp(20px, 3vw, 48px); border-top: 2px solid var(--black); padding: 18px 0 26px; }
.row:first-child { border-top: 0; padding-top: 0; }
.row__date { font-size: 15px; color: var(--muted); padding-top: .3em; }
.row__title { font-size: clamp(21px, 2vw, 28px); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; text-wrap: balance; overflow-wrap: break-word; }
.row__title a { text-decoration: none; }
.row__title a:hover, .row__title a:focus-visible { color: var(--rasp); }
.row__sum { font-size: 16px; line-height: 1.5; margin-top: 8px; max-width: 40em; text-wrap: pretty; }
.row__meta { font-size: 14px; font-weight: 700; margin-top: 8px; }
.row__meta:empty { display: none; }
.bpage--term .cats { border-bottom: 0; border-top: 2px solid var(--black); padding: 20px 0 0; margin-top: clamp(48px, 5vw, 72px); }
.bpage__back .more { margin-top: clamp(40px, 4vw, 56px); }
.bpage--term .pager + .bpage__back .more { margin-top: 28px; }

/* ---------- Tablet and phone ---------- */
@media (max-width: 1080px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; gap: 44px; }
  .pn { grid-template-columns: 1fr; gap: 28px; }
  .pn__link--next { grid-column: 1; text-align: left; align-items: flex-start; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .row__date { padding-top: 0; font-size: 14px; }
  .prose img[align="left"], .prose img[align="right"] { float: none; max-width: 100%; margin: 1em 0; }
  .pager { justify-content: space-between; }
  .pager__nums { order: 3; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .card__link:hover .card__media img { transform: none; }
}

/* Fixes after the first look */
.bhead .label { color: var(--white); }
.bhead--term .label { color: var(--rasp); }
.bhead__title::after { margin-left: .06em; }
