/* ================================================================
   MAIN-PAGE.CSS — Главная страница
   ================================================================ */

/* Обёртка главной страницы — горизонтальный padding совпадает с .container */
.page-wrapper {
  width: 100%;
  padding: 0 var(--px);
}

/* Секции на главной */
.page-wrapper > section {
  margin: 56px 0;
}

/* ----------------------------------------------------------------
   1. ПЕРВЫЙ ЭКРАН (hero)
   ---------------------------------------------------------------- */
.first-block {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-radius: var(--radius);
  overflow: hidden;
}

.first-block-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.30), rgba(255,255,255,0.30)),
    url('../images/main-page-first-block-img.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: inherit;
  z-index: 1;
}

.first-block-text {
  position: relative;
  z-index: 2;
  width: 50%;
  margin-right: 48px;
  padding: 28px 32px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(4px);
  border-radius: var(--radius);
  border: 1px solid var(--clr-primary-22);
}
.first-block-text h1 {
  font-size: 28px;
  line-height: 1.3;
  margin-bottom: 14px;
}
.first-block-text .hero-subtitle {
  font-size: 17px;
  font-style: italic;
  font-weight: 400;
  color: var(--clr-text);
  margin: 0;
}

/* ----------------------------------------------------------------
   2. О БОЛЬНИЦЕ
   ---------------------------------------------------------------- */
.about-hospital {
  background: var(--clr-primary-10);
  border-radius: var(--radius);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.about-hospital h2,
.about-hospital h3 {
  text-align: center;
}
.about-hospital h3 {
  font-size: 20px;
  font-style: italic;
  font-weight: 400;
  max-width: 800px;
}
.about-hospital-description {
  font-size: 16px;
  line-height: 1.7;
  max-width: 900px;
  width: 100%;
  text-align: left;
}
.about-hospital-description p { font-size: 16px; }

/* Слайдер */
.about-hospital-gallery {
  position: relative;
  width: 100%;
  max-width: 960px;
  height: 480px;
  overflow: hidden;
  border-radius: var(--radius);
}
.about-hospital-gallery .slider-wrapper {
  display: flex;
  height: 100%;
  transition: transform 0.45s ease;
}
.about-hospital-gallery .slide {
  min-width: 100%;
  height: 100%;
  overflow: hidden;
}
.about-hospital-gallery .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Кнопки слайдера */
.slider-prev,
.slider-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.80);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.25s;
}
.slider-prev:hover,
.slider-next:hover {
  background: rgba(255,255,255,1);
}
.slider-prev { left: 12px; }
.slider-next { right: 12px; }
.slider-prev img,
.slider-next img { width: 20px; height: 20px; object-fit: contain; }
.slider-next img { transform: rotate(180deg); }

/* ----------------------------------------------------------------
   3. ОТДЕЛЕНИЯ
   ---------------------------------------------------------------- */
.departments-section h2 {
  text-align: center;
  margin-bottom: 32px;
}

.departments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.department-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--clr-primary-10);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 0.5px solid var(--clr-primary-22);
}
.department-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.department-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.department-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.department-card:hover .department-card-image img {
  transform: scale(1.04);
}
.department-card > p {
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--clr-dark);
  text-align: center;
  margin: 0;
  line-height: 1.4;
  /* FIX: убрано обрезание текста — название отделения теперь отображается полностью */
}

/* ----------------------------------------------------------------
   4. НАПРАВЛЕНИЯ И ДОСТИЖЕНИЯ
   ---------------------------------------------------------------- */
.achievement-section {
  text-align: center;
}
.achievement-section h2 { margin-bottom: 40px; }
.achievement-section h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 20px;
  font-style: normal;
}

.directions,
.achievements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.direction,
.achieve {
  background: var(--clr-primary-10);
  border: 0.5px solid var(--clr-primary-22);
  border-radius: var(--radius);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px;
}
.number-field {
  font-size: 28px;
  font-weight: 700;
  color: var(--clr-primary);
  margin-bottom: 10px;
  line-height: 1;
}
.description-field {
  font-size: 15px;
  line-height: 1.4;
  color: var(--clr-dark);
}

/* ----------------------------------------------------------------
   5. НОВОСТИ
   ---------------------------------------------------------------- */
.news-section h2,
.news-archive h1 {
  text-align: center;
  margin-bottom: 32px;
  color: var(--clr-dark);
}

.news-section .news-list,
.news-archive .news-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.news-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px;
  background: var(--clr-primary-10);
  border: 0.5px solid var(--clr-primary-22);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}
.news-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.news-card-image {
  flex-shrink: 0;
  width: 240px;
}
.news-card-image img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.8);
}
.news-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.news-card-content h3 {
  font-size: 18px;
  font-weight: 600;
  font-style: normal;
  color: var(--clr-dark);
  margin: 0;
}
.news-card-content p {
  font-size: 15px;
  color: var(--clr-text);
  margin: 0;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "Больше новостей" */
.news-more {
  text-align: center;
  margin-top: 32px;
}

/* Пагинация */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}
.pagination ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
}
.pagination li a,
.pagination li span {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--clr-primary-30);
  color: var(--clr-dark);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s;
}
.pagination li a:hover,
.pagination li span.current {
  background: var(--clr-primary-22);
}

