/* header style  */

/* Base header z-index - ensures header is always above content even without sticky/animation */
.turbo-header-template,
#tahefobu-header {
    position: relative;
    z-index: 9999;
    /* New block formatting context: with a transparent (absolute) section the
       wrapper is 0px tall, and without this the next element's top margin
       collapses through it and pushes the header down from the top edge. */
    display: flow-root;
}

/* Sticky Header */
.ta-sticky-header {
    position: sticky;
    top: var(--ta-sticky-top, 0);
    z-index: 9999;
}


/* Transition class to smoothly show/hide header */
.turbo-header-template.ta-header-scroll-animation:not(.ta-sticky-header) {
    position: sticky;
    top: var(--ta-sticky-top, 0);
    z-index: 9999;
    /* transition: transform 0.3s ease, opacity 0.3s ease; */
}

/* When scrolling down, hide header */
.ta-header-hide {
    transform: translateY(-100%);
    opacity: 0;
}

/* When scrolling up, show header */
.ta-header-show {
    transform: translateY(0);
    opacity: 1;
}


.ta-header-scroll-animation {
    transition: transform 0.3s ease;
}
.ta-header-hidden {
    transform: translateY(-100%);
    opacity: 0;
}


/* ===== Admin bar gap fix ===== */
/* WordPress adds margin-top to <body> when the admin bar is visible.
   For sticky/animated headers, the JS sets top = adminBarH so they stick
   flush under the admin bar — no negative margins needed here.
   The body margin-top naturally pushes static headers down correctly too. */

/* ===== Sticky + Animation hardening (desktop-safe) ===== */

/* 1) Use a CSS var for the top offset on sticky headers. */
.ta-sticky-header {
  top: var(--ta-sticky-top, 0);
}

/* 2) Fixed fallback when themes break CSS sticky on desktop.
   Works with either the new #tahefobu-header id or your existing wrapper class. */
#tahefobu-header.ta-sticky-active,
.turbo-header-template.ta-sticky-active {
  position: fixed;
  top: var(--ta-sticky-top, 0);
  left: 0;
  right: 0;
  width: 100%;
  z-index: 99990; /* above theme headers, below the WP admin bar (99999) */
}

/* The wrapper stays position:relative until the fixed fallback kicks in, so
   the admin-bar offset in `top` must not shift it down while in flow. */
#tahefobu-header.ta-sticky-header:not(.ta-sticky-active),
.turbo-header-template.ta-sticky-header:not(.ta-sticky-active) {
  top: auto;
}

/* 3) Spacer to prevent content jump when switching to fixed */
.ta-header-spacer {
  display: none;
  width: 100%;
}

/* 4) Scroll hide/show — support both your old class names and the new ones used by JS */
#tahefobu-header.ta-scroll-down,
.turbo-header-template.ta-scroll-down,
.ta-header-hidden,         /* your existing */
.ta-header-hide {          /* your existing */
  transform: translateY(-100%);
  opacity: 0;
}

/* A hidden header must not catch clicks (opacity:0 alone still does — it
   blocked the admin bar). */
#tahefobu-header.ta-scroll-down,
.turbo-header-template.ta-scroll-down {
  pointer-events: none;
}

/* With a transparent (absolute) section the wrapper is 0px tall, so moving the
   wrapper by -100% does nothing — move the section itself out of view. */
.ta-scroll-down .tahefobu-effects-transparent-yes {
  transform: translateY(calc(-100% - var(--ta-sticky-top, 0px)));
}
.tahefobu-effects-transparent-yes {
  transition: transform .25s ease, background-color .25s ease, box-shadow .25s ease;
}

#tahefobu-header.ta-scroll-up,
.turbo-header-template.ta-scroll-up,
.ta-header-show {          /* your existing */
  transform: translateY(0);
  opacity: 1;
}

/* 5) Make sure transitions are smooth on the animated wrapper */
#tahefobu-header,
.turbo-header-template.ta-header-scroll-animation {
  transition: transform .25s ease, opacity .25s ease;
  will-change: transform;
}

/* 6) Header Effects — Transparent → Solid on Scroll
   (editor-driven; see includes/class-tahefobu-header-effects.php)
   The section is pulled out of normal flow so page content can scroll beneath
   it. width/left/top ensure it still stretches the full header width when
   absolute. The outer header wrapper (#tahefobu-header / .turbo-header-template)
   already has position:relative, so this is positioned against it. */
.tahefobu-effects-transparent-yes {
  background-color: transparent !important;
  position: absolute;
  width: 100%;
  left: 0;
  top: 0;
}

/* Elementor editor: keep the section in normal flow. When it is absolute the
   section wrap becomes empty, the "Add Section" box's top margin collapses
   through it and pushes the whole edit area (and the header) down ~60px.
   There is no page content under a header template in the editor anyway. */
body.elementor-editor-active .elementor-element.tahefobu-effects-transparent-yes {
  position: relative !important;
  top: auto !important;
  left: auto !important;
}

/* Solid state keeps the transparent class (and its absolute positioning) so the
   page does not jump; the colour is applied inline with !important by JS. */
.tahefobu-effects-solid {
  transition: transform .25s ease, background-color .25s ease, box-shadow .25s ease;
}

.tahefobu-effects-solid-shadow {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}