/* fpmi_callouty-theorem: FPMI house style for theorem-like environments,
 * ported from cu-callouty-theorem (same structural technique: thin uniform
 * border + a full-width tinted header bar built from Quarto's own native
 * inline title span), recolored to the accent palette already used for
 * these environments in fpmi-format/theme.scss's old bare-.theorem rules.
 *
 * All types run with `override-title: false` (see _quarto.yml), so Quarto
 * renders its own native title INLINE at the start of the body -- e.g.
 * <span class="theorem-title"><strong>Теорема 1</strong></span> -- already
 * carrying the crossref number for free. We don't rebuild it, we just turn
 * that inline span into a full-width header bar with CSS.
 */

:root {
  --fpmi-thm: #c0392b;
  --fpmi-def: #27ae60;
  --fpmi-lem: #e67e22;
  --fpmi-cor: #8e44ad;
  --fpmi-prp: #2980b9;
  --fpmi-rule: #e6e3ec;
}

.callout.callout-fpmi-thm { --accent: var(--fpmi-thm); }
.callout.callout-fpmi-def { --accent: var(--fpmi-def); }
.callout.callout-fpmi-lem { --accent: var(--fpmi-lem); }
.callout.callout-fpmi-cor { --accent: var(--fpmi-cor); }
.callout.callout-fpmi-prp { --accent: var(--fpmi-prp); }

/* ---------- shared structure for every fpmi-* type ---------- */

.callout.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) {
  /* .callout repeated to out-specificity bootstrap's own unconditional
     fallback `div.callout.callout{border-left-color:#6c757d}` */
  border: 1px solid var(--fpmi-rule);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: #ffffff;
  margin: 1.2em 0;
  padding: 0; /* appearance:simple gives .callout its own padding -- zero it
                 so the header bar sits flush against the border */
  box-shadow: none;
}

.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) .callout-icon-container {
  display: none; /* icon:false already hides Quarto's own icon slot; belt & suspenders */
}

.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) > .callout-body {
  display: block;
  margin: 0; /* bootstrap's own .callout-body margin-top reopens the white-gap-above-header issue otherwise */
}

/* the native inline lead-in ("Теорема 1"), turned into a full-bleed header bar */
.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) .theorem-title {
  display: block;
  background: color-mix(in srgb, var(--accent) 8%, white);
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border-radius: 0 3px 0 0;
  margin: -1.1rem -1.3rem 0.9rem -1.3rem;
  padding: 0.35rem 0.7rem;
}
.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) .theorem-title strong {
  font-weight: 600;
  font-style: normal;
  color: inherit;
}

.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) .callout-body-container {
  padding: 1.1rem 1.3rem 1.15rem;
  color: #141414;
}
/* Quarto's theorem wrapper carries its own small margin-top on its first
   child (bootstrap's `.callout:not(.callout-titled) .callout-body>div>:first-child`,
   specificity 0,4,1) which otherwise collapses with the title bar's negative
   escape-margin instead of being absorbed by it -- leaving a thin white gap.
   .callout repeated below to clear that specificity with room to spare. */
.callout.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) .callout-body-container > :first-child {
  margin-top: 0;
}
.callout:is(.callout-fpmi-thm, .callout-fpmi-def, .callout-fpmi-lem, .callout-fpmi-cor, .callout-fpmi-prp) .callout-body-container > *:last-child {
  margin-bottom: 0;
}
