/*
 Theme Name:   CakNews Theme
 Theme URI:    https://yusufaa.web.id
 Description:  Child theme untuk CakNews
 Author:       Kamu
 Template:     generatepress
 Version:      1.2
*/


/* --- 1. DESAIN SIDEBAR (Unified: Widget Populer & Related) --- */

/* Judul Widget (Berlaku untuk semua widget sidebar) */
.sidebar .widget-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    margin-bottom: 20px;
    background: transparent;
    padding-left: 0;
    border-bottom: none;
    /* Warna mengikuti Customizer */
}

.sidebar .widget-title::after {
    content: "";
    display: block;
    width: 100%;
    height: 3px;
    background-color: #e74c3c; /* Merah */
    flex: 1;
}

/* CONTAINER LIST (Menggabungkan Widget Bawaan & Custom Related) */
.sidebar ul.wp-block-latest-posts,
.caknews-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ITEM LIST */
.sidebar ul.wp-block-latest-posts li,
.caknews-sidebar-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: none;
    padding-bottom: 0;
}

/* GAMBAR THUMBNAIL */
.sidebar .wp-block-latest-posts__featured-image,
.caknews-sidebar-list .sidebar-thumb {
    width: 80px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.sidebar .wp-block-latest-posts__featured-image img,
.caknews-sidebar-list .sidebar-thumb img {
    border-radius: 5px;
    object-fit: cover;
    height: 65px; /* Tinggi fix agar rapi */
    width: 100%;
    display: block;
}

/* TEKS JUDUL ARTIKEL */
.sidebar .wp-block-latest-posts__list a,
.caknews-sidebar-list .sidebar-text a {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
    color: inherit; /* Mengikuti warna link tema */
    display: block;
}

.sidebar .wp-block-latest-posts__list a:hover,
.caknews-sidebar-list .sidebar-text a:hover {
    color: #e74c3c; /* Merah saat hover */
}



/* --- 2. DESAIN ARCHIVE / HOME (Grid Atas, List Bawah) --- */

.blog .generate-columns-container,
.archive .generate-columns-container {
    flex-wrap: wrap;
}

.blog .generate-columns-container .post:nth-child(n+3),
.archive .generate-columns-container .post:nth-child(n+3) {
    width: 100%;
    float: none;
    display: block;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.blog .generate-columns-container .post:nth-child(n+3) .inside-article {
    display: grid;
    grid-template-columns: 1fr 250px; 
    grid-template-areas: 
        "header image"
        "summary image"
        "meta image";
    gap: 10px 30px;
}

.blog .generate-columns-container .post:nth-child(n+3) .post-image {
    grid-area: image;
    width: 100%;
    margin: 0 !important;
}

.blog .generate-columns-container .post:nth-child(n+3) .post-image img {
    height: 150px;
    width: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.blog .generate-columns-container .post:nth-child(n+3) .entry-header { grid-area: header; }
.blog .generate-columns-container .post:nth-child(n+3) .entry-summary { grid-area: summary; }
.blog .generate-columns-container .post:nth-child(n+3) .entry-meta { grid-area: meta; }

@media (max-width: 768px) {
    .blog .generate-columns-container .post:nth-child(n+3) .inside-article { display: block; }
    .blog .generate-columns-container .post:nth-child(n+3) .post-image {
        width: 100%;
        margin-bottom: 20px !important;
    }
}

/* --- SINGLE POST STYLING --- */

/* 1. Kategori Badge */
.custom-cat-badge {
    margin-bottom: 15px;
}

.custom-cat-badge a {
    display: inline-block;
    background-color: #e74c3c;
    color: #fff;
    padding: 4px 10px;
    border: 1px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.custom-cat-badge a:hover {
    background-color: #c0392b;
    color: #fff;
}

/* 2. Judul Artikel (H1) */
.single .entry-title {
    margin-bottom: 15px;
    /* Warna dihapus: Mengikuti Customize > Colors > Content > H1 */
}

/* 3. Meta Data (Author & Date) */
.custom-post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 25px;
    font-size: 15px;
    color: inherit; /* Mengikuti warna teks body */
    opacity: 0.8;   /* Sedikit transparan agar beda dengan konten */
}

.custom-post-meta .byline {
    display: block;
    margin-bottom: 4px;
}

/* Link Author Merah */
.custom-post-meta a.url {
    color: #e74c3c; 
    font-weight: 600;
    text-decoration: none;
}

.custom-post-meta a.url:hover {
    text-decoration: underline;
}

.custom-post-meta .source-name {
    color: #e74c3c;
}

.custom-post-meta .posted-on {
    font-size: 13px;
    opacity: 0.8;
}

/* Ikon Share Merah */
.meta-right-share {
    color: #e74c3c;
    cursor: pointer;
}

/* 4. Gambar Utama */
.custom-feat-image {
    margin-bottom: 30px;
}

.custom-feat-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 5. Konten Tulisan */
.entry-content {
    /* Warna dihapus: Mengikuti Customize > Colors > Content > Text */
}

/* Tombol Share */
button.meta-right-share {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #e74c3c;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

button.meta-right-share:hover {
    transform: scale(1.1);
    color: #c0392b;
}

button.meta-right-share:focus {
    outline: none;
}


/* --- SINGLE POST TAGS --- */

.single-post-tags {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Label TAGS */
.single-post-tags .tags-label {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    color: inherit; /* Mengikuti warna teks body */
    font-weight: 800;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Container List Tag */
.single-post-tags .tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Link Tag */
.single-post-tags .tags-list a {
    display: inline-block;
    background-color: #f3f4f6;
    color: inherit; /* Mengikuti warna teks body (bukan hitam pekat) */
    opacity: 0.8;
    padding: 6px 15px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.single-post-tags .tags-list a:hover {
    background-color: #fff;
    color: #e74c3c;
    border-color: #e74c3c;
    opacity: 1;
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.15);
}

@media (max-width: 768px) {
    .single-post-tags {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
}

/* --- HEADER BORDER --- */
.site-header {
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}


/* ==========================================================
   ARCHIVE FINAL FIX (LURUS & TIDAK MEPET)
   ========================================================== */

.caknews-archive-wrapper {
    width: 100%;
    box-sizing: border-box;
}

.custom-archive-header {
    margin-bottom: 30px;
    padding: 0 !important;
    margin-left: 0 !important;
    border-bottom: none;
}

.custom-archive-header h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
    /* Warna dihapus: Mengikuti Customize > Colors > Content > H1 */
}

.custom-archive-header .archive-description {
    color: inherit; /* Mengikuti warna teks body */
    font-size: 16px;
    margin: 0;
}

.caknews-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 30px;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

.caknews-card {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
}

.caknews-card-image {
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
}

.caknews-card-image img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.caknews-cat { margin-bottom: 8px; }
.caknews-cat a {
    color: #e74c3c;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
}

.caknews-title {
    font-size: 20px;
    line-height: 1.4;
    font-weight: 700;
    margin: 0 0 8px 0;
}
.caknews-title a { 
    color: inherit; /* Mengikuti Customize > Colors > Content > H2 (atau Link) */
    text-decoration: none; 
}
.caknews-title a:hover { color: #e74c3c; }

.caknews-date { font-size: 12px; color: inherit; opacity: 0.6; }

/* Pagination */
.caknews-pagination {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}
.caknews-pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.caknews-pagination .page-numbers {
    padding: 8px 16px;
    border: 1px solid #eee;
    color: #e74c3c;
    text-decoration: none;
    border-radius: 4px;
}
.caknews-pagination .page-numbers.current {
    background: #e74c3c; color: #fff; border-color: #e74c3c;
}


/* ==========================================================
   MOBILE & TABLET FIX
   ========================================================== */

@media (max-width: 768px) {
    #main.site-main {
        padding-left: 20px !important;
        padding-right: 20px !important;
        box-sizing: border-box;
    }
    .caknews-grid-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .caknews-card-image img {
        height: auto;
        aspect-ratio: 16/9;
    }
    .custom-archive-header h1 { font-size: 28px; }
    .caknews-title { font-size: 18px; }
}


/* --- HOMEPAGE STYLES FINAL --- */

.caknews-home-section {
    margin-bottom: 50px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h2.section-title {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    margin: 0;
    padding-left: 15px;
    position: relative;
    line-height: 1.2;
    color: inherit; /* Mengikuti Customize > Colors > Content > H2 */
}

h2.section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    background-color: #e74c3c;
}

.section-more {
    font-size: 13px;
    color: inherit; /* Mengikuti warna teks biasa */
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    opacity: 0.8;
}
.section-more:hover {
    color: #e74c3c;
    text-decoration: underline;
    opacity: 1;
}

/* Grid Home */
.caknews-card-content h3.caknews-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin: 8px 0;
}

.caknews-cat {
    font-size: 12px;
    color: #e74c3c;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
}

/* List Terbaru */
.caknews-list-container {
    display: block;
}

.caknews-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 20px;
}

.caknews-list-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.list-text {
    flex: 1;
}

.small-cat {
    font-size: 11px;
    margin-bottom: 6px;
    color: #e74c3c;
    font-weight: 700;
    text-transform: uppercase;
    display: block;
}

h3.list-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 8px 0;
}

h3.list-title a {
    color: inherit; /* Mengikuti Customize > Colors > Content > H3 (atau Link) */
    text-decoration: none;
}
h3.list-title a:hover {
    color: #e74c3c;
}

.list-image {
    width: 90px;
    flex-shrink: 0;
}
.list-image img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
}

@media (max-width: 768px) {
    h2.section-title { font-size: 18px; }
    .caknews-card-content h3.caknews-title { font-size: 17px; }
    h3.list-title { font-size: 15px; }
    .caknews-list-item { align-items: center; }
}

/* --- HALAMAN 404 CUSTOM --- */

.caknews-404-wrapper {
    text-align: center;
    padding: 80px 20px;
    max-width: 700px;
    margin: 0 auto;
}

.caknews-404-wrapper .error-code {
    font-size: 120px;
    font-weight: 900;
    color: #e74c3c;
    line-height: 1;
    margin-bottom: 20px;
    letter-spacing: -5px;
}

.caknews-404-wrapper .page-title {
    font-size: 32px;
    margin-bottom: 15px;
    /* Warna dihapus: Ikut settingan H1 */
}

.caknews-404-wrapper p {
    font-size: 16px;
    color: inherit; /* Ikut warna teks body */
    margin-bottom: 15px;
    line-height: 1.6;
}

.caknews-404-wrapper .error-actions {
    margin-top: 30px;
}

.caknews-btn-red {
    display: inline-block;
    background-color: #e74c3c;
    color: #ffffff;
    padding: 12px 30px;
    border-radius: 5px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.3s ease;
    border: none;
}

.caknews-btn-red:hover {
    background-color: #c0392b;
    color: #ffffff;
}

@media (max-width: 768px) {
    .caknews-404-wrapper { padding: 50px 20px; }
    .caknews-404-wrapper .error-code { font-size: 80px; }
    .caknews-404-wrapper .page-title { font-size: 24px; }
}