/*
 * WebinarIgnition — Registration Hero Animation (video fallback).
 *
 * The markup is a Gutenberg block pattern: a `.wi-reg-hero` group holding slide
 * groups with real heading/paragraph/list/image blocks. This file only styles
 * that markup and is enqueued by wi_reg_hero_maybe_enqueue_assets() when the
 * wrapper class is on the current page — it never costs a request elsewhere.
 *
 * Every colour follows the theme's FSE palette (--wp--preset--color--*) with hard
 * fallbacks; sizing uses container queries where supported (fallback vw/px) so the
 * block scales with its column (the CTA-video rail is capped at 576px). Motion is
 * disabled under prefers-reduced-motion.
 *
 * Prefix: .wi-reg-hero / .wi-rh-*  (kept apart from the plugin's .wi-* classes)
 */
/* ---------------------------------------------------------------------------
   1. Tokens
   --------------------------------------------------------------------------- */
.wi-reg-hero{
  --rh-surface:      var(--wp--preset--color--accent-1, #ffffff);
  --rh-bg:           var(--wp--preset--color--accent-5, #f1eee9);
  --rh-bg-2:         var(--wp--preset--color--base,     #f8f7f5);
  --rh-ink:          var(--wp--preset--color--contrast, #191919);
  --rh-ink-dim:      var(--wp--preset--color--accent-4, #5f5f5f);
  --rh-accent:       var(--wp--preset--color--accent-2, #f5b684);
  --rh-line:         var(--wp--preset--color--accent-6, rgba(25,25,25,.14));
  --rh-h-font:       var(--wp--preset--font-family--beiruti, "Beiruti", system-ui, -apple-system, "Segoe UI", sans-serif);
  --rh-b-font:       var(--wp--preset--font-family--literata, "Literata", Georgia, "Times New Roman", serif);
  --rh-radius:       20px;
  --rh-ease:         cubic-bezier(.22,.61,.36,1);
  --rh-dur:          .62s;
  --rh-pad-x:        clamp(18px, 4.2vw, 40px);
  --rh-pad-b:        clamp(11px, 2vw, 18px);

  font-size: clamp(13px, 1.5vw, 18px);
  font-family: var(--rh-b-font);
  color: var(--rh-ink);
  text-align: start; /* follows the document direction (RTL safe) */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

@supports (container-type: inline-size){
  .wi-reg-hero{
    container-type: inline-size;
    font-size: clamp(13px, 2.7cqw, 19px);
    --rh-pad-x: clamp(18px, 4.2cqw, 40px);
    --rh-pad-b: clamp(11px, 2cqw, 18px);
  }
}

/* ---------------------------------------------------------------------------
   2. Shell
   --------------------------------------------------------------------------- */
.wi-reg-hero,
.wi-reg-hero *{ box-sizing: border-box; }

/* Gutenberg adds its own block margins; the animation spaces itself. */
.wi-reg-hero p,
.wi-reg-hero h1,
.wi-reg-hero h2,
.wi-reg-hero h3,
.wi-reg-hero ul,
.wi-reg-hero figure,
.wi-reg-hero .wp-block-group{ margin-block: 0; }

.wi-reg-hero{
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--rh-radius);
  background:
    radial-gradient(120% 90% at 100% 0%,  var(--rh-surface) 0%, transparent 55%),
    linear-gradient(155deg, var(--rh-bg) 0%, var(--rh-bg-2) 100%);
  box-shadow: 0 18px 50px -22px rgba(25,25,25,.35);
  isolation: isolate;
}

/* Slow drifting light behind the slides — motion without noise. */
.wi-reg-hero::before{
  content: "";
  position: absolute;
  inset: -35%;
  z-index: 0;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--rh-accent) 42%, transparent), transparent 72%) 22% 78% / 58% 58% no-repeat,
    radial-gradient(closest-side, color-mix(in srgb, var(--rh-accent) 26%, transparent), transparent 72%) 84% 18% / 46% 46% no-repeat;
  animation: wi-rh-drift 26s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes wi-rh-drift{
  from{ transform: translate3d(-2.5%, -1.5%, 0) scale(1); }
  to  { transform: translate3d( 2.5%,  2%,   0) scale(1.08); }
}

/* ---------------------------------------------------------------------------
   3. Slides
   --------------------------------------------------------------------------- */
/* All slides share ONE grid cell: the box is exactly as tall as the tallest
   slide, so nothing overflows and the height never jumps while it runs. */
.wi-reg-hero__viewport{
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 360px;
  padding: clamp(18px, 3.6vw, 34px) var(--rh-pad-x) clamp(34px, 5.4vw, 52px);
}

@supports (container-type: inline-size){
  .wi-reg-hero__viewport{
    padding: clamp(18px, 3.6cqw, 34px) var(--rh-pad-x) clamp(34px, 5.4cqw, 52px);
    min-height: clamp(340px, 62cqw, 480px);
  }
}

.wi-reg-hero__slide{
  grid-area: 1 / 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .9em;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 1.1em, 0);
  transition: opacity var(--rh-dur) var(--rh-ease),
              transform var(--rh-dur) var(--rh-ease),
              visibility 0s linear var(--rh-dur);
}

/* No-JS (or the JS bundle blocked): the first slide AND its children stay readable.
   Without the children rule the block would be an empty ~450px box — text invisible,
   not merely unstyled. */
.wi-reg-hero:not(.wi-rh-ready) .wi-reg-hero__slide:first-child{
  opacity: 1;
  visibility: visible;
  transform: none;
}
.wi-reg-hero:not(.wi-rh-ready) .wi-reg-hero__slide:first-child > *{
  opacity: 1;
  transform: none;
}

.wi-reg-hero__slide.is-active{
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s, 0s, 0s;
}

/* Direction-aware exit: leaving slides drift the way you came from. */
.wi-reg-hero__slide.is-leaving-back{ transform: translate3d(0, -1.1em, 0); }

/* Staggered children. */
.wi-reg-hero__slide > *{
  opacity: 0;
  transform: translate3d(0, .9em, 0);
  transition: opacity .5s var(--rh-ease), transform .5s var(--rh-ease);
}
.wi-reg-hero__slide.is-active > *{
  opacity: 1;
  transform: none;
  transition-delay: var(--d, 0s);
}

/* ---------------------------------------------------------------------------
   4. Shared type
   --------------------------------------------------------------------------- */
.wi-rh-eyebrow{
  display: inline-flex;
  align-items: center;
  gap: .5em;
  align-self: flex-start;
  padding: .34em .85em .3em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rh-surface) 72%, transparent);
  border: 1px solid var(--rh-line);
  color: var(--rh-ink-dim);
  font-family: var(--rh-h-font);
  font-size: .78em;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.wi-rh-eyebrow::before{
  content: "";
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: var(--rh-accent);
  box-shadow: 0 0 0 .22em color-mix(in srgb, var(--rh-accent) 34%, transparent);
  animation: wi-rh-pulse 2.4s ease-in-out infinite;
}
@keyframes wi-rh-pulse{
  0%, 100%{ box-shadow: 0 0 0 .22em color-mix(in srgb, var(--rh-accent) 34%, transparent); }
  50%     { box-shadow: 0 0 0 .5em  color-mix(in srgb, var(--rh-accent) 0%,  transparent); }
}

.wi-rh-h{
  font-family: var(--rh-h-font);
  font-size: 1.62em;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.015em;
  color: var(--rh-ink);
  text-wrap: balance;
}

.wi-rh-sub{
  font-size: .92em;
  color: var(--rh-ink-dim);
  text-wrap: pretty;
}

/* ---------------------------------------------------------------------------
   5. Slide 1 — benefits (numbered via CSS counters)
   --------------------------------------------------------------------------- */
.wi-rh-benefits{
  counter-reset: wi-rh-benefit;
  display: flex;
  flex-direction: column;
  gap: .45em;
  padding: 0;
  list-style: none;
}
.wi-rh-benefits li{
  position: relative;
  padding: .62em .8em .62em 2.7em;
  border-radius: calc(var(--rh-radius) * .55);
  background: color-mix(in srgb, var(--rh-surface) 62%, transparent);
  border: 1px solid var(--rh-line);
  font-size: .88em;
  color: var(--rh-ink-dim);
}
.wi-rh-benefits li::before{
  counter-increment: wi-rh-benefit;
  content: counter(wi-rh-benefit);
  position: absolute;
  left: .8em;
  top: .58em;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: var(--rh-accent);
  color: var(--rh-ink);
  font-family: var(--rh-h-font);
  font-size: .82em;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.wi-rh-benefits li b,
.wi-rh-benefits li strong{ color: var(--rh-ink); font-weight: 600; }

/* ---------------------------------------------------------------------------
   6. Slide 2 — host
   --------------------------------------------------------------------------- */
.wi-rh-host{
  display: flex;
  align-items: center;
  gap: 1.1em;
  padding: .95em 1.05em;
  border-radius: calc(var(--rh-radius) * .8);
  background: color-mix(in srgb, var(--rh-surface) 68%, transparent);
  border: 1px solid var(--rh-line);
}
.wi-rh-host__avatar{
  flex: 0 0 auto;
  position: relative;
  width: 6.4em;
  height: 6.4em;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--rh-accent), color-mix(in srgb, var(--rh-accent) 42%, var(--rh-surface)));
  box-shadow: 0 0 0 3px var(--rh-surface), 0 0 0 4px var(--rh-line);
  color: var(--rh-ink);
  font-family: var(--rh-h-font);
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: .02em;
}
.wi-rh-host__avatar .wp-block-image{ margin: 0; width: 100%; height: 100%; }
.wi-rh-host__avatar img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
}
/* Without a photo the monogram IS the portrait — a deliberate fallback, never a
   broken frame. Mirrors the room header: own photo → Gravatar → initials. */
