/* EpicPulls Hero block (InnerBlocks container)
   ------------------------------------------------------------------
   Full-bleed via .entry-content .alignfull (_alignment.scss). Every responsive
   property (height, overlay, image focal point, content position, button width)
   is set per breakpoint through tier-specific custom properties emitted by
   hero.php:  -d = desktop (≥992px), -t = tablet (768–991px), -m = mobile (≤767px).

   The block resolves the "active" value into generic properties (--ep-h,
   --ep-valign, …) which the media queries below swap per breakpoint, so the
   actual styling rules stay simple and only reference the generic names. */

.ep-hero {
  /* Active values default to the desktop tier; media queries override. */
  --ep-h: var(--ep-h-d);
  --ep-overlay: var(--ep-overlay-d);
  --ep-pos: var(--ep-pos-d);
  --ep-valign: var(--ep-valign-d);
  --ep-halign: var(--ep-halign-d);
  --ep-text: var(--ep-text-d);
  --ep-btn-basis: var(--ep-btn-basis-d);
  --ep-btn-linkw: var(--ep-btn-linkw-d);
  --ep-btn-display: var(--ep-btn-display-d);

  position: relative;
  display: flex;
  align-items: var(--ep-valign, center); /* vertical content position */
  overflow: hidden;
  color: #fff; /* default text colour for nested blocks; override per block */
  isolation: isolate;
  background-color: #242038; /* Midnight Violet fallback before image loads */
  min-height: var(--ep-h, 520px);
}

/* Tablet: 768–991px */
@media (min-width: 768px) and (max-width: 991.98px) {
  .ep-hero {
    --ep-h: var(--ep-h-t);
    --ep-overlay: var(--ep-overlay-t);
    --ep-pos: var(--ep-pos-t);
    --ep-valign: var(--ep-valign-t);
    --ep-halign: var(--ep-halign-t);
    --ep-text: var(--ep-text-t);
    --ep-btn-basis: var(--ep-btn-basis-t);
    --ep-btn-linkw: var(--ep-btn-linkw-t);
    --ep-btn-display: var(--ep-btn-display-t);
  }
}

/* Mobile: ≤767px */
@media (max-width: 767.98px) {
  .ep-hero {
    --ep-h: var(--ep-h-m);
    --ep-overlay: var(--ep-overlay-m);
    --ep-pos: var(--ep-pos-m);
    --ep-valign: var(--ep-valign-m);
    --ep-halign: var(--ep-halign-m);
    --ep-text: var(--ep-text-m);
    --ep-btn-basis: var(--ep-btn-basis-m);
    --ep-btn-linkw: var(--ep-btn-linkw-m);
    --ep-btn-display: var(--ep-btn-display-m);
  }
}

/* Background image */
.ep-hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
}
.ep-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--ep-pos, center center);
}

/* Tint overlay — opacity driven by the active --ep-overlay */
.ep-hero__overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(36, 32, 56, calc(var(--ep-overlay, 0.4) * 0.85)) 0%,
    rgba(36, 32, 56, var(--ep-overlay, 0.4)) 100%
  );
}

/* Inner layout — horizontal content position via justify-content */
.ep-hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: var(--ep-halign, flex-start);
  padding-top: 3rem;
  padding-bottom: 3rem;
  width: 100%;
}

.ep-hero__content {
  max-width: 640px;
  text-align: var(--ep-text, left);
}

/* ---- Defaults for nested core blocks (all overridable per block) ---- */

.ep-hero__content :is(h1, h2, h3) {
  font-weight: 800;
  line-height: 1.05;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}

/* Hero title: keep each phrase on its own line and SHRINK to fit rather than
   wrap mid-phrase. The fluid size scales with the viewport (capped on desktop);
   !important is needed to override the editor's preset/custom font size so the
   fit behaviour is guaranteed. */
.ep-hero__content h1 {
  /* Deliberate display exception to the --ep-fs-* heading ladder: the hero
     title is nowrap and shrink-to-fit, so the 9vw term is layout logic rather
     than a chosen size. Do not swap this for var(--ep-fs-h1). */
  font-size: clamp(1.5rem, 9vw, 2.75rem) !important;
  white-space: nowrap;
}
/* A coloured highlight (e.g. the violet second half) drops to its own line. */
.ep-hero__content h1 mark {
  display: block;
  background-color: transparent;
}
.ep-hero__content p {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  line-height: 1.5;
}

/* Buttons — width per breakpoint (auto = fit content, full = stacked full-width) */
.ep-hero__content .wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: var(--ep-halign, flex-start);
}
.ep-hero__content .wp-block-buttons .wp-block-button {
  flex: 0 1 var(--ep-btn-basis, auto);
  max-width: 100%;
}
.ep-hero__content .wp-block-button__link {
  display: var(--ep-btn-display, inline-block);
  width: var(--ep-btn-linkw, auto);
  text-align: center;
}

/* ---- Entrance animation: text + button rise & fade in on load ----
   Pure CSS (no JS) so a standalone Hero animates too. `both` fill-mode holds the
   from-state during the delay and the to-state after; if animations are disabled
   (reduced motion, or when nested in a slider where the per-slide transition
   takes over) the elements simply sit at their natural opacity:1 — never stuck
   hidden. Inside .ep-hero-slider this animation is switched off (see
   hero-slider.css) so the active-slide transition drives the reveal instead. */
@keyframes epHeroRise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}
.ep-hero__content > * {
  animation: epHeroRise 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.ep-hero__content > *:nth-child(1) { animation-delay: 0.15s; }
.ep-hero__content > *:nth-child(2) { animation-delay: 0.30s; }
.ep-hero__content > *:nth-child(3) { animation-delay: 0.45s; }
.ep-hero__content > *:nth-child(4) { animation-delay: 0.60s; }

/* Don't re-animate on every re-render while editing. */
.ep-hero.is-admin .ep-hero__content > * {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .ep-hero__content > * {
    animation: none;
  }
}

.ep-hero__placeholder {
  font-style: italic;
  opacity: 0.75;
}

/* Editor preview: alignfull can't fully break out inside the iframe */
.ep-hero.is-admin {
  border-radius: 8px;
}

/* Small screens: add a vertical vignette so text is legible over a busy crop,
   and ease the section padding. */
@media (max-width: 991.98px) {
  .ep-hero__overlay {
    background:
      linear-gradient(
        to bottom,
        rgba(36, 32, 56, 0.5) 0%,
        rgba(36, 32, 56, 0) 28%,
        rgba(36, 32, 56, 0) 58%,
        rgba(36, 32, 56, 0.68) 100%
      ),
      linear-gradient(
        180deg,
        rgba(36, 32, 56, calc(var(--ep-overlay) * 0.85)) 0%,
        rgba(36, 32, 56, var(--ep-overlay)) 100%
      );
  }
  .ep-hero__inner {
    padding-top: 2.25rem;
    padding-bottom: 2.25rem;
  }
  .ep-hero__content {
    max-width: 100%;
  }
}

/* Phone-only fine-tuning */
@media (max-width: 575.98px) {
  .ep-hero__content h1 {
    font-size: clamp(1.75rem, 8vw, 2.75rem);
  }
  .ep-hero__inner {
    padding-top: 1.75rem;
    padding-bottom: 1.75rem;
  }
}
