/* Site styles. Colors live in the variables below; dark mode follows the
   visitor's system setting. */

@font-face { font-family: "Source Serif"; src: url("../fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2-variations"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("../fonts/source-serif-4-latin-opsz-italic.woff2") format("woff2-variations"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --paper: #f6f7f9;
  --card: #ffffff;
  --ink: #17202b;
  --muted: #5a6574;
  --rule: #d9dee6;
  --accent: #1d5b8f;         /* deep harbour blue */
  --accent-soft: #e3edf6;
  --loop: #1d5b8f;
  --serif: "Source Serif", Georgia, "Times New Roman", serif;
  --sans: "Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 38rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11161d; --card: #171e27; --ink: #e5e9ef; --muted: #9aa5b4;
    --rule: #2a3442; --accent: #8fbbe0; --accent-soft: #1c2a3a; --loop: #8fbbe0;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.125rem/1.7 var(--serif); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img, svg { max-width: 100%; height: auto; display: block; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; font-family: var(--sans); z-index: 9; }
.skip:focus { left: 8px; }

.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.5rem; }
.wrap.narrow { max-width: calc(var(--measure) + 3rem); }
.col { max-width: 52rem; }

h1, h2, h3 { font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3rem); font-variation-settings: "opsz" 60; }

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 4.25rem; flex-wrap: wrap; padding-top: .5rem; padding-bottom: .5rem; }
.name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.masthead nav { display: flex; gap: .25rem; flex-wrap: wrap; font-family: var(--sans); font-size: .95rem; }
.masthead nav a { color: var(--muted); text-decoration: none; padding: .35rem .6rem; border-radius: 4px; }
.masthead nav a:hover { color: var(--ink); background: var(--accent-soft); }
.masthead nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }

/* ---------- home ---------- */
.intro { padding: 4.5rem 0 3.5rem; }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 3rem; align-items: center; }
.intro-lede { font-size: clamp(1.9rem, 4vw, 2.75rem); line-height: 1.2; font-weight: 500; letter-spacing: -0.015em; margin: 0 0 1.25rem; font-variation-settings: "opsz" 60; max-width: 18ch; }
.intro-body { color: var(--muted); max-width: 34rem; }
.intro-links { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.75rem; }
.intro-figure { display: block; color: inherit; text-decoration: none; }
.figure-caption { display: block; text-align: center; font-family: var(--sans); font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.intro-figure:hover .figure-caption { color: var(--accent); }
@media (max-width: 820px) { .intro-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; } .intro { padding: 3rem 0 2rem; } .intro-figure { max-width: 26rem; margin: 0 auto; } }

.button { display: inline-flex; align-items: center; font: 500 .95rem/1 var(--sans); padding: .8rem 1.15rem; border-radius: 6px; background: var(--ink); color: var(--paper); text-decoration: none; border: 1px solid var(--ink); }
.button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.button.quiet:hover { border-color: var(--accent); color: var(--accent); }

/* the Question Loop diagram */
.loop { width: 100%; overflow: hidden; font-family: var(--sans); }
.loop-ring { fill: none; stroke: var(--rule); stroke-width: 1; }
.loop-arc { fill: none; stroke: var(--loop); stroke-width: 1.6; }
.loop-arrowhead { fill: var(--loop); }
.loop-node circle { fill: var(--paper); stroke: var(--loop); stroke-width: 2; }
.loop-node.is-start circle { fill: var(--loop); }
.loop-node text { font-size: 15px; fill: var(--ink); }
@media (max-width: 560px) { .loop-node text { font-size: 21px; } .loop-center { font-size: 24px; } }
.loop-center { font-family: var(--serif); font-size: 19px; font-weight: 600; fill: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .intro .loop-arc { stroke-dasharray: 120; stroke-dashoffset: 120; animation: trace .5s ease-out forwards; }
  .intro .loop-arc:nth-of-type(2) { animation-delay: .15s } .intro .loop-arc:nth-of-type(3) { animation-delay: .3s }
  .intro .loop-arc:nth-of-type(4) { animation-delay: .45s } .intro .loop-arc:nth-of-type(5) { animation-delay: .6s }
  .intro .loop-arc:nth-of-type(6) { animation-delay: .75s } .intro .loop-arc:nth-of-type(7) { animation-delay: .9s }
  .intro .loop-arc:nth-of-type(8) { animation-delay: 1.05s }
  @keyframes trace { to { stroke-dashoffset: 0; } }
}

