/* Shared image-grid interactions. Keep Elementor's editing canvas still. */
body:not(.elementor-editor-active) :is(
  .zg-home-card,
  .zg-category-card,
  .zg-service-related-card,
  .zg-hub-tile,
  .zg-feature,
  .zg-mega-card,
  .zg-main .gallery-item,
  .zg-main .wp-block-gallery .wp-block-image
) {
  border-radius: 6px;
}

body:not(.elementor-editor-active) :is(
  .zg-home-card-photo,
  .zg-category-card-photo,
  .zg-hub-photo,
  .zg-feature .wp-block-image,
  .zg-main .gallery-icon a,
  .zg-main .wp-block-gallery .wp-block-image,
  .zg-mega-card
) {
  overflow: hidden;
  border-radius: 6px;
}

/* One native heading link covers the card, including its photograph. */
body:not(.elementor-editor-active) :is(.zg-home-card, .zg-hub-tile, .zg-feature) {
  position: relative;
}
body:not(.elementor-editor-active) :is(
  .zg-home-card-info,
  .zg-home-card .elementor-widget-heading,
  .zg-home-card .elementor-widget-heading .elementor-widget-container,
  .zg-hub-tile .elementor-widget-heading,
  .zg-hub-tile .elementor-widget-heading .elementor-widget-container,
  .zg-feature-info,
  .zg-feature h3
) {
  position: static;
}
body:not(.elementor-editor-active) :is(.zg-home-card h3, .zg-hub-tile h2, .zg-feature h3) a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 6px;
}
body:not(.elementor-editor-active) .zg-home-text-link a {
  position: relative;
  z-index: 2;
}

/* The menu image sits directly inside its link; protect its caption from the zoom. */
.zg-mega-card-caption {
  position: relative;
  z-index: 1;
  background: #f7f3f1;
}

body:not(.elementor-editor-active) :is(
  .zg-home-card,
  .zg-category-card,
  .zg-service-related-card,
  .zg-hub-tile,
  .zg-feature,
  .zg-mega-card,
  .zg-main .gallery-item,
  .zg-main .wp-block-gallery .wp-block-image
):focus-within {
  outline: 2px solid var(--zg-brand-red);
  outline-offset: 4px;
}

/* Only a mouse/trackpad receives motion; touch and reduced-motion keep a still layout. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body:not(.elementor-editor-active) :is(
    .zg-home-card,
    .zg-category-card,
    .zg-service-related-card,
    .zg-hub-tile,
    .zg-feature,
    .zg-mega-card,
    .zg-main .gallery-item,
    .zg-main .wp-block-gallery .wp-block-image
  ) {
    --zg-grid-image-scale: 1;
    --zg-grid-image-light: 1;
    transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
  }

  body:not(.elementor-editor-active) :is(
    .zg-home-card,
    .zg-category-card,
    .zg-service-related-card,
    .zg-hub-tile,
    .zg-feature,
    .zg-mega-card,
    .zg-main .gallery-item,
    .zg-main .wp-block-gallery .wp-block-image
  ) img {
    transform: scale(var(--zg-grid-image-scale));
    filter: brightness(var(--zg-grid-image-light));
    transition: transform .5s cubic-bezier(.2, .65, .25, 1), filter .5s ease;
  }

  body:not(.elementor-editor-active) :is(
    .zg-home-card,
    .zg-category-card,
    .zg-service-related-card,
    .zg-hub-tile,
    .zg-feature,
    .zg-mega-card,
    .zg-main .gallery-item,
    .zg-main .wp-block-gallery .wp-block-image
  ):is(:hover, :focus-within) {
    --zg-grid-image-scale: 1.045;
    --zg-grid-image-light: 1.035;
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgb(43 28 22 / .1);
    border-color: var(--zg-brand-red);
  }

  body:not(.elementor-editor-active) :is(
    .zg-home-card,
    .zg-category-card,
    .zg-service-related-card,
    .zg-hub-tile,
    .zg-feature,
    .zg-mega-card
  ):is(:hover, :focus-within) :is(h2 a, h3 a, .zg-mega-card-title) {
    color: var(--zg-brand-red);
  }
}
