/* NullTrace blog. Builds on styles.css (same tokens, header, footer, buttons); blog pages only. */

.blog-page { background: var(--bg); }
.blog-page .primary-nav > a[aria-current="page"] { color: var(--text); }

/* ===== Hero (index and article) ===== */

.blog-hero,
.post-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: calc(var(--header-h) + clamp(48px, 7vw, 96px)) clamp(48px, 6vw, 80px);
}
.blog-glow {
  position: absolute;
  top: -30vh;
  right: -10vw;
  width: min(1100px, 120vw);
  height: 70vh;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(101, 220, 239, .22), rgba(101, 220, 239, .05) 60%, transparent 100%);
  filter: blur(8px);
}
.blog-hero .hero-grid,
.post-hero .hero-grid {
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 80% 70% at 70% 0%, #000 10%, transparent 70%);
}
.blog-hero h1 {
  max-width: 17ch;
  margin-top: 26px;
  font-size: clamp(40px, 6.2vw, 86px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.048em;
  text-wrap: balance;
}
.blog-lede {
  max-width: 60ch;
  margin-top: 24px;
  color: #c4ced4;
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.55;
  text-wrap: pretty;
}

/* Hero entrance: once, on load. */
.js .blog-hero [data-enter-item],
.js .post-hero [data-enter-item] { animation: post-in 760ms var(--ease-enter) both; }
.js [data-enter-item]:nth-child(2) { animation-delay: 70ms; }
.js [data-enter-item]:nth-child(3) { animation-delay: 140ms; }
.js [data-enter-item]:nth-child(4) { animation-delay: 210ms; }
.js .post-hero-visual[data-enter-item] { animation-delay: 260ms; }
@keyframes post-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ===== Topic filter ===== */

.blog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 36px;
}
.blog-filter[hidden] { display: none; }
.filter-chip {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(11, 17, 23, .7);
  color: var(--muted);
  font: 500 14px/1 var(--body);
  cursor: pointer;
  transition: color 150ms var(--ease), border-color 150ms var(--ease), background-color 150ms var(--ease), transform 150ms var(--ease);
}
.filter-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.filter-chip:active { transform: translateY(1px) scale(.98); }
@media (hover: hover) and (pointer: fine) {
  .filter-chip:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
}
.filter-chip:focus-visible,
.post-card-link:focus-visible,
.post-toc a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ===== Cards ===== */

