/**
 * Style Guide — дополнительные стили для blog-single-styleguide.max.html
 * Тренды 2026: bento, галереи, popup, inline-изображения
 * msg-slide и шапка — в trendy-common.max.css
 */

/* ===== 1. Inline images разной высоты ===== */
.article-inline-images {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 2rem 0;
  align-items: flex-start;
}

/* Вариант: 1 большая сверху + 3 маленькие в ряд */
.article-inline-images--stacked {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.article-inline-images--stacked .article-inline-images__item--wide {
  grid-column: 1 / -1;
}
.article-inline-images--stacked .article-inline-images__item--small {
  min-width: 0;
  max-width: none;
}

.article-inline-images__item {
  flex: 1 1 auto;
  min-width: 140px;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(5, 63, 51, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.article-inline-images__item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(5, 63, 51, 0.14);
}

.article-inline-images__item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  vertical-align: middle;
}

.article-inline-images__item--wide { max-width: 100%; aspect-ratio: 16/9; }
.article-inline-images__item--square { max-width: 280px; aspect-ratio: 1/1; }
.article-inline-images__item--small { max-width: 200px; aspect-ratio: 1/1; }
.article-inline-images__item--tall { max-width: 200px; aspect-ratio: 3/4; }
.article-inline-images__item--medium { max-width: 240px; aspect-ratio: 4/3; }

/* Адаптив: inline-images — предотвращение overflow на узких экранах */
@media (max-width: 600px) {
  .article-inline-images__item {
    min-width: 0;
    flex: 1 1 100%;
  }
  .article-inline-images--stacked {
    grid-template-columns: 1fr;
  }
  .article-inline-images__item--small,
  .article-inline-images__item--square,
  .article-inline-images__item--tall,
  .article-inline-images__item--medium {
    max-width: 100%;
  }
}

.article-inline-images__caption {
  font-size: 13px;
  color: rgba(11, 11, 11, 0.65);
  margin-top: 8px;
  padding: 0 4px;
  line-height: 1.4;
}

.article-inline-images__caption code,
.styleguide-note code,
.article-main-content__box code {
  font-size: 12px;
  padding: 2px 6px;
  background: rgba(5, 63, 51, 0.08);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
}

/* ===== 2. Gallery slider (6-8 images) ===== */
.article-gallery-slider {
  margin: 2.5rem 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(5, 63, 51, 0.12);
  background: #1a1a1a;
}

.article-gallery-slider .swiper {
  border-radius: 20px;
  background: #1a1a1a;
}

.article-gallery-slider .swiper-wrapper {
  align-items: stretch;
}

.article-gallery-slider .swiper-slide {
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4/3;
  height: auto;
  display: flex;
}

.article-gallery-slider .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-gallery-slider .swiper-pagination {
  bottom: 16px;
}

.article-gallery-slider .swiper-pagination-bullet {
  background: rgba(255,255,255,0.6);
  opacity: 1;
}

.article-gallery-slider .swiper-pagination-bullet-active {
  background: #06B781;
  transform: scale(1.2);
}

/* ===== 3. Gallery tile + popup ===== */
.article-gallery-tile {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 120px;
  gap: 12px;
  margin: 2.5rem 0;
  grid-auto-flow: dense;
}

.article-gallery-tile__item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  min-height: 100px;
  box-shadow: 0 4px 16px rgba(5, 63, 51, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-gallery-tile__item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(5, 63, 51, 0.15);
}

/* Layout 1 (default): 8 фото — первая 2×2, 7 и 8 широкие */
.article-gallery-tile--layout-1 .article-gallery-tile__item:nth-child(1) { grid-column: span 2; grid-row: span 2; min-height: 0; }
.article-gallery-tile--layout-1 .article-gallery-tile__item:nth-child(7) { grid-column: span 2; }
.article-gallery-tile--layout-1 .article-gallery-tile__item:nth-child(8) { grid-column: span 2; }

/* Layout 2: 6 фото — 2 ряда по 3 */
.article-gallery-tile--layout-2 { grid-template-columns: repeat(3, 1fr); }
.article-gallery-tile--layout-2 .article-gallery-tile__item { }

/* Layout 4: 7 фото — крупная слева 2×2 + 5 справа (2 колонки) */
.article-gallery-tile--layout-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(1) { grid-column: span 2; grid-row: span 2; min-height: 0; }
.article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(2),
.article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(3) { }
.article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(4),
.article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(5) { }
.article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(6),
.article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(7) { grid-column: span 2; }

/* Layout 5: 9 фото — 3×3 */
.article-gallery-tile--layout-5 { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 140px; }
.article-gallery-tile--layout-5 .article-gallery-tile__item { }

/* Layout 6: 6 фото — первая высокая (1 кол) + 5 в ряд */
.article-gallery-tile--layout-6 { grid-template-columns: 1fr 1fr 1fr 1fr 1fr; }
.article-gallery-tile--layout-6 .article-gallery-tile__item:nth-child(1) { grid-row: span 2; min-height: 0; }
.article-gallery-tile--layout-6 .article-gallery-tile__item:nth-child(6) { grid-column: span 4; }

.article-gallery-tile__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-gallery-tile__item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(5, 63, 51, 0.2);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.article-gallery-tile__item:hover::after {
  opacity: 1;
}

.article-gallery-tile__zoom {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.article-gallery-tile__item:hover .article-gallery-tile__zoom {
  opacity: 1;
}

.article-gallery-tile__zoom svg {
  width: 24px;
  height: 24px;
  color: #053F33;
}

/* Popup / Lightbox */
.gallery-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.gallery-popup.is-open {
  display: flex;
}

.gallery-popup__inner {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  cursor: default;
}

.gallery-popup__inner img {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.gallery-popup__close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.gallery-popup__close:hover {
  background: rgba(255,255,255,0.25);
}

@media (max-width: 768px) {
  .article-gallery-tile {
    grid-template-columns: repeat(2, 1fr);
  }
  .article-gallery-tile--layout-1 .article-gallery-tile__item:nth-child(1) { grid-column: span 2; grid-row: span 1; aspect-ratio: 16/9; }
  .article-gallery-tile--layout-1 .article-gallery-tile__item:nth-child(7),
  .article-gallery-tile--layout-1 .article-gallery-tile__item:nth-child(8) { grid-column: span 2; }
  .article-gallery-tile--layout-2,
  .article-gallery-tile--layout-5 { grid-template-columns: repeat(2, 1fr); }
  .article-gallery-tile--layout-3 .article-gallery-tile__item:nth-child(1) { grid-column: span 2; }
  .article-gallery-tile--layout-3 { grid-template-columns: repeat(2, 1fr); }
  .article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(1) { grid-column: span 2; grid-row: span 1; }
  .article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(6),
  .article-gallery-tile--layout-4 .article-gallery-tile__item:nth-child(7) { grid-column: span 2; }
  .article-gallery-tile--layout-4 { grid-template-columns: repeat(2, 1fr); }
  .article-gallery-tile--layout-6 { grid-template-columns: 1fr 1fr; }
  .article-gallery-tile--layout-6 .article-gallery-tile__item:nth-child(1) { grid-row: span 1; }
  .article-gallery-tile--layout-6 .article-gallery-tile__item:nth-child(6) { grid-column: span 2; }
}

/* ===== 4. Bento Grid (тренд 2026) ===== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 2.5rem 0;
}

.bento-grid__item {
  border-radius: 20px;
  padding: 24px;
  background: linear-gradient(135deg, #f8faf9 0%, #f0f5f3 100%);
  border: 1px solid rgba(5, 63, 51, 0.08);
  box-shadow: 0 4px 20px rgba(5, 63, 51, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.bento-grid__item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(5, 63, 51, 0.1);
}

.bento-grid__item--span2 { grid-column: span 2; }
.bento-grid__item--span3 { grid-column: span 3; }
.bento-grid__item--tall { grid-row: span 2; }

/* Выравнивание высоты: все ячейки в одной строке грида получают одинаковую высоту */
.bento-grid {
  align-items: stretch;
}

.bento-grid__item--span3 .bento-grid__label {
  line-height: 1.35;
}

.bento-grid__value {
  font-size: 28px;
  font-weight: 700;
  color: #053F33;
  line-height: 1.2;
  margin-bottom: 4px;
}

.bento-grid__label {
  font-size: 14px;
  color: rgba(11, 11, 11, 0.65);
  font-weight: 500;
}

@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .bento-grid__item--span2,
  .bento-grid__item--span3,
  .bento-grid__item--tall { grid-column: span 1; grid-row: span 1; }
}

/* ===== 5. Glassmorphism card ===== */
.glass-card {
  margin: 2.5rem 0;
  padding: 32px;
  border-radius: 24px;
  background: rgba(248, 250, 249, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(5, 63, 51, 0.08);
}

.glass-card__title {
  font-weight: 700;
  font-size: 18px;
  color: #2d4a42;
  margin-bottom: 12px;
}

.glass-card__text {
  color: rgba(11, 11, 11, 0.8);
  line-height: 1.6;
}

/* ===== 6. Pill badges (тренд) ===== */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.5rem 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s ease;
}

.pill:hover {
  transform: scale(1.05);
}

.pill--primary {
  background: rgba(6, 183, 129, 0.15);
  color: #053F33;
  border: 1px solid rgba(6, 183, 129, 0.25);
}

.pill--secondary {
  background: rgba(5, 63, 51, 0.08);
  color: #2d4a42;
  border: 1px solid rgba(5, 63, 51, 0.12);
}

.pill--outline {
  background: transparent;
  color: #053F33;
  border: 1px solid #06B781;
}

.pill--muted {
  background: #eef3f1;
  color: rgba(11, 11, 11, 0.7);
}

/* ===== 7. Progress bar ===== */
.progress-demo {
  margin: 2rem 0;
}

.progress-bar {
  height: 8px;
  background: rgba(5, 63, 51, 0.1);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #06B781 0%, #05a372 100%);
  border-radius: 100px;
  transition: width 0.5s ease;
}

.progress-demo__label {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  color: #2d4a42;
  margin-bottom: 4px;
}

/* ===== 8. Tabs ===== */
.tabs-demo {
  margin: 2.5rem 0;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(5, 63, 51, 0.08);
  background: #f8faf9;
}

.tabs-demo__nav {
  display: flex;
  gap: 0;
  padding: 8px 8px 0;
  background: rgba(5, 63, 51, 0.04);
  border-bottom: 1px solid rgba(5, 63, 51, 0.08);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-demo__nav::-webkit-scrollbar {
  display: none;
}

.tabs-demo__tab {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  color: rgba(11, 11, 11, 0.7);
  background: transparent;
  border: none;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tabs-demo__tab:hover {
  color: #053F33;
  background: rgba(255,255,255,0.6);
}

.tabs-demo__tab.is-active {
  color: #053F33;
  background: #fff;
  box-shadow: 0 -2px 8px rgba(5, 63, 51, 0.06);
}

.tabs-demo__panel {
  display: none;
  padding: 24px;
}

.tabs-demo__panel.is-active {
  display: block;
}

.tabs-demo__panel p {
  margin: 0 0 1rem;
  color: rgba(11, 11, 11, 0.85);
  line-height: 1.6;
}

.tabs-demo__panel p:last-child {
  margin-bottom: 0;
}

.tabs-demo__panel ul {
  margin: 0;
  padding-left: 1.5em;
  color: rgba(11, 11, 11, 0.85);
  line-height: 1.6;
}

.tabs-demo__panel ul li {
  margin-bottom: 0.25rem;
}

.tabs-demo__panel .article-main-content__table-wrap {
  margin-bottom: 1rem;
}

/* ===== 9. Comparison slider (before/after) ===== */
.comparison-slider {
  margin: 2.5rem 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(5, 63, 51, 0.12);
  position: relative;
}

.comparison-slider__wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.comparison-slider__side {
  padding: 20px 24px;
  min-height: 120px;
}

.comparison-slider__side--before {
  background: linear-gradient(135deg, #fefaf0 0%, #fdf5e8 100%);
  border-right: 1px solid rgba(5, 63, 51, 0.08);
}

.comparison-slider__side--after {
  background: linear-gradient(135deg, #f0faf7 0%, #e8f5f1 100%);
}

.comparison-slider__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(5, 63, 51, 0.6);
  margin-bottom: 8px;
}

.comparison-slider__content {
  font-size: 15px;
  line-height: 1.5;
  color: #2d4a42;
}

@media (max-width: 600px) {
  .comparison-slider__wrap {
    grid-template-columns: 1fr;
  }
}

/* ===== 10. Skeleton loader (тренд) ===== */
.skeleton-demo {
  margin: 2rem 0;
}

.skeleton {
  background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton--text {
  height: 16px;
  margin-bottom: 12px;
}

.skeleton--title {
  height: 24px;
  width: 60%;
  margin-bottom: 16px;
}

.skeleton--avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* ===== 11. Toast notification (пример) ===== */
.toast-demo {
  margin: 2rem 0;
}

.toast-example {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: 16px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(5, 63, 51, 0.15);
  border: 1px solid rgba(5, 63, 51, 0.08);
  max-width: 360px;
}

.toast-example__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(6, 183, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-example__icon svg {
  width: 20px;
  height: 20px;
  color: #06B781;
}

.toast-example__text {
  font-size: 15px;
  font-weight: 500;
  color: #2d4a42;
}

/* ===== 12. Section labels для style guide ===== */
.styleguide-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #06B781;
  margin-bottom: 1rem;
  display: block;
}

/* Пояснения для команды (программист, контент, дизайнер) */
.styleguide-note {
  font-size: 14px;
  color: rgba(11, 11, 11, 0.65);
  line-height: 1.5;
  margin-top: 12px;
  padding: 16px 20px;
  background: rgba(6, 183, 129, 0.06);
  border-radius: 12px;
  border-left: 3px solid rgba(6, 183, 129, 0.4);
}

.styleguide-note strong {
  color: #2d4a42;
}