.wi-rh-host__avatar:not(.has-photo) img{ display: none; }
.wi-rh-host__avatar.has-photo .wi-rh-host__initials{ display: none; }
.wi-reg-hero__slide.is-active .wi-rh-host__avatar{ animation: wi-rh-kenburns 14s var(--rh-ease) both; }
@keyframes wi-rh-kenburns{
  from{ transform: scale(1); }
  to  { transform: scale(1.06); }
}
.wi-rh-host__body{
  display: flex;
  flex-direction: column;
  gap: .18em;
  min-width: 0;
}
.wi-rh-host__name{
  font-family: var(--rh-h-font);
  font-size: 1.18em;
  font-weight: 600;
  line-height: 1.15;
  color: var(--rh-ink);
}
.wi-rh-host__role{
  font-family: var(--rh-h-font);
  font-size: .78em;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--rh-accent) 62%, var(--rh-ink));
}
.wi-rh-host__line{
  margin-top: .35em;
  font-size: .84em;
  line-height: 1.45;
  color: var(--rh-ink-dim);
}

.wi-rh-stats{
  display: flex;
  flex-wrap: wrap;
  gap: .5em;
}
.wi-rh-stat{
  flex: 1 1 8em;
  padding: .55em .75em;
  border-radius: calc(var(--rh-radius) * .5);
  background: color-mix(in srgb, var(--rh-surface) 62%, transparent);
  border: 1px solid var(--rh-line);
}
.wi-rh-stat__num{
  display: block;
  font-family: var(--rh-h-font);
  font-size: 1.3em;
  font-weight: 700;
  line-height: 1.1;
  color: var(--rh-ink);
  font-variant-numeric: tabular-nums;
}
.wi-rh-stat__label{
  display: block;
  margin-top: .1em;
  font-size: .72em;
  line-height: 1.3;
  color: var(--rh-ink-dim);
}