.blog-featured { padding-block: 8px clamp(40px, 5vw, 64px); }
.blog-list { padding-block: clamp(40px, 5vw, 64px) clamp(72px, 9vw, 120px); border-top: 1px solid var(--line); }
.blog-featured .section-label,
.blog-list .section-label { margin-bottom: 24px; }
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
}
.post-card { min-width: 0; }
.post-card[hidden] { display: none; }
.post-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.post-card-visual {
  position: relative;
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse 60% 70% at 50% 50%, rgba(101, 220, 239, .08), transparent 70%), #060b10;
}
.post-card-visual .glyph { position: absolute; inset: 0; width: 100%; height: 100%; }
.post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 24px 24px 26px;
}
.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  color: var(--dim);
  font: 400 13px/1.4 var(--mono);
}
.post-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--accent);
  font: 500 12px/1.3 var(--mono);
  letter-spacing: .02em;
}
.post-card h3 {
  margin-top: 16px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.post-card-text { margin-top: 12px; color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.post-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 22px;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
}
@media (hover: hover) and (pointer: fine) {
  .post-card-link:hover { transform: translateY(-2px); border-color: rgba(101, 220, 239, .38); box-shadow: 0 30px 70px -40px rgba(101, 220, 239, .45); }
  .post-card-link:hover .arrow-icon { transform: translateX(3px); }
}
.post-card-link:active { transform: translateY(0) scale(.995); }

.post-card-wide .post-card-link {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}
.post-card-wide .post-card-visual { aspect-ratio: auto; min-height: 360px; border-bottom: 0; border-right: 1px solid var(--line); }
.post-card-wide .post-card-body { padding: clamp(28px, 3.4vw, 48px); justify-content: center; }
.post-card-wide h3 { font-size: clamp(28px, 3vw, 42px); line-height: 1.08; letter-spacing: -.035em; }
.post-card-wide .post-card-text { font-size: 17px; max-width: 46ch; }

/* ===== Topic drawings ===== */

.glyph { overflow: visible; }
.glyph .g-grid path { stroke: rgba(172, 210, 225, .07); stroke-width: 1; fill: none; }
.glyph .g-rings circle,
.glyph .g-track,
.glyph .g-links path,
.glyph .g-ticks path { fill: none; stroke: var(--line-strong); stroke-width: 1.4; }
.glyph .g-core { fill: var(--accent); }
.glyph .g-hub { fill: #0b1820; stroke: var(--accent); stroke-width: 1.4; }
.glyph .g-nodes circle { fill: #0d151c; stroke: var(--accent); stroke-width: 1.4; }
.glyph .g-nodes .g-hot { stroke: var(--warn); fill: rgba(242, 194, 123, .14); }
.glyph .g-sweep path { fill: rgba(101, 220, 239, .16); stroke: none; }
.glyph .g-sweep { transform-origin: 160px 100px; transform-box: view-box; }
.glyph .g-blip { fill: var(--warn); opacity: .9; }
.glyph .g-arc { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 390; stroke-dashoffset: 120; }
.glyph .g-hand { stroke: var(--accent-strong); stroke-width: 2; stroke-linecap: round; transform-origin: 160px 100px; transform-box: view-box; transform: rotate(250deg); }
.glyph .g-label { fill: var(--muted); font: 500 15px/1 var(--mono); }
.glyph .g-pulses path { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 12 260; stroke-dashoffset: -200; opacity: 0; }

/* Each drawing runs its loop once when it appears, and again while the pointer is on its card. */
.js .glyph .g-sweep { animation: g-sweep 3.2s var(--ease) 1 both; }
.js .glyph .g-blip { animation: g-blip 3.2s var(--ease) 1 both; }
.js .glyph .g-blip-2 { animation-delay: .5s; }
.js .glyph .g-blip-3 { animation-delay: 1s; }
.js .glyph .g-arc { animation: g-arc 3.2s var(--ease) 1 both; }
.js .glyph .g-hand { animation: g-hand 3.2s var(--ease) 1 both; }
.js .glyph .g-pulses path { animation: g-pulse 3s linear 1 both; }
.js .glyph .g-pulses path:nth-child(2) { animation-delay: .35s; }
.js .glyph .g-pulses path:nth-child(3) { animation-delay: .7s; }
.js .glyph .g-pulses path:nth-child(4) { animation-delay: 1.05s; }
.js .glyph .g-pulses path:nth-child(5) { animation-delay: 1.4s; }
@media (hover: hover) and (pointer: fine) {
  .js .post-card-link:hover .g-sweep { animation: g-sweep-again 3.2s linear infinite; }
  .js .post-card-link:hover .g-blip { animation: g-blip-again 3.2s var(--ease) infinite; }
  .js .post-card-link:hover .g-arc { animation: g-arc-again 3.2s var(--ease) infinite; }
  .js .post-card-link:hover .g-hand { animation: g-hand-again 3.2s var(--ease) infinite; }
  .js .post-card-link:hover .g-pulses path { animation: g-pulse-again 3s linear infinite; }
}
@keyframes g-sweep { from { transform: rotate(-120deg); } to { transform: rotate(240deg); } }
@keyframes g-sweep-again { from { transform: rotate(-120deg); } to { transform: rotate(240deg); } }
@keyframes g-blip { 0%, 30% { opacity: 0; transform: scale(.4); } 45% { opacity: 1; transform: scale(1.3); } 100% { opacity: .9; transform: none; } }
@keyframes g-blip-again { 0%, 30% { opacity: 0; transform: scale(.4); } 45% { opacity: 1; transform: scale(1.3); } 100% { opacity: .9; transform: none; } }
@keyframes g-arc { from { stroke-dashoffset: 390; } to { stroke-dashoffset: 120; } }
@keyframes g-arc-again { from { stroke-dashoffset: 390; } to { stroke-dashoffset: 120; } }
@keyframes g-hand { from { transform: rotate(0); } to { transform: rotate(250deg); } }
@keyframes g-hand-again { from { transform: rotate(0); } to { transform: rotate(250deg); } }
@keyframes g-pulse { 0% { stroke-dashoffset: 12; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { stroke-dashoffset: -200; opacity: 0; } }
@keyframes g-pulse-again { 0% { stroke-dashoffset: 12; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { stroke-dashoffset: -200; opacity: 0; } }
.glyph .g-blip { transform-box: fill-box; transform-origin: center; }

/* ===== Method band and closing call (index and article) ===== */

.blog-method { padding-block: clamp(72px, 9vw, 120px); border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(11, 17, 23, .6), transparent); }
.blog-method-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 48px 80px;
  align-items: center;
}
.blog-method .section-title { font-size: clamp(32px, 4vw, 52px); }
.blog-method .section-copy { margin-top: 20px; }
.blog-method .button { margin-top: 32px; }
.method-steps { position: relative; display: grid; gap: 0; counter-reset: none; }
.method-steps::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 22px;
  bottom: 22px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent), var(--line-strong));
}
.method-steps li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}
.method-steps span {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font: 500 13px/1 var(--mono);
}
.method-steps strong { font-size: 19px; font-weight: 550; }

