/* ===================================================================
   TheCoderSprint — editorial add-on
   Blog index, article, case study index and case study detail.

   Built ONLY from the tokens defined in styles.css (--paper, --ink,
   --accent, --deep, --r-card, --sh-2, --font-display …). No new colours,
   no new fonts, no new radii. Load it AFTER styles.css:

     <link rel="stylesheet" href="../assets/styles.css">
     <link rel="stylesheet" href="../assets/editorial.css">
   =================================================================== */

/* ── Shared: mono meta labels ───────────────────────────────────── */
.meta-mono {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.meta-row .sep {
  color: var(--line);
}
.meta-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  font-weight: 500;
}

/* ── Filter chips ───────────────────────────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.chip {
  padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  transition:
    color 0.15s,
    border-color 0.15s,
    background-color 0.15s;
}
.chip:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.chip[aria-current="true"],
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ── Index intro (two-column headline + standfirst) ─────────────── */
.index-intro {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: end;
  margin-top: 20px;
}
.index-intro h1 {
  font-size: clamp(2.2rem, 1.2rem + 2.9vw, 3.5rem);
  line-height: 1.05;
  max-width: 17ch;
}
.index-intro p {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
}

/* ── Featured card (deep indigo, full-bleed inside container) ───── */
.featured {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  border-radius: clamp(18px, 2.4vw, 26px);
  overflow: hidden;
  background: radial-gradient(120% 140% at 85% 10%, var(--deep) 0%, var(--deep-2) 60%);
  color: var(--on-deep);
  border: 1px solid transparent;
  transition:
    transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.22s;
}
.featured:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-3);
}
.featured-copy {
  padding: clamp(30px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
}
.featured h2 {
  color: var(--on-deep);
  font-size: clamp(1.6rem, 1rem + 2.2vw, 2.6rem);
  line-height: 1.08;
  margin-top: 18px;
  max-width: 20ch;
}
.featured p {
  color: var(--on-deep-mut);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 46ch;
  margin-top: 16px;
}
.featured .meta-tag {
  color: oklch(82% 0.06 265);
}
.featured .byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--on-deep-mut);
}
.featured .byline strong {
  color: var(--on-deep);
  font-weight: 600;
}
.featured .sep {
  color: oklch(96% 0.01 265 / 0.3);
}
.featured-figure {
  position: relative;
  min-height: 340px;
  background: oklch(96% 0.01 265 / 0.05);
  display: grid;
  place-items: center;
  padding: 24px 0 24px 20px;
  overflow: hidden;
}
/* The post diagrams are wide (roughly 4:1), so inside this near-square
   cell they are allowed to run past the right edge. Reads as a deliberate
   crop and fills the panel instead of floating in the middle of it. */
.featured-figure svg {
  width: 132%;
  max-width: none;
  height: auto;
  justify-self: start;
}

