/* ==========================================================
   ph_instagram — Instagram Feed CSS
   Layout: encabezado + grid 3x2 estilo post card
   ========================================================== */

/* ── Contenedor principal ── */
.ybc_instagram.block_instagram {
    padding: 30px 0;
}

/* ══════════════════════════════════════
   ENCABEZADO
   @cuenta (izquierda) | Síguenos (derecha)
   ══════════════════════════════════════ */
.ph-insta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    width: 100%;
}

.ph-insta-header__left {
    flex: 1;
}

.ph-insta-account-tag {
    font-size: 22px;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
    letter-spacing: -0.3px;
    line-height: 1;
}

.ph-insta-account-tag:hover {
    text-decoration: none;
    opacity: 0.8;
}

/* Botón "Síguenos" — borde oval, sin relleno */
.ph-insta-follow-btn {
    display: inline-block;
    padding: 7px 20px;
    border: 1.5px solid currentColor;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.ph-insta-follow-btn:hover {
    background: currentColor;
    text-decoration: none;
}

.ph-insta-follow-btn:hover,
a.ph-insta-follow-btn:hover {
    /* Al hacer hover el texto se invierte */
    color: #fff !important;
    filter: none;
}

/* ══════════════════════════════════════
   GRID 3 × 2
   ══════════════════════════════════════ */
.instagram-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

/* ══════════════════════════════════════
   CARD
   ══════════════════════════════════════ */
.instagram-card {
    list-style: none;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.instagram-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* — Header de la card: avatar + nombre + fecha | ícono IG — */
.instagram-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
}

.instagram-card__user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Avatar circular */
.instagram-card__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    /* Ring de Instagram */
    box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #e1306c;
}

.instagram-card__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Nombre + fecha */
.instagram-card__meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.instagram-card__name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.instagram-card__time {
    font-size: 11px;
    color: #8e8e8e;
    line-height: 1.2;
}

/* Ícono de Instagram arriba derecha */
.instagram-card__ig-icon {
    color: #e1306c;
    flex-shrink: 0;
    line-height: 0;
    transition: opacity 0.2s ease;
    margin-left: 8px;
}

.instagram-card__ig-icon:hover {
    opacity: 0.75;
}

/* — Caption (debajo del header, encima de la imagen) — */
.instagram-card__caption {
    padding: 0 14px 10px;
}

.instagram-card__caption p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #262626;
    word-break: break-word;
}

/* — Imagen con ratio 4:5 — */
.instagram-card__image-wrap {
    display: block;
    width: 100%;
    position: relative;
    overflow: hidden;
    padding-top: 125%; /* ratio 4:5 */
    margin-top: auto;
}

.instagram-card__image-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block !important;
}

.instagram-card__image-wrap:hover img {
    transform: scale(1.04);
}

/* Play icon para videos */
.instagram-card__play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* ══════════════════════════════════════
   LEGADO — compatibilidad con otros hooks
   ══════════════════════════════════════ */
.instagram_list_img {
    clear: both;
    width: 100%;
}

.instagram_list_img img {
    max-width: 100%;
}

li.instagram_item_img {
    list-style: none;
}

/* Clases antiguas del módulo original (footer, sidebar) */
.ybc_instagram_hook_footer .instagram_item_img {
    float: left;
    margin: 0;
    padding: 5px;
    width: 33.33%;
}

.ybc_instagram_hook_right .instagram_item_img,
.ybc_instagram_hook_left .instagram_item_img {
    float: left;
    padding: 5px;
    width: 33.33%;
}

.ybc_instagram_hook_left,
.ybc_instagram_hook_right {
    box-shadow: 2px 2px 11px 0 rgba(0, 0, 0, 0.1);
    float: left;
    margin-bottom: 1.5625rem;
    padding: 1.5625rem 1.25rem;
    width: 100%;
}

/* Info overlay (legado) */
.instagram_item_content {
    overflow: hidden;
    position: relative;
}

.ybc_instagram_info {
    bottom: 0;
    display: flex;
    justify-content: space-between;
    left: 0;
    pointer-events: none;
    padding: 5px 10px;
    position: absolute;
    width: 100%;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s;
}

.instagram_item_content:hover .ybc_instagram_info {
    opacity: 1;
    visibility: visible;
}

.ybc_instagram_info span { color: #fff; }

/* Focus */
.ybc_instagram *:focus,
.ybc_instagram *:active {
    outline: none;
    text-decoration: none;
}

/* ══════════════════════════════════════
   FANCYBOX
   ══════════════════════════════════════ */
.fancybox-wrap.fancybox-opened { z-index: 1200; }

.fancybox-overlay.fancybox-overlay-fixed {
    position: fixed;
    top: 0; right: 0; left: 0;
    width: 100%; height: 100%; bottom: 0;
    z-index: 1100;
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    display: block;
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 900px) {
    .instagram-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (max-width: 540px) {
    .instagram-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 14px;
    }

    .ph-insta-account-tag {
        font-size: 18px;
    }

    .instagram-card__image-wrap {
        padding-top: 125%;
    }

    .ybc_instagram_hook_footer {
        float: left;
        width: 100%;
    }
}

@media (min-width: 768px) {
    .ybc_instagram_hook_footer {
        float: left;
        width: 16.66%;
    }
}

/* ==========================================================
   OVERRIDES — neutralizar reglas !important del tema
   ========================================================== */

/* El tema fuerza height:100% en imágenes dentro del módulo,
   lo que rompe el ratio 4:5. Lo neutralizamos con selectores
   más específicos y nuestros propios !important */

.ybc_instagram .instagram-card__image-wrap {
    display: block !important;
    width: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    padding-top: 125% !important; /* ratio 4:5 */
    height: 0 !important; /* forzar que el padding-top controle la altura */
    border-radius: 0 !important;
}

.ybc_instagram .instagram-card__image-wrap img,
ul#Home_instagram li .instagram-card__image-wrap img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 0 !important;
    margin: 0 !important;
    display: block !important;
}

/* Grid */
.ybc_instagram ul#Home_instagram.instagram-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Card */
.ybc_instagram ul#Home_instagram.instagram-grid li.instagram-card {
    display: flex !important;
    flex-direction: column !important;
    background: #fff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    float: none !important;
}

/* Header de la card */
.ybc_instagram .instagram-card__header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 14px !important;
    order: 1 !important;
}

/* Caption */
.ybc_instagram .instagram-card__caption {
    padding: 0 14px 10px !important;
    order: 2 !important;
}

/* Imagen al final */
.ybc_instagram .instagram-card__image-wrap {
    order: 3 !important;
}

/* Header del bloque */
.ybc_instagram .ph-insta-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 24px !important;
    width: 100% !important;
}

/* Responsive */
@media (max-width: 900px) {
    .ybc_instagram ul#Home_instagram.instagram-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 540px) {
    .ybc_instagram ul#Home_instagram.instagram-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
}