.blog-cta { padding-block: clamp(64px, 8vw, 104px); border-top: 1px solid var(--line); }
.blog-cta-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 5vw, 64px);
  border: 1px solid rgba(101, 220, 239, .28);
  border-radius: calc(var(--radius) + 6px);
  background:
    radial-gradient(ellipse 60% 90% at 100% 0%, rgba(101, 220, 239, .16), transparent 70%),
    var(--surface);
}
.blog-cta-panel h2 {
  max-width: 22ch;
  margin-top: 18px;
  font-size: clamp(30px, 3.8vw, 50px);
  font-weight: 620;
  line-height: 1.05;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.blog-cta-panel > p:not(.eyebrow) { max-width: 58ch; margin-top: 18px; color: var(--muted); font-size: 17px; }
.blog-cta-panel .button { margin-top: 30px; }

/* ===== Article ===== */

.read-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: 2px;
  pointer-events: none;
}
.read-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform-origin: left;
  transform: scaleX(var(--read, 0));
}

.post-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 40px 64px;
  align-items: center;
}
.post-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--dim);
  font: 400 13px/1.4 var(--mono);
}
.post-crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) left 75% / 0 1px no-repeat;
  transition: color 150ms var(--ease), background-size 220ms var(--ease);
}
.post-crumbs a:hover { color: var(--text); background-size: 100% 1px; }
.post-hero h1 {
  max-width: 21ch;
  margin-top: 14px;
  font-size: clamp(36px, 4.6vw, 64px);
  font-weight: 650;
  line-height: 1.03;
  letter-spacing: -.042em;
  text-wrap: balance;
}
.post-dek {
  max-width: 58ch;
  margin-top: 22px;
  color: #c4ced4;
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.55;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 24px;
  color: var(--dim);
  font: 400 13px/1.5 var(--mono);
}
.post-meta time { color: var(--muted); }
.post-hero-visual {
  position: relative;
  aspect-ratio: 16 / 11;
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 4px);
  background: radial-gradient(ellipse 60% 70% at 50% 50%, rgba(101, 220, 239, .1), transparent 70%), #060b10;
  box-shadow: 0 50px 120px -60px rgba(101, 220, 239, .45);
}
.post-hero-visual .glyph { position: absolute; inset: 6%; width: 88%; height: 88%; }

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 720px) minmax(0, 1fr);
  gap: 0 56px;
  padding-bottom: clamp(56px, 7vw, 96px);
}
.post-aside { grid-column: 1; }
.post-main { grid-column: 2; min-width: 0; }
.post-toc {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  max-width: 230px;
  margin-top: 6px;
}
.post-toc-title { color: var(--dim); font: 500 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.post-toc ol { display: grid; gap: 2px; margin-top: 14px; border-left: 1px solid var(--line); }
.post-toc a {
  position: relative;
  padding: 7px 0 7px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition: color 150ms var(--ease);
}
.post-toc a::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 200ms var(--ease);
}
.post-toc a:hover { color: var(--text); }
.post-toc a.is-active { color: var(--text); }
.post-toc a.is-active::before { transform: scaleY(1); }
.post-toc-mobile { display: none; }

