/* ==========================================
   UXUI INSTAFEED GLOBAL STYLES
   ========================================== */

/* Сетка общей ленты */
.instagram-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.insta-grid-item {
    aspect-ratio: 1 / 1;
    /*overflow: hidden;*/
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.insta-image-wrapper {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s ease;
}

.insta-grid-item:hover .insta-image-wrapper {
    transform: scale(1.03);
}

/* Переносим скругление углов на внутреннюю обертку картинки */
.insta-image-wrapper {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 8px; /* Скругляем углы самой фотки */
    overflow: hidden;   /* Чтобы ховер-эффект увеличения не вылезал за границы */
}


.insta-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 2;
}

/* Ховер-эффект на сетке */
.insta-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.insta-grid-item:hover .insta-overlay {
    opacity: 1;
}

.insta-overlay-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

/* Карточка отдельного поста */
.insta-single-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eef0f2;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.03), 0 1px 4px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    margin-bottom: 30px;
}

.insta-single-media {
    background: #ffffff;
    line-height: 0;
}

.insta-single-media iframe {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border: 0;
}

.insta-single-title {
    font-weight: 700;
    color: #1a1a1a;
}

.insta-entry-text {
    font-size: 16px;
    line-height: 1.6;
    color: #333333;
}

/* Кнопка комментариев */
.insta-comments-section #submit {
    background-color: #ff6b00;
    color: #fff;
    border: 0;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s;
}

.insta-comments-section #submit:hover {
    background-color: #e05e00;
}

.insta-meta {
    font-size: 1rem !important;
} 

/* Сетка для главной страницы (4 в ряд) */
.instagram-grid-home {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 колонки на десктопе */
    gap: 15px;
}

/* Стилизация автоматических хэштегов */
.insta-hashtag {
    color: #0095f6 !important; /* Фирменный инстаграмный синий цвет */
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-block;
}

.insta-hashtag:hover {
    color: #00376b !important; /* Темно-синий цвет при наведении */
    text-decoration: underline; /* Легкое подчеркивание для интерактивности */
}

/* Корректировка отображения тегов внутри оверлея на главной/в ленте */
.insta-overlay .insta-hashtag {
    color: #38bdf8 !important; /* На темном ховер-фоне делаем синий чуть светлее, чтобы читался */
}

/* Контейнер для вертикального Reels/Shorts видео */
.insta-vertical-video-container {
    max-width: 400px;        /* Идеальная ширина для вертикального видео на ПК */
    margin: 0 auto;          /* Центрируем плеер по центру карточки */
    background: #000;        /* Черный фон, если видео будет чуть уже */
    line-height: 0;
}

.insta-vertical-video-container video {
    aspect-ratio: 9 / 16;    /* Жесткие инстаграмные вертикальные пропорции */
    object-fit: cover;
    max-height: 700px;       /* Чтобы видео не улетало вниз за пределы экрана */
}

/* Общие стили для круглых иконок в углу фото */
.insta-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.4); /* Полупрозрачный черный мат */
    backdrop-filter: blur(4px);    /* Эффект размытия стекла (Apple style) */
    width: 28px;
    height: 28px;
    border-radius: 50%;            /* Строгий ровный круг */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Иконка плеера через легкий CSS-треугольник */
.insta-icon.icon-video::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 9px; /* Геометрия стрелки */
    border-color: transparent transparent transparent #ffffff; /* Чистый белый треугольник */
    margin-left: 2px; /* Легкое смещение для идеальной центровки в круге */
}

/* Иконка карусели (два наложенных квадратика) */
.insta-icon.icon-carousel::before {
    content: "";
    display: block;
    width: 10px;
    height: 10px;
    border: 2px solid #ffffff;
    border-radius: 2px;
    position: relative;
    box-shadow: -3px 3px 0 -1px #fff; /* Эффект второго слоя */
    margin-left: 2px;
    margin-top: -2px;
}

/* Контейнер вертикального видео на странице поста */
.insta-vertical-video-container {
    max-width: 400px;
    margin: 0 auto;
    background: #000;
    line-height: 0;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.insta-vertical-video-container video {
    aspect-ratio: 9 / 16;
    object-fit: cover; /* На самой странице видео красиво обрезано под пропорции */
    max-height: 720px;
}

/* ==========================================================================
   МАГИЯ ВЕРТИКАЛЬНОГО ФУЛЛСКРИНА (Для стандартной кнопки "Во весь экран")
   ========================================================================== */

/* Для браузеров на базе WebKit (Safari на iOS, Chrome/Edge на Android и ПК) */
#insta-player::-webkit-media-controls-enclosure {
    border-radius: 0;
}

#insta-player:fullscreen {
    object-fit: contain !important; /* Вписываем видео целиком без обрезки верха и низа */
    background-color: #000000 !important;
}

#insta-player:-webkit-full-screen {
    object-fit: contain !important; /* Дублируем для iOS Safari */
    background-color: #000000 !important;
}

/* Фикс для старых Android-устройств */
#insta-player::-webkit-media-text-track-display {
    transform: translateY(0);
}

/* Чистая адаптивная инста-карусель без рамок и черных фонов */
.insta-carousel-slider {
    width: 100%;
    height: auto !important;
    position: relative;
    padding-bottom: 30px !important; /* Отступ снизу только под точки */
    background: transparent !important; /* Никакой грязи и черных гробов */
    overflow: hidden;
}

.insta-carousel-slider .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important; /* Слайдер принимает высоту САМОЙ ФОТОГРАФИИ */
}

.insta-carousel-slider .swiper-slide {
    height: auto !important;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
}

.insta-carousel-slider .swiper-slide img {
    width: 100% !important;
    height: auto !important; /* Фотка раскрывается на 100% своей родной высоты */
    display: block;
    border-radius: 8px;
    object-fit: contain !important;
}

/* Элегантные стрелочки поверх фото (светлый мат) */
.insta-swiper-next,
.insta-swiper-prev {
    color: #111111 !important; /* Темные стрелочки, чтобы читались на светлом */
    background: rgba(255, 255, 255, 0.6); /* Белый полупрозрачный мат */
    backdrop-filter: blur(4px);
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    top: 50% !important;
    transform: translateY(-50%) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.insta-swiper-next::after,
.insta-swiper-prev::after {
    font-size: 16px !important;
    font-weight: bold;
}

.insta-swiper-next:hover,
.insta-swiper-prev:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Стилизация главного заголовка ленты */
.insta-main-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px; /* Отступ между иконкой и текстом */
    color: #111111;
}

.insta-main-title .dashicons {
    font-size: 32px; /* Размер иконки под стать заголовку */
    width: 32px;
    height: 32px;
    color: #565656; /* #0095f6 Твой фирменный инстаграмный синий цвет */
    line-height: 1;
}


/* Скрываем стрелки на мобилках, там листают пальцем */
@media (max-width: 576px) {
    .insta-swiper-next,
    .insta-swiper-prev {
        display: none !important;
    }
}

/* Намертво скрываем дублирующуюся стандартную галерею внутри текста описания */
.insta-entry-text .wp-block-gallery,
.insta-entry-text figure.wp-block-gallery {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Адаптивность для главной */
@media (max-width: 992px) {
    .instagram-grid-home {
        grid-template-columns: repeat(3, 1fr); /* 3 в ряд на планшетах */
    }
}

@media (max-width: 576px) {
    .instagram-grid-home {
        grid-template-columns: repeat(2, 1fr); /* 2 в ряд на смартфонах */
        gap: 8px;
    }
}


/* Адаптивность под мобилки */
@media (max-width: 768px) {
    .instagram-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
