/* MSI Rich Text CONTENT styling — shared verbatim between the editor's
   editable surface (.msi-rte-content) and every place authored HTML is
   rendered on the public site / manage UI (.msi-rte-content wrapper).
   This is what makes authored styling persist identically everywhere:
   one stylesheet, one class, loaded on both admin and public base templates. */

.msi-rte-content h1,
.msi-rte-content h2,
.msi-rte-content h3,
.msi-rte-content h4,
.msi-rte-content h5,
.msi-rte-content h6 {
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  font-weight: 700;
  line-height: 1.3;
}

.msi-rte-content h1:first-child,
.msi-rte-content h2:first-child,
.msi-rte-content h3:first-child,
.msi-rte-content h4:first-child {
  margin-top: 0;
}

.msi-rte-content p {
  margin-bottom: 1em;
  line-height: 1.65;
}

.msi-rte-content ul,
.msi-rte-content ol {
  margin-bottom: 1em;
  padding-left: 1.5rem;
}

.msi-rte-content li {
  margin-bottom: 0.35em;
}

.msi-rte-content blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-left: 3px solid var(--msi-color-brand, #1a3c6e);
  background: var(--msi-color-surface-strong, #f1f5f9);
  color: var(--msi-color-neutral-700, #374151);
}

.msi-rte-content pre {
  margin: 1em 0;
  padding: 0.75em 1em;
  background: var(--msi-color-neutral-900, #111827);
  color: #f3f4f6;
  border-radius: 0.375rem;
  overflow-x: auto;
}

.msi-rte-content code {
  font-family: "Courier New", monospace;
  font-size: 0.9em;
}

.msi-rte-content hr {
  margin: 1.5em 0;
  border: none;
  border-top: 1px solid var(--msi-color-border, rgba(15, 23, 42, 0.08));
}

.msi-rte-content a {
  color: var(--msi-color-brand, #1a3c6e);
  text-decoration: underline;
}

.msi-rte-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  overflow-x: auto;
  display: block;
}

.msi-rte-content table.rte-table td,
.msi-rte-content table.rte-table th,
.msi-rte-content table td,
.msi-rte-content table th {
  border: 1px solid var(--msi-color-border, rgba(15, 23, 42, 0.08));
  padding: 0.5em 0.75em;
  text-align: left;
}

.msi-rte-content table th {
  background: var(--msi-color-surface-strong, #f1f5f9);
  font-weight: 600;
}

.msi-rte-content figure.rte-image {
  margin: 1em 0;
  max-width: 100%;
}

.msi-rte-content figure.rte-image img {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  display: block;
}

.msi-rte-content figure.rte-image figcaption {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--msi-color-muted, #6c757d);
  text-align: center;
}

.msi-rte-content .rte-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1em 0;
}

.msi-rte-content .rte-gallery figure.rte-image {
  margin: 0;
}

.msi-rte-content .rte-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  margin: 1em 0;
  border-radius: 0.375rem;
  overflow: hidden;
  background: #000;
}

.msi-rte-content .rte-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.msi-rte-content img:not(figure.rte-image img) {
  max-width: 100%;
  height: auto;
}