/* ----------------------------------------------------------------
   6. КОНТАКТЫ НА ГЛАВНОЙ
   ---------------------------------------------------------------- */
.contacts-section-main {
  background: var(--clr-primary-10);
  border-radius: var(--radius);
  padding: 48px 40px;
}
.contacts-section-main h2 {
  text-align: center;
  margin-bottom: 32px;
}
.contacts-map iframe {
  width: 100%;
  height: 480px;
  border: 0;
  border-radius: var(--radius);
  display: block;
  margin-bottom: 32px;
}
.contacts-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.contacts-info > div {
  background: #fff;
  border: 0.5px solid var(--clr-primary-22);
  border-radius: var(--radius-sm);
  padding: 20px;
}
.contacts-info p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--clr-dark);
}

/* ================================================================
   АДАПТИВ ГЛАВНОЙ СТРАНИЦЫ
   ================================================================ */

/* Desktop large */
@media (max-width: 1200px) {
  .about-hospital { padding: 40px 32px; }
  .about-hospital-gallery { height: 400px; }
  .first-block-text { width: 55%; margin-right: 32px; }
}

/* Tablet */
@media (max-width: 991px) {
  .first-block { min-height: 440px; }
  .first-block-text { width: 65%; margin-right: 20px; }
  .first-block-text h1 { font-size: 24px; }
  .about-hospital { padding: 32px 20px; }
  .about-hospital-gallery { height: 320px; }
  .contacts-info { grid-template-columns: 1fr 1fr; }
  .contacts-section-main { padding: 36px 24px; }
  .contacts-map iframe { height: 380px; }
  .news-card-image { width: 180px; }
  .news-card-image img { height: 130px; }
}

/* Tablet small */
@media (max-width: 767px) {
  .page-wrapper > section { margin: 32px 0; }
  .first-block { min-height: 300px; align-items: flex-end; justify-content: center; padding-bottom: 20px; }
  .first-block-text { width: 100%; margin: 0; border-radius: var(--radius-sm); padding: 18px 20px; }
  .first-block-text h1 { font-size: 20px; }
  .first-block-text .hero-subtitle { font-size: 15px; }
  .about-hospital { padding: 24px 16px; gap: 20px; }
  .about-hospital-gallery { height: 240px; }
  .about-hospital h3 { font-size: 17px; }
  .departments { grid-template-columns: 1fr 1fr; gap: 14px; }
  .directions,
  .achievements { grid-template-columns: 1fr 1fr; gap: 12px; }
  .direction,
  .achieve {
    padding: 20px 14px;
    min-height: 130px;
    background: #fff;
    border: none;
    border-top: 3px solid var(--clr-primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 3px 14px rgba(26, 127, 212, 0.10);
  }
  .news-card { flex-direction: column; }
  .news-card-image { width: 100%; }
  .news-card-image img { width: 100%; height: 180px; }
  .contacts-section-main { padding: 24px 16px; }
  .contacts-info { grid-template-columns: 1fr; }
  .contacts-map iframe { height: 280px; }
}

/* Mobile */
@media (max-width: 575px) {
  /* Hero — картинка сверху, текст снизу */
  .first-block {
    display: flex;
    flex-direction: column;
    min-height: auto;
    padding: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
  }
  .first-block-bg {
    position: static;
    width: 100%;
    height: 200px;
    flex-shrink: 0;
    border-radius: 0;
  }
  .first-block-text {
    position: static;
    width: 100%;
    margin: 0;
    padding: 20px 18px 22px;
    background: var(--clr-primary-10);
    backdrop-filter: none;
    border-radius: 0;
    border: none;
    border-top: 3px solid var(--clr-primary);
  }
  .first-block-text h1 {
    font-size: 19px;
    color: var(--clr-dark);
    margin-bottom: 10px;
    line-height: 1.35;
  }
  .first-block-text .hero-subtitle {
    font-size: 14px;
    color: var(--clr-text);
    font-style: italic;
    font-weight: 400;
    margin: 0;
    line-height: 1.5;
  }

  .about-hospital { padding: 20px 12px; gap: 16px; }
  .about-hospital-gallery { height: 180px; }

  /* Отделения — горизонтальная карусель вместо длинного списка */
  .departments {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 8px;
    cursor: grab;
  }
  .departments:active { cursor: grabbing; }
  .departments::-webkit-scrollbar { height: 3px; }
  .departments::-webkit-scrollbar-thumb {
    background: var(--clr-primary-30);
    border-radius: 2px;
  }
  .department-card {
    flex: 0 0 148px;
    width: 148px;
    scroll-snap-align: start;
  }
  .department-card-image { aspect-ratio: 1 / 1; }
  .department-card > p { font-size: 13px; padding: 8px 10px; }

  /* Направления и достижения — 2 колонки, компактно */
  .directions,
  .achievements {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .direction,
  .achieve {
    padding: 16px 12px;
    min-height: 105px;
    background: #fff;
    border: none;
    border-top: 3px solid var(--clr-primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 3px 14px rgba(26, 127, 212, 0.10);
  }
  .number-field { font-size: 22px; }
  .description-field { font-size: 13px; }
  .achievement-section h3 { font-size: 17px; margin: 20px 0 12px; }

  .news-card-image img { height: 150px; }
}