.post-brief {
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.post-brief-title { color: var(--accent); font: 500 13px/1.4 var(--mono); letter-spacing: .04em; }
.post-brief ul { display: grid; gap: 12px; margin-top: 16px; }
.post-brief li { position: relative; padding-left: 26px; color: #d6dee2; font-size: 16.5px; line-height: 1.55; }
.post-brief li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .55em;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

/* Prose: the text stays still and readable; only the blocks below move. */
.post-body { margin-top: 44px; color: #c9d3d8; font-size: 18px; line-height: 1.75; }
.post-body > * + * { margin-top: 20px; }
.post-body .post-lead { color: var(--text); font-size: clamp(19px, 1.6vw, 22px); line-height: 1.6; }
.post-body h2 {
  margin-top: 64px;
  color: var(--text);
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: -.028em;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.post-body h3 { margin-top: 36px; color: var(--text); font-size: 20px; font-weight: 600; line-height: 1.3; }
.post-body h2 + *,
.post-body h3 + * { margin-top: 14px; }
.post-body strong { color: var(--text); font-weight: 600; }
.post-body em { font-style: italic; }
.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 150ms var(--ease), text-decoration-color 150ms var(--ease);
}
.post-body a:hover { color: var(--accent-strong); }
.post-body code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent-strong);
  font: 500 .86em/1.4 var(--mono);
}
.post-body .terminal code { padding: 0; border: 0; background: none; color: var(--muted); font: 500 14px/1.5 var(--mono); }
.post-body .terminal .tone-cmd code { color: var(--accent); }
.post-body .terminal .tone-warn code { color: var(--warn); }
.post-body .terminal .tone-ok code { color: #9ff0c4; }
.post-monday { scroll-margin-top: calc(var(--header-h) + 24px); }
.post-monday h2 { scroll-margin-top: calc(var(--header-h) + 24px); }
.post-sources { margin-top: 8px; }
.post-sources h2 { margin-top: 48px; font-size: 22px; }
.post-body > ul { display: grid; gap: 12px; }
.post-body > ul > li { position: relative; padding-left: 26px; }
.post-body > ul > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .82em;
  width: 12px;
  height: 1.5px;
  background: var(--accent);
}

/* ===== Interludes ===== */

.post-body .pi { margin-block: 40px; }
.post-body figure { margin-inline: 0; }

.pi-note,
.post-disclaimer {
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(242, 194, 123, .05);
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.6;
}
.pi-note { border-left: 2px solid var(--warn); }
.post-disclaimer { margin-top: 24px; }

/* Timeline: each step lights up as it reaches the reading line, and goes dark again on the way back. */
.pi-timeline { position: relative; display: grid; gap: 26px; padding-left: 0; }
.pi-timeline::before,
.pi-timeline::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}
.pi-timeline::after {
  background: var(--accent);
  transform-origin: top;
  transform: scaleY(var(--fill, 1));
}
.pi-timeline li { position: relative; padding-left: 52px; }
.pi-timeline li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 5px var(--bg);
  transition: background-color 220ms var(--ease), border-color 220ms var(--ease);
  z-index: 1;
}
.pi-timeline li.is-lit::before,
html:not(.js) .pi-timeline li::before { background: var(--accent); }
.pi-when { display: block; color: var(--accent); font: 500 13px/1.4 var(--mono); letter-spacing: .03em; }
.pi-timeline strong { display: block; margin-top: 4px; color: var(--text); font-size: 19px; font-weight: 600; }
.pi-timeline p { margin-top: 6px; color: var(--muted); font-size: 16.5px; line-height: 1.6; }
.js .pi-timeline li { opacity: .38; transition: opacity 260ms var(--ease); }
.js .pi-timeline li.is-lit { opacity: 1; }
.js .pi-timeline li:not(.is-lit)::before { border-color: var(--line-strong); }

