/* ===== Hero Random – Front-end ===== */

/* 0) Reset-ish bits */
.hero-random-wrapper {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  isolation: isolate; /* ensure overlay blends properly */
  --hero-pad: clamp(1rem, 3vw, 3rem);
  --hero-max: 72rem;
  --hero-text: #fff;
  --hero-shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.35);
}

/* Keep an aspect ratio if your images vary wildly (optional) */
.hero-random-wrapper .hero-media {
  margin: 0;
  block-size: auto;
  inline-size: 100%;
  aspect-ratio: 16/9; /* remove if you always provide same-ish ratios with width/height */
}

.hero-random-wrapper .hero-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: center;
}

/* Overlay (centered) */
.hero-random-wrapper .hero-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--hero-pad);
  text-align: center;
  z-index: 1;
  pointer-events: none; /* let inner controls opt-in */
  /* Gradient for contrast (AA+ even on busy images) */
  background-image: linear-gradient(to top, rgba(0,0,0,.45), rgba(0,0,0,.25) 30%, rgba(0,0,0,.1) 60%, rgba(0,0,0,0));
}

.hero-random-wrapper .hero-content {
  max-width: min(90%, var(--hero-max));
  color: var(--hero-text);
  text-shadow: var(--hero-shadow);
  pointer-events: auto; /* re-enable interaction */
}

/* Typography – responsive with clamp() */
.hero-random-wrapper .hero-content h1,
.hero-random-wrapper .hero-content h2 {
  font-size: clamp(1.75rem, 3.5vw + .5rem, 3rem);
  line-height: 1.1;
  margin: 0 0 .75rem;
  color: var(--hero-text);
}

.hero-random-wrapper .hero-content p {
  font-size: clamp(1rem, 1vw + .75rem, 1.25rem);
  margin: 0 0 1rem;
}

/* Buttons block */
.hero-random-wrapper .hero-content .wp-block-buttons {
  display: inline-flex;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-random-wrapper .hero-content .wp-block-button__link {
  padding: .75rem 1rem;
  font-size: clamp(.95rem, .5vw + .75rem, 1.1rem);
  line-height: 1.2;
  border-radius: .5rem;
  box-shadow: var(--hero-shadow);
}

/* :focus-visible for a11y */
.hero-random-wrapper :where(a, button, [tabindex])::before { content: ""; }
.hero-random-wrapper :is(a, button, .wp-block-button__link):focus-visible {
  outline: 3px solid Highlight;
  outline-offset: 3px;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  .hero-random-wrapper * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Small screens tweaks */
@media (max-width: 768px) {
  .hero-random-wrapper .hero-content {
    max-width: 94%;
  }
  .hero-random-wrapper .hero-content .wp-block-buttons {
    gap: .5rem;
  }
}

/* High-contrast mode (forced colors) */
@media (forced-colors: active) {
  .hero-random-wrapper .hero-overlay {
    background: transparent; /* let system colors dominate */
  }
  .hero-random-wrapper .hero-content {
    text-shadow: none;
  }
}
