/* V24 — mocniejsze animacje WOW, ale treść zawsze pozostaje dostępna */

/* Bez JS wszystko jest normalnie widoczne. Klasy animacyjne dodaje JavaScript. */
[data-entrance], .reveal, .wow-word, .wow-line, .wow-media, .wow-card {
  visibility: visible;
}

/* HERO — tekst wjeżdża z lewej, obraz odsłania się z prawej */
.wow-hero-item {
  animation: wowSlideLeft 1.25s cubic-bezier(.16,1,.3,1) both;
  animation-delay: var(--wow-delay, 0ms);
}

.wow-hero-media {
  position: relative;
  overflow: hidden;
  animation: wowMediaIn 1.45s cubic-bezier(.16,1,.3,1) both;
  animation-delay: 180ms;
}

.wow-hero-media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(115deg, #efe4d8 0%, #d8c1ae 55%, #b89c85 100%);
  transform-origin: right center;
  animation: wowCurtain 1.15s .28s cubic-bezier(.77,0,.18,1) both;
}

.wow-hero-media img {
  animation: wowImageZoom 1.65s .22s cubic-bezier(.16,1,.3,1) both;
}

/* Nagłówki — kolejne słowa wjeżdżają, ale po animacji pozostają widoczne */
.wow-heading .wow-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(1.05em) rotate(2deg);
  animation: wowWordUp 1.05s cubic-bezier(.16,1,.3,1) forwards;
  animation-delay: calc(var(--word-index, 0) * 85ms + 110ms);
  will-change: transform, opacity;
}

.wow-heading em .wow-word,
.wow-heading .wow-word.is-accent {
  transform: translateY(1.05em) skewX(-4deg);
}

/* Sekcje przy scrollu */
.wow-scroll {
  opacity: 0;
  transform: translateY(46px) scale(.985);
  transition:
    opacity 1.15s cubic-bezier(.16,1,.3,1),
    transform 1.15s cubic-bezier(.16,1,.3,1);
  transition-delay: var(--wow-delay, 0ms);
}

.wow-scroll.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.wow-scroll-left {
  opacity: 0;
  transform: translateX(-55px);
  transition: opacity 1.25s cubic-bezier(.16,1,.3,1), transform 1.25s cubic-bezier(.16,1,.3,1);
}

.wow-scroll-right {
  opacity: 0;
  transform: translateX(55px);
  transition: opacity 1.25s cubic-bezier(.16,1,.3,1), transform 1.25s cubic-bezier(.16,1,.3,1);
}

.wow-scroll-left.is-visible,
.wow-scroll-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Karty pojawiają się falą */
.wow-card {
  opacity: 0;
  transform: translateY(34px) rotateX(5deg);
  transform-origin: center bottom;
  transition:
    opacity 1s cubic-bezier(.16,1,.3,1),
    transform 1s cubic-bezier(.16,1,.3,1),
    box-shadow .35s ease,
    border-color .35s ease;
  transition-delay: var(--wow-delay, 0ms);
}

.wow-card.is-visible {
  opacity: 1;
  transform: translateY(0) rotateX(0);
}

.wow-card.is-visible:hover {
  transform: translateY(-8px) scale(1.012);
  box-shadow: 0 24px 65px rgba(77,54,45,.14);
}

/* Zdjęcia — maska, zoom i światło pod kursorem */
.wow-image {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.wow-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: #e9ddcf;
  transform: scaleX(1);
  transform-origin: right;
  transition: transform 1s cubic-bezier(.77,0,.18,1);
}

.wow-image.is-visible::before {
  transform: scaleX(0);
}

.wow-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(360px circle at var(--mouse-x,50%) var(--mouse-y,50%), rgba(255,255,255,.34), transparent 55%);
  transition: opacity .35s ease;
}

.wow-image:hover::after { opacity: 1; }

.wow-image img {
  opacity: 1 !important;
  visibility: visible !important;
  transform: scale(1.08);
  transition: transform 1.45s cubic-bezier(.16,1,.3,1), filter .45s ease;
}

