/* home.css */

/* === Общие настройки === */


/* === Заголовок === */
.headline {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap; /* важно: в одну строку */
  gap: 8px;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
  overflow-x: auto;
}

.headline h1 {
  margin: 0;
  padding: 0;
  white-space: nowrap; /* запрещаем перенос */
}

/* === Центровка === */
.text-center {
  text-align: center;
  padding-bottom: 20px;
  margin: 0;
}

h2.text-center {
  padding: 20px 0;
}

/* === Параграф === */
p {
  font-size: 18px;
  color: #666;
  margin-bottom: 30px;
}


/* === Анимация "печатная машинка" === */
.typewriter {
  display: inline-block;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  border-right: 2px solid black;
  font-size: 36px;
  width: 0;
  animation: typing 3s steps(30, end) forwards, blink 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink {
  from, to { border-color: transparent }
  50% { border-color: black }
}

/* === Иконка внутри кнопки === */
button .icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

/* === Контейнеры === */
.container {
  max-width: 1260px;
  margin: 0 auto;
}

.containersearch-wrapper {
  position: relative;
  z-index: 0;
  overflow: hidden;
}

.containersearch {
  max-width: 960px;
  margin: 0 auto;
  padding: 200px 20px 20px;
  position: relative;
  z-index: 1;
}

/* === Поисковая форма === */
.search-home {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-home input[type="text"] {
  padding: 10px 15px;
  width: 60%;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
}

.search-home button {
  padding: 10px 20px;
  background-color: black;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.search-home button:hover {
  background-color: #545454;
}

/* === Летающие слова (фон) === */
.background-letters {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-letter {
  position: absolute;
  animation: floatLinear var(--duration) linear infinite;
  color: rgba(0, 0, 0, 0.10) !important;
  font-weight: bold;
  user-select: none;
  will-change: transform;
  white-space: nowrap;
}

@keyframes floatLinear {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(var(--dx), var(--dy));
  }
}

/* === Адаптив для мобильных устройств === */
@media (max-width: 768px) {
  h1 {
    font-size: 28px;
    white-space: nowrap;       /* Запрещаем перенос всей строки */
    overflow-x: auto;          /* Добавляем горизонтальный скролл при необходимости */
  }

  .typewriter {
    font-size: 20px;
    white-space: nowrap;       /* Не переносим слово */
    overflow: hidden;
    max-width: 100%;
    animation: typingMobile 2.5s steps(20, end) forwards, blink 0.75s step-end infinite;
  }

  @keyframes typingMobile {
    from { width: 0 }
    to { width: 100% }
  }

  .containersearch {
    padding: 120px 16px 20px;
  }

  .search-home {
    flex-direction: column;
    align-items: stretch;
  }

  .search-home input[type="text"],
  .search-home button {
    width: 100%;
    font-size: 15px;
  }

  .headline {
    font-size: 24px;
    flex-wrap: nowrap;        /* ⚠️ важный момент: не разрешаем перенос частей заголовка */
    overflow-x: auto;
  }
  .floating-letter {
  color: black !important;
  opacity: 0.1 !important;
}
.text-center {
    font-size: 14px;


  }
}



/* === Популярные категории === */
.popular-categories {
  background-color: #ffffff;
  padding: 0 20px;
  margin-bottom: 40px;
}

.popular-categories h2 {
  text-align: center;
}

.popular-heading .icon-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.popular-heading .icon {
  width: 36px;
  height: 36px;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.category-list a {
  background-color: white;
  padding: 10px 18px;
  border-radius: 20px;
  text-decoration: none;
  color: #333;
  font-weight: 400;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.category-list a:hover {
  background-color: #f2f2f2;
}

.category-item {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 20px;
  text-decoration: none;
  color: white; /* исправлено с #white */
  font-weight: bold;
  background-color: black;
  position: relative;
  transform-origin: center center;
  transition: transform 0.3s ease-out, background-color 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.category-item:hover {
  z-index: 1;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
  .popular-categories {
    padding: 0 12px;
    margin-bottom: 24px;
  }

  .popular-categories h2 {
    font-size: 20px;
  }

  .category-list {
    gap: 8px;
    margin-bottom: 12px;
  }

  .category-list a,
  .category-item {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 16px;
  }

  .popular-heading .icon {
    width: 28px;
    height: 28px;
  }
}


/* === Типы ресурсов: "добавить ресурс" блок === */
.type-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 140px;
}

.type-list a {
  background-color: white;
  padding: 10px 18px;
  border-radius: 20px;
  text-decoration: none;
  color: #333;
  font-weight: 200;
  transition: background-color 0.2s ease;
}

.type-list a:hover {
  background-color: #dcdcdc;
}


/* === Кнопки === */
.btn {
  display: inline-block;
  padding: 10px 22px;
  background-color: black;
  color: white !important;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.btn:hover {
  background-color: #545454;
}

.btn-primary {
  background-color: black;
}

.btn-primary:hover {
  background-color: #545454;
}

@media (max-width: 768px) {
  .btn {
    padding: 8px 18px;
    font-size: 13px;
    margin-top: 10px;
  }
}

/* === Карточка: Добавить ресурс === */
.add-resource .card {
  background: #fff;
  padding: 30px;
  margin: 40px auto;
  border-radius: 12px;
  max-width: 700px;
  text-align: center;
  animation: rgbShadow 5s infinite alternate;
}

@keyframes rgbShadow {
  0% {
    box-shadow: 0 2px 16px rgba(100, 200, 100, 0.3);
  }
  50% {
    box-shadow: 0 2px 16px rgba(130, 130, 130, 0.2);
  }
  100% {
    box-shadow: 0 2px 16px rgba(100, 200, 100, 0.3);
  }
}

.title-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.add-resource .card h2 {
  font-size: 28px;
  margin-bottom: 10px;
}

.add-resource .card p {
  font-size: 16px;
  margin-bottom: 20px;
}

.add-resource .advantages {
  list-style: none;
  padding: 0;
  margin: 0 auto 20px;
  text-align: left;
  max-width: 500px;
}

.add-resource .advantages li {
  margin: 8px 0;
  font-size: 15px;
  padding-left: 1.2em;
}

.add-resource .btn {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .add-resource .card {
    padding: 20px;
    margin: 24px auto;
  }

  .add-resource .card h2 {
    font-size: 16px; /* уменьшено с 22px */
  }

  .add-resource .card p {
    font-size: 14px;
    margin-bottom: 16px;
  }

  .add-resource .advantages li {
    font-size: 14px;
  }

  .add-resource .btn {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 6px;
  }
}


/* === Статистика сайта === */
.site-stats {
  padding-bottom: 40px;
  background: #f9f9f9;
}

.site-stats h2 {
  font-size: 28px;
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  padding: 20px 30px;
  text-align: center;
  min-width: 130px;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-title {
  font-size: 15px;
  color: #777;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #222;
}

.stat-card.total {
  background: #eaf7ff;
  border: 2px solid #2196f3;
}

@media (max-width: 768px) {
  .site-stats {
    padding: 20px 12px;
  }

  .stats-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .stat-card {
    width: 100%;
    min-width: unset;
    padding: 16px 20px;
    border-radius: 12px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .stat-title {
    font-size: 14px;
    color: #666;
    margin: 0;
  }

  .stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #111;
  }

  .stat-card.total {
    background: #eaf7ff;
    border: 2px solid #2196f3;
  }
}


/* === Карусель (подборки) === */
/* === Секция Подборок === */
.main-title {
  text-align: center;
}

.featured-selections {
  padding: 40px 60px;
  background-color: #f9f9f9;
}

.carousel-wrapper {
  overflow: unset;
}

.carousel-track {
  display: flex;
  flex-wrap: wrap;            /* карточки идут в несколько строк */
  gap: 20px;
  justify-content: center;
  padding: 0;
}

/* Карточка */
.carousel-card {
  display: flex;
  flex-direction: column;
  width: 300px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: transform 0.3s ease;
}

.carousel-card:hover {
  transform: translateY(-4px);
}

.carousel-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.carousel-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.carousel-content h3 {
  font-size: 1.1em;
  margin: 0 0 10px;
}

.carousel-content p {
  font-size: 0.9em;
  color: #555;
  flex-grow: 1;
}

.carousel-content .btn {
  margin-top: 12px;
  align-self: flex-start;
}

@media (max-width: 768px) {
  .featured-selections {
    padding: 0; /* убираем внутренние отступы */
	margin-top: 30px;
  }

  .featured-selections .container {
    width: 100%;
    padding: 0 12px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .carousel-wrapper {
    width: 100%;
    padding: 0;
    margin: 0;
  }

  .carousel-track {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .carousel-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100% !important;       /* полностью растягивается */
    margin: 0 !important;         /* убираем центрирование */
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    background-color: #fff;
  }

  .carousel-image-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
  }

  .carousel-card img {
    width: 100px;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .carousel-content {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .carousel-content h3 {
    font-size: 14px;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .carousel-content p {
    font-size: 12px;
    margin: 0 0 6px;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 30px;
  }

  .carousel-content .btn {
    font-size: 12px;
    padding: 6px 10px;
    align-self: flex-start;
    margin-top: auto;
  }
}










/* === Заголовки и иконки === */
.icon-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
}

.icon-title .icon {
  width: 36px;
  height: 36px;
}

.section-title {
  text-align: center;
  margin: 0;
  padding: 20px 0;
}

@media (max-width: 768px) {
  .icon-title {
    font-size: 18px;
    gap: 6px;
  }

  .icon-title .icon {
    width: 28px;
    height: 28px;
  }

  .section-title {
    padding: 16px 0;
    font-size: 20px;
  }
}


/* === Сетка каталога === */
.catalog-grid {
  --primary-color: black;
  --danger-color: #f44336;
  --border-color: #ddd;
  --text-muted: #777;
  --text-light: #999;
  --card-radius: 12px;
  --transition: 0.3s ease;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.1);

  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 0 60px;
  max-width: 1600px;
  margin: 0 auto;
}

/* === Карточка ресурса === */
.resource-card {
  position: relative;
  display: flex;
  height: 120px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease;
  gap: 10px;
  align-items: stretch;
}

.resource-card:hover {
  transform: translateY(-3px);
}



/* === Изображение карточки === */
.resource-image-wrapper {
  flex: 0 0 120px;
  height: 100%;
}

.image-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.resource-thumb-rect {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* === Рейтинг (оценка) поверх изображения === */
.rating-overlay {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* === Контент карточки === */
.resource-content {
  padding: 6px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.titleprem {
  margin: 0;
  font-size: 16px;
}

/* === Метаданные === */
.meta {
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 4px;
}

.icon {
  width: 22px;
  height: 22px;
  vertical-align: text-bottom;
}

.iconcat {
  width: 46px;
  height: 46px;
  margin-right: 6px;
  vertical-align: text-bottom;
}

/* === Категория и бейджи === */
.category-badge {
  background-color: #ddfcdc;
  font-size: 13px;
  padding: 2px 6px;
  border-left: 4px solid #000;
  border-radius: 4px;
  display: inline-block;
  font-weight: 600;
  margin: 4px 0;
  width: max-content;
}

.catprem {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

/* === Описание === */
.description {
  margin: 0;
  font-size: 12px;
  color: #333;
  line-height: 1.5;
}

/* === Эффект блюра === */
.blurred {
  filter: blur(10px);
  transition: filter 0.3s ease;
}

@media (max-width: 768px) {
  .catalog-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    box-sizing: border-box;
  }
  
  .iconcat {
  width: 28px;
  height: 28px;
  margin-right: 6px;
  vertical-align: text-bottom;
}

  a.recommendation-card-link {
    width: 100%;
    display: block;
    max-width: 700px;
    box-sizing: border-box;
  }

  .resource-card {
    width: 100%;
    min-height: 130px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    box-sizing: border-box;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  }

  .resource-image-wrapper {
    flex: 0 0 110px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .resource-thumb-rect {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .resource-content {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .titleprem {
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .meta {
    font-size: 12px;
    gap: 8px;
    display: flex;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .category-badge {
    width: fit-content;
    font-size: 12px;
    margin-top: 4px;
  }

  .description {
    font-size: 12px;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1em;
  }
}








/* === Адаптив под мобильные === */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .containersearch {
    padding: 120px 16px 20px;
  }

  .search-home {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search-home input[type="text"] {
    width: 100%;
    font-size: 15px;
  }

  .search-home button {
    width: 100%;
    font-size: 15px;
    margin-left: 0;
  }
}