/* Case-study article typography.
   Loaded with the app shell, after /styles.css and /vendor/katex/katex.min.css.
   Reuses the site's custom properties (--ink, --muted, --quiet, --blue, --line,
   --strong-line, --surface, --surface-2, --paper) rather than restating the
   palette, so a case tracks the product's light/dark themes automatically.

   A case study is not a page of its own: the build emits an HTML fragment that
   the case page renders under its breadcrumb. Every heading in the fragment is
   one level lower — the report title is <h2> and its sections are
   <h3>/<h4>/<h5>. */

.case-article {
  width: min(880px, calc(100% - 48px));
  margin-inline: auto;
  padding: 42px 0 96px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.9;
}

.case-draft-note {
  margin: 0 0 40px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--pending);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* Headings ---------------------------------------------------------------- */

.case-article h2,
.case-article h3,
.case-article h4,
.case-article h5 { line-height: 1.35; text-wrap: balance; }
.case-article h2 { margin: 0 0 28px; font-size: clamp(28px, 3.6vw, 38px); letter-spacing: -.01em; }
.case-article h3 { margin: 64px 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--strong-line); font-size: clamp(22px, 2.6vw, 28px); }
.case-article h4 { margin: 44px 0 14px; font-size: 19px; }
.case-article h5 { margin: 32px 0 12px; color: var(--muted); font-size: 16px; }
.case-article h2 + *, .case-article h3 + *, .case-article h4 + *, .case-article h5 + * { margin-top: 0; }

/* Body -------------------------------------------------------------------- */

.case-article p { margin: 0 0 18px; }
.case-article strong { font-weight: 700; }
.case-article a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.case-article ul, .case-article ol { margin: 0 0 20px; padding-left: 22px; }
.case-article li { margin-bottom: 10px; }
.case-article li::marker { color: var(--quiet); }
.case-article hr { height: 0; margin: 56px 0; border: 0; border-top: 1px solid var(--line); }

.case-article blockquote {
  margin: 0 0 32px;
  padding: 18px 24px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: var(--ink);
}
.case-article blockquote p:last-child { margin-bottom: 0; }

.case-article code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font: .88em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.case-article pre {
  margin: 0 0 26px;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.case-article pre code { padding: 0; border: 0; background: transparent; font-size: 13px; line-height: 1.7; }

/* Tables ------------------------------------------------------------------ */

.case-article table {
  width: 100%;
  margin: 0 0 30px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13.5px;
  line-height: 1.6;
}
.case-article table colgroup { display: none; }
.case-article th, .case-article td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.case-article thead th { border-bottom: 1px solid var(--strong-line); background: var(--surface-2); font-weight: 700; white-space: nowrap; }
.case-article tbody tr:last-child td { border-bottom: 0; }
.case-article tbody tr:hover { background: var(--blue-soft); }

/* Each table is wrapped in .table-scroll by the renderer: a wide data table
   scrolls inside its own box instead of making the page scroll sideways.
   pandoc's own inline column widths are guesses from the markdown source, so
   the browser sizes the columns from the actual content instead. */
.case-article .table-scroll { margin: 0 0 30px; overflow-x: auto; }
.case-article .table-scroll table { margin: 0; min-width: 100%; width: max-content; max-width: none; table-layout: auto; }
/* pandoc puts width guesses in an inline style; only !important can drop them. */
.case-article .table-scroll table[style] { width: max-content !important; }

/* Figures ----------------------------------------------------------------- */

.case-article figure { margin: 0 0 32px; }
/* Figures stay readable beside the text: at most 720 px wide and 70% of the screen high, centred. */
.case-article figure img { display: block; margin-inline: auto; max-width: min(100%, 720px); max-height: 70vh; width: auto; height: auto; object-fit: contain; border: 1px solid var(--line); }
.case-article figcaption { margin-top: 10px; color: var(--quiet); font-size: 12.5px; line-height: 1.6; }

.figure-pending-box {
  min-height: 180px;
  padding: 28px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  border: 1px dashed var(--strong-line);
  background: repeating-linear-gradient(135deg, transparent 0 12px, var(--surface-2) 12px 24px);
  text-align: center;
}
.figure-pending-tag { color: var(--pending); font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
.figure-pending-file { color: var(--quiet); font-size: 12px; }
.figure-pending-file code { background: var(--surface); }

/* Math -------------------------------------------------------------------- */

.case-article .katex { font-size: 1.03em; }
.case-article .katex-display { margin: 26px 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; }

@media (max-width: 720px) {
  .case-article { width: calc(100% - 36px); padding-top: 24px; }
  .case-article h3 { margin-top: 44px; }
  .case-article table { font-size: 12.5px; }
  .case-article th, .case-article td { padding: 8px 10px; }
}
