/* ===== Yandex Gallery Block (assets icons, ровная сетка, hover) ===== */

.yandex-gallery{ margin: 20px 0; }

/* Header (назад + хлебные крошки) */
.yandex-gallery .yg-header{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
  flex-wrap:wrap;
}

.yandex-gallery .yg-back{
  cursor:pointer;
  border:1px solid #d0d7de;
  background:#fff;
  padding:6px 10px;
  border-radius:8px;
  transition: background-color .15s ease, border-color .15s ease;
}

.yandex-gallery .yg-back:hover{
  background:#f6f8fa;
  border-color:#cbd5e1;
}

.yandex-gallery .yg-back:disabled{
  opacity:0.5;
  cursor:default;
}

.yandex-gallery .yg-breadcrumbs{
  font-size:13px;
  color:#444;
  user-select:none;
}

.yandex-gallery .yg-crumb{ cursor:pointer; color:#0073aa; }
.yandex-gallery .yg-crumb:hover{ text-decoration:underline; }
.yandex-gallery .yg-sep{ color:#999; margin:0 6px; }

/* Loading */
.yandex-gallery .yg-loading{ margin:10px 0; color:#666; }

/* Containers */
.yandex-gallery.yg-grid,
.yandex-gallery .yg-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));
  gap:12px;
  align-items:stretch; /* важно: растягиваем элементы */
}

.yandex-gallery.yg-row,
.yandex-gallery .yg-row{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}

/* ===== Card base (папки + файлы) ===== */
.yandex-gallery .yg-folder,
.yandex-gallery .yg-file{
  border:1px solid #e5e7eb;
  border-radius:16px;
  background:#fff;
  box-sizing:border-box;

  transition:
    transform .15s ease,
    box-shadow .15s ease,
    border-color .15s ease,
    background-color .15s ease;
}

.yandex-gallery .yg-folder:hover,
.yandex-gallery .yg-file:hover{
  border-color:#cbd5e1;
  box-shadow:0 10px 22px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

/* Row layout */
.yandex-gallery .yg-folder{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  padding:12px 14px;
  cursor:pointer;
  text-align:left;
}

.yandex-gallery .yg-file{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  padding:12px 14px;
  color:inherit;
  text-decoration:none;
}

/* ===== Grid: ровные карточки ===== */
.yandex-gallery .yg-grid .yg-folder,
.yandex-gallery .yg-grid .yg-file{
  height:200px;               /* одинаковая высота */
  padding:14px 14px 12px;
  display:flex;
  flex-direction:column;
  justify-content:flex-start; /* контролируем вертикаль */
  align-items:center;
  text-align:center;
}

/* Иконки в grid всегда на одном уровне */
.yandex-gallery .yg-grid .yg-folder__icon,
.yandex-gallery .yg-grid .yg-file__icon{
  margin-top:18px;
}

/* Текст всегда у низа карточки */
.yandex-gallery .yg-grid .yg-folder__name,
.yandex-gallery .yg-grid .yg-file__meta{
  margin-top:auto;
}

/* ===== Images (только для фоток) ===== */
.yandex-gallery .yg-item{
  display:block;
  overflow:hidden;
  border-radius:16px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.yandex-gallery .yg-item:hover{
  transform: translateY(-2px);
  box-shadow:0 10px 22px rgba(15, 23, 42, 0.08);
}

.yandex-gallery .yg-grid .yg-item img{
  width:100%;
  height:200px;
  object-fit:cover;
  display:block;
}

.yandex-gallery .yg-row .yg-item{ flex-shrink:0; }
.yandex-gallery .yg-row .yg-item img{
  height:200px;
  width:auto;
  object-fit:cover;
  display:block;
}

/* ===== Folder icon (assets/folder.svg) ===== */
.yandex-gallery .yg-folder__icon{
  width:64px;
  height:64px;
  flex:0 0 auto;

  background-image:url("assets/folder.svg");
  background-repeat:no-repeat;
  background-position:center;
  background-size:contain;
}

/* вырубаем старую псевдо-иконку (на всякий) */
.yandex-gallery .yg-folder__icon::before{ content:none; }

.yandex-gallery .yg-folder__name{
  font-size:14px;
  color:#111;
  word-break:break-word;
  line-height:1.2;

  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* ===== File icon base (assets/file.svg) ===== */
.yandex-gallery .yg-file__icon{
  width:64px;
  height:64px;
  flex:0 0 auto;

  background-repeat:no-repeat;
  background-position:center;
  background-size:contain;
  background-image:url("assets/file.svg");
}

/* Typed file icons */
.yandex-gallery .yg-file--pdf  .yg-file__icon{ background-image:url("assets/pdf.svg"); }
.yandex-gallery .yg-file--word .yg-file__icon{ background-image:url("assets/ms-word.svg"); }
.yandex-gallery .yg-file--excel .yg-file__icon{ background-image:url("assets/ms-excel.svg"); }
.yandex-gallery .yg-file--ppt  .yg-file__icon{ background-image:url("assets/ms-powerpoint.svg"); }

.yandex-gallery .yg-file__meta{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.yandex-gallery .yg-file__name{
  font-size:14px;
  color:#111827;
  word-break:break-word;
  line-height:1.2;

  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.yandex-gallery .yg-file__size{
  font-size:12px;
  color:#6b7280;
}

/* Load more button hover */
.yg-load-more:hover{ opacity:0.92; }