.feature { padding: 0 0 1rem; }
.feature-card { display: grid; gap: .6rem; padding: 2rem 2.25rem; background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 6px; color: inherit; text-decoration: none; max-width: 52rem; }
.feature-card:hover { border-color: var(--accent); }
.feature-text { display: grid; gap: .6rem; align-content: start; }
.feature-card.has-image { grid-template-columns: minmax(0, 1fr) 10rem; gap: 2rem; align-items: center; }
.feature-thumb { width: 100%; border-radius: 4px; border: 1px solid var(--rule); }
@media (max-width: 640px) { .feature-card.has-image { grid-template-columns: minmax(0, 1fr); } .feature-thumb { max-width: 12rem; } }
.intro-grid.solo { grid-template-columns: minmax(0, 1fr); }
.series-kicker { font-family: var(--sans); font-size: .9rem; font-weight: 500; color: var(--accent); margin: 0 0 .75rem; }
.feature-card .series-kicker { margin: 0; }
.feature-title { font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 600; line-height: 1.15; font-variation-settings: "opsz" 48; }
.feature-excerpt { color: var(--muted); max-width: 40rem; }
.feature-meta { font-family: var(--sans); font-size: .85rem; color: var(--muted); }

.recent, .frameworks, .archive { padding: 2.5rem 0 1rem; }
.section-title { font-family: var(--sans); font-size: 1rem; font-weight: 600; color: var(--muted); padding-bottom: .6rem; border-bottom: 1px solid var(--rule); margin-bottom: 0; letter-spacing: 0; }

.entries { list-style: none; margin: 0; padding: 0; }
.entry { border-bottom: 1px solid var(--rule); }
.entry-link { display: grid; gap: .3rem; padding: 1.3rem 0; color: inherit; text-decoration: none; }
.entry-link:hover .entry-title { color: var(--accent); }
.entry-meta { display: flex; gap: .75rem; flex-wrap: wrap; font-family: var(--sans); font-size: .85rem; color: var(--muted); }
.series-mark { color: var(--accent); }
.entry-title { font-size: 1.35rem; font-weight: 600; line-height: 1.25; }
.entry-excerpt { color: var(--muted); font-size: 1rem; line-height: 1.55; }
.more { font-family: var(--sans); font-size: .95rem; margin-top: 1.25rem; }
.empty { color: var(--muted); font-style: italic; padding: 1.5rem 0; }

.fw-list { list-style: none; margin: 0; padding: 0; }
.fw-list li { border-bottom: 1px solid var(--rule); }
.fw-list a { display: grid; gap: .25rem; padding: 1.2rem 0; color: inherit; text-decoration: none; }
.fw-title { font-size: 1.25rem; font-weight: 600; }
.fw-list a:hover .fw-title { color: var(--accent); }
.fw-summary { color: var(--muted); font-size: 1rem; }

/* ---------- archive ---------- */
.page-head { padding: 3.5rem 0 1rem; }
.page-sub { color: var(--muted); }
.filter { display: grid; gap: .5rem; margin-top: 1.5rem; font-family: var(--sans); font-size: .95rem; }
.filter label { font-weight: 500; }
.filter input[type=search] { font: 1rem var(--sans); color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: .7rem .8rem; width: 100%; }
.filter input[type=search]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400 !important; color: var(--muted); }
.check input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.filter-status { color: var(--muted); margin: 0; min-height: 1.4em; font-size: .9rem; }
.year { font-family: var(--sans); font-size: 1rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: .6rem; margin: 2rem 0 0; }
.year-group:first-child .year { margin-top: 0; }

