/* Customizations for content created in the Rich Text Editor */

/* ---------- Images ---------- */
img.image-left,
img.image-right {
  max-width: 50%;
  box-sizing: border-box;
}

img.image-left  { float: left;  padding-right: 20px; }
img.image-right { float: right; padding-left: 20px; }

/* Captioned images: float the whole figure, not just the image */
figure:has(> img.image-left)  { float: left;  max-width: 50%; }
figure:has(> img.image-right) { float: right; max-width: 50%; }
figure:has(> img.image-left)  > img,
figure:has(> img.image-right) > img { float: none; max-width: 100%; }

/* Mobile: no float, full width, 20px above and below */
@media (max-width: 767px) {
  img.image-left,
  img.image-right,
  figure:has(> img.image-left),
  figure:has(> img.image-right) {
    float: none;
    display: block;
    max-width: 100%;
  }
  img.image-left,
  img.image-right {
    padding: 20px 0px 20px 0px;
  }
}

/* ---------- Tables (Page template only) ---------- */
.page-richtext table {
  border-collapse: collapse;
}
.page-richtext table,
.page-richtext th,
.page-richtext td {
  border: 1px solid #000;
}
.page-richtext th,
.page-richtext td {
  padding: 10px;
}

/* The editor (Tiptap) wraps every cell's content in a <p>. Remove the theme's
   paragraph margin there, but keep spacing between several paragraphs in one cell. */
.page-richtext th > p,
.page-richtext td > p {
  margin: 0;
}
.page-richtext th > p + p,
.page-richtext td > p + p {
  margin-top: 0.75em;
}