/* ---------------------------------------------------------------------------
   7. Slide 3 — call to action
   --------------------------------------------------------------------------- */
.wi-rh-cta-row{
  display: flex;
  align-items: center;
  gap: .9em;
  flex-wrap: wrap;
}
.wi-rh-cta-row .wp-block-button{ margin: 0; }
.wi-rh-cta .wp-block-button__link{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .55em;
  padding: .82em 1.5em;
  border: 0;
  border-radius: 999px;
  background: var(--rh-ink);
  color: var(--rh-surface);
  font-family: var(--rh-h-font);
  font-size: .95em;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s var(--rh-ease), box-shadow .2s var(--rh-ease);
}
.wi-rh-cta .wp-block-button__link:hover,
.wi-rh-cta .wp-block-button__link:focus-visible{
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--rh-ink) 70%, transparent);
}
.wi-rh-cta .wp-block-button__link::after{
  content: "\203A";
  font-size: 1.15em;
  line-height: 1;
  transform: translateX(0);
  animation: wi-rh-nudge 1.8s ease-in-out infinite;
}
@keyframes wi-rh-nudge{
  0%, 60%, 100%{ transform: translateX(0); }
  30%          { transform: translateX(.28em); }
}
/* Halo that draws the eye to the one action on this slide. */
.wi-rh-cta .wp-block-button__link::before{
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid color-mix(in srgb, var(--rh-accent) 85%, transparent);
  opacity: 0;
  animation: wi-rh-halo 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes wi-rh-halo{
  0%  { opacity: .85; transform: scale(1); }
  70% { opacity: 0;   transform: scale(1.14); }
  100%{ opacity: 0;   transform: scale(1.14); }
}

/* Short recap of the promise, so the ask lands with the value still in view. */
.wi-rh-recap{
  display: flex;
  flex-wrap: wrap;
  gap: .4em;
  padding: 0;
  list-style: none;
}
.wi-rh-recap li{
  padding: .36em .75em .32em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rh-surface) 62%, transparent);
  border: 1px solid var(--rh-line);
  font-size: .76em;
  color: var(--rh-ink-dim);
}
.wi-rh-recap li::before{
  content: "\2713";
  margin-right: .45em;
  color: color-mix(in srgb, var(--rh-accent) 70%, var(--rh-ink));
  font-weight: 700;
}

