/* ARTICLE PROSE — typography for rendered blog content (posts, poems, math)
 * plus the shared drop-cap used on the portfolio lead and blog home cards. */

/* Drop cap on a prose paragraph: first letter in burgundy. Used on the
 * portfolio lead text and the blog home cards ("<p class='drop-cap'>…").
 * Element-scoped to <p> so the inline <span class="drop-cap"> letter below
 * is never double-floated. */
p.drop-cap::first-letter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  float: left;
  font-size: 3.5rem;
  line-height: 0.8;
  padding-top: 4px;
  padding-right: 10px;
  padding-bottom: 2px;
  color: var(--burgundy);
}

.article-body {
  font-family: var(--font-serif);
}

/* Long unbroken URLs (e.g. reference links) must wrap instead of widening
 * the layout; `anywhere` allows breaking inside the hostname when needed. */
.article-body a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article-body p {
  padding-bottom: 12px;
}

.article-body img {
  max-width: 100%;
  height: auto;
}

/* Post header image + caption, styled as a box like the lamb illustration */
.article-body p:has(img):has(em) {
  text-align: center;
  border: 3px double var(--border-color);
  background-color: var(--paper-texture-subtle);
  padding: 18px;
  margin: 0 0 20px;
}

.article-body p:has(img):has(em) img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto 12px;
  border: 1px solid var(--light-border);
}

.article-body p:has(img):has(em) em {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  line-height: 1.5;
}

.article-body p:has(img):has(em) a {
  color: var(--burgundy);
}

.article-body p:has(img):has(em) a:hover {
  color: var(--burgundy-hover);
}

.article-body pre {
  border: 1px solid var(--light-border);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
  font-family: var(--font-mono);
  /* Zola inlines a gruvbox background; override it with a solid tone from the
   * site palette (theme-aware token) and pin color-scheme to the active site
   * theme so the syntax colors follow the toggle and not the OS. */
  background-color: var(--code-block-bg) !important;
  color-scheme: light !important;
}

html.dark-mode .article-body pre,
body.dark-mode .article-body pre {
  color-scheme: dark !important;
}

.article-body code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

.article-body pre code {
  background: none;
  padding: 0;
}

/* MathJax display equations must stay inside the article frame. MathJax v4
 * flags oversized equations with overflow="overflow", but its own stylesheet
 * only handles "scroll"/"truncate", so the wide ones keep their inline
 * min-width and overflow the page. Clamp them like <pre> and scroll instead. */
.article-body mjx-container[display="true"] {
  max-width: 100%;
  min-width: 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
}

.article-body table {
  border-collapse: collapse;
  margin: 1rem 0;
}

.article-body th,
.article-body td {
  border: 1px solid var(--light-border);
  padding: 0.4rem 0.75rem;
}

.article-body blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--burgundy);
  color: var(--text-color);
  background-color: var(--paper-texture-subtle);
  font-style: italic;
}

/* Drop cap: first letter in burgundy, as on the blog home cards. Use
 * <span class="drop-cap">A</span>s brumas... — the rest of the paragraph
 * keeps rendering as markdown. */
.article-body .drop-cap {
  float: left;
  font-family: var(--font-headers);
  font-weight: 600;
  font-size: 3.5rem;
  line-height: 0.8;
  padding-top: 4px;
  padding-right: 10px;
  padding-bottom: 2px;
  color: var(--burgundy);
}

/* POEM PANEL: title + author header, then numbered verses */
.poem {
  width: fit-content;
  max-width: 100%;
  margin: 1.25rem auto;
  background-color: var(--paper-texture-subtle);
  border-top: 3px double var(--border-color);
  border-bottom: 3px double var(--border-color);
  padding: 8px;
  text-align: left;
}

.poem-head {
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--light-border);
}

.poem-head::before {
  content: "𓂃🖊";
  display: block;
  font-family: var(--font-key);
  color: var(--burgundy);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.poem-title {
  display: block;
  font-family: var(--font-headers);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--burgundy);
}

.poem-author {
  display: block;
  margin-top: 4px;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
}