/* ── Numbered post list ─────────────────────────────────────────── */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.list-head h2 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.post-row {
  display: grid;
  grid-template-columns: 72px 1fr 200px;
  gap: 32px;
  align-items: start;
  padding: 28px 8px;
  border-bottom: 1px solid var(--line);
  transition:
    background-color 0.2s,
    padding-left 0.2s;
}
.post-row:hover {
  background: var(--paper-2);
  padding-left: 18px;
}
.post-row .num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--subtle);
  padding-top: 5px;
}
.post-row h3 {
  font-size: 1.35rem;
  margin: 10px 0 0;
  max-width: 32ch;
}
.post-row p {
  color: var(--muted);
  font-size: 0.96rem;
  max-width: 64ch;
  margin-top: 8px;
}
.post-row .aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding-top: 5px;
}
.byline-pill {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* A row for a post that is written but not published yet. Rendered as
   <article> (not <a>) so nothing links to a 404. To publish: change the
   tag to <a href="…">, drop .is-planned and swap the badge for a read
   time. */
.post-row.is-planned {
  cursor: default;
}
.post-row.is-planned:hover {
  background: transparent;
  padding-left: 8px;
}
.post-row.is-planned h3,
.post-row.is-planned .meta-tag {
  color: var(--muted);
}
.badge-planned {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.list-more {
  display: flex;
  justify-content: center;
  padding-top: 36px;
}

/* ── Newsletter band (paper-2, quiet) ───────────────────────────── */
.newsletter {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(28px, 4vw, 48px);
  align-items: center;
  padding: clamp(30px, 4vw, 52px);
  border-radius: var(--r-card);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.newsletter h2 {
  font-size: clamp(1.5rem, 1rem + 1.6vw, 2.1rem);
  max-width: 22ch;
}
.newsletter p {
  color: var(--muted);
  margin-top: 12px;
  max-width: 48ch;
}
.newsletter form {
  display: flex;
  gap: 10px;
}
.newsletter .input {
  flex: 1;
  min-width: 0;
  height: 50px;
  border-radius: var(--r-pill);
  padding-inline: 20px;
  background: var(--card);
}
.newsletter .button {
  flex: none;
  border-radius: var(--r-pill);
}

/* ===================================================================
   ARTICLE
   =================================================================== */

/* Reading progress — sits directly under the sticky header */
.read-progress {
  position: fixed;
  left: 0;
  top: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 41;
  transition: width 0.12s linear;
}

.article-head {
  padding: clamp(36px, 4.5vw, 64px) 0 0;
}
.back-link {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
  transition: color 0.15s;
}
.back-link:hover {
  color: var(--accent-ink);
}
.article-head h1 {
  font-size: clamp(2.1rem, 1.2rem + 3.2vw, 3.7rem);
  line-height: 1.04;
  max-width: 24ch;
  margin-top: 20px;
}
.article-head .lede {
  margin-top: 22px;
  max-width: 64ch;
  color: var(--ink-soft);
}

.article-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 34px;
  padding: 20px 0;
  border-block: 1px solid var(--line);
}
.avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-tint);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.avatar-lg {
  width: 76px;
  height: 76px;
  font-size: 1.3rem;
}
.article-byline .who {
  margin-right: auto;
}
.article-byline .who b {
  display: block;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
}
.article-byline .who span {
  font-size: 0.86rem;
  color: var(--muted);
}
.article-byline .fact {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--subtle);
}

/* Hero figure — inline SVG diagram, no image asset required */
.figure-frame {
  margin: 36px 0 0;
  padding: clamp(20px, 3vw, 40px);
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--sh-1);
}
.figure-frame svg {
  width: 100%;
  height: auto;
}
.figure-frame figcaption {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--subtle);
  text-align: center;
}

/* Placeholder for a photo you have not shot yet. Swap the whole
   <div class="photo-slot"> for an <img> when the asset exists. */
.photo-slot {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 240px;
  height: 100%;
  padding: 24px;
  border-radius: var(--r-card);
  border: 1.5px dashed var(--line);
  background: var(--paper-2);
  color: var(--subtle);
  text-align: center;
}
.photo-slot span {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.photo-slot small {
  font-size: 0.8rem;
  max-width: 30ch;
  line-height: 1.5;
}
/* Real photos dropped in place of a .photo-slot. */
.case-photo {
  width: 100%;
  height: auto;
  border-radius: var(--r-card);
}

.photo-slot.is-round {
  border-radius: 50%;
  min-height: 0;
  height: auto;
  aspect-ratio: 1;
}

/* Article body + sticky table of contents */
.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
  margin-top: 48px;
}