.wow-image.is-visible img { transform: scale(1); }
.wow-image:hover img { transform: scale(1.045); filter: saturate(1.06) contrast(1.025); }

/* Tło reagujące na myszkę — subtelny premium glow */
.wow-glow {
  position: relative;
  isolation: isolate;
}

.wow-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(650px circle at var(--page-x,50%) var(--page-y,50%), rgba(168,129,96,.12), transparent 56%);
  transition: opacity .25s ease;
}

/* Przycisk z przesuwającą się poświatą */
.button--primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.button--primary::after {
  content: "";
  position: absolute;
  top: -120%;
  left: -35%;
  width: 28%;
  height: 340%;
  z-index: -1;
  background: rgba(255,255,255,.25);
  transform: rotate(22deg) translateX(-250%);
  transition: transform .65s cubic-bezier(.16,1,.3,1);
}

.button--primary:hover::after { transform: rotate(22deg) translateX(650%); }

/* Linie pod nagłówkami */
.wow-rule {
  position: relative;
}

.wow-rule::after {
  content: "";
  display: block;
  width: 0;
  height: 1px;
  margin-top: 22px;
  background: currentColor;
  opacity: .22;
  transition: width 1s cubic-bezier(.16,1,.3,1);
}

.wow-rule.is-visible::after { width: min(180px, 42%); }

/* Dialogi */
.booking-dialog[open], .privacy-dialog[open], .search-dialog[open], .gallery-dialog[open] {
  animation: wowDialog .38s cubic-bezier(.16,1,.3,1);
}

