:root {
    --color-bg: #fdfbf7;
    --color-surface: #ffffff;
    --color-text: #24211d;
    --color-text-muted: #7a736a;
    --color-text-faint: #a39c92;
    --color-border: #e8e2d8;
    --color-primary: #16406b;
    --color-primary-soft: #eaf1f7;
    --color-accent: #c76a2b;
    --color-accent-soft: #fbeee1;
    --font-heading: 'Lora', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --app-max-width: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
    margin: 0;
    font-family: var(--font-body);
    background: #efece4;
    color: var(--color-text);
    line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-heading); }
button, input, textarea, select { font-family: inherit; }

/* Setiap section top-level (header/main/footer) dibatasi selebar HP & dipusatkan,
   supaya tetap rapi ala aplikasi mobile walau dibuka di layar lebar. */
.container { padding: 0 16px; }

/* Header */
.site-header {
    max-width: var(--app-max-width); margin: 0 auto;
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; background: var(--color-surface); z-index: 50;
    padding-top: env(safe-area-inset-top);
}
.site-header .top-row {
    display: flex; align-items: center; justify-content: center;
    padding: 12px 0 8px;
}
.site-header .logo { display: block; }
.site-header .logo img { height: 42px; width: auto; }
.site-header .search-form {
    display: flex; align-items: center; gap: 10px;
    background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 999px;
    padding: 10px 16px; margin: 0 16px 10px;
}
.site-header .search-form i { color: var(--color-text-faint); font-size: 14px; }
.site-header .search-form input { border: none; background: transparent; outline: none; flex: 1; font-size: 15px; color: var(--color-text); font-family: var(--font-body); }

