/* ==========================================================================
   EndoGrup Modern Slider (eg-slider) — 2026
   Pure CSS + Vanilla JS • No jQuery • GPU-Accelerated • PageSpeed Optimized
   ========================================================================== */

/* ── Container ── */
.eg-slider {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #0d1b2a;
  contain: layout style;
  -webkit-user-select: none;
  user-select: none;
}

.eg-slider__track {
  position: relative;
  width: 100%;
  aspect-ratio: 1170 / 500;
  max-height: 520px;
}

/* ── Slides ── */
.eg-slider__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  transition: none;
  will-change: opacity;
}

.eg-slider--ready .eg-slider__slide {
  transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.eg-slider__slide--active,
.eg-slider__slide--leaving {
  visibility: visible;
}

.eg-slider__slide--active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.eg-slider__slide--leaving {
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

/* ── Background Image ── */
.eg-slider__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Gradient overlay for text readability */
.eg-slider__slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(13,27,42,0.75) 0%, rgba(13,27,42,0.45) 40%, rgba(13,27,42,0.1) 65%, transparent 100%);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.8s ease 0.4s;
}
.eg-slider__slide--active::after {
  opacity: 1;
}

/* ── Content Layout ── */
.eg-slider__content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(60px, 6vw, 120px);
  z-index: 2;
  gap: 3%;
  overflow: hidden;
}

/* ── Text Area (Left) ── */
.eg-slider__text {
  flex: 0 0 38%;
  max-width: 420px;
  min-width: 0;
  padding: 20px 0;
}

.eg-slider__title {
  font-family: 'Raleway', sans-serif;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  margin: 0 0 16px 0;
  line-height: 1.25;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  /* Animation — powered by @keyframes on --active */
  opacity: 0;
}

.eg-slider__desc {
  font-family: 'Open Sans', sans-serif;
  font-size: clamp(12px, 1.1vw, 15px);
  color: rgba(255,255,255,0.92);
  line-height: 1.7;
  margin: 0 0 22px 0;
  text-shadow: 0 1px 4px rgba(0,0,0,0.25);
  /* Animation — powered by @keyframes on --active */
  opacity: 0;
}

.eg-slider__cta {
  display: inline-block;
  padding: 11px 32px;
  background: #fb8608;
  color: #fff;
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 15px rgba(251,134,8,0.35);
  /* Animation — powered by @keyframes on --active */
  opacity: 0;
  transition: background-color 0.25s ease, transform 0.2s ease;
}

.eg-slider__cta:hover,
.eg-slider__cta:focus-visible {
  background: #e07505;
  box-shadow: 0 6px 20px rgba(251,134,8,0.5);
  color: #fff;
  text-decoration: none;
}

/* ── Products Area (Right) ── */
.eg-slider__products {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 16px 15px 10px;
  overflow: hidden;
  min-width: 0;
  max-height: 100%;
}

.eg-slider__product {
  max-height: clamp(145px, 16vw, 240px);
  max-width: 46%;
  width: auto;
  height: auto;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  border-radius: 6px;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.35));
  /* Animation — powered by @keyframes on --active */
  opacity: 0;
  will-change: transform, opacity;
}

.eg-slider__product--square {
  aspect-ratio: 1 / 1;
  width: min(34%, 200px);
  max-width: 36%;
  height: auto;
}

.eg-slider__product--wide {
  aspect-ratio: 400 / 179;
  width: min(46%, 320px);
  max-width: 46%;
  height: auto;
}

.eg-slider__product--medium {
  aspect-ratio: 218 / 200;
  width: min(37%, 235px);
  max-width: 40%;
  height: auto;
}

.eg-slider__product--compact-wide {
  aspect-ratio: 220 / 140;
  width: min(37%, 210px);
  max-width: 40%;
  height: auto;
}

.eg-slider__product--mini-wide {
  aspect-ratio: 150 / 94;
  width: min(32%, 170px);
  max-width: 34%;
  height: auto;
}

