/* =========================================================
   HERO SERWISU (/serwis-mercedes-benz) — wg Figmy (ramka 1920).
   Wymiary w jednostkach --u: 1u = 1px przy szerokości 1920,
   tło (kadr 1920×1100) skaluje się z szerokością okna, auto
   wychodzi za prawą krawędź tak jak w projekcie.
   ========================================================= */

.hero-aso {
  --s: calc(100vw / 1920);
  --u: clamp(0.78px, var(--s), 1.3px);
  position: relative;
  overflow: hidden;
  min-height: calc(1100 * var(--s));
  background: #050506;
  color: #fff;
}

.hero-aso-media {
  position: absolute;
  inset: 0 0 auto 0;
  pointer-events: none;
}

.hero-aso-media img {
  display: block;
  width: 100%;
  height: auto;
}

.hero-aso-inner {
  position: relative;
  z-index: 1;
  padding-top: calc(208 * var(--s));
}

.hero-aso-copy {
  max-width: calc(480 * var(--u));
}

/* --- ocena Google: wspólny widget z hero strony głównej (styles.css → .hero-rating);
   odstęp do tytułu daje margines tytułu --- */

.hero-aso-copy .hero-rating {
  margin-bottom: 0;
}

/* --- tytuł i lead --- */

.hero-aso-title {
  margin: calc(26 * var(--u)) 0 0;
  font-family: var(--font-display);
  font-size: calc(45.14 * var(--u));
  font-weight: 400;
  line-height: 1.375;
  letter-spacing: -0.05em;
  color: #fff;
}

