/**
 * Base styles for the "Agency News Grid" block.
 *
 * NOTE:
 * - The child theme (artafair) provides the final look and feel.
 * - These rules are scoped to .agency-news-* and aim to be usable on their own.
 */

.agency-news-grid {
  width: 100%;
}

.agency-news-grid__items {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 16px;
}

@media (min-width: 720px) {
  .agency-news-grid__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .agency-news-grid__items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.agency-news-card {
  position: relative;
}

/* Instagram Portrait: 4:5 */
.agency-news-card__image {
  display: block;
  /* Ensure the overlay can sit above the image reliably (z-index stacking). */
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  text-decoration: none;
}

.agency-news-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agency-news-card__image--placeholder {
  display: block;
  width: 100%;
  height: 100%;
}

/* Overlay full-cover; theme can override colors */
.agency-news-card__overlay {
  position: absolute;
  inset: 0;
  /* Must sit above the image link; some themes may create stacking contexts. */
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 160ms ease;
}

.agency-news-card:hover .agency-news-card__overlay,
.agency-news-card:focus-within .agency-news-card__overlay {
  opacity: 1;
  pointer-events: auto;
}

.agency-news-card__actions {
  display: flex;
  gap: 12px;
}

.agency-news-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Touch devices: show overlay by default so actions are reachable */
@media (hover: none) {
  .agency-news-card__overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ============================================================
 * Variant: Artist profile (single-darsteller)
 * - 4 columns like the artist gallery (desktop)
 * - keep natural image aspect ratio (no 4:5 crop)
 * - overlay on touch devices: tap-to-open via JS
 * ========================================================== */

.agency-news-grid--artist .agency-news-grid__items {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 1024px) {
  .agency-news-grid--artist .agency-news-grid__items {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Visual alignment with the gallery tiles */
.agency-news-grid--artist .agency-news-card {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--agency-border, rgba(0,0,0,0.12));
  background: rgba(0, 0, 0, 0.05);
}

/* Artist profile overlay should be visible and readable (theme styles on body.home do not apply here). */
.agency-news-grid--artist .agency-news-card__overlay {
  /* Light dim to make the icon readable on any image. */
  background: color-mix(in srgb, #000 28%, transparent);
}

/* Explicit hover/focus rules for the artist variant.
 * Some block themes apply more specific defaults that can accidentally override
 * the base `.agency-news-card:hover ...` selector.
 */
.agency-news-grid--artist .agency-news-card:hover .agency-news-card__overlay,
.agency-news-grid--artist .agency-news-card:focus-within .agency-news-card__overlay {
  opacity: 1;
  pointer-events: auto;
}

.agency-news-grid--artist .agency-news-card__actions {
  gap: 14px;
}

.agency-news-grid--artist .agency-news-card__action {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, #fff 40%, transparent);
  background: color-mix(in srgb, #000 25%, transparent);
  color: #fff;
}

.agency-news-grid--artist .agency-news-card__action:focus-visible {
  outline: 2px solid color-mix(in srgb, #fff 70%, transparent);
  outline-offset: 2px;
}

/* Disable the Instagram 4:5 crop on single profiles */
.agency-news-grid--artist .agency-news-card__image {
  aspect-ratio: auto;
}

/* Natural image proportions */
.agency-news-grid--artist .agency-news-card__image img {
  height: auto;
  object-fit: contain;
}

/* Touch devices: match homepage UX (tap reveals overlay instead of always visible) */
@media (hover: none) {
  .agency-news-grid--artist .agency-news-card__overlay {
    opacity: 0;
    pointer-events: none;
  }

  /* Neutralize hover/focus "stickiness" on touch browsers */
  .agency-news-grid--artist .agency-news-card:hover .agency-news-card__overlay,
  .agency-news-grid--artist .agency-news-card:focus-within .agency-news-card__overlay {
    opacity: 0;
    pointer-events: none;
  }

  .agency-news-grid--artist .agency-news-card.agency-news-card--open .agency-news-card__overlay {
    opacity: 1;
    pointer-events: auto;
    background: color-mix(in srgb, #000 18%, transparent);
  }
}
