/* ===============================
   APC Hero Slider (lint-friendly)
   =============================== */

.apc-hero-slider {
  position: relative;
  width: 100%;
  height: var(--apc-slider-h, 420px);
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate; /* Create new stacking context */

  /* fallback + custom props for theme control */
  /* accent (primary btn + progress) */
  --apc-accent: #DE3431;
  /* primary button text color */
  --apc-btn-text: #ffffff;
  /* mobile bottom panel background */
  --apc-panel-bg: #000000;
}

/* ===============================
   Progressive enhancement (SAFE)
   - Before Swiper initializes, show ONLY first slide so hero paints fast.
   - Swiper adds .swiper-initialized when ready; at that point normal Swiper CSS takes over.
   =============================== */
.apc-hero-slider:not(.swiper-initialized) .swiper-wrapper {
  display: block !important;
  height: 100%;
  width: 100%;
}

.apc-hero-slider:not(.swiper-initialized) .swiper-slide {
  display: none !important;
  height: 100%;
  width: 100% !important;
  max-width: 100% !important;
}

.apc-hero-slider:not(.swiper-initialized) .swiper-slide:first-child {
  display: block !important;
}

.apc-hero-slider:not(.swiper-initialized) .apc__nav,
.apc-hero-slider:not(.swiper-initialized) .swiper-pagination,
.apc-hero-slider:not(.swiper-initialized) .apc__progress {
  display: none !important;
}

/* Swiper container fixes */
.apc-hero-slider.swiper {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 0 !important;
}

.apc-hero-slider .swiper-wrapper {
  height: 100%;
  width: 100%;
}

.apc-hero-slider .swiper-slide {
  height: 100%;
  width: 100% !important;
  max-width: 100% !important;
  flex-shrink: 0 !important;
}

/* slide */
.apc__slide {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden; /* Ensure content doesn't bleed */
}

/* ===============================
   Background media layer
   - Backward compatible:
     1) Works if .apc__bg is a DIV with background-image
     2) Works if you switch .apc__bg to <picture> and place <img class="apc__bg-img">
   =============================== */
/* background image wrapper (supports real <img> for LCP) */
.apc__bg {
  position: absolute;
  top: 0; 
  right: 0; 
  bottom: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;

  /* keep these as a fallback if you ever use background-image again */
  background-size: cover;
  background-position: center;
}

/* the real image */
.apc__bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* overlay tint */
.apc__overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
}

/* Hide mobile-specific overlay content on desktop */
.apc__overlay .apc__title,
.apc__overlay .apc__subtitle {
  display: none;
}

/* content wrapper (desktop/tablet overlay) */
.apc__inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  align-content: center;
  padding: 36px 48px 36px 68px; /* Added 20px more padding on the left */
  max-width: 980px;
}

/* alignment modifiers */
.apc__inner--left   { justify-items: start;  text-align: left; }
.apc__inner--center { justify-items: center; text-align: center; margin-left: auto; margin-right: auto; }
.apc__inner--right  { justify-items: end;    text-align: right;  margin-left: auto; }

/* text elements (no qualified selectors) */
.apc__title    { font-size: clamp(28px, 4vw, 46px); line-height: 1.1; margin: 0 0 8px; color: #ffffff; font-weight: 600; }
.apc__subtitle { font-size: clamp(16px, 2vw, 22px); margin: 0 0 10px; color: rgba(255,255,255,0.9); }
.apc__desc     { font-size: clamp(14px, 1.6vw, 18px); line-height: 1.35; margin: 0 0 18px; max-width: 60ch; color: rgba(255,255,255,0.85); }

/* buttons */
.apc__buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Override Elementor button styles within slider */
.apc-hero-slider .elementor-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 20px !important;
  border-radius: 5px !important;
  text-decoration: none;
  font-weight: 700;
  border: 2px solid #ffffff !important;
  color: #ffffff !important;
  background: transparent !important;
  transition: 0.3s ease;
}

.apc-hero-slider .elementor-button:hover {
  background: rgba(255,255,255,0.1) !important;
  transform: translateY(-2px);
  color: #ffffff !important;
}

/* Ensure text stays white */
.apc-hero-slider .elementor-button-text {
  color: #ffffff !important;
}

/* arrows */
.apc__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  cursor: pointer;
  z-index: 3;
}

.apc__nav--prev { left: 14px; }
.apc__nav--next { right: 14px; }

/* simple background-image (no mask/backdrop) */
.apc__nav::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M14.7 5.3 9 11l5.7 5.7-1.4 1.4L6.3 11l7-7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 22px 22px;
}

.apc__nav--next::before {
  transform: scaleX(-1);
}

/* dots */
.swiper-pagination-bullet {
  background: rgba(255,255,255,0.6);
  opacity: 1;
}

