/* ==========================================================================
   Headline News Widget — Tirto.id Clone (FINAL FIX)
   Layout: 1 big left | 2x2 right grid
   Garis: HANYA vertikal kiri↔kanan (full height)
          DAN vertikal col2↔col3 BARIS ATAS saja
          TIDAK ADA garis horizontal / bawah dimanapun
   ========================================================================== */

/* ---- Section Wrapper ---- */
.headline-widget-section {
    background: #fff;
    padding: 28px 0 24px;
    border: none !important;
    outline: none !important;
}

/* ---- Inner Container ---- */
.headline-widget-inner {
    max-width: 1033px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
    border: none !important;
}

/* ---- NUCLEAR RESET: paksa hapus semua border default ---- */
.headline-widget-section *,
.headline-widget-section *::before,
.headline-widget-section *::after {
    box-sizing: border-box;
}
.headline-widget-section figure { margin: 0; padding: 0; }
.headline-widget-section img { display: block; }
.headline-widget-section a { text-decoration: none; }

/* Reset border default di SEMUA elemen di dalam widget */
.headline-widget-section article,
.headline-widget-section section,
.headline-widget-section div,
.headline-widget-section figure,
.headline-widget-section figcaption,
.headline-widget-section h1,
.headline-widget-section h2,
.headline-widget-section h3,
.headline-widget-section p,
.headline-widget-section a,
.headline-widget-section span,
.headline-widget-section time {
    border: none;
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-right: none;
    outline: none;
}

/* ==========================================================================
   GRID — 3 Kolom
   ========================================================================== */
.hw-grid {
    display: grid;
    grid-template-columns: 1fr 0.7fr 0.7fr;
    grid-template-rows: auto auto;
    column-gap: 0;
    row-gap: 0;
    align-items: stretch;
    border: none !important;
}

/* ==========================================================================
   KOLOM KIRI — Berita Utama (span 2 baris)
   SATU-SATUNYA border-right yang diizinkan (pemisah kiri↔kanan)
   ========================================================================== */
.hw-main {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    padding-right: 24px;
    border: none !important;
    border-right: 1px solid #ececec !important;  /* Dikembalikan ke warna abu-abu terang agar terlihat */
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
}

/* Gambar utama */
.hw-main-image-wrap {
    overflow: hidden;
    background: #f0f0f0;
    line-height: 0;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
}
.hw-main-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.hw-main:hover .hw-main-image-wrap img { transform: scale(1.04); }

/* Body */
.hw-main-body { padding-top: 10px; }

/* Meta row */
.hw-meta-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1;
}