/* Figures with their source under each number. */
.pi-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pi-figure {
  display: flex;
  flex-direction: column;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.pi-number {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--accent);
  font-size: clamp(42px, 4.4vw, 56px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.pi-number small { color: var(--muted); font: 500 14px/1 var(--mono); letter-spacing: 0; }
.pi-figure p:not(.pi-number):not(.pi-cite) { margin-top: 14px; color: #d6dee2; font-size: 15px; line-height: 1.5; }
.pi-cite { margin-top: auto; padding-top: 14px; color: var(--dim); font: 400 12px/1.4 var(--mono); }

/* Comparison table; on phones each row becomes a small card. */
.pi-compare { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.pi-compare table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.pi-compare th,
.pi-compare td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.pi-compare tbody tr:last-child th,
.pi-compare tbody tr:last-child td { border-bottom: 0; }
.pi-compare thead th { color: var(--muted); background: var(--surface-2); font: 500 12.5px/1.35 var(--mono); }
.pi-compare thead th:nth-child(2) { color: var(--accent); }
.pi-compare tbody th { color: var(--text); font-weight: 600; width: 22%; }
.pi-compare tbody td { color: var(--muted); }
.pi-compare tbody td:nth-of-type(1) { color: #e3eaee; background: var(--accent-soft); }

/* Layers, from the internet inwards; the scan passes once when the block is first seen. */
.pi-layers ol { position: relative; display: grid; gap: 8px; }
.pi-layers li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 6px 20px;
  align-items: baseline;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.pi-layers li:nth-child(2) { margin-inline: 12px; }
.pi-layers li:nth-child(3) { margin-inline: 24px; }
.pi-layers li:nth-child(4) { margin-inline: 36px; }
.pi-layers li:nth-child(5) { margin-inline: 48px; }
.pi-layers .is-in { border-color: rgba(101, 220, 239, .3); }
.pi-layers .is-out { border-style: dashed; background: transparent; }
.pi-layer-name { color: var(--text); font: 500 14px/1.4 var(--mono); }
.pi-layers .is-out .pi-layer-name { color: var(--dim); }
.pi-layer-what { color: var(--muted); font-size: 15px; line-height: 1.5; }
.pi-layers .is-in::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(101, 220, 239, .16), transparent);
  transform: translateX(-100%);
}
.js .pi-layers.is-seen .is-in::after { animation: layer-scan 1.1s var(--ease) both; }
.js .pi-layers.is-seen li:nth-child(2)::after { animation-delay: .25s; }
.js .pi-layers.is-seen li:nth-child(3)::after { animation-delay: .5s; }
.js .pi-layers.is-seen li:nth-child(4)::after { animation-delay: .75s; }
@keyframes layer-scan { to { transform: translateX(100%); } }

/* Terminal: rows appear one by one as the block crosses the screen, and rewind on the way back. */
.pi-terminal .terminal { box-shadow: 0 40px 100px -50px rgba(101, 220, 239, .4); }
.pi-rows { padding: 6px 22px 18px; }
.pi-rows .terminal-row:last-child { border-bottom: 0; }
.pi-terminal .terminal-progress span { transform: scaleX(var(--scan-progress, 1)); }
.js .pi-terminal .terminal-row { opacity: .14; transform: translateY(6px); transition: opacity 260ms var(--ease), transform 260ms var(--ease); }
.js .pi-terminal .terminal-row.is-on { opacity: 1; transform: none; }
.js .pi-terminal .terminal-row.is-on code { animation: type-in 520ms steps(24, end); }
.js .pi-terminal .terminal-row.is-current { background: linear-gradient(90deg, rgba(101, 220, 239, .07), transparent 80%); }

.pi-sources { display: grid; gap: 10px; padding-left: 0; counter-reset: source; }
.pi-sources li {
  position: relative;
  padding-left: 34px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  counter-increment: source;
}
.pi-sources li::before {
  content: counter(source, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--dim);
  font: 400 12.5px/1.6 var(--mono);
}

/* Monday checklist: the reader ticks each point. Each tick pops, the bar on top fills,
   and the last one lights the whole panel. */
.post-monday {
  position: relative;
  overflow: hidden;
  margin-top: 56px;
  padding: clamp(24px, 3.4vw, 36px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  transition: border-color 320ms var(--ease), box-shadow 320ms var(--ease);
}
.post-monday::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
  transform-origin: left;
  transform: scaleX(var(--done, 0));
  transition: transform 460ms var(--ease-enter);
}
.post-monday.is-complete { border-color: rgba(101, 220, 239, .55); box-shadow: 0 0 0 4px var(--accent-soft), 0 30px 80px -40px var(--accent-glow); }
.post-monday h2 { font-size: clamp(24px, 2.4vw, 30px); font-weight: 620; letter-spacing: -.025em; }
.pi-checklist-hint { margin-top: 8px; color: var(--muted); font-size: 15px; }
html:not(.js) .pi-checklist-hint,
html:not(.js) .pi-checklist-count { display: none; }
.pi-checklist { display: grid; gap: 8px; margin-top: 18px; }
.pi-check-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  min-height: 56px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .015);
  color: #d6dee2;
  font: inherit;
  font-size: 16.5px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease), color 180ms var(--ease), transform 260ms var(--spring);
}
.pi-check-btn:active { transform: scale(.975); transition-duration: 90ms; }
.pi-check-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pi-check-btn[aria-pressed="true"] { border-color: rgba(101, 220, 239, .45); background: var(--accent-soft); color: var(--text); }
@media (hover: hover) and (pointer: fine) {
  .pi-check-btn:hover { border-color: rgba(101, 220, 239, .4); }
}
.pi-check {
  position: relative;
  width: 26px;
  height: 26px;
  flex: none;
  margin-top: -1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
}
.pi-check::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 12px;
  border-right: 2.5px solid var(--accent-ink);
  border-bottom: 2.5px solid var(--accent-ink);
  transform: rotate(45deg) scale(0);
  transition: transform 260ms var(--spring);
}
.pi-check-btn[aria-pressed="true"] .pi-check { background: var(--accent); border-color: var(--accent); }
.pi-check-btn[aria-pressed="true"] .pi-check::after { transform: rotate(45deg) scale(1); }
.just-ticked .pi-check { animation: tick-pop 440ms var(--spring); }
.just-ticked .pi-check::before {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  animation: tick-ring 620ms var(--ease) forwards;
}
.pi-checklist-count { margin-top: 16px; color: var(--muted); font: 500 13px/1.4 var(--mono); }
.is-complete .pi-checklist-count { color: var(--accent); animation: note-in 420ms var(--ease-enter); }
@keyframes tick-pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes tick-ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(2); } }