/* ── Entry Animations (@keyframes) ── */
/* Slide 1 — Text: Fade Up | Products: left, bottom, right */
.eg-slider__slide:nth-child(1).eg-slider__slide--active .eg-slider__title { animation: egFadeUp 0.7s ease 0.3s both; }
.eg-slider__slide:nth-child(1).eg-slider__slide--active .eg-slider__desc  { animation: egFadeUp 0.7s ease 0.55s both; }
.eg-slider__slide:nth-child(1).eg-slider__slide--active .eg-slider__cta   { animation: egFadeUp 0.7s ease 0.8s both; }
.eg-slider__slide:nth-child(1).eg-slider__slide--active .eg-slider__product:nth-child(1) { animation: egProdLeft  1.3s cubic-bezier(0.22,1,0.36,1) 0.6s both; }
.eg-slider__slide:nth-child(1).eg-slider__slide--active .eg-slider__product:nth-child(2) { animation: egProdUp    1.3s cubic-bezier(0.22,1,0.36,1) 0.9s both; }
.eg-slider__slide:nth-child(1).eg-slider__slide--active .eg-slider__product:nth-child(3) { animation: egProdRight 1.3s cubic-bezier(0.22,1,0.36,1) 1.2s both; }

/* Slide 2 — Text: Fade Left | Products: top, diagonal-BR, left */
.eg-slider__slide:nth-child(2).eg-slider__slide--active .eg-slider__title { animation: egFadeLeft 0.7s ease 0.3s both; }
.eg-slider__slide:nth-child(2).eg-slider__slide--active .eg-slider__desc  { animation: egFadeLeft 0.7s ease 0.55s both; }
.eg-slider__slide:nth-child(2).eg-slider__slide--active .eg-slider__cta   { animation: egFadeLeft 0.7s ease 0.8s both; }
.eg-slider__slide:nth-child(2).eg-slider__slide--active .eg-slider__product:nth-child(1) { animation: egProdDown  1.3s cubic-bezier(0.22,1,0.36,1) 0.6s both; }
.eg-slider__slide:nth-child(2).eg-slider__slide--active .eg-slider__product:nth-child(2) { animation: egProdDiag2 1.3s cubic-bezier(0.22,1,0.36,1) 0.9s both; }
.eg-slider__slide:nth-child(2).eg-slider__slide--active .eg-slider__product:nth-child(3) { animation: egProdLeft  1.3s cubic-bezier(0.22,1,0.36,1) 1.2s both; }

/* Slide 3 — Text: Scale | Products: diagonal-TL, right, bottom */
.eg-slider__slide:nth-child(3).eg-slider__slide--active .eg-slider__title { animation: egFadeScale 0.7s ease 0.3s both; }
.eg-slider__slide:nth-child(3).eg-slider__slide--active .eg-slider__desc  { animation: egFadeDown  0.7s ease 0.55s both; }
.eg-slider__slide:nth-child(3).eg-slider__slide--active .eg-slider__cta   { animation: egFadeScale 0.7s ease 0.8s both; }
.eg-slider__slide:nth-child(3).eg-slider__slide--active .eg-slider__product:nth-child(1) { animation: egProdDiag1 1.3s cubic-bezier(0.22,1,0.36,1) 0.6s both; }
.eg-slider__slide:nth-child(3).eg-slider__slide--active .eg-slider__product:nth-child(2) { animation: egProdRight 1.3s cubic-bezier(0.22,1,0.36,1) 0.9s both; }
.eg-slider__slide:nth-child(3).eg-slider__slide--active .eg-slider__product:nth-child(3) { animation: egProdUp    1.3s cubic-bezier(0.22,1,0.36,1) 1.2s both; }

/* Slide 4 — Text: Fade Up | Products: right, up, diagonal-TL */
.eg-slider__slide:nth-child(4).eg-slider__slide--active .eg-slider__title { animation: egFadeUp 0.7s ease 0.3s both; }
.eg-slider__slide:nth-child(4).eg-slider__slide--active .eg-slider__desc  { animation: egFadeUp 0.7s ease 0.55s both; }
.eg-slider__slide:nth-child(4).eg-slider__slide--active .eg-slider__cta   { animation: egFadeUp 0.7s ease 0.8s both; }
.eg-slider__slide:nth-child(4).eg-slider__slide--active .eg-slider__product:nth-child(1) { animation: egProdRight 1.3s cubic-bezier(0.22,1,0.36,1) 0.6s both; }
.eg-slider__slide:nth-child(4).eg-slider__slide--active .eg-slider__product:nth-child(2) { animation: egProdUp    1.3s cubic-bezier(0.22,1,0.36,1) 0.9s both; }

