.hero {
  position: relative;
  overflow: hidden;
  color: var(--color-white);
  background: var(--color-navy-deep);
}

#hits {
  scroll-margin-top: calc(var(--header-h) + var(--safe-top) + 0.75rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: inline-size;
  container-name: hero-copy;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(56, 168, 216, 0.28), transparent 55%),
    linear-gradient(160deg, #0a1a30 0%, #102848 52%, #183858 100%);
  padding:
    var(--space-6)
    max(1.25rem, var(--safe-right))
    var(--space-6)
    max(1.25rem, var(--safe-left));
}

.hero-copy-inner {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  display: grid;
  gap: clamp(0.7rem, 2.4vw, 1.1rem);
  align-content: center;
  justify-items: center;
  text-align: center;
}

.hero-brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.55rem, 1.6vw, 0.85rem);
  margin-bottom: 0.15rem;
}

.hero-brand img {
  height: clamp(1.7rem, 4.5vw, 2rem);
  width: auto;
  filter: brightness(0) invert(1);
}

.hero-brand span {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3.2vw, 1.4rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  color: rgba(255, 255, 255, 0.72);
}

.hero h1 {
  font-family: var(--font-hero);
  font-size: clamp(2.05rem, 7.2vw, 3.35rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.045em;
  max-width: none;
  text-wrap: balance;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.8s var(--ease) 0.15s forwards;
}

.hero-title-line {
  display: block;
}

.hero-title-line + .hero-title-line {
  margin-top: 0.06em;
}

.hero-copy p {
  max-width: min(36ch, 92%);
  margin-top: 0.35rem;
  margin-inline: auto;
  font-size: clamp(0.95rem, 2.1vw, 1.08rem);
  line-height: 1.45;
  letter-spacing: 0.005em;
  color: rgba(255, 255, 255, 0.72);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.8s var(--ease) 0.28s forwards;
}

.hero-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  width: max-content;
  max-width: 100%;
  gap: clamp(0.65rem, 2vw, 1rem);
  margin-top: 0.55rem;
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.8s var(--ease) 0.4s forwards;
}

.hero-cta .btn {
  width: 100%;
  box-sizing: border-box;
  font-size: clamp(0.92rem, 2vw, 1.02rem);
  padding: clamp(0.65rem, 1.6vw, 0.8rem) clamp(1.15rem, 3vw, 1.4rem);
}

.btn-on-dark {
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--color-white);
  background: transparent;
}

.btn-on-dark:hover {
  border-color: var(--color-white);
  background: rgba(255, 255, 255, 0.08);
}

.hero-visual {
  position: relative;
  aspect-ratio: 4 / 3;
  min-height: 12.5rem;
  background: #eef3f7;
  overflow: hidden;
}

.hero-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.02);
  animation: hero-drift 14s var(--ease) infinite alternate;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

.product-tile {
  display: grid;
  gap: var(--space-3);
}

.product-tile-media {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-snow);
  border: 1px solid var(--color-line);
  transition: transform 0.45s var(--ease);
}

.product-tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-tile:hover .product-tile-media {
  transform: scale(1.015);
}

.product-tile h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-navy);
}

.product-tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.product-tile-meta .price-with-vat {
  align-items: baseline;
}

.home-shelf {
  padding-block: clamp(2rem, 4vw, 3rem);
}

.home-shelf-alt {
  background: var(--color-snow);
  border-block: 1px solid var(--color-line);
}

.home-shelf .section-head {
  margin-bottom: var(--space-4);
}

.home-shelf .section-head p {
  max-width: 40rem;
}

.home-shelf-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--grid-gap, var(--space-4));
  --grid-gap: var(--space-4);
  --grid-cols: 2;
}

.home-shelf-grid > .catalog-card {
  width: calc((100% - (var(--grid-cols) - 1) * var(--grid-gap)) / var(--grid-cols));
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

/* Повні ряди: 2 кол → 4, 3 → 6, 4 → 8 (бекенд до 8; «Переглянути всі» → каталог) */
.home-shelf-grid > .catalog-card:nth-child(n + 5) {
  display: none;
}

.home-shelf .catalog-card-media {
  aspect-ratio: 5 / 4;
}

.home-shelf .catalog-card {
  gap: var(--space-2);
}

.home-shelf .catalog-card h2 {
  font-size: clamp(1rem, 1.4vw, 1.12rem);
}

.section-more {
  display: flex;
  justify-content: center;
  margin-top: var(--space-5);
}

.section-more a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-cyan);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.section-more a:hover {
  text-decoration: underline;
}

@media (min-width: 480px) {
  .home-shelf-grid {
    --grid-cols: 2;
  }
}

