/* ============================================================
   Elementor Flip Hero
   Everything is namespaced efh- / --efh-*.

   NEVER introduce a custom property called --display or --body in
   this file. Elementor sets `--display: flex` on .e-con for its own
   container layout, so a token by either name is shadowed inside
   every container and `font-family: var(--display)` computes to the
   unknown family "flex". Type then silently falls back to the
   browser default and nothing anywhere reports an error.
   ============================================================ */

.efh {
  /* Per-instance values are written as inline custom properties by
     the widget, so this stylesheet stays static and cacheable. */
  --efh-card-w: 15rem;
  --efh-gap: 2rem;
  --efh-ratio: 63 / 88;
  --efh-radius: 0.6rem;
  --efh-flip-ms: 850ms;
  --efh-stagger: 150ms;
  --efh-turn-lift: -1rem;
  --efh-hover-lift: -0.55rem;
  --efh-accent: #b99a5b;
  --efh-shadow: 0 1.1rem 2.2rem rgba(0, 0, 0, 0.35);
  --efh-shadow-lift: 0 1.8rem 3.4rem rgba(0, 0, 0, 0.45);
  --efh-ease: cubic-bezier(0.2, 0.8, 0.25, 1);
  --efh-flip-from: rotateY(0deg);
  --efh-flip-to: rotateY(180deg);

  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.efh *,
.efh *::before,
.efh *::after { box-sizing: border-box; }

.efh img { display: block; max-width: 100%; }

/* ------------------------------------------------------------
   HEAD
   ------------------------------------------------------------ */
.efh__head { margin-bottom: clamp(1.5rem, 3.5vw, 3rem); }
.efh[data-align="center"] .efh__head { text-align: center; }
.efh[data-align="center"] .efh__sub { margin-inline: auto; }

.efh__eyebrow {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--efh-accent);
  margin-bottom: 1.25rem;
}
.efh__headline { margin: 0; line-height: 0.98; text-wrap: balance; }
.efh__headline em { font-style: inherit; color: var(--efh-accent); }
.efh__sub {
  margin: 1.25rem 0 0;
  max-width: 44ch;
  line-height: 1.55;
  opacity: 0.78;
}

/* ------------------------------------------------------------
   DECK
   .efh__deck owns state; .efh__fan is the row the cards sit in, so
   the prompt and note below are never dragged into the flex layout.
   ------------------------------------------------------------ */
.efh__deck { display: block; }

.efh__fan {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--efh-gap);
  perspective: 1800px;
  padding-block: 1rem 0.5rem;
}
.efh[data-layout="row"] .efh__fan { align-items: stretch; }

/* ------------------------------------------------------------
   CARD
   A real anchor. The first activation turns it; the second follows
   the link. With no JS it is simply a link that works.
   ------------------------------------------------------------ */
.efh__card {
  --efh-rot: 0deg;
  --efh-lift: 0rem;
  position: relative;
  display: block;
  flex: none;
  width: var(--efh-card-w);
  aspect-ratio: var(--efh-ratio);
  padding: 0;
  border: 0;
  background: none;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: rotate(var(--efh-rot)) translateY(var(--efh-lift));
  transition: transform 0.6s var(--efh-ease);
}
.efh__card:hover { translate: 0 var(--efh-hover-lift); }
.efh__card:focus-visible { outline: none; }
.efh__card:focus-visible .efh__inner {
  box-shadow: 0 0 0 2px var(--efh-accent), var(--efh-shadow-lift);
}

/* Three classes deliberately. The turned state has to outrank
   .efh__card:hover (0-2-0) or a hovered card refuses to sit level
   with its neighbours once it has been turned. It also sets
   `transform` outright rather than reassigning --efh-rot, because
   those come from inline styles and inline always wins a variable. */
.efh .efh__card.is-turned {
  transform: rotate(0deg) translateY(var(--efh-turn-lift));
  translate: none;
  z-index: 3;
}

/* Optional: once one card is turned, the rest step back so the
   revealed face is clearly the subject. */
.efh__card.is-dimmed { opacity: 0.45; filter: saturate(0.75); }
.efh__card.is-dimmed:hover { opacity: 0.8; filter: none; }

