/* ============================================================
   HERO SLIDER – Custom Swiper.js
   ============================================================ */

:root {
  --slider-height: 60vh;
  --fg-offset:           80px;    /* Fallback. Nadpisywane przez JS (auto-detekcja headera) */
  --hero-bg:             #F5F0EB;
  --hero-text:           #1F1F1F;
    --hero-accent:       #4B392E;
  --hero-text-rgb:       26, 26, 26;
  --hero-btn-hover-text: #ffffff;
  --hero-font-display:   'Cormorant Garamond', sans-serif;
  --hero-font-body:      'Montserrat', sans-serif;
  --hero-ease:           cubic-bezier(0.16, 1, 0.3, 1);
  --hero-duration:       0.85s;
  --hero-container:      1300px;
  /* Padding responsywny: 20px na mobile → 48px na desktop */
  --hero-padding:        clamp(20px, 2vw, 24px);
}

/* ─── SEKCJA ─────────────────────────────────────────────────
   BEZ overflow:hidden – foreground musi wychodzić górą.
   ─────────────────────────────────────────────────────────── */
.hero-slider-section {
  position: relative;
  width: 100%;
  height: var(--slider-height);
  min-height: 440px;
  background-color: var(--hero-bg);
}

/* ─── SWIPER ─────────────────────────────────────────────────
   Swiper ustawia overflow:hidden przez JS – OK,
   foreground i controls są poza tym elementem.
   ─────────────────────────────────────────────────────────── */
.hero-swiper,
.hero-swiper .swiper-wrapper {
  width: 100%;
  height: 100%;
}

/* Swiper przy effect:fade ustawia slajdy position:absolute.
   !important chroni przed nadpisaniem przez swiper-bundle.css */
.hero-swiper .swiper-slide {
  height: 100% !important;
}

/* ─── SLAJD ──────────────────────────────────────────────── */
.hero-slide {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--slide-bg, #F5F0EB);
}

/* ─── TŁO SLAJDU ─────────────────────────────────────────── */
.hero-slide__bg {
  /* Explicit width+height zamiast inset:0 – pewniejsze gdy
     Swiper JS zmienia pozycjonowanie slajdów w trybie fade */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.hero-slide__bg img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  object-position: center top;
}

.hero-slide__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(245,240,235,.75) 0%,
    rgba(245,240,235,.35) 50%,
    transparent 75%
  );
  pointer-events: none;
}

/* ─── INNER LAYOUT ───────────────────────────────────────────
   max-width + margin auto = centrowanie kontenera.
   padding-inline używa --hero-padding (clamp).
   Bez padding-top/bottom – treść centrowana przez align-items.
   ─────────────────────────────────────────────────────────── */
.hero-slide__inner {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  z-index: 10;
  max-width: var(--hero-container);
  width: 100%;
  margin: 0 auto;
  padding-inline: var(--hero-padding);
}

/* ─── TREŚĆ TEKSTOWA ─────────────────────────────────────── */
.hero-slide__content {
  flex: 0 0 auto;
  width: 50%;
  position: relative;
  z-index: 20;
}

.hero_nadnaglowek {
  display: block;
  font-family: var(--hero-font-body);
  font-size: 1em;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--hero-text);
  margin-bottom: 14px;
}

.hero-slide__heading {
  font-family: var(--hero-font-display);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--hero-text);
  text-transform: uppercase;
  margin: 0 0 18px;
}

.hero_podnaglowek {
  display: block;
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
}

.hero-slide__caption {
  display: block;
  font-family: var(--hero-font-body);
  font-size: 1em;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--hero-text);
  margin-bottom: 14px;
}

.hero-slide__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border: 1.5px solid var(--hero-text);
  color: var(--hero-text);
  background: transparent;
  text-decoration: none;
  font-family: var(--hero-font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  /* transition: background-color .3s ease, color .3s ease; */
  transition: 0.2s !important;
}

.hero-slide__btn::after {
  content: '→';
  font-size: 13px;
  transition: transform .3s ease;
}

.hero-slide__btn:hover { background-color: var(--hero-accent); color: var(--hero-btn-hover-text); transition: 0.2s !important; }
.hero-slide__btn:hover::after { transform: translateX(4px); }
.hero-slide__btn:focus-visible { outline: 2px solid var(--hero-text); outline-offset: 4px; }


