/* Shared by the public profile and its server-rendered editor preview. */
.profile-rich-content { display: flow-root; min-width: 0; overflow-wrap: anywhere; }
.profile-rich-content img { display: block; max-width: 100%; height: auto; }
.profile-rich-content .profile-figure { margin: 24px auto; width: 100%; min-width: 0; }
.profile-rich-content .profile-figure img { width: 100%; height: auto; border: 1px solid var(--line, #e0e6eb); border-radius: 8px; background: var(--surface, #f4f8fb); }
.profile-rich-content .profile-figure figcaption { margin: 9px 0 0; color: var(--muted, #617286); font-size: .86em; line-height: 1.7; text-align: center; overflow-wrap: anywhere; }
.profile-rich-content .profile-image-left { float: left; width: min(42%, 300px); margin: 5px 24px 18px 0; }
.profile-rich-content .profile-image-right { float: right; width: min(42%, 300px); margin: 5px 0 18px 24px; }
.profile-rich-content .profile-image-wide { clear: both; }
.profile-rich-content .profile-image-grid { clear: both; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 18px; margin: 24px 0; align-items: start; }
.profile-rich-content .profile-image-grid .profile-figure { margin: 0; width: 100%; float: none; }
.profile-rich-content .profile-image-grid img { aspect-ratio: 4 / 3; object-fit: contain; }
.profile-rich-content .profile-math { font-family: Georgia, "Times New Roman", serif; }
.profile-rich-content .profile-math[data-display="block"] { display: block; clear: both; max-width: 100%; overflow-x: auto; overflow-y: hidden; margin: 20px 0; padding: 6px 2px; text-align: center; white-space: pre-wrap; }
.profile-rich-content .profile-math[data-display="inline"] { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; overflow-wrap: normal; }
.profile-rich-content .katex { font-size: 1.08em; }
.profile-rich-content .katex-display { margin: 0; white-space: nowrap; }
.profile-rich-content .katex-display > .katex { white-space: nowrap; }
.profile-rich-content .katex-display > .katex > .katex-html { display: inline-block; padding: 3px 0; }
.profile-rich-content .profile-math-error { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--surface, #f4f8fb); border-radius: 4px; font-size: .9em; }
.profile-rich-content .profile-figure:first-child, .profile-rich-content .profile-image-grid:first-child { margin-top: 0; }
.profile-rich-content .profile-figure:last-child, .profile-rich-content .profile-image-grid:last-child { margin-bottom: 0; }
@media (max-width: 575px) {
  .profile-rich-content .profile-image-left, .profile-rich-content .profile-image-right { float: none; width: 100%; margin: 20px 0; }
  .profile-rich-content .profile-image-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 14px; }
}
/* Device-width preview works even when the editor itself is on a wide monitor. */
[data-live-preview-root][data-width="narrow"] .profile-rich-content .profile-image-left,
[data-live-preview-root][data-width="narrow"] .profile-rich-content .profile-image-right { float: none; width: 100%; margin: 20px 0; }
@media print {
  .profile-rich-content .profile-figure, .profile-rich-content .profile-image-grid { break-inside: avoid; }
  .profile-rich-content .profile-math[data-display="block"] { overflow: visible; }
}
