/* Shared reading treatment for blog posts and the reference guide. */
.blog-reading-page {
  --blog-paper: #f4f7f4;
  --blog-rule: #c8d8cc;
  --blog-forest: #152f25;
  --blog-slate: #40574b;
  --blog-note: #edf5ef;
  --reading-green: #107c41;
  --reading-green-dark: #096633;
}

.blog-reading-page .blog-wrap {
  max-width: 1192px;
  padding-top: clamp(14px, 3vw, 36px);
}

.blog-reading-page .blog-article-header {
  grid-template-columns: minmax(0, 1.37fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 52px);
  padding: clamp(20px, 3.3vw, 40px);
  margin-bottom: clamp(24px, 3vw, 38px);
  border-radius: 14px;
}

.blog-reading-page .blog-article-title,
.blog-reading-page .blog-guide-header h1 {
  max-width: 23ch;
  margin-block: 8px 17px;
  color: var(--blog-forest);
  font-size: clamp(34px, 4.2vw, 56px);
  letter-spacing: -.047em;
  line-height: 1.07;
}

.blog-reading-page .blog-summary {
  max-width: 58ch;
  margin-block: 12px 14px;
  padding: 12px 15px;
  border-inline-start: 3px solid var(--reading-green);
  background: var(--blog-note);
  color: var(--blog-forest);
  font-size: 17px;
  line-height: 1.52;
}

.blog-reading-page .blog-summary p { margin: 0; }

.blog-reading-page .blog-summary .blog-summary-label {
  margin-bottom: 4px;
  color: var(--reading-green-dark);
  font-size: 13px;
  font-weight: 800;
}

.blog-reading-page .blog-article-actions {
  gap: 6px 14px;
  margin-top: 12px;
}

.blog-reading-page .blog-practice-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid var(--reading-green-dark);
  border-bottom: 3px solid #075b2c;
  border-radius: 8px;
  background: var(--reading-green);
  color: white;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
}

.blog-reading-page .blog-practice-link:hover { background: var(--reading-green-dark); }

.blog-reading-page .blog-article-photo {
  border: 1px solid var(--blog-rule);
  border-radius: 9px;
}

.blog-reading-page .blog-article-layout {
  grid-template-columns: minmax(0, 67ch) minmax(210px, 254px);
  justify-content: space-between;
  gap: clamp(24px, 6vw, 76px);
}

.blog-reading-page .blog-prose {
  max-width: 65ch;
  font-size: clamp(17px, 1.45vw, 19px);
  line-height: 1.7;
}

.blog-reading-page .blog-reading-intro {
  max-width: 60ch;
  margin: 0 0 24px;
  color: var(--blog-slate);
}

.blog-reading-page .blog-prose h2 {
  margin-block: 1.35em .42em;
  color: var(--blog-forest);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.16;
}

.blog-reading-page .blog-prose > section:first-of-type h2:first-child { margin-top: 0; }

.blog-reading-page .blog-prose table :is(th, td) {
  border-color: var(--blog-rule);
}

.blog-reading-page .blog-prose table th {
  background: #e2efe5;
  color: var(--blog-forest);
}

.blog-reading-page .blog-prose table tbody tr:nth-child(even) {
  background: #f1f7f2;
}

.blog-reading-page :is(.blog-prose pre, .blog-formula, .blog-tool-output pre) {
  padding: 13px 14px;
  border: 1px solid var(--blog-rule);
  border-inline-start: 3px solid var(--reading-green);
  border-radius: 7px;
  background: #eaf4ed;
  color: var(--blog-forest);
  font-family: var(--mono);
  font-size: .85em;
  font-variant-ligatures: none;
}

.blog-reading-page :is(.blog-prose pre, .blog-formula) code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.blog-reading-page :is(.blog-table, .blog-table-scroll, .blog-tool-table, .blog-formula) {
  max-width: 100%;
  overflow-x: auto;
}

/* The guide opens with its one sentence, the title card's button, then the formula view and its short "why"
   (scripts/dollar-stay-figure.mjs) across the full width so "Without $" and "With $" sit side by side. */