.post-body {
  min-width: 0;
}
.post-body h2 {
  font-size: clamp(1.5rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.14;
  margin: 52px 0 0;
  scroll-margin-top: 100px;
}
.post-body h3 {
  font-size: 1.15rem;
  margin: 32px 0 0;
}
.post-body p {
  margin-top: 18px;
  font-size: 1.04rem;
  line-height: 1.8;
  color: var(--ink-soft);
  max-width: 70ch;
}
.post-body ul,
.post-body ol {
  margin: 16px 0 0;
  padding-left: 22px;
  max-width: 70ch;
}
.post-body li {
  margin: 8px 0;
  line-height: 1.75;
  color: var(--ink-soft);
}
.post-body a {
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.post-body a:hover {
  text-decoration-color: currentColor;
}
.post-body > :first-child {
  margin-top: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.post-body p code,
.post-body li code,
.compare code,
.step-list code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  color: var(--accent-ink);
}

pre {
  margin: 24px 0 0;
  padding: 22px 24px;
  border-radius: 14px;
  overflow-x: auto;
  background: var(--deep-2);
  color: oklch(90% 0.02 265);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.75;
}
pre code {
  font-size: inherit;
}
pre .c {
  color: oklch(68% 0.04 265);
} /* comment  */
pre .k {
  color: oklch(80% 0.11 264);
} /* keyword  */
pre .s {
  color: oklch(84% 0.08 150);
} /* string   */
pre .n {
  color: oklch(86% 0.02 265);
} /* neutral  */

.callout-note {
  display: flex;
  gap: 16px;
  margin-top: 28px;
  padding: 22px 26px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  box-shadow: var(--sh-1);
}
.callout-note .label {
  flex: none;
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.callout-note p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.tldr {
  padding: 26px 30px;
  border-radius: var(--r-card);
  background: var(--accent-tint);
  border: 1px solid oklch(54% 0.21 264 / 0.2);
}
.tldr .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.tldr ul {
  margin: 14px 0 0;
  padding-left: 20px;
}
.tldr li {
  margin: 6px 0;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* Numbered step list (waitlist / promotion style tables) */
.step-list {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.step-list > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.step-list > div:last-child {
  border-bottom: 0;
}
.step-list .step {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.step-list p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

/* Metric tiles */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 26px;
}
.metric {
  padding: 22px;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--line);
}
.metric .val {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.metric .val small {
  font-size: 1rem;
  font-weight: 600;
}
.metric .lbl {
  margin-top: 10px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}
.metric.is-accent .val {
  color: var(--accent);
}
.metric.is-deep {
  background: radial-gradient(120% 140% at 85% 10%, var(--deep) 0%, var(--deep-2) 60%);
  border-color: transparent;
  color: var(--on-deep);
}
.metric.is-deep .val {
  color: var(--on-deep);
}
.metric.is-deep .lbl {
  color: var(--on-deep-mut);
}

/* Table of contents */
.toc {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 26px;
}
.toc h2 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.toc nav {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-top: 14px;
}
.toc nav a {
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--muted);
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -14px;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.toc nav a:hover {
  color: var(--ink);
}
.toc nav a.is-active {
  color: var(--accent-ink);
  border-left-color: var(--accent);
  font-weight: 600;
}
.toc-card {
  padding: 20px;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--line);
}
.toc-card .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.toc-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

/* Author bio */
.author-bio {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 56px;
  padding: 28px 30px;
  border-radius: var(--r-card);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.author-bio b {
  font-size: 0.98rem;
  font-weight: 700;
}
.author-bio p {
  margin-top: 8px;
  max-width: 62ch;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--muted);
}

/* Related posts */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 26px;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--line);
  transition:
    transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.2s,
    border-color 0.2s;
}
.related-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-2);
  border-color: oklch(54% 0.21 264 / 0.35);
}
.related-card h3 {
  font-size: 1.08rem;
  line-height: 1.3;
}
.related-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}
.related-card .read {
  margin-top: auto;
  padding-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--subtle);
}

/* ===================================================================
   CASE STUDY
   =================================================================== */

.case-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: clamp(24px, 3vw, 48px);
  align-items: start;
}

