/* Core blocks on the page (DEB-3667): loaded only on pages made of blocks (inc/block-editor.php), after style.css.
   Core's own block CSS loads on demand; this makes the blocks look like the rest of the site. Keep in step with
   assets/editor-style.css. */

.entry__body figcaption, .entry__body .wp-element-caption { font-size: .85rem; line-height: 1.35; color: var(--ink-soft); margin: .5em 2px 0; text-align: left; }
.entry__body .wp-block-separator { border: 0; border-top: 1px solid var(--rule); margin: 1.6em 0; }
.entry__body .wp-block-quote { margin-left: 0; padding-left: 1em; border-left: 3px solid var(--rule); color: var(--ink-soft); }

/* tables: like the registers */
.entry__body .wp-block-table table { width: 100%; font-size: .95rem; }
.entry__body .wp-block-table td, .entry__body .wp-block-table th { border: 0; border-bottom: 1px solid var(--rule); }
.entry__body .wp-block-table thead th { background: var(--panel); border-bottom: 2px solid var(--mold); text-align: left; }
.entry__body .wp-block-table td img { max-width: 100%; }

/* albums: framed photos, the caption under the photo (as in the old [gallery] albums), not over it */
/* core sizes each photo from --wp--style--unstable-gallery-gap (fed by --wp--style--gallery-gap-default): set the gap
   through them, or the row overflows and wraps to two columns */
.entry__body .wp-block-gallery.has-nested-images { margin: 1.4em 0; --wp--style--gallery-gap-default: 14px; --wp--style--unstable-gallery-gap: 14px; gap: 14px; }
.entry__body .wp-block-gallery.has-nested-images figure.wp-block-image { background: var(--paper); border: 1px solid var(--rule); padding: 6px; flex-direction: column; justify-content: flex-start; flex-grow: 0; }   /* a short last row keeps the tile size, as in the old albums */
/* core's cropped rule (height:100%; flex:1 0 0%) carries #individual-image; match it, or with the caption under the
   photo a small original collapses to 0 px high */
.entry__body .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img { aspect-ratio: 4 / 3; width: 100%; height: auto; flex: none; object-fit: cover; }
.entry__body .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
  position: static; background: none; color: var(--ink-soft); padding: 0; max-height: none; overflow: visible;
  font-size: .85rem; text-shadow: none; text-align: left; margin: .5em 2px 0;
}
.entry__body .wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before { display: none; }

/* photo beside text */
.entry__body .wp-block-media-text { margin: 0 0 1.2em; }
.entry__body .wp-block-media-text .wp-block-media-text__content { padding: 0 0 0 1.2em; }
.entry__body .wp-block-media-text.has-media-on-the-right .wp-block-media-text__content { padding: 0 1.2em 0 0; }
@media (max-width: 600px) {
  .entry__body .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content { padding: .8em 0 0; }
}
.entry__body .wp-block-columns { margin-bottom: 1em; }
.entry__body .wp-block-column > :last-child { margin-bottom: 0; }

.entry__body .wp-block-details { margin: 0 0 1em; }
.entry__body .wp-block-details summary { cursor: pointer; font-weight: 600; }
.entry__body .wp-block-embed { margin: 0 0 1.2em; }

/* a floated photo must not run into the sub-page list under the text */
.gh-has-blocks .entry__body::after { content: ""; display: table; clear: both; }

/* the photo's caption in the enlarged view (DEB-4185; the line and the script that measures it are added in
   inc/block-editor.php). The photo stays centred where core puts it, caption or not: --gh-lb-cap (the caption's
   height, 0 without one) is taken off the photo's height twice, once below and once above, and object-fit keeps
   its shape, so a long caption makes the photo smaller but never moves it. On a phone the caption sits between
   the arrows, which core puts at the bottom there. */
.wp-lightbox-overlay .gh-lightbox-caption {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2000002;
  margin: 0 auto; max-width: 60em; max-height: 30vh; overflow-y: auto; box-sizing: border-box;
  padding: 8px 64px calc(env(safe-area-inset-bottom) + 10px);
  font-family: var(--sans); font-size: .95rem; line-height: 1.4; color: var(--ink); text-align: center;
  white-space: pre-line; background: rgba(255, 255, 255, .85);
}
.wp-lightbox-overlay .gh-lightbox-caption[hidden] { display: none; }
.wp-lightbox-overlay .lightbox-image-container .wp-block-image img {
  min-height: 0; object-fit: contain;
  height: min(var(--wp--lightbox-image-height), calc(100vh - 2 * var(--gh-lb-cap, 0px) - 16px));
}
@media (min-width: 960px) {
  .wp-lightbox-overlay .gh-lightbox-caption { padding-left: 24px; padding-right: 24px; }
}
@media not (prefers-reduced-motion) {
  .wp-lightbox-overlay.active .gh-lightbox-caption { animation: both turn-on-visibility .4s; }
}

@media print {
  .entry__body .wp-lightbox-container button, .wp-lightbox-overlay { display: none !important; }
  .entry__body .wp-block-gallery.has-nested-images figure.wp-block-image { break-inside: avoid; }
}
