/* ============================================================================
   Article typography — isti.studio
   ----------------------------------------------------------------------------
   Scoped entirely to .blog-article-content, so nothing outside a single post
   can be affected. Loaded AFTER main.css, so equal-specificity rules win.

   Colours use the site's own tokens (--at-neutral-*, --at-theme-primary).
   [data-bs-theme=dark] remaps those tokens upstream, so dark mode follows
   automatically and needs no parallel colour block.

   Fixes measured on the live page before this file existed:
     body line-height 1.2  -> 1.75      (was unreadably tight)
     117 characters/line   -> ~72       (was far past the 60-80 comfort range)
     h2 72px / h3 64px     -> 34 / 26   (display sizes leaking into body copy)
     heading margin-top 0  -> real space before each section
     li margin-bottom 0    -> list items no longer collide
     body weight 500       -> 400       (500 is a heading weight)
     body colour #585959   -> neutral-900 (contrast on white was marginal)
   ========================================================================== */

.blog-article-content {
  /* Reading measure. NOT set in `ch`: that unit keys off the font's "0" glyph,
     and in DM Sans 72ch measured 890px live (~87 characters) — well past the
     60-80 comfort range. A fixed measure is predictable across weights. */
  max-width: 690px;
  font-family: var(--at-ff-body, 'DM Sans', sans-serif);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--at-neutral-900, #1d1d1d);
  letter-spacing: 0.002em;
}

@media (max-width: 575.98px) {
  .blog-article-content { font-size: 17px; line-height: 1.7; }
}

/* --- paragraphs ---------------------------------------------------------- */
.blog-article-content p {
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
  color: inherit;
  margin: 0 0 1.35em;
}