/* Sticky section rail with a moving marker */
.rail {
  position: sticky;
  top: 104px;
  display: flex;
  gap: 16px;
  padding-top: 56px;
}
.rail-track {
  position: relative;
  width: 2px;
  flex: none;
  border-radius: 2px;
  background: var(--line);
}
.rail-marker {
  position: absolute;
  left: -1px;
  top: 0;
  width: 4px;
  height: 24px;
  border-radius: 4px;
  background: var(--accent);
  transition: top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.rail nav {
  display: flex;
  flex-direction: column;
  gap: 13px;
  font-size: 0.84rem;
  font-weight: 500;
}
.rail nav a {
  color: var(--muted);
  line-height: 1.3;
  transition: color 0.15s;
}
.rail nav a:hover,
.rail nav a.is-active {
  color: var(--ink);
}

.case-section {
  padding: clamp(56px, 6vw, 92px) 0 0;
  scroll-margin-top: 96px;
}
.case-section:first-child {
  padding-top: clamp(40px, 4vw, 60px);
}
.case-section > .head {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.case-section > .head .no {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
}
.case-section > .head h2 {
  font-size: clamp(1.7rem, 1.1rem + 2vw, 2.6rem);
  line-height: 1.08;
}
.case-section > .head + p {
  margin-top: 18px;
  max-width: 68ch;
  font-size: 1.04rem;
  line-height: 1.75;
  color: var(--muted);
}

.case-hero h1 {
  font-size: clamp(2.2rem, 1.2rem + 3.6vw, 4rem);
  line-height: 1.02;
  max-width: 20ch;
  margin-top: 20px;
}
.case-hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.case-hero .split {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(28px, 4vw, 52px);
  align-items: start;
  margin-top: 38px;
}
.case-hero .split > p {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.case-hero .split strong {
  color: var(--ink);
  font-weight: 700;
}

.headline-stat {
  padding: 26px 28px;
  border-radius: var(--r-card);
  background: radial-gradient(120% 140% at 85% 10%, var(--deep) 0%, var(--deep-2) 60%);
  color: var(--on-deep);
}
.headline-stat .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(82% 0.06 265);
}
.headline-stat .pair {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 16px;
}
.headline-stat .from {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  color: oklch(96% 0.01 265 / 0.45);
}
.headline-stat .arrow {
  color: oklch(96% 0.01 265 / 0.45);
}
.headline-stat .to {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.headline-stat .note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid oklch(96% 0.01 265 / 0.16);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--on-deep-mut);
}

/* Before / after time audit */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 34px;
}
.compare-card {
  padding: 28px;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--line);
}
.compare-card.is-after {
  background: var(--accent-tint);
  border-color: oklch(54% 0.21 264 / 0.2);
}
.compare-card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.compare-card.is-after .top {
  color: var(--accent-ink);
}
.compare-card .top .total {
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 600;
  color: var(--ink);
}
.compare-card.is-after .top .total {
  color: var(--accent-ink);
}
.compare-card ul {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.compare-card.is-after ul {
  border-top-color: oklch(54% 0.21 264 / 0.2);
}
.compare-card li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.compare-card.is-after li {
  border-bottom-color: oklch(54% 0.21 264 / 0.14);
}
.compare-card li:last-child {
  border-bottom: 0;
}
.compare-card li span {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--subtle);
}
.compare-card.is-after li span {
  color: var(--accent-ink);
}
.compare-card li.is-gone {
  color: var(--subtle);
  text-decoration: line-through;
  text-decoration-color: var(--line);
}