/* ===== Tap feedback =====
   The pressed state, the wave and the email confirmation are shared with the homepage (styles.css). */

.filter-chip,
.next-card,
.read-dock-button,
.read-sheet a,
.post-toc-mobile summary { position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.post-card-link { position: relative; -webkit-tap-highlight-color: transparent; }
.filter-chip.is-pressed { transform: translateY(1px) scale(.96); }
.post-card-link.is-pressed { transform: scale(.985); }
.next-card.is-pressed { transform: scale(.98); transition-duration: 90ms; }
.read-dock-button.is-pressed { transform: scale(.97); transition-duration: 90ms; }
.pi-check-btn.is-pressed { transform: scale(.975); transition-duration: 90ms; }

/* Filter: the chosen chip pops and the cards that stay deal back in, one after the other. */
.filter-chip.is-popped { animation: chip-pop 420ms var(--spring); }
@keyframes chip-pop { 0% { transform: scale(1); } 35% { transform: scale(1.1); } 100% { transform: scale(1); } }
.post-card.is-entering { animation: card-in 480ms var(--ease-enter) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.blog-filter-count { margin-top: 14px; color: var(--accent); font: 500 13px/1.4 var(--mono); }
.blog-filter-count[hidden] { display: none; }

/* ===== Clear sections: numbered headings, and a flash when you jump to one ===== */

.post-main { counter-reset: section; }
.post-body > h2,
.post-monday h2 { counter-increment: section; }
.post-body > h2::before,
.post-monday h2::before {
  content: counter(section, decimal-leading-zero);
  display: block;
  width: max-content;
  margin-bottom: 12px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--accent);
  font: 500 12px/1.4 var(--mono);
  letter-spacing: .02em;
}
.post-body > h2 { padding-top: 28px; border-top: 1px solid var(--line); }
.post-sources > h2 { padding-top: 0; border-top: 0; }
.is-arrived { animation: arrived 1200ms var(--ease) 1; }
@keyframes arrived { 0%, 25% { color: var(--accent); text-shadow: 0 0 26px var(--accent-glow); } 100% { color: var(--text); text-shadow: none; } }
.post-toc a { display: flex; gap: 10px; }
.toc-num { flex: none; color: var(--dim); font: 500 12px/1.6 var(--mono); }
.post-toc a.is-active .toc-num,
.read-sheet a.is-active .toc-num { color: var(--accent); }

/* ===== Plain explanations ===== */

.post-brief-hint {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14.5px;
}
.post-brief-hint[hidden] { display: none; }
.post-body .term {
  display: inline;
  padding: 0 2px;
  margin: 0 -2px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-decoration: underline dotted var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}
.post-body .term:hover,
.post-body .term.is-open { color: var(--accent); background: var(--accent-soft); }
.post-body .term:active { background: rgba(101, 220, 239, .25); }
.post-body .term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.term-card {
  display: block;
  margin: 12px 0 4px;
  padding: 14px 16px;
  border-left: 2px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--surface-2);
  color: #d6dee2;
  font-size: 15.5px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 220ms var(--ease), transform 260ms var(--ease-enter);
}
.term-card.is-open { opacity: 1; transform: none; }
.term-card strong { color: var(--accent); }

