/* =======================================================================
   #why — «Почему авто из Китая с Pavel-Avto выгоднее»
   ======================================================================= */

/* База секции */
.why{
  background: var(--paper-200);
  border-top: 1px solid rgba(31,30,22,.08);
}
#why{
  position: relative;
}
#why .container{
  padding-block: clamp(16px, 5vh, 48px);
}

/* Заголовок */
#why .section-title{
  font-weight: 800;
  font-size: clamp(1.75rem, 2.5vw, 2.5rem);
  line-height: 1.15;
  text-transform: uppercase;
  text-align: center;
  margin-inline: auto;
  max-width: 1100px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.45), 0 0 1px rgba(0,0,0,.35);
  padding-bottom: 5% !important;
}
#why .section-title .brand-name{
  color: var(--terracotta);
}

/* Подзаголовок внизу */
#why .why-stats{
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  color: rgba(255,255,255,.92);
  text-shadow: 0 2px 6px rgba(0,0,0,.45);
  display: inline-block;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(0,0,0,.28);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#why .why-stats .brand-name{
  color: var(--terracotta);
}

/* Фон + оверлеи */
.why-bg{
  background: center / cover no-repeat url("../img/background/why-bg.jpeg");
}
.why-bg::before,
.why-bg::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
}
.why-bg::before{
  --why-overlay-top:.40;
  --why-overlay-bot:.66;
  --why-vignette:.36;
  background:
    linear-gradient(rgba(0,0,0,var(--why-overlay-top)), rgba(0,0,0,var(--why-overlay-bot))),
    linear-gradient(135deg, color-mix(in srgb, var(--paper-200) 28%, transparent) 0%, transparent 55%),
    rgba(0,0,0,.10);
  backdrop-filter: blur(2.5px) saturate(.92) brightness(.88);
  -webkit-backdrop-filter: blur(2.5px) saturate(.92) brightness(.88);
}
.why-bg::after{
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,var(--why-vignette)) 100%);
  mix-blend-mode: multiply;
}
.why-bg > *{
  position: relative;
  z-index: 1;
}

/* ---------- Сетка и одинаковая высота ---------- */

/* в разметке стоит .row.g-4.align-items-start — перебиваем на stretch */
#why .row{
  align-items: stretch !important;
}

/* каждая колонка — flex-обёртка для карточки */
#why .row > [class*="col-"]{
  display: flex;
}

/* карточка тянется на всю высоту колонки */
#why .why-item{
  background: var(--paper-100);
  border: 2px solid var(--paper-300);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  flex: 1 1 auto;
  height: 100%;
  gap: 14px;
}

/* ---------- Иконка сверху ---------- */
#why .why-ico{
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--terracotta);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--btnshadow);
  margin-bottom: 6px;
}
#why .why-ico i{
  font-size: 28px;
  line-height: 1;
}

/* ---------- Контент карточки ---------- */
#why .why-content{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;  /* тянем контент, чтобы выровнять высоту */
}
#why .why-title{
  font-weight: 600;
  margin-bottom: 4px;
}
#why .why-text{
  color: var(--ink-60);
  font-size: 1rem;
  margin: 0;
  flex-grow: 1;    /* текст занимает «середину» */
}

/* Кнопка "Смотреть пример" в стиле Pavel-Avto */
#why .why-btn{
  margin-top: 12px;
  align-self: center;
  font-size: 0.95rem;

  padding: .55rem 1.25rem;
  border-radius: .75rem;

  background: var(--terracotta);
  color: #fff;
  border: 2px solid var(--terracotta);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;

  box-shadow: var(--btnshadow);
  text-decoration: none;

  transition: background-color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

#why .why-btn:hover,
#why .why-btn:focus{
  background: var(--terracotta-hover);
  border-color: var(--terracotta-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

#why .why-btn:active{
  transform: translateY(0);
  box-shadow: var(--btnshadow);
}

/* ---------- Мобилка ≤575.98px ---------- */
@media (max-width: 575.98px){
  #why .why-item{
    padding: 16px;
    gap: 10px;
  }
  #why .why-ico{
    width: 52px;
    height: 52px;
  }
  #why .why-ico i{
    font-size: 22px;
  }
  #why .section-title{
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
    padding-inline: 6px;
  }
  #why .why-stats{
    display:block;
    text-align:center;
    margin-top: 18px;
    padding: 8px 10px;
  }
}

/* ---------- Планшеты 576–991.98px ---------- */
@media (min-width: 576px) and (max-width: 991.98px){
  #why .row{ --bs-gutter-x: 20px; }
  #why .why-item{ padding: 20px; }
  #why .why-ico{ width: 60px; height: 60px; }
  #why .why-ico i{ font-size: 26px; }
}

/* ---------- iPad портрет: карточки столбиком ---------- */
@media only screen and (orientation: portrait) and (min-width: 744px) and (max-width: 1024px),
       only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait){
  #why .row > .col-12.col-md-3,
  #why .row > .col-12.col-md-6{
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  #why .why-item{
    padding: 18px;
  }
}

/* ---------- Десктоп ≥1200px: пропорции 25 / 50 / 25 ---------- */
@media (min-width: 1200px){
  #why .col-md-3{ flex: 0 0 25%; max-width: 25%; }
  #why .col-md-6{ flex: 0 0 50%; max-width: 50%; }
}

/* ---------- Авто-высота и отступы секции ---------- */
#why,
#why .container,
#why .row{
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
}
#why .container{
  padding-top: clamp(20px, 5vh, 48px);
  padding-bottom: clamp(20px, 5vh, 48px);
}
#why .section-title{
  margin-bottom: clamp(16px, 3vh, 28px) !important;
}
@media only screen and (orientation: portrait) and (min-width: 744px) and (max-width: 1024px),
       only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait){
  #why .section-title{
    margin-bottom: clamp(18px, 3.5vh, 32px) !important;
  }
}

/* Якорный оффсет под фикс-хедер */
#why[id]{ scroll-margin-top: calc(var(--header-h) + 14px); }