/* ── Keyframes — Text ── */
@keyframes egFadeUp    { from { opacity:0; transform:translateY(25px);  } to { opacity:1; transform:translateY(0); } }
@keyframes egFadeLeft  { from { opacity:0; transform:translateX(-35px); } to { opacity:1; transform:translateX(0); } }
@keyframes egFadeDown  { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
@keyframes egFadeScale { from { opacity:0; transform:scale(0.92);      } to { opacity:1; transform:scale(1); } }

/* ── Keyframes — Products ── */
@keyframes egProdLeft  { from { opacity:0; transform:translateX(-130px) scale(0.80);      } to { opacity:1; transform:translate(0) scale(1); } }
@keyframes egProdRight { from { opacity:0; transform:translateX(130px) scale(0.80);       } to { opacity:1; transform:translate(0) scale(1); } }
@keyframes egProdUp    { from { opacity:0; transform:translateY(130px) scale(0.80);       } to { opacity:1; transform:translate(0) scale(1); } }
@keyframes egProdDown  { from { opacity:0; transform:translateY(-130px) scale(0.80);      } to { opacity:1; transform:translate(0) scale(1); } }
@keyframes egProdDiag1 { from { opacity:0; transform:translate(-140px,-70px) scale(0.80); } to { opacity:1; transform:translate(0) scale(1); } }
@keyframes egProdDiag2 { from { opacity:0; transform:translate(140px,70px) scale(0.80);   } to { opacity:1; transform:translate(0) scale(1); } }

/* ── Navigation Arrows ── */
.eg-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0;
  transition: background-color 0.25s ease, transform 0.2s ease;
  outline: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.eg-slider__arrow:hover {
  background-color: rgba(251,134,8,0.9);
}

.eg-slider__arrow:focus-visible {
  outline: 2px solid #fb8608;
  outline-offset: 3px;
}

.eg-slider__arrow:active {
  transform: translateY(-50%) scale(0.92);
}

.eg-slider__arrow--prev { left: max(12px, calc(50% - 710px)); }
.eg-slider__arrow--next { right: max(12px, calc(50% - 710px)); }

.eg-slider__arrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Progress Bar ── */
.eg-slider__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, #fb8608, #ff9f40, #fb8608);
  z-index: 15;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px rgba(251,134,8,0.6);
  will-change: transform;
}

.eg-slider__progress--run {
  animation: egProgress 5.5s linear forwards;
}
@media (max-width: 767px) {
  .eg-slider__progress--run { animation-duration: 5s; }
}

@keyframes egProgress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ── Dot Navigation ── */
.eg-slider__dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 12px;
}