/* Loss → decision → result rows */
.decision-list {
  margin-top: 34px;
  border-top: 1px solid var(--line);
}
.decision-row {
  display: grid;
  grid-template-columns: 36px 1.1fr 1.4fr 190px;
  gap: 28px;
  align-items: start;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.decision-row .key {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--subtle);
}
.decision-row .label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.decision-row .label.is-fix {
  color: var(--accent-ink);
}
.decision-row p {
  margin-top: 10px;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.decision-row .result {
  text-align: right;
}
.decision-row .result .val {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.decision-row .result .cap {
  margin-top: 8px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

/* Baseline metric bars */
.baseline-table {
  margin-top: 34px;
  border-top: 1px solid var(--line);
}
.baseline-row {
  display: grid;
  grid-template-columns: 1.3fr 80px 80px 1fr;
  gap: 24px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.baseline-row .name {
  font-size: 0.98rem;
  font-weight: 600;
}
.baseline-row .before {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--subtle);
}
.baseline-row .after {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
}
.bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.method-note {
  margin-top: 18px;
  max-width: 76ch;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  color: var(--subtle);
}

/* Pull quote */
.pullquote {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: clamp(24px, 4vw, 44px);
  align-items: center;
  margin: 44px 0 0;
  padding: clamp(28px, 3.5vw, 44px);
  border-radius: var(--r-card);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.pullquote blockquote {
  margin: 0;
}
.pullquote blockquote p {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 0.9rem + 1.5vw, 2rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.pullquote figcaption {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
}
.pullquote figcaption b {
  display: block;
  font-size: 0.96rem;
}
.pullquote figcaption span {
  font-size: 0.88rem;
  color: var(--muted);
}

/* Cost list + timeline */
.cost-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 52px);
  align-items: start;
  margin-top: 28px;
}
.cost-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.cost-list > div {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.cost-list .no {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  padding-top: 2px;
}

.timeline {
  padding: 30px;
  border-radius: var(--r-card);
  background: radial-gradient(120% 140% at 85% 10%, var(--deep) 0%, var(--deep-2) 60%);
  color: var(--on-deep);
}
.timeline .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(82% 0.06 265);
}
.timeline ol {
  list-style: none;
  margin: 22px 0 0 6px;
  padding: 0 0 0 20px;
  border-left: 1px solid oklch(96% 0.01 265 / 0.18);
}
.timeline li {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 16px;
  padding-bottom: 20px;
  font-size: 0.92rem;
  line-height: 1.55;
}
.timeline li:last-child {
  padding-bottom: 0;
}
.timeline li b {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: oklch(96% 0.01 265 / 0.55);
}
.timeline li:last-child b {
  color: oklch(82% 0.06 265);
}

/* Case study card (index) */
.case-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 28px;
}
.case-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 30px;
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--line);
  transition:
    transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.2s,
    border-color 0.2s;
}
.case-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-2);
  border-color: oklch(54% 0.21 264 / 0.35);
}
.case-card h3 {
  font-size: 1.3rem;
  line-height: 1.25;
  max-width: 26ch;
}
.case-card p {
  color: var(--muted);
  font-size: 0.96rem;
}
.case-card .kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.case-card .kpi b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-ink);
}
.case-card .kpi span {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 1040px) {
  .article-grid {
    grid-template-columns: 1fr;
  }
  .toc {
    position: static;
    display: none;
  }
  .case-layout {
    grid-template-columns: 1fr;
  }
  .rail {
    display: none;
  }
}