.wi-rh-hint{
  display: inline-flex;
  align-items: center;
  gap: .4em;
  margin-top: .6em;
  font-size: .8em;
  color: var(--rh-ink-dim);
}
.wi-rh-hint::after{
  content: "\2192";
  font-size: 1.2em;
  line-height: 1;
  color: color-mix(in srgb, var(--rh-accent) 70%, var(--rh-ink));
  animation: wi-rh-nudge 1.8s ease-in-out infinite;
}

/* ---------------------------------------------------------------------------
   8. Controls: progress bars, arrows, pause (created by the JS)
   --------------------------------------------------------------------------- */
.wi-reg-hero__bars{
  position: absolute;
  z-index: 3;
  left: var(--rh-pad-x);
  right: var(--rh-pad-x);
  bottom: var(--rh-pad-b);
  display: flex;
  gap: 6px;
}
.wi-rh-bar{
  flex: 1;
  height: 3px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rh-ink) 16%, transparent);
  cursor: pointer;
  overflow: hidden;
  appearance: none;
}
.wi-rh-bar:focus-visible{ outline: 2px solid var(--rh-ink); outline-offset: 3px; }
.wi-rh-bar span{
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--rh-ink);
}
.wi-rh-bar.is-done span{ width: 100%; }

.wi-rh-nav{
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 2em;
  height: 2em;
  margin-top: -1em;
  padding: 0;
  border: 1px solid var(--rh-line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--rh-surface) 70%, transparent);
  color: var(--rh-ink);
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  transition: background .2s var(--rh-ease), transform .2s var(--rh-ease);
}
.wi-rh-nav:hover{ background: var(--rh-surface); }
.wi-rh-nav--prev{ left: .7em; }
.wi-rh-nav--next{ right: .7em; }
.wi-rh-nav[hidden]{ display: none; }

.wi-rh-pause{
  position: absolute;
  z-index: 3;
  right: var(--rh-pad-x);
  bottom: calc(var(--rh-pad-b) + 1.15em);
  width: 1.6em;
  height: 1.6em;
  padding: 0;
  border: 1px solid var(--rh-line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--rh-surface) 70%, transparent);
  color: var(--rh-ink-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: .55;
  transition: opacity .2s var(--rh-ease);
}
.wi-rh-pause:hover,
.wi-rh-pause:focus-visible{ opacity: 1; }
.wi-rh-pause::before{
  content: "";
  width: .42em;
  height: .42em;
  border-left: .16em solid currentColor;
  border-right: .16em solid currentColor;
}
.wi-reg-hero.is-paused .wi-rh-pause::before{
  width: 0;
  height: 0;
  border: .26em solid transparent;
  border-left: .42em solid currentColor;
  border-right: 0;
}

/* ---------------------------------------------------------------------------
   9. Responsive + reduced motion
   --------------------------------------------------------------------------- */
@media (max-width: 781px){
  .wi-reg-hero{ font-size: clamp(13px, 3.9vw, 16px); }
  .wi-reg-hero__viewport{ min-height: 0; }
  .wi-rh-host{ flex-direction: column; text-align: center; align-items: center; }
  .wi-rh-host__body{ align-items: center; text-align: center; }
  .wi-rh-eyebrow{ align-self: center; }
  .wi-rh-h{ text-align: center; }
  .wi-rh-sub{ text-align: center; }
  .wi-rh-benefits{ text-align: start; }
  .wi-rh-cta-row{ justify-content: center; }
  .wi-rh-hint{ justify-content: center; }
  .wi-rh-hint::after{ content: "\2193"; }
  .wi-rh-nav{ display: none; }
}

@media (prefers-reduced-motion: reduce){
  .wi-reg-hero::before,
  .wi-rh-eyebrow::before,
  .wi-rh-cta .wp-block-button__link::before,
  .wi-rh-cta .wp-block-button__link::after,
  .wi-rh-hint::after,
  .wi-rh-host__avatar{ animation: none !important; }
  .wi-reg-hero__slide,
  .wi-reg-hero__slide > *{ transition-duration: .01ms !important; }
  .wi-reg-hero__slide,
  .wi-reg-hero__slide > *{ transform: none !important; }
}