.eg-slider__dot {
  width: 12px;
  height: 12px;
  min-width: 24px;
  min-height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  background-clip: content-box;
  border: none;
  cursor: pointer;
  padding: 6px;
  transition: transform 0.3s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.eg-slider__dot--active {
  background: #fb8608;
  background-clip: content-box;
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(251,134,8,0.5);
}

.eg-slider__dot:hover {
  background: rgba(255,255,255,0.75);
  background-clip: content-box;
}

.eg-slider__dot:focus-visible {
  outline: 2px solid #fb8608;
  outline-offset: 2px;
}

/* ── Fallback: animations blocked by extensions / OS settings ── */
.eg-slider--no-anim .eg-slider__slide--active .eg-slider__title,
.eg-slider--no-anim .eg-slider__slide--active .eg-slider__desc,
.eg-slider--no-anim .eg-slider__slide--active .eg-slider__cta,
.eg-slider--no-anim .eg-slider__slide--active .eg-slider__product {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
.eg-slider--no-anim .eg-slider__progress {
  animation: none !important;
  transform: scaleX(1);
  opacity: 0.45;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

/* Small desktop / laptop */
@media (max-width: 1200px) {
  .eg-slider__content {
    padding: 0 clamp(36px, 4.5vw, 56px);
    gap: 2.2%;
  }
  .eg-slider__text {
    flex: 0 0 40%;
    max-width: 380px;
  }
  .eg-slider__products {
    padding: 12px 16px 12px 8px;
  }
}

/* Tablet landscape */
@media (max-width: 1100px) {
  .eg-slider__content { padding: 0 46px; }
  .eg-slider__text { flex: 0 0 41%; max-width: 360px; }
  .eg-slider__products { padding: 10px 14px 10px 6px; }
  .eg-slider__product { max-height: clamp(110px, 14vw, 160px); max-width: 46%; }
}

/* Tablet portrait */
@media (max-width: 992px) {
  .eg-slider__text {
    flex: 0 0 43%;
    max-width: 340px;
  }
  .eg-slider__content { padding: 0 38px; }
  .eg-slider__products { padding: 8px 12px 8px 4px; }
  .eg-slider__product { max-height: clamp(100px, 14vw, 140px); max-width: 47%; }
  .eg-slider__arrow { width: 42px; height: 42px; }
  .eg-slider__arrow--prev { left: 10px; }
  .eg-slider__arrow--next { right: 10px; }
}

/* Mid-range desktop/tablet: keep arrow controls clear of readable text.
   Starts just above 767px to avoid fractional dead-zone near 767-768 (e.g. 767.33px).
   At exactly <=767px, mobile rules remain authoritative. */
@media (min-width: 767.01px) and (max-width: 1200px) {
  .eg-slider__text {
    padding-left: clamp(20px, 2.2vw, 30px);
  }
  .eg-slider__products {
    padding-right: clamp(14px, 2vw, 24px);
  }
  .eg-slider__arrow {
    width: 42px;
    height: 42px;
  }
  .eg-slider__arrow--prev { left: 8px; }
  .eg-slider__arrow--next { right: 8px; }
}

/* Mobile */
@media (max-width: 767px) {
  .eg-slider__track {
    aspect-ratio: auto;
    min-height: 480px;
  }

  .eg-slider__slide::after {
    background: linear-gradient(180deg, rgba(13,27,42,0.75) 0%, rgba(13,27,42,0.45) 50%, rgba(13,27,42,0.2) 100%);
  }

  .eg-slider__content {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 20px 55px;
    gap: 12px;
  }

  .eg-slider__text {
    flex: none;
    max-width: 100%;
    width: 100%;
    text-align: center;
    padding: 0;
  }

  .eg-slider__title {
    font-size: 22px;
    margin-bottom: 10px;
  }

  .eg-slider__desc {
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.6;
  }

  .eg-slider__cta {
    padding: 10px 28px;
    font-size: 13px;
  }

  .eg-slider__products {
    padding: 10px 5px;
    gap: 12px;
    justify-content: center;
    flex: 1 1 auto;
  }

  .eg-slider__product {
    max-height: 155px;
    max-width: 47%;
  }

  /* Hide 3rd product on mobile — two larger products look cleaner */
  .eg-slider__product:nth-child(3) {
    display: none;
  }

  .eg-slider__arrow {
    width: 36px;
    height: 36px;
    top: 50%;
    transform: translateY(-50%);
  }
  .eg-slider__arrow--prev { left: 8px; }
  .eg-slider__arrow--next { right: 8px; }
  .eg-slider__arrow:active { transform: translateY(-50%) scale(0.92); }

  .eg-slider__dots { bottom: 12px; }
}

/* Small mobile */
@media (max-width: 480px) {
  .eg-slider__track {
    min-height: 420px;
  }

  .eg-slider__title {
    font-size: 19px;
  }

  .eg-slider__desc {
    font-size: 12px;
    margin-bottom: 14px;
  }

  .eg-slider__product {
    max-height: 110px;
    max-width: 44%;
  }

  .eg-slider__arrow { width: 32px; height: 32px; }
  .eg-slider__arrow svg { width: 15px; height: 15px; }
}

/* ── Print ── */
@media print {
  .eg-slider__arrow,
  .eg-slider__dots,
  .eg-slider__progress { display: none; }
  .eg-slider__slide { position: static; opacity: 1; visibility: visible; }
  .eg-slider__slide:not(:first-child) { display: none; }
}