.blog-reading-page .blog-guide-header {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "lead cta" "figure figure";
  grid-template-rows: auto;
  align-items: end;
  row-gap: clamp(14px, 2.4vw, 26px);
}

.blog-reading-page .blog-guide-header .blog-article-lead { grid-area: lead; }
.blog-reading-page .blog-guide-header .blog-article-actions { grid-area: cta; align-self: end; margin: 0 0 6px; }
.blog-reading-page .blog-guide-header .ds-block { grid-area: figure; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.blog-reading-page .blog-guide-header .blog-deck { max-width: 30ch; margin-bottom: 0; font-size: clamp(19px, 2vw, 24px); font-weight: 700; line-height: 1.4; }

/* A small, quiet note at the end of a section. */
.blog-reading-page .blog-small-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--blog-rule);
  border-radius: 8px;
  background: var(--blog-note);
  color: var(--blog-slate);
  font-size: 15px;
  line-height: 1.55;
}

.blog-reading-page .blog-small-note h3 { margin: 0 0 4px; color: var(--blog-forest); font-size: 14px; line-height: 1.3; letter-spacing: 0; }
.blog-reading-page .blog-small-note p { margin: 0; }
.blog-reading-page .blog-prose .blog-small-note p { color: var(--blog-slate); }

@media (max-width: 860px) {
  .blog-reading-page .blog-article-layout {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .blog-reading-page .blog-guide-header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "lead" "figure" "cta";
    align-items: start;
    row-gap: 14px;
  }

  .blog-reading-page .blog-guide-header .blog-article-actions { align-self: start; margin: 0; }

  .blog-reading-page .blog-guide-header .blog-deck { max-width: 36ch; }
}

@media (max-width: 720px) {
  .blog-reading-page .blog-article-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 15px;
  }

  .blog-reading-page .blog-article-title,
  .blog-reading-page .blog-guide-header h1 {
    font-size: clamp(31px, 8.2vw, 42px);
  }

  .blog-reading-page .blog-article-photo { aspect-ratio: 3 / 1; }
  .blog-reading-page .blog-summary { padding: 10px 11px; font-size: 16px; }
  .blog-reading-page .blog-article-actions { gap: 4px 12px; }
  .blog-reading-page .blog-prose { max-width: none; }
  .blog-reading-page .blog-reading-intro { margin-bottom: 18px; }
}
/*
 * Look of the "$ means stay" pictures (scripts/dollar-stay-figure.mjs). Shared by the guide, the blog and the lesson.
 * Flat green language from DESIGN.md: solid fills, crisp borders, no glow and no soft shadows.
 * Three colors carry the meaning and each is paired with words, never color alone:
 *   mint chip      the price part: it moves with its row (good)
 *   coral chip     the rate part when it moves too (bad)
 *   solid green    the rate part with a $ (it stays, with the pin icon)
 * The pictures draw on their own white paper, so they read the same anywhere. Formula text is 16px, labels 14px.
 */
.ds-block, .ds-cases, .ds-legend, .ds-case-diagram, .ds-legend-icon {
  --ds-paper: #ffffff;
  --ds-ink: #10231a;
  --ds-ink-2: #45584e;
  --ds-grid: #d3dcd6;
  --ds-grid-soft: #e3e8e5;
  --ds-grid-strong: #9fb0a5;
  --ds-head: #eef3f0;
  --ds-green: #0e8644;
  --ds-green-ink: #064e2a;
  --ds-mint: #e8f8ef;
  --ds-mint-edge: #bfe6cf;
  --ds-coral: #e5483a;
  --ds-coral-ink: #a82a18;
  --ds-coral-soft: #ffeeeb;
  --ds-coral-edge: #f5c9c3;
  --ds-moved: #eef2f0;
  --ds-sans: var(--sans, "Manrope Variable", Manrope, system-ui, sans-serif);
  --ds-mono: var(--mono, "JetBrains Mono", ui-monospace, monospace);
}