/* ---------- article ---------- */
.article { padding: 3.5rem 0 2rem; }
.article-head { margin-bottom: 2rem; }
.article-meta { font-family: var(--sans); font-size: .9rem; color: var(--muted); display: flex; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.tags { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.tag { color: var(--muted); }
.prose { font-size: 1.2rem; line-height: 1.75; }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-size: 1.5rem; margin-top: 2em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .4em; }
.prose blockquote { margin: 1.5em 0; padding-left: 1.2em; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }
.fw-figure { margin: 0 auto 2rem; }
.post-image { margin: 0 auto 2.5rem; padding: 0 1.5rem; max-width: 64rem; }
.post-image img { margin: 0 auto; max-height: 82vh; width: auto; max-width: 100%; border-radius: 6px; border: 1px solid var(--rule); }
.post-image a { display: block; }
.fw-figure .loop { max-width: 30rem; margin: 0 auto; }

.article-foot { margin-top: 2.5rem; }
.article-foot > :first-child { padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
.pager a { display: grid; gap: .2rem; color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.3; }
.pager a span { font-family: var(--sans); font-size: .85rem; font-weight: 400; color: var(--muted); }
.pager a:hover { color: var(--accent); }
.pager-newer { text-align: right; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager-newer { text-align: left; } }

/* ---------- footer ---------- */
.colophon { border-top: 1px solid var(--rule); margin-top: 4rem; padding: 2rem 0; font-family: var(--sans); font-size: .9rem; color: var(--muted); }
.colophon-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.colophon a { color: var(--muted); margin-left: 1rem; }
.colophon a:first-child { margin-left: 0; }
.colophon a:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  .wrap { padding: 0 1.15rem; }
  .prose { font-size: 1.1rem; }
  .feature-card { padding: 1.5rem; }
}

/* ---------- books ---------- */
.books-sub { max-width: 40rem; }
.books { padding: 1rem 0 2rem; }
.books-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 2.5rem 2rem; }
.book-card { display: grid; gap: .45rem; align-content: start; }
.book-cover-link img, .book-row img, .book-hero-cover img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 8px 24px rgba(13,20,34,.18); }
.book-cover-link:hover img, .book-row a:hover img { transform: translateY(-2px); transition: transform .15s ease; }
.book-vol, .book-row-vol { font-family: var(--sans); font-size: .8rem; font-weight: 600; color: var(--accent); margin-top: .6rem; }
.book-title { font-size: 1.2rem; font-weight: 600; line-height: 1.25; color: var(--ink); text-decoration: none; }
.book-title:hover { color: var(--accent); }
.book-question { color: var(--muted); font-size: .98rem; line-height: 1.5; }
.book-actions { display: flex; gap: 1rem; font-family: var(--sans); font-size: .9rem; font-weight: 500; margin-top: .2rem; }

.books-strip { padding: 2.5rem 0 1rem; }
.book-row { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); gap: 1.25rem; }
.book-row a { display: grid; gap: .15rem; color: inherit; text-decoration: none; }
.book-row-title { font-size: .95rem; font-weight: 600; line-height: 1.25; }
.book-row a:hover .book-row-title { color: var(--accent); }

.book-hero { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); gap: 3rem; align-items: center; margin-bottom: 2.5rem; }
.book-hero-cover { display: block; }
.book-opening { font-size: 1.25rem; line-height: 1.55; font-style: italic; color: var(--muted); max-width: 34rem; }
.book-facts { font-family: var(--sans); font-size: .9rem; color: var(--muted); margin: .4rem 0 0; }
.book-audio { margin-bottom: 2rem; }
.book-audio h2 { font-size: 1.25rem; }
.book-audio audio { width: 100%; }
.key-ideas li { margin-bottom: .6em; }
.book-license { font-family: var(--sans); font-size: .85rem; color: var(--muted); }
@media (max-width: 720px) { .book-hero { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; } .book-hero-cover { max-width: 14rem; } }

.post-book { font-family: var(--sans); font-size: .98rem; background: var(--accent-soft); border-radius: 6px; padding: 1rem 1.2rem; }
.post-book a { display: block; margin-top: .45rem; font-weight: 600; }

/* Audiobooks catalog */
.audiobooks { padding: 0 0 4rem; }
.audiobook-series + .audiobook-series { margin-top: 3rem; }
.audiobook-series h2 { margin-bottom: .4rem; }
.audio-legend { display: flex; gap: 1rem; margin: 0 0 1rem; font-size: .9rem; }
.status-live { color: #16833b; font-weight: 700; }
.status-soon, .coming-soon { color: var(--muted, #6b7280); }
.audio-table-wrap { overflow-x: auto; border: 1px solid var(--line, #d8d8d8); border-radius: .65rem; }
.audio-table { width: 100%; min-width: 860px; border-collapse: collapse; background: var(--paper, #fff); }
.audio-table th, .audio-table td { padding: .85rem .9rem; border-bottom: 1px solid var(--line, #e5e5e5); text-align: left; vertical-align: middle; }
.audio-table thead th { background: var(--soft, #f7f7f5); font-size: .9rem; }
.audio-table tbody tr:last-child th, .audio-table tbody tr:last-child td { border-bottom: 0; }
.audio-table tbody th { min-width: 250px; }
.audio-vol { display: block; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #6b7280); }
.audio-title { display: block; margin-top: .18rem; font-weight: 700; }
.spotify-link { white-space: nowrap; font-weight: 700; }
.coming-soon { white-space: nowrap; font-size: .9rem; }
.audio-note { margin-top: 1rem; color: var(--muted, #6b7280); font-size: .9rem; }