/* ==========================================================================
   Страница «Акции» (discounts.php). Подключается через $pageCss.
   Переменные --nh-* объявлены в header.css.
   Префикс deal-/deals- выбран намеренно: блокировщики рекламы режут «ad», «promo», «banner».
   ========================================================================== */

.deals {
  --deal-ease: cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

/* ---------- Шапка страницы ---------- */

.deals-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 24px;
  overflow: hidden;
  padding: 32px 48px;
  border: 1px solid rgba(0, 89, 205, 0.1);
  border-radius: 28px;
  background:
    radial-gradient(ellipse 420px 260px at 100% 0%, rgba(76, 196, 255, 0.35), transparent 70%),
    radial-gradient(ellipse 380px 240px at 0% 100%, rgba(0, 89, 205, 0.12), transparent 70%),
    linear-gradient(135deg, #fff 0%, #eaf2ff 100%);
  box-shadow: 0 24px 50px -30px rgba(0, 53, 125, 0.5);
}

.deals-hero__title {
  margin: 0 0 18px;
  color: var(--nh-ink);
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.deals-hero__title span {
  background: linear-gradient(90deg, #0059cd, #2f8cff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.deals-hero__count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--nh-ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 20px -10px rgba(0, 53, 125, 0.45);
}

.deals-hero__count::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: deal-pulse 2.2s ease-out infinite;
}

@keyframes deal-pulse {
  70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.deals-hero__art {
  display: flex;
  justify-content: center;
}

.deals-hero__art img {
  display: block;
  width: 100%;
  max-width: 230px;
  height: auto;
  animation: deal-float 7s ease-in-out infinite;
}

@keyframes deal-float {
  50% { transform: translateY(-10px); }
}

/* ---------- Сетка карточек ---------- */

.deals__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
  gap: 24px;
  margin-top: 28px;
}

/* контейнер для container query: раскладка карточки зависит от её ширины */
.deal-wrap {
  container: deal / inline-size;
  min-width: 0;
}

.deal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(0, 89, 205, 0.09);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 38px -26px rgba(0, 53, 125, 0.5);
  transition: transform 0.5s var(--deal-ease), box-shadow 0.5s var(--deal-ease), border-color 0.5s var(--deal-ease);
}

.deal-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 89, 205, 0.22);
  box-shadow: 0 28px 48px -26px rgba(0, 53, 125, 0.6);
}

.deal-card__media {
  position: relative;
  overflow: hidden;
  background: var(--nh-ice);
}

.deal-card__media img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.7s var(--deal-ease);
}

.deal-card:hover .deal-card__media img {
  transform: scale(1.04);
}

/* чип срока на картинке */
.deal-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--nh-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: 0 6px 16px -6px rgba(0, 28, 79, 0.45);
}

.deal-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4a1c;
}

.deal-chip--ended::before {
  background: #94a3b8;
}

.deal-card__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 24px 28px 26px;
}

.deal-card__title {
  margin: 0 0 10px;
  color: var(--nh-ink);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.deal-card__text {
  color: #4a5670;
  font-size: 15.5px;
  line-height: 1.65;
}

.deal-card__text p {
  margin: 0 0 8px;
  color: inherit;
  font-size: inherit;
}

.deal-card__until {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  color: #6b7a90;
  font-size: 14px;
  font-weight: 500;
}

/* в style.v10.css у * задан color — без явного цвета у дочерних элементов svg иконки остаются тёмными */
.deal-card__until svg,
.deal-card__until svg *,
.deals-empty__icon svg,
.deals-empty__icon svg * {
  color: var(--nh-blue);
}

.deal-card__until svg {
  flex: none;
}

.deal-card__cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  margin-top: 20px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--nh-blue);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 12px 22px -12px rgba(0, 89, 205, 0.9);
  transition: background-color 0.25s, box-shadow 0.25s;
}

.deal-card__cta::after {
  content: "→";
  margin-left: 8px;
  transition: transform 0.3s var(--deal-ease);
}

.deal-card__cta:hover {
  background: var(--nh-blue-dark);
  color: #fff;
  box-shadow: 0 16px 26px -12px rgba(0, 89, 205, 1);
}

.deal-card__cta:hover::after {
  transform: translateX(5px);
}

/* срок вышел: карточка остаётся, но приглушена */
.deal-card--ended .deal-card__media img {
  filter: grayscale(0.85);
  opacity: 0.8;
}

/* карточка шире ~560px: картинка слева, текст справа */
@container deal (min-width: 560px) {
  .deal-card {
    flex-direction: row;
  }

  .deal-card__media {
    flex: 0 0 40%;
    min-height: 280px;
  }

  .deal-card__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }

  .deal-card__body {
    justify-content: center;
    padding: 30px 32px;
  }

  .deal-card__cta {
    margin-top: 22px;
  }
}

/* ---------- Низ страницы и пустое состояние ---------- */

.deals__past {
  margin-top: 32px;
  text-align: center;
}

.deals__past a {
  display: inline-flex;
  align-items: center;
  padding: 11px 22px;
  border: 1px solid var(--nh-ice-2);
  border-radius: 999px;
  background: #fff;
  color: var(--nh-ink);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.deals__past a::after {
  content: "→";
  margin-left: 8px;
}

.deals__past a:hover {
  border-color: var(--nh-blue);
  background: var(--nh-ice);
  color: var(--nh-blue);
}

.deals-empty {
  margin-top: 28px;
  padding: 56px 24px;
  border: 1px dashed rgba(0, 89, 205, 0.3);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.deals-empty__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 22px;
  background: linear-gradient(145deg, #eef4ff, #dce9ff);
  color: var(--nh-blue);
}

.deals-empty__title {
  margin: 0 0 8px;
  color: var(--nh-ink);
  font-size: 22px;
  font-weight: 700;
}

.deals-empty__text {
  margin: 0 0 22px;
  color: #6b7a90;
  font-size: 15.5px;
}

/* ---------- Адаптив ---------- */

@media (max-width: 860px) {
  .deals {
    padding: 18px 16px 56px;
  }

  .deals-hero {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 32px 26px 24px;
    border-radius: 24px;
    text-align: left;
  }

  .deals-hero__art {
    order: -1;
    justify-content: flex-start;
  }

  .deals-hero__art img {
    max-width: 190px;
  }

  .deals-hero__title {
    margin-top: 6px;
  }

  .deals__grid {
    gap: 18px;
  }

  .deal-card__body {
    padding: 22px 22px 24px;
  }
}

/* плавное появление при загрузке */
@keyframes deal-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.deals-hero,
.deal-wrap,
.deals-empty,
.deals__past {
  animation: deal-in 0.8s var(--deal-ease) both;
}

.deal-wrap:nth-child(2) { animation-delay: 0.08s; }
.deal-wrap:nth-child(3) { animation-delay: 0.16s; }
.deal-wrap:nth-child(n + 4) { animation-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  .deals-hero,
  .deal-wrap,
  .deals-empty,
  .deals__past,
  .deals-hero__art img,
  .deals-hero__count::before {
    animation: none;
  }

  .deal-card,
  .deal-card__media img,
  .deal-card__cta,
  .deal-card__cta::after {
    transition: none;
  }
}
