/*==============================================================================
  TMC FADE-IN ANIMATIONS
  Simple keyframe fade-in with directional offset. Uses Elementor's animation
  duration / delay controls directly.
==============================================================================*/

@keyframes tmcAnimationFadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tmcFadeInUp {
  animation-name: tmcAnimationFadeInUp;
}

.tmcFadeInUp.animated {
  animation-duration: 1s;
}

/*==============================================================================
  TMC SLIDE-IN ANIMATIONS  (4 directions x Primary & Secondary colour)

  A colour panel covers the element, its content slides in underneath, then
  the panel wipes away. One rule set for every kind of element: a boxed or
  full-width container, a legacy section or column, or a widget.

  The panel is the animated element's own ::after, so it always spans the
  element's full box. The content is the element's direct children, whatever
  they are. Until Oct 2026 the non-boxed rules hung both on a wrapper child
  (.elementor-widget-container, -widget-wrap or .elementor-container); a
  full-width container has none (its widgets are its children), so a nested
  full-width container got no animation at all, and elsewhere the wipe only
  covered the wrapper.

  Elementor adds the animation's class (with .animated) when the element
  enters the viewport, and .animated-fast / .animated-slow from the
  Animation Duration control. Before that it carries .elementor-invisible.

  Keyframes move the individual translate and scale properties, never
  transform: animation-fill-mode: both holds the end value, and a held
  transform: none replaced the transform Elementor's Transform controls put
  on a widget's wrapper.

  "Normal" speed:  content 0.6s / 0.2s delay,  panel 0.8s / 0.65s delay
  "Fast" speed:    content 0.3s / 0.1s delay,  panel 0.4s / 0.33s delay
  "Slow" speed:    content 1.2s / 0.4s delay,  panel 1.6s / 1.3s delay
==============================================================================*/

/* -- Keyframes ---------------------------------------------------------------- */

/* "Slide In Left" moves leftwards, so its content starts off to the right. */
@keyframes tmcSlideInUpContent    { from { translate: 0 100%; }  to { translate: none; } }
@keyframes tmcSlideInDownContent  { from { translate: 0 -100%; } to { translate: none; } }
@keyframes tmcSlideInLeftContent  { from { translate: 100% 0; }  to { translate: none; } }
@keyframes tmcSlideInRightContent { from { translate: -100% 0; } to { translate: none; } }

/* The panel shrinks towards its transform-origin. */
@keyframes tmcSlideInVerticalPanel   { from { scale: 1 1; } to { scale: 1 0; } }
@keyframes tmcSlideInHorizontalPanel { from { scale: 1 1; } to { scale: 0 1; } }

/* -- 1. The animated element: colour, timing, clipping ------------------------ */
:is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
    .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary) {
  --tmc-slide-ease: cubic-bezier(.565,.43,.24,.92);
  --tmc-slide-content-duration: .6s;
  --tmc-slide-content-delay: .2s;
  --tmc-slide-panel-duration: .8s;
  --tmc-slide-panel-delay: .65s;
  overflow: hidden;
  overflow: clip; /* clips like hidden without making a scroll container */
}
:is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight) {
  --tmc-slide-color: var(--e-global-color-primary);
}
:is(.tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary) {
  --tmc-slide-color: var(--e-global-color-secondary);
}
:is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
    .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary):is(.animated-fast) {
  --tmc-slide-content-duration: .3s;
  --tmc-slide-content-delay: .1s;
  --tmc-slide-panel-duration: .4s;
  --tmc-slide-panel-delay: .33s;
}
:is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
    .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary):is(.animated-slow) {
  --tmc-slide-content-duration: 1.2s;
  --tmc-slide-content-delay: .4s;
  --tmc-slide-panel-duration: 1.6s;
  --tmc-slide-panel-delay: 1.3s;
}

/* The panel needs a positioned box to fill. Every Elementor element is
   already position: relative; :where() keeps this at zero specificity so an
   element set to Absolute or Fixed keeps that. */
:where(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
       .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary) {
  position: relative;
}

/* -- 2. The panel ---------------------------------------------------------------- */
:is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
    .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary)::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background-color: var(--tmc-slide-color);
  pointer-events: none;
  animation: tmcSlideInHorizontalPanel var(--tmc-slide-panel-duration) var(--tmc-slide-ease) var(--tmc-slide-panel-delay) both;
}
:is(.tmcSlideInUp, .tmcSlideInUpSecondary)::after       { transform-origin: center top;    animation-name: tmcSlideInVerticalPanel; }
:is(.tmcSlideInDown, .tmcSlideInDownSecondary)::after   { transform-origin: center bottom; animation-name: tmcSlideInVerticalPanel; }
:is(.tmcSlideInLeft, .tmcSlideInLeftSecondary)::after   { transform-origin: left center; }
:is(.tmcSlideInRight, .tmcSlideInRightSecondary)::after { transform-origin: right center; }

