/* ==========================================================================
   Esai Foto Widget — Tirto.id Clone
   Layout: Grid (default 4 columns)
   Thumbnail: 16:9 + Green Camera Icon
   ========================================================================== */

.photo-widget {
    background: #fff;
    margin-top: 22px;
    margin-bottom: 22px;
    font-family: 'Inter', Arial, Roboto, sans-serif;
    box-sizing: border-box;
}

.photo-widget *,
.photo-widget *::before,
.photo-widget *::after {
    box-sizing: border-box;
}

.photo-widget-inner {
    max-width: 1033px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* HEADER */
.photo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    padding-bottom: 10px;
    margin-bottom: 18px;
    border-top: 1px solid #2d2d2d;
    border-bottom: 1px dashed #dcdcdc;
    width: 100%;
}

.photo-header-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0;
    line-height: 1.2;
}

.photo-more {
    font-size: 14px;
    color: #2d5bd1;
    text-decoration: none;
    font-weight: 500;
}
.photo-more:hover {
    text-decoration: underline;
}

/* GRID LAYOUT */
.photo-layout-grid {
    display: grid;
    row-gap: 24px;
    column-gap: 0;
}

.photo-wrapper.cols-3 { grid-template-columns: repeat(3, 1fr); }
.photo-wrapper.cols-4 { grid-template-columns: repeat(4, 1fr); }
.photo-wrapper.cols-5 { grid-template-columns: repeat(5, 1fr); }

/* SLIDER LAYOUT */
.photo-layout-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
    scrollbar-width: thin;
    gap: 0;
}
.photo-layout-slider .photo-item {
    flex: 0 0 calc(100% / 4);
    scroll-snap-align: start;
}
.photo-layout-slider.cols-3 .photo-item { flex: 0 0 calc(100% / 3); }

/* ITEM STYLES */
.photo-item {
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    border-right: 1px solid #ececec;
}

.photo-item:first-child { padding-left: 0; }
.photo-item:last-child { border-right: none; padding-right: 0; }

.photo-item-imglink { display: block; text-decoration: none; }

.photo-thumb {
    margin: 0;
    padding: 0;
    line-height: 0;
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    background: #f0f0f0;
}

.photo-thumb-img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: block;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
    border-radius: 2px;
}

.photo-item:hover .photo-thumb-img-wrapper img {
    transform: scale(1.03);
}

/* META & TITLE */
.photo-item-content {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
}

.photo-meta {
    display: flex;
    align-items: center;
    line-height: 1;
    margin-bottom: 6px;
}

.photo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 14px;
    background: #1d8a55; /* Green camera background */
    border-radius: 2px;
    margin-right: 6px;
}
.photo-icon svg {
    width: 10px;
    height: 10px;
    fill: #ffffff;
}

.photo-category {
    font-size: 13px;
    color: #2f5fd3;
    font-weight: 600;
    text-decoration: none;
}
.photo-category:hover { text-decoration: underline; }

.photo-meta-sep {
    margin: 0 6px;
    color: #ccc;
    font-size: 11px;
}

.photo-time {
    font-size: 12px;
    color: #777;
}

.photo-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.15px;
    margin: 0;
    min-height: 54px;
}
.photo-title a {
    color: #111;
    text-decoration: none;
    transition: color 0.2s;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.photo-item:hover .photo-title a { color: #0d47a1; }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .photo-wrapper.cols-4 { grid-template-columns: repeat(3, 1fr); }
    .photo-layout-grid .photo-item:nth-child(3n) { border-right: none; padding-right: 0; }
    .photo-layout-slider .photo-item { flex: 0 0 calc(100% / 3); }
}

@media (max-width: 768px) {
    /* Hilangkan garis atas/bawah judul di mobile agar persis seperti Video */
    .photo-header {
        border-top: none !important;
        border-bottom: none !important;
        padding-top: 0;
        margin-top: 12px;
    }

    /* Margin Widget & Pemisah antar widget (Abu-abu tebal) */
    .photo-widget {
        margin-top: 8px !important;
        margin-bottom: 8px !important;
        padding-bottom: 16px !important;
        border-bottom: 8px solid #f5f5f5 !important;
    }

    /* Container Slider */
    .photo-wrapper.cols-3,
    .photo-wrapper.cols-4,
    .photo-layout-grid,
    .photo-layout-slider {
        display: grid !important;
        grid-template-columns: none !important;
        grid-auto-flow: column !important;
        grid-auto-columns: 85% !important; /* Slider width */
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        gap: 16px !important;
        padding-bottom: 16px !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .photo-wrapper::-webkit-scrollbar {
        display: none;
    }

    /* Kartu Foto */
    .photo-wrapper .photo-item {
        background: #fff;
        border-radius: 8px !important;
        border: 1px solid #e0e0e0 !important;
        padding: 0 !important;
        scroll-snap-align: start;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
        height: 100%;
        box-sizing: border-box;
    }

    /* Thumbnail Gambar */
    .photo-wrapper .photo-thumb {
        border: none !important;
        border-radius: 0 !important;
        background: transparent;
        aspect-ratio: 16 / 9; /* Format foto (Lanskap) */
        width: 100%;
        margin-bottom: 0 !important;
    }
    
    .photo-wrapper .photo-thumb-img-wrapper {
        width: 100%;
        height: 100%;
    }
    
    .photo-wrapper .photo-thumb-img-wrapper img {
        border-radius: 0 !important;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* Konten Teks */
    .photo-wrapper .photo-item-content {
        padding: 12px 14px 16px 14px;
        margin-top: 0;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
    }
    
    .photo-wrapper .photo-meta {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    .photo-wrapper .photo-title {
        font-size: 15px;
        line-height: 1.35;
        min-height: 0; /* Reset min-height dari versi desktop */
    }
}