.hero-aso-lead {
  margin: calc(29 * var(--u)) 0 0;
  max-width: calc(472 * var(--u));
  color: #6a6d72;
  font-size: calc(22.57 * var(--u));
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

/* --- przyciski --- */

.hero-aso-actions {
  display: flex;
  flex-wrap: wrap;
  gap: calc(22.57 * var(--u));
  margin-top: calc(43 * var(--u));
}

.hero-aso-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(207.65 * var(--u));
  height: calc(46.27 * var(--u));
  border-radius: calc(11.29 * var(--u));
  font-size: calc(19.18 * var(--u));
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.035em;
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

.hero-aso-btn-primary {
  background: #e0e0e0;
  color: #000;
}

.hero-aso-btn-primary:hover,
.hero-aso-btn-primary:focus-visible {
  background: #fff;
  color: #000;
}

.hero-aso-btn-outline {
  border: calc(1.13 * var(--u)) solid #aeb0b4;
  color: #9da0a4;
}

.hero-aso-btn-outline:hover,
.hero-aso-btn-outline:focus-visible {
  border-color: #fff;
  color: #fff;
}

/* --- liczby: ikona + wartość/opis, separatory z gradientem --- */

.hero-aso-stats {
  display: flex;
  align-items: center;
  margin: calc(181 * var(--u)) 0 0 calc(-2 * var(--u));
  padding: 0;
  list-style: none;
}

.hero-aso-stat {
  display: flex;
  align-items: center;
  gap: calc(8 * var(--u));
  color: #e0e0e0;
}

.hero-aso-stat + .hero-aso-stat {
  margin-left: calc(31 * var(--u));
  padding-left: calc(30 * var(--u));
  background: linear-gradient(#2f343e, #1d1e20) left center / 1px calc(39 * var(--u)) no-repeat;
}

.hero-aso-stat:first-child {
  margin-right: calc(4 * var(--u));
}

.hero-aso-stat-icon {
  flex: 0 0 auto;
  width: calc(39 * var(--u));
  height: calc(42 * var(--u));
  fill: none;
  stroke: #e0e0e0;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-aso-stat-text {
  display: flex;
  flex-direction: column;
  gap: calc(3 * var(--u));
  white-space: nowrap;
}

.hero-aso-stat-text strong {
  font-size: calc(19.18 * var(--u));
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.hero-aso-stat-text span {
  font-size: calc(15 * var(--u));
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* --- węższe ekrany: sekcja rośnie, gdy treść jest wyższa niż kadr --- */

.hero-aso-inner {
  padding-bottom: calc(110 * var(--u));
}

/* --- telefon: tekst → liczby → auto (prawa połowa kadru) --- */

@media (max-width: 767.98px) {
  .hero-aso {
    --u: 0.82px;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .hero-aso-inner {
    order: 1;
    padding-top: calc(var(--nav-height) + 52px);
    padding-bottom: 0;
  }

  .hero-aso-media {
    position: relative;
    inset: auto;
    order: 2;
    height: 78vw;
    margin-top: 0;
    overflow: hidden;
  }

  .hero-aso-actions {
    flex-wrap: nowrap;
    gap: 12px;
  }

  .hero-aso-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 46px;
    font-size: 16px;
  }

  /* dwie równe kolumny; opis łamie się w swojej kolumnie, zamiast wychodzić na sąsiednią */
  .hero-aso-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
    margin-top: 44px;
  }

  .hero-aso-stat {
    min-width: 0;
  }

  .hero-aso-stat-text {
    white-space: normal;
  }

  .hero-aso-stat + .hero-aso-stat {
    margin-left: 0;
    padding-left: 0;
    background: none;
  }

  .hero-aso-stat:first-child {
    margin-right: 0;
  }
}

@media (max-width: 359.98px) {
  .hero-aso-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- kadr z Figmy (1920×1100): tło (budynek ASO) pulsuje, auto stoi na nim jako osobna warstwa --- */

.hero-aso-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1920 / 1100;
}

.hero-aso-media .hero-aso-bg {
  width: 100%;
  height: 100%;
  -webkit-mask-image: linear-gradient(#000 86%, transparent);
  mask-image: linear-gradient(#000 86%, transparent);
  animation: hero-aso-pulse 7s ease-in-out infinite;
}

/* auto: pozycja 1:1 z Figmy (wycięcie 752×332, skala 1,289); dół lekko wtopiony w tło,
   żeby koła nie odcinały się ostrą krawędzią od podłoża */
.hero-aso-media .hero-aso-car {
  position: absolute;
  left: 51.16%;
  top: 36.65%;
  width: 50.48%;
  height: auto;
  -webkit-mask-image: linear-gradient(#000 70%, rgba(0, 0, 0, 0.7) 84%, rgba(0, 0, 0, 0.15) 100%);
  mask-image: linear-gradient(#000 70%, rgba(0, 0, 0, 0.7) 84%, rgba(0, 0, 0, 0.15) 100%);
}

@keyframes hero-aso-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* --- poświata w lewym górnym rogu (Ellipse 1 z Figmy) --- */

.hero-aso-glow {
  display: none;
}

@media (min-width: 768px) {
  .hero-aso-glow {
    display: block;
    position: absolute;
    top: calc(-797 * var(--s));
    left: calc(-857 * var(--s));
    width: calc(1717 * var(--s));
    height: calc(1897 * var(--s));
    background: url("../images/aso/hero-aso-glow.webp") 0 0 / 100% 100% no-repeat;
  }
}

/* --- szerokie ekrany (>1920): skala od wysokości okna, kadr przyklejony do prawej;
   lewa krawędź tła jest czarna, więc łączy się z tłem sekcji --- */

@media (min-width: 1921px) {
  .hero-aso {
    --s: min(calc(100vw / 1920), calc(100vh / 1080), 1.5px);
    --u: max(0.78px, var(--s));
  }

  .hero-aso-frame {
    width: calc(1920 * var(--s));
    margin-left: auto;
  }
}

/* --- telefon (jak w poprzedniej wersji z miastem): budynek przygaszony i pulsujący
   w tle całego hero, także pod tekstem; auto osobno pod liczbami --- */

@media (max-width: 767.98px) {
  /* static: tło liczy pozycję od całej sekcji, nie od kadru z autem */
  .hero-aso-media:not(.hero-aso-media--photo) {
    position: static;
    height: auto;
    overflow: visible;
  }

  .hero-aso-frame {
    position: static;
    aspect-ratio: auto;
  }

  .hero-aso-media .hero-aso-bg {
    /* przyklejone do dołu sekcji: jasna brama garażu wypada za liczbami i autem, nie pod leadem */
    position: absolute;
    inset: auto 0 0 0;
    z-index: 0;
    height: min(100%, 185vw);
    object-fit: cover;
    object-position: 62% 50%;
    -webkit-mask-image: linear-gradient(transparent 0%, transparent 10%, rgba(0, 0, 0, 0.35) 34%, #000 54%, #000 76%, transparent 100%);
    mask-image: linear-gradient(transparent 0%, transparent 10%, rgba(0, 0, 0, 0.35) 34%, #000 54%, #000 76%, transparent 100%);
    animation-name: hero-aso-pulse-mobile;
  }

  /* auto wychodzi za prawą krawędź, tak jak na desktopie */
  .hero-aso-media .hero-aso-car {
    position: relative;
    z-index: 1;
    left: 6vw;
    top: 0;
    width: 128vw;
    max-width: none;
    margin: 6vw 0 4vw;
    -webkit-mask-image: linear-gradient(#000 52%, rgba(0, 0, 0, 0.6) 72%, rgba(0, 0, 0, 0.18) 88%, transparent 100%);
    mask-image: linear-gradient(#000 52%, rgba(0, 0, 0, 0.6) 72%, rgba(0, 0, 0, 0.18) 88%, transparent 100%);
  }
}

@keyframes hero-aso-pulse-mobile {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-aso-media .hero-aso-bg {
    animation: none;
  }
}

/* dłuższy H1 („…Mercedes-Benz w Warszawie”) nie łamie się przez wąski kontener leadu */
.hero-aso-title {
  width: max-content;
  max-width: calc(100vw - 2 * var(--page-gutter));
}

/* =========================================================
   Wariant z własnym zdjęciem (pole „Zdjęcie” sekcji): kadr na całe hero,
   z lewej przyciemnienie i progresywny blur pod tekstem, dół wtopiony w tło.
   ========================================================= */

.hero-aso-media--photo {
  inset: 0;
  overflow: hidden;
}

.hero-aso-media--photo > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% 60%;
  -webkit-mask-image: none;
  mask-image: none;
}

.hero-aso-blur,
.hero-aso-blur span,
.hero-aso-shade {
  position: absolute;
  inset: 0;
}

.hero-aso-blur span:nth-child(1) {
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 34%, transparent 62%);
  mask-image: linear-gradient(90deg, #000 0%, #000 34%, transparent 62%);
}

.hero-aso-blur span:nth-child(2) {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 28%, transparent 52%);
  mask-image: linear-gradient(90deg, #000 0%, #000 28%, transparent 52%);
}

.hero-aso-blur span:nth-child(3) {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 20%, transparent 42%);
  mask-image: linear-gradient(90deg, #000 0%, #000 20%, transparent 42%);
}

.hero-aso-blur span:nth-child(4) {
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 12%, transparent 32%);
  mask-image: linear-gradient(90deg, #000 0%, #000 12%, transparent 32%);
}

.hero-aso-shade {
  background:
    linear-gradient(90deg, rgba(5, 5, 6, 0.9) 0%, rgba(5, 5, 6, 0.72) 28%, rgba(5, 5, 6, 0.2) 55%, rgba(5, 5, 6, 0) 70%),
    linear-gradient(180deg, rgba(5, 5, 6, 0.45) 0%, rgba(5, 5, 6, 0) 22%, rgba(5, 5, 6, 0) 62%, #050506 100%);
}

/* telefon: zdjęcie pod treścią, płynnie wyłania się z tła u góry i znika na dole */
@media (max-width: 767.98px) {
  .hero-aso-media--photo {
    position: relative;
    height: 90vw;
  }

  .hero-aso-media--photo > img {
    margin: 0;
    width: 100%;
    object-position: 60% 55%;
  }

  .hero-aso-media--photo .hero-aso-blur {
    display: none;
  }

  .hero-aso-media--photo .hero-aso-shade {
    background: linear-gradient(180deg, #050506 0%, rgba(5, 5, 6, 0) 28%, rgba(5, 5, 6, 0) 70%, #050506 100%);
  }
}