/* The block: setup line, the two formula views, then the short answer */
.ds-block { container-type: inline-size; box-sizing: border-box; min-width: 0; margin: 20px 0 24px; padding: 12px; border: 1px solid var(--ds-grid); border-radius: 12px; background: var(--ds-paper); color: var(--ds-ink); font-family: var(--ds-sans); }
.ds-block :is(p, ul, li, span, code, b) { box-sizing: border-box; }
.ds-block .ds-setup { margin: 0 2px 12px; color: var(--ds-ink-2); font: 700 14px/1.45 var(--ds-sans); }
.ds-block .ds-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.ds-block .ds-panel { min-width: 0; margin: 0; border: 1px solid var(--ds-grid); border-radius: 10px; overflow: hidden; background: var(--ds-paper); }
.ds-block .ds-panel-title { margin: 0; padding: 9px 12px; border-bottom: 1px solid var(--ds-grid); font: 800 18px/1.2 var(--ds-sans); letter-spacing: -.01em; }
.ds-block .ds-panel-without .ds-panel-title { border-bottom-color: var(--ds-coral-edge); background: var(--ds-coral-soft); color: var(--ds-coral-ink); }
.ds-block .ds-panel-with .ds-panel-title { border-bottom-color: var(--ds-mint-edge); background: var(--ds-mint); color: var(--ds-green-ink); }

/* One copied row: the formula line (cell, formula, result), then a plain label for each colored part */
.ds-block ul.ds-rows { margin: 0; padding: 0; list-style: none; }
.ds-block ul.ds-rows > li.ds-row { display: block; margin: 0; padding: 9px 12px 8px; border-top: 1px solid var(--ds-grid-soft); list-style: none; color: var(--ds-ink); }
.ds-block ul.ds-rows > li.ds-row:first-child { border-top: 0; }
.ds-block .ds-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.ds-block .ds-cell-name { flex: 0 0 26px; color: var(--ds-ink-2); font: 800 14px/1.4 var(--ds-sans); }
.ds-block code.ds-formula { display: block; flex: 0 1 auto; min-width: 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--ds-ink); font: 700 16px/1.6 var(--ds-mono); letter-spacing: 0; font-variant-ligatures: none; white-space: nowrap; overflow-wrap: normal; }
.ds-block .ds-result { margin-inline-start: auto; font: 800 16px/1.6 var(--ds-sans); font-variant-numeric: tabular-nums; text-align: end; }
.ds-block .ds-result-good { color: var(--ds-green-ink); }
.ds-block .ds-result-bad { color: var(--ds-coral-ink); }
.ds-block .ds-note { display: block; margin: 3px 0 0 34px; color: var(--ds-ink); font: 600 14px/1.5 var(--ds-sans); }
.ds-block .ds-verdict { font-weight: 800; }
.ds-block .ds-verdict-good { color: var(--ds-green-ink); }
.ds-block .ds-verdict-bad { color: var(--ds-coral-ink); }
.ds-block .ds-pin-icon { display: inline-block; width: 13px; height: 15px; margin-inline-end: 5px; vertical-align: -2px; overflow: visible; }