/* -- 3. The content: every direct child except the element's background layers
   (video, slideshow, shape dividers, motion-effect layers stay put, so the
   element's own background never shows a gap). ------------------------------ */
:is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
    .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary)
  > :not(.elementor-background-overlay, .elementor-background-video-container, .elementor-background-slideshow, .elementor-shape, .elementor-motion-effects-container) {
  animation: tmcSlideInLeftContent var(--tmc-slide-content-duration) var(--tmc-slide-ease) var(--tmc-slide-content-delay) both;
}
:is(.tmcSlideInUp, .tmcSlideInUpSecondary)
  > :not(.elementor-background-overlay, .elementor-background-video-container, .elementor-background-slideshow, .elementor-shape, .elementor-motion-effects-container) {
  animation-name: tmcSlideInUpContent;
}
:is(.tmcSlideInDown, .tmcSlideInDownSecondary)
  > :not(.elementor-background-overlay, .elementor-background-video-container, .elementor-background-slideshow, .elementor-shape, .elementor-motion-effects-container) {
  animation-name: tmcSlideInDownContent;
}
:is(.tmcSlideInRight, .tmcSlideInRightSecondary)
  > :not(.elementor-background-overlay, .elementor-background-video-container, .elementor-background-slideshow, .elementor-shape, .elementor-motion-effects-container) {
  animation-name: tmcSlideInRightContent;
}

/* -- 4. Waiting to start: the panel is already there. -----------------------
   Elementor keeps the element at visibility: hidden (.elementor-invisible)
   until it is a few percent into the viewport and its script has run, so on
   a quick scroll the top of the section showed the page background (paper,
   near white) for a moment, then the panel colour arrived: a white flicker
   on dark sections (staging.tallack.media, Oct 2026). While it waits, the
   element now shows the panel at full size over its own background, with
   its content hidden, which is exactly the animation's first frame. The
   class is not on the element yet, so the animation is read from
   data-settings (containers and sections save "animation", widgets
   "_animation"), or from data-tmc-early-anim when the early-start script
   took the element over with a delay. */
@media (prefers-reduced-motion: no-preference) {
  .elementor-invisible:is([data-settings*='"animation":"tmcSlideIn'], [data-settings*='"_animation":"tmcSlideIn'], [data-tmc-early-anim^="tmcSlideIn"]) {
    --tmc-slide-color: var(--e-global-color-primary);
    visibility: visible;
    overflow: hidden;
    overflow: clip;
  }
  .elementor-invisible:is([data-settings*='"animation":"tmcSlideIn'], [data-settings*='"_animation":"tmcSlideIn'], [data-tmc-early-anim^="tmcSlideIn"]):is([data-settings*='Secondary"'], [data-tmc-early-anim$="Secondary"]) {
    --tmc-slide-color: var(--e-global-color-secondary);
  }
  :where(.elementor-invisible:is([data-settings*='"animation":"tmcSlideIn'], [data-settings*='"_animation":"tmcSlideIn'], [data-tmc-early-anim^="tmcSlideIn"])) {
    position: relative;
  }
  .elementor-invisible:is([data-settings*='"animation":"tmcSlideIn'], [data-settings*='"_animation":"tmcSlideIn'], [data-tmc-early-anim^="tmcSlideIn"])::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: var(--tmc-slide-color);
    pointer-events: none;
  }
  .elementor-invisible:is([data-settings*='"animation":"tmcSlideIn'], [data-settings*='"_animation":"tmcSlideIn'], [data-tmc-early-anim^="tmcSlideIn"]) > * {
    visibility: hidden;
  }
}

/* -- 5. Reduced motion: no panel, no slide; the content just appears. ------- */
@media (prefers-reduced-motion: reduce) {
  :is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
      .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary)::after {
    content: none;
  }
  :is(.tmcSlideInUp, .tmcSlideInDown, .tmcSlideInLeft, .tmcSlideInRight,
      .tmcSlideInUpSecondary, .tmcSlideInDownSecondary, .tmcSlideInLeftSecondary, .tmcSlideInRightSecondary) > * {
    animation: none;
  }
}
