/* ==========================================================================
   The Engineering Dispatch — Prose & Technical Reading System
   Disciplined 710px measure, dense ink code blocks, clear typographic scale.
   ========================================================================== */

.prose {
  max-width: var(--reading-width);
  min-width: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

/* Headings */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.3;
  scroll-margin-top: 88px;
}

.prose h1 {
  font-size: 1.85em;
  margin: 2.2em 0 0.8em;
}

.prose h2 {
  font-size: 1.5em;
  margin: 2em 0 0.75em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--rule);
}

.prose h3 {
  font-size: 1.25em;
  margin: 1.7em 0 0.6em;
}

.prose h4 {
  font-size: 1.1em;
  margin: 1.5em 0 0.5em;
}

.prose p {
  margin: 1.2em 0;
}

.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: color 120ms ease;
}

.prose a:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

.prose strong {
  font-weight: 750;
  color: var(--text);
}

.prose em {
  font-style: italic;
}

/* Lists */
.prose ul,
.prose ol {
  padding-left: 1.6em;
  margin: 1.2em 0;
}

.prose li {
  margin: 0.4em 0;
  padding-left: 0.2em;
}

.prose li::marker {
  color: var(--accent);
  font-weight: 750;
}

/* Blockquotes */
.prose blockquote {
  margin: 1.8em 0;
  padding: 14px 20px;
  border-left: 3px solid var(--quote-border);
  background: var(--quote-bg);
  border-radius: var(--radius-xs);
  color: var(--text);
}

.prose blockquote > :first-child {
  margin-top: 0;
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose hr {
  height: 2px;
  margin: 2.8em 0;
  border: 0;
  background: var(--rule-strong);
}

/* Inline Code */
.prose :not(pre) > code {
  padding: 2px 6px;
  border: 1px solid var(--code-inline-border);
  border-radius: var(--radius-xs);
  background: var(--code-inline-bg);
  color: var(--code-inline-text);
  font-family: var(--mono);
  font-size: 0.88em;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Dense Ink Code Blocks */
.prose pre {
  position: relative;
  max-width: 100%;
  margin: 1.8em 0;
  padding: 20px 22px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  tab-size: 4;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  display: block;
}

.code-copy-button {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border: 1px solid #363a45;
  border-radius: 2px;
  background: #20232a;
  color: #eceae5;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 120ms ease, background-color 120ms ease;
}

.prose pre:hover .code-copy-button,
.code-copy-button:focus-visible {
  opacity: 1;
}

.code-copy-button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* Tables */
.prose table {
  width: 100%;
  margin: 1.8em 0;
  border-collapse: collapse;
  font-size: 14.5px;
}

.prose th,
.prose td {
  padding: 10px 14px;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface-raised);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
}

.prose tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-raised) 45%, transparent);
}

/* Figures and Images */
.prose figure,
.article-image-figure {
  margin: 2em 0;
}

.prose figure img,
.article-image-figure img {
  display: block;
  max-width: 100%;
  max-height: 720px;
  margin: 0 auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
}

.article-image-figure.is-svg img {
  border: 0;
}

.lightbox-trigger {
  position: relative;
  display: inline-block;
  max-width: 100%;
  cursor: zoom-in;
}

.article-image-figure figcaption {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-subtle);
  line-height: 1.5;
  text-align: left;
}

.article-image-figure figcaption:empty {
  display: none;
}

.prose iframe {
  max-width: 100%;
  border: 0;
}

.prose input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--accent);
}

@media (max-width: 768px) {
  .prose {
    font-size: 16px;
    line-height: 1.8;
  }

  .prose pre {
    margin-inline: -16px;
    padding: 16px 14px;
    border-radius: 0;
    border-inline: 0;
  }

  .code-copy-button {
    opacity: 1;
  }

  .prose table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}