/* display:block matters — this is a <span>, so width and height
   would otherwise be ignored and the card collapses to nothing. */
.efh__inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  border-radius: var(--efh-radius);
  box-shadow: var(--efh-shadow);
  transform: var(--efh-flip-from);
  transition: transform var(--efh-flip-ms) var(--efh-ease),
              box-shadow 0.5s var(--efh-ease);
}
.efh__card.is-turned .efh__inner {
  transform: var(--efh-flip-to);
  box-shadow: var(--efh-shadow-lift);
}
.efh[data-trigger="hover"] .efh__card:hover .efh__inner { transform: var(--efh-flip-to); }

.efh__side {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--efh-radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fff;
}
.efh__side img { width: 100%; height: 100%; object-fit: cover; }
.efh__side--face { transform: var(--efh-flip-to); }

/* Caption is printed on the revealed face rather than floating over
   it: a solid band, a hairline, and a soft bleed upward so it joins
   the image instead of fogging it. */
.efh__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.8rem 0.7rem 0.95rem;
  text-align: center;
  background: var(--efh-caption-bg, #fff);
  border-top: 1px solid rgba(0, 0, 0, 0.16);
  box-shadow: 0 -1.5rem 1.5rem 0.2rem var(--efh-caption-bg, #fff);
  color: var(--efh-caption-fg, #15170f);
}
.efh__card-title { display: block; line-height: 1.05; }
.efh__card-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--efh-accent);
}
.efh__card-blurb {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  line-height: 1.4;
  opacity: 0.75;
}

/* ------------------------------------------------------------
   PROMPT + REVEAL NOTE
   The note is the payoff device: it says something the visitor has
   only earned by turning a card.
   ------------------------------------------------------------ */
.efh__prompt {
  margin: clamp(1.25rem, 2.5vw, 2.5rem) 0 0;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.5;
  transition: opacity 0.6s var(--efh-ease);
}
.efh__deck.is-opened .efh__prompt { opacity: 0; }

.efh__note {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.7s var(--efh-ease) 0.25s, transform 0.7s var(--efh-ease) 0.25s;
}
.efh__deck.is-opened .efh__note { opacity: 0.55; transform: none; }
.efh__note a { color: var(--efh-accent); }

/* ------------------------------------------------------------
   ENTRANCE
   Fires on scroll-into-view, never blindly on load.
   ------------------------------------------------------------ */
.efh__deck[data-state="pending"] .efh__card { opacity: 0; }
.efh__deck[data-state="run"] .efh__card {
  animation-duration: 0.95s;
  animation-timing-function: var(--efh-ease);
  animation-fill-mode: backwards;
  animation-delay: calc(var(--i) * var(--efh-stagger));
}
.efh[data-entrance="deal"]  .efh__deck[data-state="run"] .efh__card { animation-name: efh-deal; }
.efh[data-entrance="rise"]  .efh__deck[data-state="run"] .efh__card { animation-name: efh-rise; }
.efh[data-entrance="fade"]  .efh__deck[data-state="run"] .efh__card { animation-name: efh-fade; }

@keyframes efh-deal {
  0%   { opacity: 0; transform: translate(-62vw, 14vh) rotate(-118deg) scale(0.88); }
  62%  { opacity: 1; }
  100% { opacity: 1; transform: rotate(var(--efh-rot)) translateY(var(--efh-lift)); }
}
@keyframes efh-rise {
  0%   { opacity: 0; transform: translateY(3.5rem) rotate(var(--efh-rot)) scale(0.96); }
  100% { opacity: 1; transform: rotate(var(--efh-rot)) translateY(var(--efh-lift)); }
}
@keyframes efh-fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 720px) {
  .efh__fan { gap: min(var(--efh-gap), 0.5rem); }
  .efh[data-layout="row"] .efh__fan { flex-wrap: wrap; }
}

/* ------------------------------------------------------------
   REDUCED MOTION
   No deal, and the turn becomes a cut rather than a rotation.
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .efh *, .efh *::before, .efh *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .efh__deck[data-state="pending"] .efh__card { opacity: 1; }
  .efh__inner { transition: none; }
}