/* Lead paragraph: sets the tone without needing an extra class in the HTML. */
.blog-article-content > p:first-of-type {
  font-size: 1.14em;
  line-height: 1.65;
  color: var(--at-neutral-900, #1d1d1d);
  margin-bottom: 1.5em;
}

/* --- headings ------------------------------------------------------------ */
/* Space belongs BEFORE a heading, tying it to the text it introduces. */
.blog-article-content h2,
.blog-article-content h3,
.blog-article-content h4,
.blog-article-content h5 {
  font-family: var(--at-ff-heading, 'DM Sans', sans-serif);
  color: var(--at-neutral-950, #0f0f0f);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.blog-article-content h2 {
  font-size: clamp(27px, 2.6vw, 34px);
  line-height: 1.22;
  font-weight: 600;
  margin: 2.4em 0 0.6em;
  padding-top: 1.1em;
  border-top: 1px solid var(--at-neutral-100, #dfdfdf);
}

/* The first heading needs no rule above it — the cover image already divides. */
.blog-article-content > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.blog-article-content h3 {
  font-size: clamp(21px, 1.9vw, 25px);
  line-height: 1.3;
  font-weight: 600;
  margin: 2em 0 0.5em;
}

.blog-article-content h4 {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
  margin: 1.8em 0 0.45em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--at-neutral-500, #585959);
}

.blog-article-content h5 {
  font-size: 17px;
  font-weight: 600;
  margin: 1.6em 0 0.4em;
}

/* --- lists --------------------------------------------------------------- */
.blog-article-content ul,
.blog-article-content ol {
  margin: 0 0 1.35em;
  padding-left: 1.35em;
}

.blog-article-content li {
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  margin-bottom: 0.45em;
  padding-left: 0.2em;
}

.blog-article-content li:last-child { margin-bottom: 0; }
.blog-article-content li > ul,
.blog-article-content li > ol { margin: 0.45em 0 0.2em; }

.blog-article-content ul > li::marker {
  color: var(--at-theme-primary, #f0460e);
}
.blog-article-content ol > li::marker {
  color: var(--at-neutral-500, #585959);
  font-variant-numeric: tabular-nums;
}

/* --- links --------------------------------------------------------------- */
.blog-article-content a {
  color: var(--at-theme-primary, #f0460e);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(240, 70, 14, 0.45);
  transition: text-decoration-color 0.18s ease, color 0.18s ease;
}
.blog-article-content a:hover,
.blog-article-content a:focus-visible {
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

/* --- emphasis ------------------------------------------------------------ */
.blog-article-content strong,
.blog-article-content b {
  font-weight: 600;
  color: var(--at-neutral-950, #0f0f0f);
}
.blog-article-content em { font-style: italic; }

/* --- blockquote ---------------------------------------------------------- */
.blog-article-content blockquote {
  margin: 1.8em 0;
  padding: 0.1em 0 0.1em 1.35em;
  border-left: 3px solid var(--at-theme-primary, #f0460e);
  color: var(--at-neutral-900, #1d1d1d);
  font-size: 1.06em;
  line-height: 1.6;
}
.blog-article-content blockquote p:last-child { margin-bottom: 0; }

/* --- code ---------------------------------------------------------------- */
.blog-article-content code,
.blog-article-content kbd,
.blog-article-content samp {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.88em;
  background: var(--at-neutral-50, #f2f2f2);
  border: 1px solid var(--at-neutral-100, #dfdfdf);
  border-radius: 5px;
  padding: 0.12em 0.38em;
  word-break: break-word;
}

.blog-article-content pre {
  margin: 1.6em 0;
  padding: 18px 20px;
  background: var(--at-neutral-50, #f2f2f2);
  border: 1px solid var(--at-neutral-100, #dfdfdf);
  border-radius: 10px;
  overflow-x: auto;              /* long lines scroll; the page never does */
  line-height: 1.6;
  font-size: 15px;
  -webkit-overflow-scrolling: touch;
}
.blog-article-content pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  white-space: pre;
  word-break: normal;
}

/* --- media --------------------------------------------------------------- */
.blog-article-content img,
.blog-article-content video {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 1.6em 0;
  display: block;
}

.blog-article-content figure { margin: 1.8em 0; }
.blog-article-content figure img { margin: 0; }
.blog-article-content figcaption {
  margin-top: 0.7em;
  font-size: 14px;
  line-height: 1.55;
  color: var(--at-neutral-500, #585959);
}

/* --- tables -------------------------------------------------------------- */
/* Wide tables scroll inside their own box rather than breaking the layout. */
.blog-article-content table {
  width: 100%;
  margin: 1.7em 0;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.55;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}
.blog-article-content th,
.blog-article-content td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--at-neutral-100, #dfdfdf);
  text-align: left;
  vertical-align: top;
}
.blog-article-content th {
  font-weight: 600;
  color: var(--at-neutral-950, #0f0f0f);
  border-bottom-width: 2px;
}

/* --- rules --------------------------------------------------------------- */
.blog-article-content hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--at-neutral-100, #dfdfdf);
  opacity: 1;
}

/* --- dark mode: only what the token remap cannot cover ------------------- */
[data-bs-theme=dark] .blog-article-content code,
[data-bs-theme=dark] .blog-article-content kbd,
[data-bs-theme=dark] .blog-article-content samp,
[data-bs-theme=dark] .blog-article-content pre {
  background: var(--at-neutral-dark-50, #141414);
  border-color: var(--at-neutral-dark-200, #2d2d2d);
}
[data-bs-theme=dark] .blog-article-content a {
  text-decoration-color: rgba(240, 70, 14, 0.6);
}
[data-bs-theme=dark] .blog-article-content h2,
[data-bs-theme=dark] .blog-article-content hr,
[data-bs-theme=dark] .blog-article-content th,
[data-bs-theme=dark] .blog-article-content td {
  border-color: var(--at-neutral-dark-200, #2d2d2d);
}

/* --- print --------------------------------------------------------------- */
@media print {
  .blog-article-content { max-width: none; font-size: 11.5pt; color: #000; }
  .blog-article-content a { color: #000; text-decoration: underline; }
  .blog-article-content h2 { border-top: 0; padding-top: 0; }
}