.swiper-pagination-bullet-active {
  background: #ffffff;
}

/* ---------- Mobile bottom panel option ---------- */
/* Use modifiers on the slide: .apc__slide--overlay or .apc__slide--panel */
.apc__mobile-panel { display: none; }

/* Remove rounded corners on tablet and below */
@media (max-width: 1024px) {
  .apc-hero-slider {
    border-radius: 0;
  }
}

@media (max-width: 767px) {
  /* Hide arrows on mobile by default */
  .apc__nav {
    display: none;
  }

  /* Show arrows on mobile only if explicitly enabled */
  .apc-hero-slider[data-arrows-mobile="yes"] .apc__nav {
    display: block;
  }

  /* overlay mode keeps the in-slide content visible */
  .apc__slide--overlay .apc__inner { display: grid; }

  /* panel mode - split layout with overlay title/subtitle */
  .apc__slide--panel {
    position: relative;
    display: flex;
    flex-direction: column;
  }

  /* Hide the original desktop inner content */
  .apc__slide--panel > .apc__inner { display: none !important; }

  /* Image takes up 50% */
  .apc__slide--panel .apc__bg {
    position: relative;
    flex: 0 0 50%;
    height: 50%;
    width: 100%;

    /* keep background-image fallback intact */
    background-position: center center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
  }

  /* If using <img> for the bg, ensure it fills panel top */
  .apc__slide--panel .apc__bg-img,
  .apc__slide--panel .apc__bg > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Overlay for title and subtitle on image */
  .apc__slide--panel .apc__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
    background: linear-gradient(to right, rgba(0,0,0,0.8) 50%, transparent);
    z-index: 2;
  }

  /* Style for overlaid title and subtitle - show only on mobile */
  .apc__slide--panel .apc__overlay .apc__title {
    display: block !important;
    font-size: 24px;
    margin: 0 0 8px;
    color: #ffffff;
    max-width: 50%;
  }

  .apc__slide--panel .apc__overlay .apc__subtitle {
    display: block !important;
    font-size: 16px;
    margin: 0;
    color: rgba(255,255,255,0.9);
    max-width: 50%;
  }

  /* Black panel for description and buttons only */
  .apc__slide--panel .apc__mobile-panel {
    display: block;
    position: relative;
    flex: 0 0 50%;
    min-height: 50%;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000000;
    background: var(--apc-panel-bg);
    z-index: 3;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
  }

  /* Hide title/subtitle in panel since they're overlaid */
  .apc__slide--panel .apc__mobile-panel .apc__title,
  .apc__slide--panel .apc__mobile-panel .apc__subtitle {
    display: none !important;
  }

  .apc__slide--panel .apc__mobile-panel .apc__inner {
    display: block !important;
    padding: 0;
    max-width: 100%;
  }

  .apc__slide--panel .apc__desc  {
    font-size: 14px;
    line-height: 1.35;
    max-width: none;
    margin: 0 0 16px;
    color: rgba(255,255,255,0.85);
  }

  .apc__slide--panel .apc__buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }

  /* Ensure buttons fit properly */
  .apc__slide--panel .elementor-button {
    padding: 12px 20px !important;
  }
}

/* ---------- Autoplay progress bar ---------- */
.apc__progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: rgba(255,255,255,0.15);
  z-index: 4;
  overflow: hidden;
}

.apc__progress span {
  display: block;
  height: 100%;
  width: 0;

  /* fallback first, then custom property */
  background: #DE3431;
  background: var(--apc-accent);

  transition: none;
}

.apc__progress span.is-running {
  animation: apc-progress linear forwards;
  animation-duration: var(--apc-progress-duration, 6000ms);
}

@keyframes apc-progress {
  from { width: 0; }
  to   { width: 100%; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .apc__progress span.is-running { animation: none; width: 0; }
}

/* ---------- NEW: full-bleed template slides ---------- */
.apc__slide--template {
  position: relative;
  width: 100% !important;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-width: 100% !important;
}

.apc__slide--template .apc__template-fill {
  position: relative;
  width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apc__slide--template > .elementor,
.apc__slide--template > .elementor-section-wrap,
.apc__slide--template .elementor-section,
.apc__slide--template .elementor-container,
.apc__slide--template .elementor-row {
  position: relative;
  width: 100%;
  max-height: 100%;
}

.apc__slide--template .elementor,
.apc__slide--template .elementor-section,
.apc__slide--template .elementor-container,
.apc__slide--template .elementor-row {
  margin: 0;
  padding: 0;
}

/* Ensure template content scales appropriately */
.apc__slide--template .apc__template-fill > * {
  width: 100%;
  height: auto;
  object-fit: contain;
}