/* ===== Read next ===== */

.next-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 20px;
  align-items: center;
  margin-top: 48px;
  padding: 26px 26px 26px 28px;
  border: 1px solid rgba(101, 220, 239, .3);
  border-radius: var(--radius);
  background: radial-gradient(ellipse 70% 120% at 100% 0%, rgba(101, 220, 239, .14), transparent 70%), var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform 300ms var(--spring), border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.next-label { grid-column: 1 / -1; color: var(--accent); font: 500 13px/1.4 var(--mono); }
.next-title { grid-column: 1; font-size: clamp(21px, 2.3vw, 27px); font-weight: 620; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
.next-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--dim); font: 400 13px/1.4 var(--mono); }
.next-arrow {
  grid-column: 2;
  grid-row: 2 / span 2;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px -10px var(--accent-glow);
  transition: transform 300ms var(--spring);
}
.next-arrow .arrow-icon { width: 22px; height: 22px; }
@media (hover: hover) and (pointer: fine) {
  .next-card:hover { transform: translateY(-2px); border-color: rgba(101, 220, 239, .55); box-shadow: 0 30px 70px -40px rgba(101, 220, 239, .5); }
  .next-card:hover .next-arrow { transform: translateX(4px); }
}
.next-card:active { transform: scale(.98); transition-duration: 90ms; }
.next-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ===== Phone reading dock: where you are, how much is left, every section one tap away ===== */