.hw-category {
    font-weight: 700;
    color: #1a56db;
    font-size: 13px;
}
.hw-category:hover { color: #1140a6; }

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

.hw-time {
    color: #888;
    font-size: 13px;
    font-weight: 400;
}

/* Judul utama — 26px serif bold */
.hw-main-title {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.3px;
    color: #111;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
.hw-main-title a { color: inherit; }
.hw-main:hover .hw-main-title { color: #1a56db; }

/* Deskripsi */
.hw-main-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   4 CARD SIDEBAR — Posisi Eksplisit + Zero Border
   ========================================================================== */
.hw-sidebar-card {
    display: flex;
    flex-direction: column;
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
}

/* ===== Card 2 (baris atas, kolom tengah) — SATU-SATUNYA yang punya border-right ===== */
.hw-grid > .hw-sidebar-card:nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    padding: 0 16px 12px 20px;
    border: none !important;
    border-right: 1px solid #ececec !important;
    border-bottom: 1px solid #ececec !important;
    border-top: none !important;
    border-left: none !important;
}

/* ===== Card 3 (baris atas, kolom kanan) — ZERO border ===== */
.hw-grid > .hw-sidebar-card:nth-child(3) {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    padding: 0 0 12px 20px;
    border: none !important;
    border-bottom: 1px solid #ececec !important;
    border-top: none !important;
    border-right: none !important;
    border-left: none !important;
}

/* ===== Card 4 (baris bawah, kolom tengah) — ZERO border ===== */
.hw-grid > .hw-sidebar-card:nth-child(4) {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    padding: 12px 16px 0 20px;
    border: none !important;
    border-right: 1px solid #ececec !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
}

/* ===== Card 5 (baris bawah, kolom kanan) — ZERO border ===== */
.hw-grid > .hw-sidebar-card:nth-child(5) {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
    padding: 12px 0 0 20px;
    border: none !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-left: none !important;
}

/* Gambar sidebar */
.hw-sidebar-image-wrap {
    overflow: hidden;
    background: #f0f0f0;
    line-height: 0;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
}
.hw-sidebar-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}
.hw-sidebar-card:hover .hw-sidebar-image-wrap img { transform: scale(1.05); }

/* Body sidebar */
.hw-sidebar-body { padding-top: 6px; }

/* Meta sidebar */
.hw-sidebar-meta {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1;
}

/* Judul sidebar — 14px serif bold */
.hw-sidebar-title {
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    color: #111;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
.hw-sidebar-title a { color: inherit; }
.hw-sidebar-card:hover .hw-sidebar-title { color: #1a56db; }

/* Section title (opsional) */
.hw-section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #111;
    margin: 0 0 16px;
    border: none !important;
}

/* ==========================================================================
   RESPONSIVE — Tablet (<=1024px)
   ========================================================================== */
@media (max-width: 1024px) {
    .hw-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
        gap: 20px;
    }
    .hw-main {
        grid-column: 1 / -1;
        grid-row: auto;
        border: none !important;
        padding-right: 0;
        margin-bottom: 0;
    }
    .hw-grid > .hw-sidebar-card:nth-child(2),
    .hw-grid > .hw-sidebar-card:nth-child(3),
    .hw-grid > .hw-sidebar-card:nth-child(4),
    .hw-grid > .hw-sidebar-card:nth-child(5) {
        grid-column: auto;
        grid-row: auto;
        padding: 0 !important;
        border: none !important;
    }
    .hw-main-title { font-size: 22px; }
}

/* ==========================================================================
   RESPONSIVE — Mobile (<=768px)
   ========================================================================== */
@media (max-width: 768px) {
    .headline-widget-section { padding: 16px 0 20px; }
    .headline-widget-inner { padding: 0 16px; overflow: hidden; }
    
    .hw-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 12px;
        padding-bottom: 10px; /* space for scrollbar */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .hw-grid::-webkit-scrollbar {
        display: none;
    }
    
    /* Make all cards a swipeable rectangle with background image */
    .hw-main,
    .hw-grid > .hw-sidebar-card:nth-child(2),
    .hw-grid > .hw-sidebar-card:nth-child(3),
    .hw-grid > .hw-sidebar-card:nth-child(4),
    .hw-grid > .hw-sidebar-card:nth-child(5) {
        flex: 0 0 85%;
        scroll-snap-align: center;
        position: relative;
        border-radius: 8px !important;
        overflow: hidden;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        height: 240px; /* fixed height for identical cards */
        display: block !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .hw-main-link,
    .hw-sidebar-link {
        display: block;
        width: 100%;
        height: 100%;
    }
    
    .hw-main-image-wrap,
    .hw-sidebar-image-wrap {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        margin: 0 !important;
        padding: 0 !important;
        aspect-ratio: auto;
    }
    
    .hw-main-image-wrap img,
    .hw-sidebar-image-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Gradient overlay at the bottom */
    .hw-main-image-wrap::after,
    .hw-sidebar-image-wrap::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 70%;
        background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 50%, transparent 100%);
        pointer-events: none;
    }

    /* Content styling positioned over the gradient */
    .hw-main-body,
    .hw-sidebar-body {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        z-index: 2;
        display: flex;
        flex-direction: column-reverse; /* Put title above meta */
        pointer-events: none;
    }
    
    .hw-main-body *,
    .hw-sidebar-body * {
        pointer-events: auto;
    }

    /* Meta styling */
    .hw-meta-row,
    .hw-sidebar-meta {
        margin: 0;
        order: 1; /* Under title */
        font-size: 12px;
        display: flex;
        align-items: center;
    }
    
    .hw-category {
        color: #60A5FA !important;
        font-weight: 700;
    }
    
    .hw-meta-sep,
    .hw-time {
        color: #d1d5db !important;
    }

    /* Title styling */
    .hw-main-title,
    .hw-sidebar-title {
        font-size: 16px !important;
        line-height: 1.4 !important;
        color: #fff !important;
        margin: 0 0 8px 0 !important;
        order: 2; /* Above meta */
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .hw-main-title a,
    .hw-sidebar-title a {
        color: #fff !important;
    }

    /* Hide desc on mobile */
    .hw-main-desc {
        display: none !important;
    }
}

/* ==========================================================================
   RESPONSIVE — Small Mobile (<=480px)
   ========================================================================== */
@media (max-width: 480px) {
    .headline-widget-inner { padding: 0 12px; }
    .hw-main-title,
    .hw-sidebar-title { font-size: 15px !important; }
}