/* ═══════════════════════════════════════════════════════════
   FOREGROUND – POZA SWIPEREM
   ═══════════════════════════════════════════════════════════

   Kluczowe zachowanie:
   ┌──────────────────────────────────────────────┐
   │  Ekran > 1300px (np. 1600px)                │
   │  (1600-1300)/2 = 160px od prawej krawędzi   │
   │  → prawy brzeg obrazka = prawy brzeg kontenera │
   └──────────────────────────────────────────────┘
   ┌──────────────────────────────────────────────┐
   │  Ekran < 1300px                              │
   │  max(0px, wartość_ujemna) = 0px              │
   │  → prawy brzeg obrazka = krawędź sekcji     │
   └──────────────────────────────────────────────┘

   top: calc(-1 * --fg-offset) → wychodzi PONAD sekcję
   --fg-offset ustawiane przez JS (ResizeObserver na headerze)
   ═══════════════════════════════════════════════════════════ */
.hero-foreground {
  position: absolute;
  right: max(0px, calc((100% - var(--hero-container)) / 2));
  top: calc(-1 * var(--fg-offset, 80px));
  bottom: 0;
  width: 100%;
  z-index: 101;
  pointer-events: none;
  max-width: 678px;
  opacity: 0;
  transform: translateX(20px);
  transition:
    opacity   var(--hero-duration) var(--hero-ease),
    transform var(--hero-duration) var(--hero-ease);
}

.hero-foreground.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.hero-foreground.is-switching {
  opacity: 0;
  transform: translateX(10px);
  transition: opacity .22s ease, transform .22s ease;
}

/* Obraz: height 100% wrappera (sekcja + fg-offset), width auto
   object-position: right bottom żeby obraz stał przy dole */
.hero-foreground__img {
  position: absolute;
  right: 0;
  bottom: 0;
  height: 100%;
  width: auto;
  max-width: none;   /* NIE ograniczamy width – liczy się height */
  object-fit: contain;
  object-position: right bottom;
  display: block;
}


/* ═══════════════════════════════════════════════════════════
   HERO CONTROLS – strzałki + paginacja, POZA SWIPEREM
   Używamy CSS chevrons zamiast SVG – odporne na reset motywu
   ═══════════════════════════════════════════════════════════ */
.hero-controls {
  position: absolute;
  bottom: clamp(24px, 4vh, 48px);
  left: max(var(--hero-padding), calc((100% - var(--hero-container)) / 2 + var(--hero-padding)));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  z-index: 30;
}

.arrow-holder {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

/* ─── Strzałki (CSS chevrons – bez SVG) ─────────────────── */
.hero-swiper__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid rgba(var(--hero-text-rgb), 1);
  background: transparent !important;
  color: var(--hero-text) !important;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  /* transition: border-color .25s ease, background-color .25s ease, color .25s ease; */
  transition: 0.2s !important;
}

/* CSS chevron – lewy */
.hero-swiper__btn--prev::before,
.hero-swiper__btn--next::before {
  content: '';
  display: block;
  width: 9px;
  height: 9px;
  border-style: solid;
  border-color: currentColor;
  border-width: 0;
  flex-shrink: 0;
}

.hero-swiper__btn--prev::before {
  border-left-width: 1.5px;
  border-bottom-width: 1.5px;
  transform: rotate(45deg) translate(2px, -2px);
}

.hero-swiper__btn--next::before {
  border-right-width: 1.5px;
  border-bottom-width: 1.5px;
  transform: rotate(-45deg) translate(-2px, -2px);
}

.hero-swiper__btn:hover {
  border-color: var(--hero-accent) !important;
  color: white !important;
  background-color: var(--hero-accent) !important;
  transition: 0.2s !important;
}

.hero-swiper__btn:focus-visible { outline: 2px solid var(--hero-text); outline-offset: 3px; }
.hero-swiper__btn.swiper-button-disabled { opacity: .2; pointer-events: none; }