.poem-lines {
  counter-reset: line;
}

.poem-line {
  position: relative;
  display: block;
  counter-increment: line;
  padding-left: 25px;
  min-height: 1.7em;
  font-style: italic;
}

.poem-line::before {
  content: counter(line);
  position: absolute;
  top: 2px;
  left: 0;
  width: 15px;
  text-align: right;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 1px;
  font-style: normal;
  color: var(--text-subtle);
  opacity: 0.7;
}

/* POEM QUOTE: cite verses with numbers, starting at the given line.
 * Use <blockquote class="poem-quote" style="--start: 4">...</blockquote> */
.poem-quote {
  counter-reset: line calc(var(--start, 1) - 1);
}

.article-body blockquote.poem-quote {
  padding: 8px;
}

.poem-quote .poem-line {
  padding-left: 25px;
}

.poem-quote .poem-line::before {
  width: 15px;
  font-size: 0.68rem;
}

/* BIBLE QUOTE: numbered verses with a reference line. Use:
 * <blockquote class="bible-quote" style="--start: 1">
 *   <span class="bible-verse">…verse text…</span>
 *   <span class="bible-ref">
 *     <span class="bible-passage">Gênesis 1:1–2</span>, …, na tradução de Pe.
 *     Antônio Pereira de Figueiredo <a href="#referencias">[4]</a>.
 *   </span>
 * </blockquote> */
.bible-quote {
  counter-reset: verse calc(var(--start, 1) - 1);
}

/* Centered quote, sized to the widest line (like the poem panel). */
.article-body blockquote.bible-quote {
  width: fit-content;
  max-width: 100%;
  margin: 12px auto;
  padding: 8px 16px;
  text-align: left;
}

/* Three nails above the quote, centered, burgundy (middle one bigger).
 * Rendered in markup as the first child of the quote:
 * <span class="bible-nails">🕇 <span>♱</span> 🕇</span> */
.bible-quote .bible-nails {
  font-style: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
  font-family: var(--font-symbol);
  line-height: 1;
  color: var(--burgundy);
}

.bible-quote .bible-nails span {
  font-size: 1.7em;
  display: inline-block;
}

.bible-quote .bible-verse {
  position: relative;
  display: block;
  counter-increment: verse;
  padding-left: 25px;
  min-height: 1.7em;
}

.bible-quote .bible-verse::before {
  content: counter(verse);
  position: absolute;
  top: 2px;
  left: 0;
  width: 15px;
  text-align: right;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 1px;
  font-style: normal;
  color: var(--text-subtle);
  opacity: 0.7;
}

.bible-quote .bible-ref {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--light-border);
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
}

.bible-quote .bible-ref .bible-passage {
  font-style: normal;
  font-weight: 600;
  color: var(--burgundy);
}

@media (max-width: 520px) {

  .poem-line,
  .bible-quote .bible-verse {
    padding-left: 34px;
  }

  .poem-line::before,
  .bible-quote .bible-verse::before {
    width: 24px;
  }
}

.article-body .MathJax {
  font-size: 1em;
}

.article-body mjx-container[jax="CHTML"][display="true"] {
  display: block;
  margin: 1rem 0;
  text-align: center;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.article-body hr {
  border: none;
  border-top: 1px dashed var(--light-border);
  margin: 1.5rem 0;
}

/* Inline float figure: image takes roughly half the content width and the
 * following text wraps alongside it, continuing at full width below. */
.article-body .float-figure {
  float: left;
  width: 47%;
  max-width: 430px;
  margin: 0 1.5rem 1rem 0;
  border: 3px double var(--border-color);
  background-color: var(--paper-texture-subtle);
  padding: 14px;
  text-align: center;
}

.article-body .float-figure img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--light-border);
}

.article-body .float-figure em {
  display: block;
  margin-top: 8px;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  line-height: 1.5;
  color: var(--text-subtle);
  font-style: italic;
}

@media (max-width: 600px) {
  .article-body .float-figure {
    float: none;
    width: 100%;
    margin: 0 auto 1rem;
  }
}
