.ig-tiktok-feed {
    --if-bg: #FFFFFF;
    --if-surface: #FFFFFF;
    --if-text: #14161A;
    --if-text-muted: #6B7280;
    --if-accent: #FF41A0;
    --if-accent-hover: #E62F91;
    --if-on-accent: #FFFFFF;
    --if-border: #E7E5E1;
    --if-radius: 14px;
    --if-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --if-gap: 1.25rem;

    background-color: var(--if-bg);
    color: var(--if-text);
    padding: 4rem 1rem;
    font-family: inherit;
}

.ig-tiktok-feed__container {
    max-width: 1160px;
    margin: 0 auto;
}

.ig-tiktok-feed__header {
    text-align: center;
    max-width: 560px;
    margin: 0 auto 2.5rem;
}

.ig-tiktok-feed__title {
    font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.9rem;
    color: var(--if-text);
    position: relative;
    display: inline-block;
}

.ig-tiktok-feed__title::after {
    content: "";
    display: block;
    width: 46px;
    height: 4px;
    background-color: #14161A;
    border-radius: 2px;
    margin: 0.6rem auto 0;
}

.ig-tiktok-feed__subtitle {
    font-size: 1.05rem;
    color: var(--if-text-muted);
    margin: 0 0 1rem;
    line-height: 1.5;
}

/* Tarjeta de perfil (icono + handle + botón "Ver perfil") */
/* Cada grupo = barra de perfil de una red + su propio grid de publicaciones */
.ig-tiktok-feed__platform-group {
    max-width: 1160px;
    margin: 0 auto 3rem;
}

.ig-tiktok-feed__platform-group:last-of-type {
    margin-bottom: 2rem;
}

.ig-tiktok-feed__profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    background-color: #F7F6F4;
    border-radius: 16px;
    padding: 0.9rem 1.25rem;
    margin: 0 0 1.5rem;
    text-align: left;
}

.ig-tiktok-feed__profile-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.instagram-feed__profile-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--if-accent);;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instagram-feed__profile-icon svg {
    width: 32px;
    height: 32px;
    fill: #ffffff;
}

.tiktok-feed__profile-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #0D0D0D;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tiktok-feed__profile-icon svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.ig-tiktok-feed__profile-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #0D0D0D;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-tiktok-feed__profile-icon svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.ig-tiktok-feed__profile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ig-tiktok-feed__profile-handle {
    font-weight: 700;
    color: var(--if-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ig-tiktok-feed__profile-name {
    color: var(--if-text-muted);
    font-size: 0.9rem;
}

.ig-tiktok-feed__profile-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--if-accent);
    color: var(--if-on-accent);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    border: 2px solid var(--if-accent);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ig-tiktok-feed__profile-link:hover,
.ig-tiktok-feed__profile-link:focus-visible {
    background-color: var(--if-accent-hover);
    border-color: var(--if-accent-hover);
    color: var(--if-on-accent);
}

.ig-tiktok-feed__profile-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Móvil: cada tarjeta pasa a apilarse internamente y el botón ocupa todo el ancho */
@media (max-width: 480px) {
    .ig-tiktok-feed__profile-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .ig-tiktok-feed__profile-info {
        justify-content: center;
    }
    .ig-tiktok-feed__profile-link {
        justify-content: center;
    }
}

/* Grid de publicaciones */
.ig-tiktok-feed__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--if-gap);
}

/* Si JavaScript está deshabilitado el grid queda vacío: lo colapsamos
   para que no deje un hueco en el diseño (requisito de fallback). */
.ig-tiktok-feed__grid:empty {
    display: none;
}

.ig-tiktok-feed__noscript {
    text-align: center;
    color: var(--if-text-muted);
    padding: 1rem;
    border: 1px dashed var(--if-border);
    border-radius: var(--if-radius);
    margin: 0 0 1rem;
}

.ig-tiktok-feed__item {
    margin: 0;
}

.ig-tiktok-feed__link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--if-radius);
    outline-offset: 4px;
}

.ig-tiktok-feed__image-wrap {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1; /* Reserva espacio => evita CLS */
    overflow: hidden;
    border-radius: var(--if-radius);
    background-color: var(--if-surface);
    border: 1px solid var(--if-border);
    box-shadow: var(--if-shadow);
}

.ig-tiktok-feed__image-wrap picture {
    display: block;
    width: 100%;
    height: 100%;
}

.ig-tiktok-feed__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.ig-tiktok-feed__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 65, 160, 0.9); /* Instagram: rosa */
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ig-tiktok-feed__overlay--tiktok,
.ig-tiktok-feed__grid--tiktok .ig-tiktok-feed__overlay {
    background: rgba(13, 13, 13, 0.88); /* TikTok: negro */
}

.ig-tiktok-feed__overlay svg {
    width: 60px;
    height: 60px;
    fill: var(--if-on-accent);
    transform: translateY(4px);
    transition: transform 0.25s ease;
}

.ig-tiktok-feed__link:hover .ig-tiktok-feed__image,
.ig-tiktok-feed__link:focus-visible .ig-tiktok-feed__image {
    transform: scale(1.04);
}

.ig-tiktok-feed__link:hover .ig-tiktok-feed__overlay,
.ig-tiktok-feed__link:focus-visible .ig-tiktok-feed__overlay {
    opacity: 1;
}

.ig-tiktok-feed__link:hover .ig-tiktok-feed__overlay svg,
.ig-tiktok-feed__link:focus-visible .ig-tiktok-feed__overlay svg {
    transform: translateY(0);
}

.ig-tiktok-feed__link:focus-visible {
    outline: 2px solid var(--if-accent);
}

.ig-tiktok-feed__caption {
    margin: 0.6rem 0 0;
    font-size: 0.9rem;
    color: var(--if-text-muted);
    line-height: 1.4;
    /* Recorta a 2 líneas sin romper el layout */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ig-tiktok-feed__footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2.5rem;
}

.ig-tiktok-feed__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.5rem;
    background-color: var(--if-accent);
    color: var(--if-on-accent);
    text-decoration: none;
    border-radius: 999px;
    border: 2px solid var(--if-accent);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ig-tiktok-feed__cta:hover,
.ig-tiktok-feed__cta:focus-visible {
    background-color: var(--if-accent-hover);
    border-color: var(--if-accent-hover);
    color: var(--if-on-accent);
}

.ig-tiktok-feed__cta--tiktok {
    background-color: #0D0D0D;
    border-color: #0D0D0D;
}

.ig-tiktok-feed__cta--tiktok:hover,
.ig-tiktok-feed__cta--tiktok:focus-visible {
    background-color: #262626;
    border-color: #262626;
}

.ig-tiktok-feed__cta svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Tablet */
@media (max-width: 991.98px) {
    .ig-tiktok-feed__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Móvil: 1 o 2 columnas según ancho disponible */
@media (max-width: 420px) {
    .ig-tiktok-feed__grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

/* Reduce el movimiento si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
    .ig-tiktok-feed__image,
    .ig-tiktok-feed__overlay,
    .ig-tiktok-feed__overlay svg,
    .ig-tiktok-feed__profile-link,
    .ig-tiktok-feed__cta {
        transition: none !important;
    }
}