/* ─── Paginacja (kreski) ─────────────────────────────────── */
.hero-swiper__pagination.swiper-pagination {
  position: static !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  transform: none !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-swiper__pagination .swiper-pagination-bullet {
  width: 24px;
  height: 1.5px;
  border-radius: 0;
  background: var(--hero-text);
  opacity: 0.25;
  margin: 0 !important;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .3s ease, width .3s ease;
}

.hero-swiper__pagination .swiper-pagination-bullet-active {
  opacity: 1;
  width: 40px;
}


/* ─── ANIMACJE TEKSTÓW ───────────────────────────────────── */

/*
 * Exit szybki (.15s) – stary tekst znika zanim pojawi się nowy.
 * Eliminuje nakładanie się tekstów ("font flash") przy przejściach.
 * will-change pomaga przeglądarce pre-renderować warstwy.
 */
.hero-slide .hero_nadnaglowek,
.hero-slide .hero-slide__heading,
.hero-slide .hero-slide__caption,
.hero-slide .hero-slide__btn {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .15s ease, transform .15s ease;
  will-change: opacity, transform;
}

/*
 * Wejście wolne + kaskadowe – transition tu nadpisuje .hero-slide.
 * Przy utracie swiper-slide-active przeglądarka wraca do .hero-slide
 * → automatyczny szybki exit bez żadnego JS.
 */
.swiper-slide-active .hero_nadnaglowek {
  opacity: 1; transform: translateY(0);
  transition: opacity .6s ease .05s, transform .6s ease .05s;
}
.swiper-slide-active .hero-slide__heading {
  opacity: 1; transform: translateY(0);
  transition: opacity .6s ease .15s, transform .6s ease .15s;
}
.swiper-slide-active .hero-slide__caption {
  opacity: 1; transform: translateY(0);
  transition: opacity .6s ease .27s, transform .6s ease .27s;
}
.swiper-slide-active .hero-slide__btn {
  opacity: 1; transform: translateY(0);
  transition: opacity .6s ease .38s, transform .6s ease .38s;
}

.hero-slide__heading {
 font-size: clamp(32px, 10vw, 72px) !important;

}
/* ─── RESPONSIVE ─────────────────────────────────────────── */

@media (max-width: 1600px) {
  .hero-slider-section {
    height: 92vh;
  }
  .hero-foreground {
    width: 38% !important;
    max-width: 670px !important;
  }
}

/* Tylko foreground – reszta = globalny default */
@media (max-width: 1366px) {
  .hero-foreground {
    width: 52% !important;
  }
}

@media (max-width: 1200px) {

   .hero-slider-section {
    height: 62vh;
  }

  .hero-foreground {
    width: 82%;
  }
  .hero-slide__heading {
    font-size: clamp(32px, 10vw, 48px) !important;
  }
}

@media (max-width: 900px) {
  .hero-slide__content { width: 45%; }
  .hero-foreground     { width: 82%; }
}

@media (max-width: 768px) {
  .hero-slider-section  { min-height: 520px; }

  .hero-slide__heading  { font-size: clamp(32px, 10vw, 48px) !important; }
  .hero_podnaglowek     { font-size: clamp(22px, 7vw, 36px) !important; }

  .hero-slide__inner {
    align-items: flex-start;
    padding-top: calc(var(--fg-offset, 80px) + 32px);
    padding-bottom: 80px;
  }

  /* width: 50% = globalny default, nie trzeba powtarzać */

  .hero-slide__btn {
    padding: 12px 22px;
    font-size: 12px;
  }

  .hero-foreground {
    top: 0;
    right: 0;
    width: 82%;
    z-index: 5;
  }

  .hero-slide__bg::after {
    background: linear-gradient(
      90deg,
      rgba(245,240,235,.92) 0%,
      rgba(245,240,235,.7)  40%,
      rgba(245,240,235,.15) 100%
    );
  }

  .hero-controls {
    bottom: 24px;
    left: var(--hero-padding);
  }

  .hero-swiper__btn {
    width: 34px;
    height: 34px;
  }
  .hero-swiper__btn--prev::before,
  .hero-swiper__btn--next::before {
    width: 7px;
    height: 7px;
  }
}

@media (max-width: 480px) {
  .hero-slider-section  { min-height: 450px; }

  /* Małe fonty – content + obrazek side by side */
  .hero-slide__heading  { font-size: 28px !important; }
  .hero_podnaglowek     { font-size: clamp(13px, 4vw, 18px) !important; }

  /* Nadnagłówek i caption – wspólne reguły w jednym selektorze */
  .hero_nadnaglowek,
  .hero-slide__caption {
    font-size: 10px !important;
    line-height: 1.4;
  }

  .hero-slide__content  { width: 52%; }
  .hero-foreground      { width: 52% !important; }

  .hero-slide__btn {
    padding: 10px 16px;
    font-size: 9px;    /* było 9px – zbyt małe dla accessibility */
    line-height: 1.4;
  }
}


/* ─── REDUCED MOTION ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-slide .hero_nadnaglowek,
  .hero-slide .hero-slide__heading,
  .hero-slide .hero-slide__caption,
  .hero-slide .hero-slide__btn,
  .hero-foreground {
    transition: opacity .2s ease !important;
    transform: none !important;
  }
}