.read-dock { display: none; }
@media (max-width: 1100px) {
  .js .read-dock:not([hidden]) {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 45;
    display: block;
    opacity: 0;
    transform: translateY(24px);
    pointer-events: none;
    transition: opacity 240ms var(--ease), transform 340ms var(--spring);
  }
  .js .read-dock.is-visible { opacity: 1; transform: none; pointer-events: auto; }
  .js .post-toc-mobile { display: none; }
}
.read-dock-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  min-height: 62px;
  margin-inline: auto;
  padding: 8px 18px 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(11, 17, 23, .94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  font: inherit;
  text-align: left;
  box-shadow: 0 22px 50px -18px rgba(0, 0, 0, .9);
  cursor: pointer;
  transition: transform 300ms var(--spring), border-color 200ms var(--ease);
}
.read-dock-button:active { transform: scale(.97); transition-duration: 90ms; }
.read-dock-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.read-dock.is-open .read-dock-button { border-color: var(--accent); }
.read-dock-ring { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex: none; }
.read-dock-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line-strong); stroke-width: 3; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 94.25px; stroke-dashoffset: calc(94.25px * (1 - var(--read, 0))); }
.read-dock-index { color: var(--accent); font: 600 12px/1 var(--mono); }
.read-dock-text { display: grid; flex: 1; min-width: 0; gap: 2px; }
.read-dock-title { overflow: hidden; font-size: 15px; font-weight: 600; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.read-dock-title.is-changing { animation: note-in 320ms var(--ease-enter); }
.read-dock-left { color: var(--muted); font: 400 12.5px/1.3 var(--mono); }
.read-dock-chevron { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 240ms var(--spring); }
.read-dock.is-open .read-dock-chevron { transform: rotate(180deg); }
.read-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  max-width: 560px;
  max-height: min(62vh, 480px);
  margin-inline: auto;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(8, 13, 18, .97);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .95);
  animation: sheet-in 300ms var(--spring);
  transform-origin: bottom center;
}
.read-sheet[hidden] { display: none; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.read-sheet-title { padding: 6px 10px 10px; color: var(--dim); font: 500 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.read-sheet ol { display: grid; gap: 2px; }
.read-sheet a {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 50px;
  padding: 8px 12px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.35;
  text-decoration: none;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.read-sheet a.is-active { color: var(--text); background: var(--accent-soft); }
.read-sheet a:active { background: rgba(101, 220, 239, .2); }

.blog-related { border-top: 1px solid var(--line); }

/* ===== Responsive ===== */

@media (max-width: 1100px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); max-width: calc(760px + 2 * var(--gutter)); }
  .post-aside { display: none; }
  .post-main { grid-column: 1; }
  .post-toc-mobile {
    display: block;
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
  }
  .post-toc-mobile summary {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 0 18px;
    color: var(--muted);
    font: 500 14px/1 var(--mono);
    cursor: pointer;
    list-style: none;
  }
  .post-toc-mobile summary::-webkit-details-marker { display: none; }
  .post-toc-mobile summary::after { content: "+"; margin-left: auto; color: var(--accent); font-size: 18px; }
  .post-toc-mobile[open] summary::after { content: "−"; }
  .post-toc-mobile ol { display: grid; padding: 0 18px 14px; }
  .post-toc-mobile a { display: flex; align-items: center; min-height: 44px; color: var(--text); font-size: 15px; text-decoration: none; border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .post-hero-inner,
  .blog-method-inner { grid-template-columns: minmax(0, 1fr); }
  .post-hero-visual { aspect-ratio: 16 / 7; }
  .post-card-wide .post-card-link { display: flex; }
  .post-card-wide .post-card-visual { min-height: 0; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 699px) {
  .blog-hero h1 { font-size: clamp(36px, 10.5vw, 48px); }
  .post-hero h1 { font-size: clamp(31px, 8.6vw, 40px); }
  .post-hero-visual { aspect-ratio: 16 / 8; }
  .post-body { font-size: 17px; }
  .post-body h2 { margin-top: 52px; }
  .pi-figures { grid-template-columns: minmax(0, 1fr); }
  .pi-figure { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
  .pi-figure p:not(.pi-number):not(.pi-cite) { margin-top: 4px; flex-basis: 100%; }
  .pi-cite { padding-top: 6px; }
  .pi-layers li { grid-template-columns: minmax(0, 1fr); margin-inline: 0 !important; }
  .pi-compare { border: 0; border-radius: 0; overflow: visible; }
  .pi-compare table,
  .pi-compare tbody,
  .pi-compare tr,
  .pi-compare th,
  .pi-compare td { display: block; width: auto; }
  .pi-compare thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pi-compare tbody { display: grid; gap: 12px; }
  .pi-compare tr { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .pi-compare tbody th { width: auto; background: var(--surface-2); }
  .pi-compare tbody td { border-bottom: 1px solid var(--line); }
  .pi-compare tbody tr td:last-child { border-bottom: 0; }
  .pi-compare tbody td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--dim); font: 500 12px/1.3 var(--mono); }
  .pi-compare tbody td:nth-of-type(1)::before { color: var(--accent); }
  .pi-rows { padding: 4px 16px 14px; }
  .pi-terminal .terminal-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pi-terminal .terminal-head { display: none; }
  .blog-cta-panel .button { width: 100%; white-space: normal; text-align: center; }
  .blog-method .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .js .blog-hero [data-enter-item],
  .js .post-hero [data-enter-item],
  .js .glyph *,
  .js .pi-layers.is-seen .is-in::after { animation: none !important; }
  .js .pi-timeline li,
  .js .pi-terminal .terminal-row { opacity: 1; transform: none; }
  .filter-chip.is-popped, .post-card.is-entering, .just-ticked .pi-check, .just-ticked .pi-check::before,
  .is-arrived, .read-sheet, .read-dock-title.is-changing { animation: none !important; }
  .post-card-link { transition: none; }
}

@media print {
  .read-progress, .post-aside, .post-toc-mobile, .blog-cta, .blog-related, .post-hero-visual { display: none !important; }
}
