/**
 * FastBlog - Post Collections Styles (Подборки постов)
 * Grid and Slider layouts with Aspect Ratios (1:1, 16:9, 9:16, 4:5)
 *
 * @package FastBlog
 * @version 2.5
 */

.fb-collection-wrapper {
    position: relative;
    width: 100%;
    margin: 30px 0;
    box-sizing: border-box;
}

/* Header */
.fb-collection__header {
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fb-collection__title {
    font-size: clamp(1.3rem, 2.4vw, 1.75rem);
    font-weight: 800;
    margin: 0;
    color: var(--fb-text-color, #0f172a);
    letter-spacing: -0.02em;
    position: relative;
    display: inline-block;
}

/* ==========================================================================
   1. Сетка постов (Grid Layout)
   ========================================================================== */
.fb-collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .fb-collection-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ==========================================================================
   2. Слайдер с 20% обзором соседних постов (Slider Layout)
   ========================================================================== */
.fb-collection-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 10px 0 20px;
    box-sizing: border-box;
}

.fb-collection-slider-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    padding: 10px 10%; /* 10% отступ слева и справа для видимости соседних постов */
    box-sizing: border-box;
}

.fb-collection-slider-track::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

/* Слайды */
.fb-collection-slide {
    flex: 0 0 calc(33.333% - 16px);
    scroll-snap-align: center;
    box-sizing: border-box;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

@media (max-width: 1024px) {
    .fb-collection-slider-track {
        padding: 10px 12%;
    }
    .fb-collection-slide {
        flex: 0 0 calc(52% - 14px);
    }
}

@media (max-width: 640px) {
    .fb-collection-slider-track {
        padding: 10px 12.5%; /* На смартфонах 75% ширина слайда + по 12.5% отступ = ровно 20% видимость соседа */
        gap: 14px;
    }
    .fb-collection-slide {
        flex: 0 0 75%;
    }
}

/* Навигационные кнопки слайдера (Стрелки) */
.fb-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.fb-slider-nav:hover:not(:disabled) {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.08);
}

.fb-slider-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.fb-slider-nav--prev {
    left: 8px;
}

.fb-slider-nav--next {
    right: 8px;
}

@media (max-width: 640px) {
    .fb-slider-nav {
        width: 36px;
        height: 36px;
    }
    .fb-slider-nav--prev {
        left: 2px;
    }
    .fb-slider-nav--next {
        right: 2px;
    }
}

/* ==========================================================================
   3. Карточка поста в подборке (.fb-coll-card)
   ========================================================================== */
.fb-coll-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.fb-coll-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.12);
}

.fb-coll-card__img-link {
    display: block;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

/* Бейдж категории */
.fb-coll-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 6px;
    z-index: 2;
    pointer-events: none;
}

/* Тело карточки */
.fb-coll-card__body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.fb-coll-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 10px;
    color: #0f172a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fb-coll-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.fb-coll-card__title a:hover {
    color: var(--fb-accent-color, #0284c7);
}

.fb-coll-card__date {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: auto;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   4. Пропорции изображений (1:1, 16:9, 9:16, 4:5)
   ========================================================================== */
.fb-collection--ratio-1-1 .fb-card__image-wrapper,
.fb-card--ratio-1-1 .fb-card__image-wrapper {
    aspect-ratio: 1 / 1 !important;
}

.fb-collection--ratio-16-9 .fb-card__image-wrapper,
.fb-card--ratio-16-9 .fb-card__image-wrapper {
    aspect-ratio: 16 / 9 !important;
}

.fb-collection--ratio-9-16 .fb-card__image-wrapper,
.fb-card--ratio-9-16 .fb-card__image-wrapper {
    aspect-ratio: 9 / 16 !important;
}

.fb-collection--ratio-4-5 .fb-card__image-wrapper,
.fb-card--ratio-4-5 .fb-card__image-wrapper {
    aspect-ratio: 4 / 5 !important;
}

/* ==========================================================================
   5. Горизонтальная табличка 10:4 со скругленными углами (.fb-plaque-card)
   ========================================================================== */
.fb-collection-grid--plaques {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
}

.fb-plaque-card {
    position: relative;
    width: 100%;
    aspect-ratio: 10 / 4;
    min-height: 110px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    overflow: hidden;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.28s ease;
}

.fb-plaque-card:hover {
    transform: translateY(-3px);
    border-color: var(--fb-accent-color, #0284c7);
    box-shadow: 0 10px 24px rgba(2, 132, 199, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.fb-plaque-card__link {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: 16px 18px;
    box-sizing: border-box;
    text-decoration: none;
    color: inherit;
}

.fb-plaque-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.fb-plaque-card__badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(2, 132, 199, 0.09);
    color: var(--fb-accent-color, #0284c7);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.fb-plaque-card__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f8fafc;
    color: #64748b;
    flex-shrink: 0;
    transition: all 0.25s ease;
    margin-left: auto;
}

.fb-plaque-card:hover .fb-plaque-card__arrow {
    background: var(--fb-accent-color, #0284c7);
    color: #ffffff;
    transform: translateX(3px);
}

.fb-plaque-card__body {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.fb-plaque-card__title {
    font-size: clamp(0.95rem, 1.3vw, 1.12rem);
    font-weight: 700;
    line-height: 1.35;
    color: #0f172a;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.fb-plaque-card:hover .fb-plaque-card__title {
    color: var(--fb-accent-color, #0284c7);
}

.fb-plaque-card__footer {
    margin-top: 6px;
}

.fb-plaque-card__date {
    font-size: 0.75rem;
    color: #94a3b8;
}

@media (max-width: 640px) {
    .fb-plaque-card {
        aspect-ratio: 10 / 4.4;
        min-height: 105px;
    }
    .fb-plaque-card__link {
        padding: 12px 14px;
    }
}
