/*
  WordPress block markup inside migrated content (ContentPage.BodyHtml, product DescriptionHtml), scoped
  to .ld-prose. Covers the block classes the 11 pages and the old front page used in the dump (list in
  docs/contracts/K3-pages.md section 5). The classes only arrive if HtmlSanitiser keeps them; today it
  strips every class, so the "classless" rules at the end style what it currently outputs.
*/

/* Images */
.ld-prose .wp-block-image { margin: 0 0 1.5rem; }
.ld-prose .wp-block-image img { max-width: 100%; height: auto; }
.ld-prose .wp-block-image.alignright, .ld-prose .alignright { float: right; margin: 0 0 1rem 1.5rem; max-width: 50%; }
.ld-prose .is-resized img { width: auto; }

/* Gallery (columns-N, is-cropped, captions over a faint gradient as on the old site) */
.ld-prose .wp-block-gallery, .ld-prose .blocks-gallery-grid {
  display: grid; grid-template-columns: repeat(var(--ld-gallery-cols, 2), minmax(0, 1fr));
  gap: 1rem; list-style: none; padding: 0; margin: 0 0 1.5rem;
}
.ld-prose .wp-block-gallery > .blocks-gallery-grid { margin: 0; }
.ld-prose .columns-1 { --ld-gallery-cols: 1; }
.ld-prose .columns-3 { --ld-gallery-cols: 3; }
.ld-prose .columns-4 { --ld-gallery-cols: 4; }
.ld-prose .blocks-gallery-item { position: relative; margin: 0; }
.ld-prose .blocks-gallery-item figure { margin: 0; height: 100%; }
.ld-prose .blocks-gallery-item img { display: block; width: 100%; height: auto; }
.ld-prose .is-cropped .blocks-gallery-item img { aspect-ratio: 1 / 1; object-fit: cover; height: 100%; }
.ld-prose .blocks-gallery-item__caption, .ld-prose .blocks-gallery-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2rem 0.75rem 0.75rem; text-align: center;
  color: #fff; font-size: var(--ld-caption-size); background: linear-gradient(to top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}
.ld-prose .blocks-gallery-item a { color: #fff; text-decoration: none; }

/* Cover (has-background-dim, is-position-bottom-center, inner container) */
.ld-prose .wp-block-cover {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 430px; overflow: hidden; margin: 0 0 1.5rem; padding: 1rem; color: #fff;
}
.ld-prose .wp-block-cover__image-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ld-prose .wp-block-cover.has-background-dim::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.ld-prose .wp-block-cover.has-white-background-color { background: #fff; color: var(--ld-title); }
.ld-prose .wp-block-cover.has-white-background-color::before { background: rgba(255, 255, 255, 0.5); }
.ld-prose .wp-block-cover__inner-container { position: relative; z-index: 1; width: 100%; }
.ld-prose .wp-block-cover.is-position-bottom-center { align-items: flex-end; }
.ld-prose .wp-block-cover.has-custom-content-position .wp-block-cover__inner-container { width: auto; }

/* Columns */
.ld-prose .wp-block-columns { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0 0 1.5rem; }
.ld-prose .wp-block-column { flex: 1 1 0; min-width: 0; }
.ld-prose .are-vertically-aligned-center, .ld-prose .is-vertically-aligned-center { align-items: center; align-self: center; }
@media (max-width: 781px) { .ld-prose .wp-block-columns { flex-direction: column; } }

/* Group */
.ld-prose .wp-block-group { margin: 0 0 1.5rem; }
.ld-prose .wp-block-group.has-background { padding: 1.25rem; }

/* Buttons: Savona fill by default; is-style-outline black on white with a 4px radius; width-25 widened to 35% */
.ld-prose .wp-block-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.5rem; }
.ld-prose .wp-block-buttons.is-content-justification-center { justify-content: center; }
.ld-prose .wp-block-button__link {
  display: inline-block; padding: 0.6rem 1.5rem; text-align: center; text-decoration: none;
  background: var(--ld-button-bg); color: var(--ld-button-text); border: 1px solid var(--ld-button-bg);
}
.ld-prose .wp-block-button__link:hover, .ld-prose .wp-block-button__link:focus { background: var(--ld-button-hover); border-color: var(--ld-button-hover); color: #fff; }
.ld-prose .is-style-outline .wp-block-button__link, .ld-prose .wp-block-button__link.is-style-outline {
  background: #fff; color: var(--ld-title); border-color: var(--ld-title); border-radius: var(--ld-radius);
}
.ld-prose .is-style-outline .wp-block-button__link:hover { background: var(--ld-button-bg); color: #fff; }
.ld-prose .wp-block-button.has-custom-width .wp-block-button__link { width: 100%; }
.ld-prose .wp-block-button__width-25 { width: 35%; }
.ld-prose .wp-block-button__width-50 { width: 50%; }
.ld-prose .wp-block-button__width-75 { width: 75%; }
.ld-prose .wp-block-button__width-100 { width: 100%; }
@media (max-width: 575.98px) { .ld-prose .wp-block-button[class*="__width-"] { width: 100%; } }

/* Text helpers */
.ld-prose .has-text-align-center { text-align: center; }
.ld-prose .has-text-align-left { text-align: left; }
.ld-prose .has-text-align-right { text-align: right; }
.ld-prose .has-medium-font-size { font-size: 1.25rem; }
.ld-prose .has-black-color { color: #000; }
.ld-prose .has-white-background-color { background-color: #fff; }
.ld-prose .has-pale-pink-color { color: #f78da7; }

/* Separator, code */
.ld-prose .wp-block-separator, .ld-prose hr { border: 0; border-top: 1px solid var(--ld-border); opacity: 1; margin: 2rem auto; max-width: 100px; }
.ld-prose .wp-block-code, .ld-prose pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--ld-font); font-size: var(--ld-font-size); }

/* Classless: what HtmlSanitiser outputs today (galleries become figure > ul > li > figure > img) */
.ld-prose figure > ul {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0;
}
.ld-prose figure > ul > li { margin: 0; }
.ld-prose figure > ul > li figure { margin: 0; }
.ld-prose figure > ul img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.ld-prose figure { margin: 0 0 1.5rem; }
.ld-prose figure img { max-width: 100%; height: auto; }
.ld-prose figcaption { text-align: center; font-size: 0.9rem; color: var(--ld-muted); margin-top: 0.4rem; }
/* Adjacent links (the sanitised social icons arrive as <a>Facebook</a><a>Twitter</a>... with no space) */
.ld-prose a + a { margin-left: 0.75em; }
.ld-prose::after { content: ""; display: table; clear: both; }