@media (max-width: 940px) {
  .index-intro {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .featured {
    grid-template-columns: 1fr;
  }
  .featured-figure {
    min-height: 220px;
    order: -1;
  }
  .post-row {
    grid-template-columns: 48px 1fr;
    gap: 18px;
  }
  .post-row .aside {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    padding-top: 4px;
  }
  .newsletter {
    grid-template-columns: 1fr;
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .compare {
    grid-template-columns: 1fr;
  }
  .cost-split {
    grid-template-columns: 1fr;
  }
  .case-hero .split {
    grid-template-columns: 1fr;
  }
  .pullquote {
    grid-template-columns: 1fr;
  }
  .case-grid {
    grid-template-columns: 1fr;
  }
  .decision-row {
    grid-template-columns: 28px 1fr;
    gap: 8px 18px;
  }
  .decision-row .result {
    grid-column: 2;
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-top: 6px;
  }
  .decision-row .result .cap {
    margin-top: 0;
  }
  .baseline-row {
    grid-template-columns: 1fr 64px 64px;
    gap: 8px 16px;
  }
  .baseline-row .bar {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .article-byline {
    gap: 12px;
  }
  .article-byline .who {
    margin-right: 0;
    width: calc(100% - 60px);
  }
  .author-bio {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .newsletter form {
    flex-direction: column;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .step-list > div {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  pre {
    padding: 18px;
    font-size: 0.78rem;
  }
  /* Diagrams stay legible by scrolling sideways rather than shrinking
     their labels into nothing. */
  .figure-frame {
    overflow-x: auto;
    padding: 18px;
  }
  .figure-frame svg {
    min-width: 620px;
  }
  .figure-frame figcaption {
    min-width: 620px;
  }
  .post-row {
    padding-inline: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail-marker,
  .read-progress {
    transition: none;
  }
}

/* ===================================================================
   IMPORTED ARTICLE CONTENT
   Extra elements that appear in posts converted from the blog
   database: blockquotes, tables, images, horizontal rules, and
   Pygments-highlighted code. Same tokens as everything above.
   =================================================================== */

/* Single-column article (posts with fewer than three sections get no
   table of contents, so the body takes the full measure). */
.article-grid.is-single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 76ch;
}

.post-body blockquote {
  margin: 26px 0 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent);
  max-width: 70ch;
}
.post-body blockquote p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 1.06rem;
}
.post-body blockquote p:first-child {
  margin-top: 0;
}

.post-body hr {
  margin: 44px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.post-body img {
  margin: 26px 0 0;
  max-width: 100%;
  height: auto;
  border-radius: var(--r-card);
}
/* Imported posts reference images that used to live on the old app's
   /storage disk — see assets/blog/README-images.txt. Until those files
   are copied in, the frame plus alt text makes the gap obvious rather
   than silently blank. */
.post-body img {
  border: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

.post-body table {
  width: 100%;
  margin: 26px 0 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.post-body th,
.post-body td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}
.post-body th {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
  border-bottom-color: var(--ink);
}
.post-body tbody tr:last-child td {
  border-bottom: 0;
}

/* Language chip on code blocks. The right padding keeps a long first
   line from running underneath it. */
.post-body pre {
  position: relative;
}
.post-body pre[data-lang] {
  padding-right: 76px;
}
.post-body pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 10px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: oklch(96% 0.01 265 / 0.35);
  pointer-events: none;
}

/* ── Pygments tokens on the deep code surface ────────────────────────
   Four hues only: grey comments, indigo keywords, green strings, blue
   identifiers. Everything else inherits the base code colour. */
pre code[class^="lang-"] {
  color: oklch(90% 0.018 265);
}
pre .c, pre .c1, pre .cm, pre .cs, pre .cp, pre .cpf, pre .ch {
  color: oklch(63% 0.03 265);
  font-style: italic;
}
pre .k, pre .kc, pre .kd, pre .kn, pre .kp, pre .kr, pre .kt, pre .ow, pre .bp {
  color: oklch(80% 0.12 275);
}
pre .s, pre .s1, pre .s2, pre .sb, pre .sc, pre .sd, pre .se, pre .sh,
pre .si, pre .sx, pre .sr, pre .ss {
  color: oklch(84% 0.085 152);
}
pre .m, pre .mi, pre .mf, pre .mh, pre .mo, pre .il {
  color: oklch(86% 0.09 62);
}
pre .nv, pre .vc, pre .vg, pre .vi, pre .na {
  color: oklch(85% 0.085 228);
}
pre .nf, pre .nc, pre .nb, pre .nn, pre .ne, pre .nt {
  color: oklch(89% 0.05 200);
}
pre .nx, pre .n, pre .p, pre .o, pre .w {
  color: inherit;
}
pre .gp {
  color: oklch(70% 0.05 265);
  user-select: none;
}
pre .err {
  color: inherit;
  border: 0;
  background: none;
}

.empty-note {
  margin: 40px 0 0;
  text-align: center;
  color: var(--muted);
}

/* ── Per-post hero diagram ───────────────────────────────────────────
   A schematic of what the post is about, drawn as inline SVG on the
   same deep-indigo band the CTA uses. Generated per slug — there is no
   image file to lose. */
.post-figure {
  margin: 36px 0 0;
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--r-card);
  background: radial-gradient(120% 140% at 85% 10%, var(--deep) 0%, var(--deep-2) 60%);
  overflow: hidden;
}
.post-figure svg {
  width: 100%;
  height: auto;
  display: block;
}

.origin-note {
  margin: 18px 0 0;
  font-size: 0.88rem;
  color: var(--subtle);
}
.origin-note a {
  color: var(--accent-ink);
  font-weight: 500;
}
.origin-note a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 720px) {
  /* Keep diagram labels legible instead of shrinking them to nothing. */
  .post-figure {
    overflow-x: auto;
    padding: 20px;
  }
  .post-figure svg {
    /* Wide enough that the labels stay readable; the panel scrolls
       sideways rather than shrinking the diagram into illegibility. */
    min-width: 700px;
  }
}