@keyframes wowSlideLeft {
  from { opacity: 0; transform: translateX(-48px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes wowMediaIn {
  from { opacity: 0; transform: translateX(70px) scale(.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

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

@keyframes wowImageZoom {
  from { transform: scale(1.13); filter: saturate(.78); }
  to { transform: scale(1); filter: saturate(1); }
}

@keyframes wowWordUp {
  from { opacity: 0; transform: translateY(1.05em) rotate(2deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes wowDialog {
  from { opacity: 0; transform: translateY(24px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Awaryjnie po załadowaniu zawsze pokazujemy treść */
body.wow-fallback .wow-scroll,
body.wow-fallback .wow-scroll-left,
body.wow-fallback .wow-scroll-right,
body.wow-fallback .wow-card,
body.wow-fallback .wow-heading .wow-word {
  opacity: 1 !important;
  transform: none !important;
}

body.wow-fallback .wow-image::before { transform: scaleX(0) !important; }

@media (max-width: 768px) {
  .wow-card.is-visible:hover,
  .wow-image:hover img { transform: none; }

  .wow-glow::after,
  .wow-image::after { display: none; }

  .wow-scroll-left,
  .wow-scroll-right { transform: translateY(32px); }
  .wow-scroll-left.is-visible,
  .wow-scroll-right.is-visible { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .wow-scroll,
  .wow-scroll-left,
  .wow-scroll-right,
  .wow-card,
  .wow-heading .wow-word {
    opacity: 1 !important;
    transform: none !important;
  }

  .wow-image::before { transform: scaleX(0) !important; }
}


/* V25 — mobilka i stabilność animacji */
@media (max-width: 900px) {
  .wow-heading .wow-word {
    animation-duration: .82s;
    animation-delay: calc(var(--word-index, 0) * 48ms + 50ms);
  }

  .wow-scroll,
  .wow-scroll-left,
  .wow-scroll-right,
  .wow-card {
    transition-duration: .82s;
  }

  .wow-hero-media::before {
    animation-duration: 1.05s;
  }
}

/* Treść nie może zostać niewidoczna przy błędzie JS */
html:not(.js-ready) .wow-scroll,
html:not(.js-ready) .wow-scroll-left,
html:not(.js-ready) .wow-scroll-right,
html:not(.js-ready) .wow-card,
html:not(.js-ready) .wow-heading .wow-word {
  opacity: 1 !important;
  transform: none !important;
}


/* ===== V35: przywrócone animacje tekstu i kart ===== */

/* Treść jest widoczna domyślnie — animacja tylko ją podkreśla */
.v35-text-enter,
.v35-card-enter,
.v35-image-enter {
  opacity: 1;
  visibility: visible;
}

/* Nagłówki i tekst */
html.animations-ready .v35-text-enter {
  animation: v35TextEnter 1s cubic-bezier(.22,.61,.36,1) both;
}

@keyframes v35TextEnter {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* Karty */
html.animations-ready .v35-card-enter {
  animation: v35CardEnter .95s cubic-bezier(.22,.61,.36,1) both;
  animation-delay: var(--v35-delay, 0ms);
}

@keyframes v35CardEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Zdjęcia */
html.animations-ready .v35-image-enter {
  animation: v35ImageEnter 1.15s cubic-bezier(.22,.61,.36,1) both;
}

@keyframes v35ImageEnter {
  from {
    opacity: 0;
    transform: scale(1.035);
    filter: saturate(.92) blur(2px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: saturate(1) blur(0);
  }
}

/* Animowany underline nagłówków sekcji */
.v35-heading-line {
  position: relative;
}

.v35-heading-line::after {
  content: "";
  display: block;
  width: min(120px, 28vw);
  height: 1px;
  margin-top: 16px;
  background: currentColor;
  opacity: .28;
  transform-origin: left center;
}

html.animations-ready .v35-heading-line::after {
  animation: v35Line 1s .25s cubic-bezier(.22,.61,.36,1) both;
}

@keyframes v35Line {
  from { transform: scaleX(0); opacity: 0; }
  to { transform: scaleX(1); opacity: .28; }
}

/* Tablet: animacje zostają, ale bez przesuwania karuzeli */
@media (max-width: 1199px) {
  html.animations-ready .team-card.v35-card-enter,
  html.animations-ready .condition-card.v35-card-enter {
    animation-name: v35CarouselCardEnter;
  }

  @keyframes v35CarouselCardEnter {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Telefon: spokojniej i szybciej */
@media (max-width: 560px) {
  html.animations-ready .v35-text-enter {
    animation-duration: .82s;
  }

  html.animations-ready .v35-card-enter {
    animation-duration: .78s;
  }

  html.animations-ready .v35-image-enter {
    animation-duration: .9s;
  }
}

/* Dostępność */
@media (prefers-reduced-motion: reduce) {
  .v35-text-enter,
  .v35-card-enter,
  .v35-image-enter,
  .v35-heading-line::after {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}


/* ===== V36: natychmiastowa animacja Hero po loaderze ===== */
.hero-v36-ready .hero__content > *,
.hero-v36-ready .hero-photo,
.hero-v36-ready .hero__visual {
  animation-play-state: running !important;
}

html:not(.loader-finished) .hero__content > *,
html:not(.loader-finished) .hero-photo,
html:not(.loader-finished) .hero__visual {
  opacity: 0;
}

html.loader-finished .hero__content > * {
  animation: v36HeroText .95s cubic-bezier(.22,.61,.36,1) both;
}

html.loader-finished .hero__content > *:nth-child(1) { animation-delay: .05s; }
html.loader-finished .hero__content > *:nth-child(2) { animation-delay: .14s; }
html.loader-finished .hero__content > *:nth-child(3) { animation-delay: .23s; }
html.loader-finished .hero__content > *:nth-child(4) { animation-delay: .32s; }
html.loader-finished .hero__content > *:nth-child(5) { animation-delay: .41s; }

html.loader-finished .hero-photo,
html.loader-finished .hero__visual {
  animation: v36HeroImage 1.15s cubic-bezier(.22,.61,.36,1) .18s both;
}

@keyframes v36HeroText {
  from {
    opacity: 0;
    transform: translateY(34px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes v36HeroImage {
  from {
    opacity: 0;
    transform: scale(1.04) translateY(24px);
    filter: blur(5px) saturate(.92);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0) saturate(1);
  }
}

/* Bezpiecznik: jeśli JS nie ruszy, treść pojawi się sama */
@media (prefers-reduced-motion: no-preference) {
  html.no-js-loader-fallback .hero__content > *,
  html.no-js-loader-fallback .hero-photo,
  html.no-js-loader-fallback .hero__visual {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
    filter: none !important;
  }
}

@media (max-width: 560px) {
  html.loader-finished .hero__content > * {
    animation-duration: .78s;
  }

  html.loader-finished .hero-photo,
  html.loader-finished .hero__visual {
    animation-duration: .95s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-loader__inner strong,
  .site-loader__inner span,
  .site-loader__inner i,
  html.loader-finished .hero__content > *,
  html.loader-finished .hero-photo,
  html.loader-finished .hero__visual {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
    filter: none !important;
  }
}

/* ===== V63 / richer motion ===== */
html.v63-motion .v63-reveal {
  opacity: 0;
  transition:
    opacity .78s cubic-bezier(.22,.61,.36,1),
    transform .9s cubic-bezier(.22,.61,.36,1),
    filter .9s cubic-bezier(.22,.61,.36,1);
  transition-delay: var(--v63-delay, 0ms);
  will-change: opacity, transform;
}
html.v63-motion .v63-reveal--up { transform: translate3d(0, 34px, 0); }
html.v63-motion .v63-reveal--left { transform: translate3d(-46px, 0, 0); }
html.v63-motion .v63-reveal--right { transform: translate3d(46px, 0, 0); }
html.v63-motion .v63-reveal--card {
  transform: translate3d(0, 42px, 0) scale(.985);
  filter: blur(2px);
}
html.v63-motion .v63-reveal.v63-visible {
  opacity: 1;
  transform: translate3d(0,0,0) scale(1);
  filter: none;
}

/* Delikatna reakcja kart i zdjęć na hover — strona żyje, ale pozostaje medyczna/elegancka. */
@media (hover:hover) and (pointer:fine) {
  .team-card, .condition-card, .service-card, .review-card, .gallery-card, .method-card, .problem-card {
    transition: transform .38s cubic-bezier(.22,.61,.36,1), box-shadow .38s ease, border-color .38s ease;
  }
  .team-card:hover, .condition-card:hover, .service-card:hover, .review-card:hover, .gallery-card:hover, .method-card:hover, .problem-card:hover {
    transform: translateY(-6px);
  }
  .gallery-card img, .gallery-item img, .team-card img, .condition-card img {
    transition: transform .8s cubic-bezier(.22,.61,.36,1), filter .5s ease;
  }
  .gallery-card:hover img, .gallery-item:hover img, .team-card:hover img, .condition-card:hover img {
    transform: scale(1.035);
  }
  .button, .section-more, .team-card__booking {
    transition: transform .25s ease, box-shadow .3s ease, background-color .3s ease, color .3s ease;
  }
  .button:hover, .section-more:hover, .team-card__booking:hover { transform: translateY(-2px); }
}

/* Obraz hero porusza się minimalnie podczas scrolla. */
.hero-photo img, .hero__visual img, .page-hero img {
  translate: 0 var(--v63-parallax, 0px);
  transition: translate .18s linear;
}

/* Opinie mają miękkie snapowanie również przy autoplay. */
[data-reviews-viewport] { scroll-behavior: smooth; }
.review-card { scroll-snap-align: start; }

@media (prefers-reduced-motion: reduce) {
  html.v63-motion .v63-reveal,
  html.v63-motion .v63-reveal.v63-visible {
    opacity: 1 !important; transform: none !important; filter: none !important;
    transition: none !important;
  }
  .hero-photo img, .hero__visual img, .page-hero img { translate: none !important; transition: none !important; }
}
