/**
 * Block Compatibility Fixes for E-Tineret Theme
 * 
 * Ensures WordPress core blocks and custom ET blocks work well together
 */

/* Ensure WordPress core gallery blocks don't conflict with ET Gallery blocks */
.wp-block-gallery {
  /* Reset any potential conflicts from global gallery styles */
  margin: 1em 0;
  clear: both;
}

.wp-block-gallery .blocks-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

/* Ensure proper spacing for core blocks within entry-content */
.entry-content .wp-block-gallery,
.entry-content .wp-block-image,
.entry-content .wp-block-embed,
.entry-content .wp-block-video {
  margin: 1.5em 0;
}

/* Prevent custom ET block styles from affecting core blocks */
.wp-block-etineret-gallery {
  /* Isolate custom gallery block styles */
  isolation: isolate;
}

/* Ensure proper width for blocks within container */
.container .entry-content > .wp-block-gallery,
.container .entry-content > .wp-block-image.alignwide,
.container .entry-content > .wp-block-embed.alignwide {
  width: 100%;
  max-width: 100%;
}

/* Fix for core gallery block alignment within containerized content */
.container .entry-content .wp-block-gallery.alignfull {
  width: calc(100vw - 2 * var(--et-adaptive-gutter, 70px));
  max-width: none;
  margin-left: calc(-1 * var(--et-adaptive-gutter, 70px));
  margin-right: calc(-1 * var(--et-adaptive-gutter, 70px));
}

@media (max-width: 991px) {
  .container .entry-content .wp-block-gallery.alignfull {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
  }
}

/* Ensure text color doesn't get overridden by theme colors */
.wp-block-gallery .blocks-gallery-item figcaption,
.wp-block-image figcaption {
  color: #666;
  font-size: 0.875em;
}