/**
 * Social Swiper Block — Frontend CSS
 *
 * Carousel Instagram posts với hiệu ứng hover overlay
 * trượt lên từ dưới và animation mượt mà.
 */

html,
body {
    overflow-x: hidden;
}

/* =============================================
   1. SECTION WRAPPER
   ============================================= */
.ss-social-swiper-section {
    width: 100%;
    padding: 50px 0;
    overflow-x: hidden;
}

.ss-scroll-stage {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* =============================================
   2. SECTION TITLE
   ============================================= */
.ss-section-title {
    text-align: center;
    margin: 0 0 40px 0;
    padding: 0 12px;
    line-height: 1.3;
}

/* =============================================
   3. SWIPER CONTAINER
   ============================================= */
.ss-swiper-container {
    position: relative;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Minimal glass-free navigation controls for the social carousel. */
.ss-swiper-nav {
    position: absolute;
    z-index: 5;
    top: 50%;
    display: grid;
    width: 54px;
    height: 54px;
    padding: 0;
    place-items: center;
    color: #FF781E;
    background: #fff !important;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    cursor: pointer;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity .48s cubic-bezier(.22, 1, .36, 1),
        transform .58s cubic-bezier(.22, 1, .36, 1),
        background .2s ease, border-color .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.ss-swiper-nav-prev { left: 70px; }
.ss-swiper-nav-next { left: calc(100% - 70px); }

.ss-swiper-nav svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}

.ss-swiper-nav-prev svg { transform: translateX(-1px); }
.ss-swiper-nav-next svg { transform: translateX(1px); }

.ss-swiper-nav:hover,
.ss-swiper-nav:active,
.ss-swiper-nav:focus {
    color: #D95F0A;
    background: #fff !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}

.ss-swiper-nav:focus-visible {
    outline: 2px solid #D95F0A;
    outline-offset: 4px;
}

.ss-swiper-nav.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(.82);
}

@media (max-width: 1024px) {
    .ss-swiper-nav { width: 48px; height: 48px; }
    .ss-swiper-nav svg { width: 23px; height: 23px; }
    .ss-swiper-nav-prev { left: 50px; }
    .ss-swiper-nav-next { left: calc(100% - 50px); }
}

@media (max-width: 768px) {
    .ss-swiper-nav { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .ss-swiper-nav,
    .ss-swiper-nav svg { transition-duration: .01ms; }
}

.ss-swiper {
    width: 100%;
    height: auto !important;
    overflow: visible !important;
}

.ss-swiper .swiper-wrapper {
    height: auto !important;
    align-items: stretch;
    box-sizing: border-box;
}

/* =============================================
   4. SLIDE / CARD
   ============================================= */
.ss-slide {
    width: 78% !important;
    max-width: 300px;
    height: auto !important;
    flex-shrink: 0;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .ss-slide {
        width: 46% !important;
        max-width: 360px;
    }
}

@media (min-width: 769px) {
    .ss-slide {
        width: calc((100vw - 70px - 3 * 14px) / 3) !important;
        max-width: 320px;
    }
}

/* Desktop: 3 ảnh chính bằng nhau, slide thứ 4 luôn thò ra một phần (~90px) ngay cả trên màn hình 1440px */
@media (min-width: 1025px) {
    .ss-slide {
        width: calc((min(100vw, 1440px) - 70px - 2 * 14px) / 3) !important;
        max-width: 432px !important;
    }
}

/* Mobile: bỏ padding-left 70px */
@media (max-width: 768px) {
    .ss-swiper-container {
        padding: 0 !important;
        margin: 0 !important;
    }

    .ss-slide {
        width: 90% !important;
        max-width: none;
    }
}

.ss-card {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5 !important;
    border-radius: 4px !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
    background: transparent !important;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.ss-card,
.ss-card:hover,
.ss-card:focus,
.ss-card:active {
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

.ss-card-image {
	border-radius:4px !important;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 5 !important;
    object-fit: cover;
    object-position: center;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    display: block;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

/* =============================================
   5. INSTAGRAM ICON (Góc phải trên)
   ============================================= */
.ss-insta-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 28px;
    height: 28px;
    opacity: 0.85;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
    transition: opacity 0.3s ease;
}

.ss-card:hover .ss-insta-icon {
    opacity: 1;
}

/* =============================================
   6. OVERLAY (Mặc định hiển thị, khi hover sẽ hạ thấp xuống có animation)
   ============================================= */
.ss-card-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: 120px;
    /* Chiều cao cố định bằng nhau cho tất cả slide */
    box-sizing: border-box;
    background-color: #0009;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    /* Mặc định hiển thị */
    transform: translateY(0);
    opacity: 1;
    transition:
        transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 0.35s ease;
    pointer-events: auto;
}

/* Hover: vùng đen dịch chuyển hạ thấp xuống mượt mà đồng bộ cùng dòng 2 */
.ss-card:hover .ss-card-overlay {
    transform: translateY(10px);
    opacity: 0.96;
}

/* =============================================
   7. OVERLAY CONTENT
   ============================================= */
.ss-overlay-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

/* Logo tròn */
.ss-logo-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ss-logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Thông tin bài post */
.ss-post-info {
    flex: 1;
    min-width: 0;
}

.ss-account-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0 !important;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-post-caption {
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 8px 0 !important;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* Luôn giữ 2 dòng để không bị giật layout */
    -webkit-box-orient: vertical;
    max-height: 17px;
    /* Ban đầu: che mất dòng 2, chỉ để lộ đúng 1 dòng (Hình 1) */
    overflow: hidden;
    text-overflow: ellipsis;
    transition: max-height 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Khi hover: mở rộng mượt mà như tấm che trượt xuống để lộ dòng 2 (Hình 2) */
.ss-card:hover .ss-post-caption {
    max-height: 38px;
}

/* Hashtags */
.ss-post-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    max-height: 20px;
    overflow: hidden;
}

.ss-post-hashtags span {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.3;
    white-space: nowrap;
}

/* =============================================
   8. RESPONSIVE — TABLET (≤1024px)
   ============================================= */
@media (max-width: 1024px) {
    .ss-scroll-stage {
        padding: 0;
    }

    .ss-social-swiper-section {
        padding: 50px 0;
    }

    .ss-section-title {
        margin-bottom: 30px;
    }
}

/* =============================================
   9. RESPONSIVE — MOBILE (≤768px)
   ============================================= */
@media (max-width: 768px) {
    .ss-scroll-stage {
        position: static;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .ss-section-title {
        margin-bottom: 24px;
    }

    .ss-swiper-container {
        padding: 0 !important;
        margin: 0 !important;
    }

    .ss-card {
        border-radius: 0 !important;
        border: none !important;
    }

    .ss-insta-icon {
        top: 10px;
        right: 10px;
        width: 22px;
        height: 22px;
    }

    /* Mobile: overlay luôn hiện (vì không có hover) */
    .ss-card-overlay {
        height: 90px;
        padding: 10px 12px;
        transform: translate3d(0, 0, 0);
        opacity: 1;
        pointer-events: auto;
        background-color: rgba(0, 0, 0, 0.6);
        transition: none;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    /* Touch browsers can keep :hover active after a tap; keep the overlay settled. */
    .ss-card:hover .ss-card-overlay {
        transform: none;
        opacity: 1;
    }

    .ss-card:hover .ss-post-caption {
        max-height: 17px;
    }

    .ss-post-caption {
        transition: none;
    }

    .ss-logo-circle {
        width: 30px;
        height: 30px;
    }

    .ss-account-name {
        font-size: 12px;
    }

    .ss-post-caption {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }

    .ss-post-hashtags span {
        font-size: 10px;
    }
}

/* =============================================
   10. RESPONSIVE — SMALL MOBILE (≤480px)
   ============================================= */
@media (max-width: 480px) {
    .ss-scroll-stage {
        padding: 0;
    }
    .ss-swiper-container {
        padding: 0 !important;
        margin: 0 !important;
    }

    .ss-section-title {
        margin-bottom: 20px;
    }
}