@media (min-width: 768px) {
  .home-shelf-grid {
    --grid-cols: 3;
  }

  .home-shelf-grid > .catalog-card:nth-child(-n + 6) {
    display: grid;
  }

  .home-shelf-grid > .catalog-card:nth-child(n + 7) {
    display: none;
  }
}

@media (min-width: 1024px) {
  .home-shelf-grid {
    --grid-cols: var(--grid-cols-desktop, 4);
  }

  .home-shelf-grid > .catalog-card:nth-child(-n + 8) {
    display: grid;
  }
}

.trust-strip {
  background: var(--color-snow);
  border-block: 1px solid var(--color-line);
}

.trust-list {
  display: grid;
  gap: var(--space-4);
}

.trust-list li {
  display: grid;
  gap: 0.35rem;
}

.trust-list strong {
  font-family: var(--font-display);
  color: var(--color-navy);
}

.trust-list span {
  color: var(--color-muted);
  font-size: 0.95rem;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-drift {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.05) translate3d(-1.2%, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero h1,
  .hero-copy p,
  .hero-cta,
  .hero-visual img {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .trust-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-copy {
    padding-inline: max(1.75rem, var(--safe-right), var(--safe-left));
  }

  .hero-visual {
    aspect-ratio: 16 / 10;
    min-height: 0;
  }
}

@media (min-width: 768px) {
  /* Варіант 1: hero рівно на перший екран — «Хіти» повністю під скролом */
  .hero {
    height: calc(100svh - var(--header-h) - var(--safe-top));
    height: calc(100dvh - var(--header-h) - var(--safe-top));
    max-height: calc(100svh - var(--header-h) - var(--safe-top));
    max-height: calc(100dvh - var(--header-h) - var(--safe-top));
    overflow: hidden;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    height: 100%;
    min-height: 100%;
  }

  .hero-copy {
    padding: var(--space-6) clamp(1.25rem, 3.5vw, 2.5rem);
    align-items: center;
    justify-content: center;
    min-height: 0;
  }

  .hero-copy-inner {
    margin: 0 auto;
    max-width: none;
    /* vw fallback → cqi від ширини лівої половини */
    gap: clamp(0.85rem, 1.4vw, 1.55rem);
    gap: clamp(0.85rem, 2.1cqi, 1.55rem);
  }

  .hero-brand {
    gap: clamp(0.65rem, 1.1vw, 1rem);
    gap: clamp(0.65rem, 1.7cqi, 1rem);
  }

  .hero-brand img {
    height: clamp(1.95rem, 1.7vw, 2.75rem);
    height: clamp(1.95rem, 2.95cqi, 2.75rem);
  }

  .hero-brand span {
    font-size: clamp(1.2rem, 1.35vw, 2.05rem);
    font-size: clamp(1.2rem, 2.35cqi, 2.05rem);
  }

  .hero h1 {
    font-size: clamp(2.35rem, 3.55vw, 5.15rem);
    font-size: clamp(2.35rem, 6.85cqi, 5.15rem);
  }

  .hero-copy p {
    max-width: min(42ch, 90%);
    font-size: clamp(1rem, 1.05vw, 1.45rem);
    font-size: clamp(1rem, 1.75cqi, 1.45rem);
  }

  .hero-cta {
    gap: clamp(0.75rem, 1.15vw, 1.35rem);
    gap: clamp(0.75rem, 1.85cqi, 1.35rem);
    margin-top: clamp(0.55rem, 1.2cqi, 1rem);
  }

  .hero-cta .btn {
    font-size: clamp(0.98rem, 0.95vw, 1.22rem);
    font-size: clamp(0.98rem, 1.55cqi, 1.22rem);
    padding:
      clamp(0.72rem, 1.15cqi, 1.05rem)
      clamp(1.3rem, 2.45cqi, 1.95rem);
  }

  .hero-visual {
    aspect-ratio: auto;
    min-height: 0;
    height: 100%;
  }

  .hero-visual img {
    position: absolute;
    inset: 0;
  }
}

@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  }

  .hero-copy {
    padding: var(--space-7) clamp(1.5rem, 4.5vw, 3.75rem);
  }

  .hero-visual img {
    position: absolute;
    inset: 0;
    object-position: center;
  }

  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* iOS Safari: svh стабільніший за fill-available (той інколи стискав hero і відкривав «хвости» хітів) */
@supports (-webkit-touch-callout: none) {
  @media (min-width: 768px) {
    .hero {
      height: calc(100svh - var(--header-h) - var(--safe-top));
      max-height: calc(100svh - var(--header-h) - var(--safe-top));
    }
  }

  .hero-visual img {
    -webkit-transform: translateZ(0);
  }
}