.main-nav { display: flex; align-items: center; gap: 6px; overflow-x: auto; overflow-anchor: none; padding-bottom: 10px; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a { padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; background: var(--color-bg); border: 1px solid var(--color-border); }
.main-nav a.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.main-nav .scroll-spacer { flex: 0 0 10px; width: 10px; height: 1px; }

main { max-width: var(--app-max-width); margin: 0 auto; background: var(--color-bg); display: block; min-height: 60vh; }

/* Horizontal scroll strip (dipakai untuk trending & per-kategori di beranda).
   Inset kiri/kanan pakai elemen spacer sungguhan (.scroll-spacer), BUKAN padding
   atau margin di container/child -- keduanya terbukti tidak konsisten dirender
   di sebagian browser mobile untuk container scroll-snap. Elemen fisik selalu pasti. */
.scroll-strip { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; overflow-anchor: none; padding-bottom: 6px; scrollbar-width: none; }
.scroll-strip::-webkit-scrollbar { display: none; }
.scroll-strip > * { scroll-snap-align: start; flex-shrink: 0; }
.scroll-spacer { flex: 0 0 4px; width: 4px; height: 1px; }

/* Hero / Featured */
.hero-section { padding: 16px 0 8px; }
.hero-main { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16/11; background: var(--color-primary-soft); margin: 0 16px; display: block; }
.hero-main img { width: 100%; height: 100%; object-fit: cover; }
.hero-main .overlay-title { padding: 16px 16px 32px; }
.hero-main .overlay-title h2 {
    color: #fff; font-size: 25px; font-weight: 700; line-height: 1.28; margin: 0;
    font-family: var(--font-body);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    text-shadow: 0 1px 4px rgba(0,0,0,0.55);
}
.hero-main .overlay-kategori {
    display: block; margin-top: 7px; background: none; padding: 0; border-radius: 0;
    color: #d4d4d4; font-size: 12px; font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.hero-side { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 0; }
.hero-side-item { display: flex; gap: 12px; }
.hero-side-item .thumb-wrap { position: relative; width: 84px; height: 64px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.hero-side-item .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.hero-side-item .kategori-tag { font-size: 10.5px; font-weight: 700; color: var(--color-accent); }
.hero-side-item h3 { font-size: 13.5px; margin: 3px 0 0; line-height: 1.38; font-weight: 600; }

/* Trending */
.trending-section { padding: 20px 0 8px; border-top: 1px solid var(--color-border); margin-top: 12px; }
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.section-title i { color: var(--color-accent); }
.trending-item { width: 128px; }
.trending-item .thumb-wrap { position: relative; border-radius: 10px; overflow: hidden; }
.trending-item .rank { position: absolute; top: 8px; left: 8px; background: rgba(22,64,107,0.85); color: #fff; font-weight: 700; font-size: 12px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; z-index: 2; }
.trending-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.trending-item h4 { font-size: 12.5px; margin: 7px 0 0; font-weight: 600; line-height: 1.38; font-family: var(--font-body); }

/* Video Instagram (beranda) -- putar langsung tanpa buka artikel */
.shorts-section { padding: 20px 0 8px; border-top: 1px solid var(--color-border); margin-top: 12px; }
.shorts-item { width: 210px; aspect-ratio: 9/16; border-radius: 14px; overflow: hidden; background: #000; position: relative; }
/* Kartu ini sempit (210px) -- transform:scale() bikin buram karena cuma membesarkan gambar
   yang sudah dirender kecil. Jadi di sini lebar iframe-nya sendiri yang dibuat lebih besar
   (bukan discale visual) supaya Instagram merender ulang di resolusi lebih tinggi, lalu
   dipusatkan secara horizontal -- ini menghindari blur dibanding transform:scale.
   Angka beda dari .video-player-wrap.instagram-embed karena kartu ini jauh lebih sempit,
   jadi header/footer bawaan Instagram (tinggi pikselnya relatif tetap) makan porsi lebih
   besar di sini -- perlu zoom lebih besar untuk hasil yang sama. */
.shorts-item iframe {
    position: absolute; top: -76px; left: -30%;
    width: 160%; height: calc(100% + 260px);
    border: none; display: block;
    touch-action: none;
}

/* Category rows (beranda) */
.kategori-section { padding: 20px 0 8px; border-top: 1px solid var(--color-border); margin-top: 12px; }
.kategori-section .see-all { font-size: 12.5px; font-weight: 600; color: var(--color-accent); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 16px; }
.section-title-row .section-title { padding: 0; margin-bottom: 0; }

.article-card { width: 158px; display: block; }
.article-card .thumb-wrap { position: relative; border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.article-card .thumb-wrap img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.article-card .kategori-tag { font-size: 10.5px; font-weight: 700; color: var(--color-accent); }
.article-card h3 { font-size: 14px; margin: 5px 0; line-height: 1.38; font-weight: 600; }
.article-card .meta { font-size: 11.5px; color: var(--color-text-faint); font-family: var(--font-body); }
.article-card .ringkasan { font-size: 12.5px; color: var(--color-text-muted); margin-top: 4px; }

/* Overlay judul+kategori di atas thumbnail (dipakai di kartu hero yang punya video) */
.overlay-title {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 10px 10px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.72) 20%, transparent);
}
.overlay-kategori {
    display: inline-block; margin-top: 6px;
    background: var(--color-accent); color: #fff;
    font-size: 9.5px; font-weight: 700;
    padding: 3px 8px; border-radius: 5px;
}

/* List page (kategori/tag/search) */
.list-page { padding: 16px 0 24px; }
.list-page h1 { font-size: 21px; margin: 0 0 4px; font-weight: 600; padding: 0 16px; }
.list-page .deskripsi { color: var(--color-text-muted); font-size: 13.5px; margin-bottom: 8px; padding: 0 16px; }
.list-page > .article-list-row:first-of-type { border-top: 1px solid var(--color-border); margin-top: 12px; }
.article-list-row { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--color-border); }
.article-list-row .thumb-wrap { position: relative; width: 108px; height: 80px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.article-list-row .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.article-list-row h3 { font-size: 14.5px; margin: 0 0 4px; font-weight: 600; line-height: 1.35; }
.article-list-row .ringkasan { font-size: 12px; color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-list-row .meta { font-size: 11px; color: var(--color-text-faint); margin-top: 5px; }

/* Article detail */
.article-detail { display: block; padding: 16px 16px 40px; }
.article-detail .kategori-tag { font-size: 11.5px; font-weight: 700; color: var(--color-accent); }
.article-detail h1 { font-size: 22px; margin: 8px 0; line-height: 1.32; font-weight: 600; }
.article-detail .meta-row { display: flex; gap: 10px; align-items: center; color: var(--color-text-muted); font-size: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.article-detail .cover-img { width: 100%; border-radius: 14px; margin-bottom: 20px; aspect-ratio: 16/10; object-fit: cover; }
.article-body { font-size: 16.5px; line-height: 1.8; color: var(--color-text); }
.article-body p { margin: 0 0 16px; }
.article-body img { border-radius: 10px; margin: 18px 0; }
.article-tags { margin-top: 24px; display: flex; gap: 8px; flex-wrap: wrap; }
.article-tags a { background: var(--color-primary-soft); padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--color-primary); }
.related-section { margin-top: 32px; border-top: 1px solid var(--color-border); padding-top: 20px; }
.related-section .section-title { padding: 0 0 12px; }
.related-section .scroll-strip { margin: 0 -16px; }

/* Comments */
.comment-section { margin-top: 32px; border-top: 1px solid var(--color-border); padding-top: 20px; }
.comment-form textarea, .comment-form input { width: 100%; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: 10px; font-size: 16px; margin-bottom: 10px; font-family: inherit; box-sizing: border-box; background: var(--color-surface); color: var(--color-text); }
.comment-form button { background: var(--color-primary); color: #fff; border: none; padding: 12px 22px; border-radius: 10px; font-weight: 600; cursor: pointer; width: 100%; font-size: 15px; }
.comment-form button:active { background: #103156; }
.comment-item { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.comment-item .nama { font-weight: 700; font-size: 13.5px; }
.comment-item .waktu { font-size: 11.5px; color: var(--color-text-faint); margin-left: 8px; }
.comment-item .isi { font-size: 13.5px; margin-top: 5px; color: var(--color-text); }

/* Badge durasi video di pojok kanan-bawah thumbnail */
.duration-badge {
    position: absolute; right: 8px; bottom: 8px; z-index: 2;
    background: rgba(0,0,0,0.72); color: #fff;
    font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
    padding: 2px 7px; border-radius: 5px;
    font-family: var(--font-body);
}
.duration-badge-sm { font-size: 10px; padding: 1px 5px; right: 6px; bottom: 6px; }

/* Video player (dipakai di halaman detail artikel yang menyertakan video) */
.video-player-wrap { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 20px; }
.video-player-wrap iframe, .video-player-wrap video { width: 100%; height: 100%; border: none; }
/* Crop perkiraan: sembunyikan header profil (atas) & footer like/komentar (bawah) bawaan
   widget Instagram. TINGGI KONTAINER (aspect-ratio) inilah yang menentukan batas potong bawah,
   BUKAN tinggi iframe -- iframe cuma perlu cukup tinggi supaya kontennya tidak scroll internal.
   Angka aspect-ratio ini hasil kira-kira dari screenshot, belum tentu pas untuk semua video. */
.video-player-wrap.instagram-embed { aspect-ratio: 9/16; background: var(--color-surface); }
/* Lebar iframe sendiri dibesarkan (bukan transform:scale, supaya tidak buram) lalu dipusatkan
   horizontal -- ini juga otomatis membantu mendorong footer lebih ke bawah karena video ikut
   merender lebih tinggi mengikuti lebar barunya. Angka masih perkiraan. */
.video-player-wrap.instagram-embed iframe {
    position: absolute; top: -75px; left: 50%;
    width: 150%; height: calc(100% + 260px);
    transform: translateX(-50%);
    touch-action: none;
}

/* Footer */
.site-footer { max-width: var(--app-max-width); margin: 0 auto; border-top: 1px solid var(--color-border); padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); color: var(--color-text-muted); font-size: 12.5px; text-align: center; background: var(--color-bg); }

/* Pagination shared */
.pagination { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 20px; padding: 0 16px; font-size: 13px; }
.pagination .page-link { color: var(--color-primary); font-weight: 600; }
.pagination .page-info { color: var(--color-text-muted); }