/* The colored parts */
.ds-block .ds-part { display: inline-block; padding: 0 5px; border-radius: 5px; font-family: var(--ds-mono); font-weight: 800; font-variant-ligatures: none; letter-spacing: 0; }
.ds-block .ds-note .ds-part { font-size: 14px; line-height: 1.35; }
.ds-block .ds-part-price { background: var(--ds-mint); color: var(--ds-green-ink); }
.ds-block .ds-part-bad { background: var(--ds-coral-soft); color: var(--ds-coral-ink); }
.ds-block .ds-part-stay { background: var(--ds-green); color: #ffffff; }

.ds-block .ds-panel-verdict { margin: 0; padding: 9px 12px 10px; border-top: 1px solid var(--ds-grid-soft); font: 800 15px/1.35 var(--ds-sans); }
.ds-block .ds-panel-verdict-good { color: var(--ds-green-ink); }
.ds-block .ds-panel-verdict-bad { color: var(--ds-coral-ink); }

/* Narrow places (the lesson's side notes, a small phone): notes use the full row width and the parts hug their text. */
@container (max-width: 300px) {
  .ds-block ul.ds-rows > li.ds-row { padding-inline: 9px; }
  .ds-block .ds-note { margin-inline-start: 0; }
  .ds-block .ds-part { padding-inline: 4px; }
  .ds-block .ds-panel-title, .ds-block .ds-panel-verdict { padding-inline: 9px; }
}

/* Why does Excel do that? */
.ds-block .ds-why { margin: 14px 2px 2px; padding: 2px 0 2px 14px; border-inline-start: 3px solid var(--ds-green); }
.ds-block .ds-why-title { margin: 0 0 6px; color: var(--ds-green-ink); font: 800 18px/1.25 var(--ds-sans); letter-spacing: -.01em; }
.ds-block .ds-why-line { max-width: 62ch; margin: 0 0 6px; color: var(--ds-ink); font: 600 16px/1.5 var(--ds-sans); }
.ds-block .ds-why-line:last-child { margin-bottom: 0; }
.ds-block .ds-why-line + .ds-why-line { margin-top: 0; }
.ds-block .ds-dollar { padding: 0 3px; border-radius: 4px; background: var(--ds-green); color: #ffffff; font-family: var(--ds-mono); font-weight: 800; }

/* Pin and the small case diagrams: one line weight */
.ds-case-diagram { display: block; width: 100%; height: auto; overflow: visible; }
:where(.ds-case-diagram) text { fill: var(--ds-ink); font-family: var(--ds-sans); font-size: 13px; font-weight: 700; }
.ds-cell { fill: var(--ds-paper); stroke: var(--ds-grid); stroke-width: 1; }
.ds-cell-stay { fill: var(--ds-mint); stroke: var(--ds-green); stroke-width: 2.5; }
.ds-cell-start { fill: var(--ds-paper); stroke: var(--ds-ink-2); stroke-width: 2.5; }
.ds-cell-moved { fill: var(--ds-moved); stroke: var(--ds-ink-2); stroke-width: 2.5; }
.ds-cell-gone { fill: var(--ds-paper); stroke: var(--ds-grid-strong); stroke-width: 2.5; stroke-dasharray: 4 3; }
.ds-num { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ds-strong { font-weight: 800; }
.ds-small { fill: var(--ds-ink-2); font-size: 11px; font-weight: 800; }
.ds-muted { fill: var(--ds-ink-2); font-weight: 700; }
.ds-arrow line { fill: none; stroke: var(--ds-ink-2); stroke-width: 2.5; stroke-linecap: round; }
.ds-arrow path { fill: var(--ds-ink-2); stroke: var(--ds-ink-2); stroke-width: 2.5; stroke-linejoin: round; }
.ds-pin path { fill: var(--ds-green); stroke: var(--ds-green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ds-pin path:last-child { fill: none; }

/* The four cases */
ul.ds-cases { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 10px; margin: 16px 0 8px; padding: 0; list-style: none; }
ul.ds-cases > li.ds-case { box-sizing: border-box; min-width: 0; margin: 0; padding: 10px 10px 12px; border: 1px solid var(--ds-grid); border-radius: 12px; background: var(--ds-paper); color: var(--ds-ink); list-style: none; }
.ds-cases .ds-case-ref { margin: 0 0 6px; }
.ds-cases .ds-case-ref code { padding: 0; border: 0; background: none; color: var(--ds-ink-2); font: 800 24px/1.2 var(--ds-mono); letter-spacing: 0; white-space: nowrap; }
.ds-pinned, .ds-loose { display: inline-block; padding-bottom: 1px; border-bottom: 3px solid transparent; }
.ds-pinned { border-bottom-color: var(--ds-green); color: var(--ds-green-ink); }
.ds-loose { color: var(--ds-ink-2); }
.ds-cases .ds-case-caption { margin: 8px 0 0; color: var(--ds-ink); font: 700 14px/1.35 var(--ds-sans); }
p.ds-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 4px; color: var(--ds-ink-2); font: 700 14px/1.4 var(--ds-sans); }
p.ds-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ds-legend-icon { display: block; width: auto; height: 16px; overflow: visible; }
