/*
Theme Name: MPI Portal
Theme URI: https://mitrapublik.or.id/
Author: Mitra Publik Indonesia
Description: Tema portal News untuk Mitra Publik Indonesia — header putih menempel, menu kapital tebal, hero, daftar Terkini, dan sidebar.
Version: 1.1.1
License: GNU General Public License v2 or later
Text Domain: mpi-portal
*/

:root {
  --mpi-orange: #F05A28;
  --mpi-dark: #1a1a1a;
  --mpi-blue: #1B2A4A;
  --mpi-gray: #6c6c6c;
  --mpi-light: #f2f2f2;
  --mpi-border: #e6e6e6;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 140px; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--mpi-dark);
  background: #fff;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--mpi-dark); text-decoration: none; }
a:hover { color: var(--mpi-orange); }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4,
.site-title, .main-nav a, .section-title {
  font-family: 'Montserrat', 'Inter', sans-serif;
}

/* ---------- Header ---------- */
.header-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--mpi-border);
}
.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.hamburger {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--mpi-orange);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.site-brand .custom-logo { height: 48px; width: auto; }
.site-brand-text { line-height: 1.15; }
.site-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--mpi-blue);
  margin: 0;
  white-space: nowrap;
}
.site-title a { color: var(--mpi-blue); }
.site-title .tld { color: var(--mpi-orange); }
.site-tagline {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mpi-gray);
  margin: 0;
}
.header-search { margin-left: auto; flex: 0 1 320px; }
.header-search form {
  display: flex;
  align-items: center;
  background: #f7f7f7;
  border: 1px solid var(--mpi-border);
  border-radius: 999px;
  overflow: hidden;
}
.header-search input[type="search"] {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 13px;
  font-style: italic;
  color: var(--mpi-dark);
  outline: none;
  min-width: 0;
}
.header-search button {
  border: none;
  background: transparent;
  color: var(--mpi-gray);
  font-size: 16px;
  padding: 8px 14px;
  cursor: pointer;
}

/* ---------- Main nav ---------- */
.main-nav {
  background: #fff;
  border-bottom: 1px solid var(--mpi-border);
}
.main-nav ul {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
  list-style: none;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav ul::-webkit-scrollbar { display: none; }
.main-nav a {
  display: block;
  padding: 12px 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--mpi-dark);
  white-space: nowrap;
}
.main-nav a:hover,
.main-nav .current-menu-item a { color: var(--mpi-orange); }
.main-nav.nav-closed { display: none; }

/* Header menempel tidak boleh masuk ke bawah bilah admin WordPress. */
body.admin-bar .header-bar { top: 32px; }
@media (max-width: 782px) {
  body.admin-bar .header-bar { top: 46px; }
}

/* ---------- Hero tanpa gambar unggulan ---------- */
.hero-featured.hero-no-image { background: var(--mpi-blue); min-height: 240px; display: flex; align-items: flex-end; }
.hero-featured.hero-no-image .hero-overlay { position: static; background: none; }

/* ---------- Slideshow halaman News ---------- */
.news-slider { position: relative; border-radius: 6px; overflow: hidden; margin-bottom: 24px; }
.news-slider-track { position: relative; aspect-ratio: 16 / 9; background: var(--mpi-blue); }
.news-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.news-slide.is-active { opacity: 1; pointer-events: auto; z-index: 1; }
.news-slide-link { display: block; height: 100%; }
.news-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-slide.slide-no-image { background: var(--mpi-blue); display: flex; align-items: flex-end; }
.news-slide.slide-no-image .hero-overlay { position: static; background: none; }
.news-slider-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); cursor: pointer;
  background: rgba(0,0,0,.65); color: #fff; font-size: 28px; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding-bottom: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.news-slider-arrow:hover { background: var(--mpi-orange); border-color: #fff; }
.news-slider-prev { left: 12px; }
.news-slider-next { right: 12px; }
.news-slider-dots { position: absolute; left: 50%; transform: translateX(-50%); right: auto; bottom: 12px; z-index: 2; display: flex; justify-content: center; gap: 10px; background: rgba(0,0,0,.35); padding: 7px 12px; border-radius: 999px; }
.news-slider-dots button { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; padding: 0; cursor: pointer; background: rgba(255,255,255,.55); }
.news-slider-dots button.is-active { background: var(--mpi-orange); border-color: #fff; }

/* ---------- Layout ---------- */
.portal-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.portal-main { flex: 1 1 0; min-width: 0; }
.portal-sidebar {
  flex: 0 0 320px;
  width: 320px;
}
.content-narrow {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ---------- Hero ---------- */
.hero { margin-bottom: 28px; }
.hero-featured { position: relative; border-radius: 6px; overflow: hidden; }
.hero-featured img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 56px 20px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.55) 35%, rgba(0,0,0,.88));
  color: #fff;
}
.hero-overlay .post-meta { color: #e8e8e8; }
.hero-overlay h2 {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
}
.hero-overlay h2 a { color: #fff; }
.hero-overlay h2 a:hover { color: #ffd9c7; }
.hero-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.hero-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; }
.hero-card h3 {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Sections ---------- */
.portal-section { margin-top: 36px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--mpi-border);
  padding-bottom: 10px;
  margin-bottom: 18px;
}
.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--mpi-orange);
}
.pill {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
}
.pill-dark { background: var(--mpi-blue); color: #fff; }
.pill-dark:hover { color: #fff; opacity: .9; }
.pill-orange { background: var(--mpi-orange); color: #fff; }
.pill-orange:hover { color: #fff; opacity: .92; }
.load-more { text-align: center; margin-top: 22px; }

/* ---------- Article list rows ---------- */
.post-row {
  display: flex;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--mpi-border);
}
.post-row:first-of-type { padding-top: 0; }
.post-row-thumb { flex: 0 0 300px; width: 300px; }
.post-row-thumb img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; }
.post-row-body { min-width: 0; }
.post-meta {
  font-size: 12px;
  color: var(--mpi-gray);
  margin: 0 0 6px;
}
.post-meta .cat { color: var(--mpi-orange); font-weight: 600; }
.post-row h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-excerpt { color: #444; font-size: 14px; margin: 8px 0 0; }

/* ---------- Sidebar ---------- */
.sidebar-block { margin-bottom: 32px; }
.sidebar-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--mpi-orange);
}
.tag-cloud a { font-weight: 700; color: var(--mpi-dark); }
.tag-cloud a:hover { color: var(--mpi-orange); }
.tag-cloud a::before { content: "#"; color: var(--mpi-orange); }
.side-post {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--mpi-border);
}
.side-post:first-of-type { padding-top: 0; }
.side-post img { flex: 0 0 96px; width: 96px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; }
.side-post .post-meta { font-size: 12px; margin-bottom: 2px; }
.side-post h4 { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.35; }
.popular-list { list-style: none; margin: 0; padding: 0; counter-reset: pop; }
.popular-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--mpi-border);
}
.popular-list .num {
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #d9d9d9;
  color: var(--mpi-dark);
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.popular-list h4 { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.35; }

/* ---------- Footer ---------- */
.site-footer { background: var(--mpi-light); border-top: 1px solid var(--mpi-border); }
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 20px 16px;
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}
.footer-col { flex: 1 1 220px; }
.footer-map { background: #fff; border-bottom: 1px solid var(--mpi-border); }
.footer-map-inner { max-width: 1320px; margin: 0 auto; padding: 24px 20px; }
.footer-map-inner h3 { margin: 0 0 6px; font-size: 14px; font-weight: 800; text-transform: uppercase; }
.footer-map-inner p { margin: 0 0 14px; font-size: 13px; color: #444; }
.footer-map-inner iframe { width: 100%; height: 260px; border: 0; border-radius: 6px; display: block; }
.map-open-link { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--mpi-orange); }
.footer-col h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 6px 0; }
.footer-col a { font-size: 13px; }
.social-icons { display: flex; gap: 10px; flex-wrap: wrap; }
.social-icons a {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 13px;
}
.social-icons .fb { background: #3b5998; }
.social-icons .x { background: #000; }
.social-icons .wa { background: #25D366; }
.social-icons .tg { background: #229ED9; }
.social-icons .ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.social-icons .yt { background: #FF0000; }
.social-icons .tt { background: #000; }
.footer-company { font-size: 13px; color: #444; }
.footer-bottom {
  border-top: 1px solid #ddd;
  padding: 14px 20px;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 12px;
}
.to-top {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--mpi-orange);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ---------- Single post / page ---------- */
.article-head { margin-bottom: 20px; }
.article-head h1 { font-size: 30px; font-weight: 800; line-height: 1.25; margin: 6px 0; }
.article-featured img { width: 100%; border-radius: 6px; margin-bottom: 20px; }
.article-content { font-size: 16px; }
.article-content h2, .article-content h3 { font-weight: 800; }
.page-title { font-size: 30px; font-weight: 800; margin: 0 0 16px; }

/* ---------- Pagination ---------- */
.pagination { margin-top: 28px; text-align: center; }
.pagination .page-numbers {
  display: inline-block;
  padding: 6px 12px;
  margin: 0 2px;
  border: 1px solid var(--mpi-border);
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
}
.pagination .current { background: var(--mpi-orange); border-color: var(--mpi-orange); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .main-nav { display: none; }
  .main-nav.nav-open {
    display: block;
    position: fixed;
    top: 72px;
    left: 0; right: 0;
    z-index: 99;
    overflow-y: auto;
    background: #fff;
    box-shadow: 0 8px 16px rgba(0,0,0,.12);
  }
  .main-nav.nav-open ul {
    flex-direction: column;
    gap: 0;
    overflow: visible;
    padding: 0;
    max-width: none;
  }
  .main-nav.nav-open li { border-bottom: 1px solid var(--mpi-border); }
  .main-nav.nav-open a { padding: 14px 20px; font-size: 14px; }
}
@media (max-width: 900px) {
  html { scroll-padding-top: 84px; }
  .portal-wrap { flex-direction: column; padding-bottom: 32px; }
  .portal-sidebar { flex: 1 1 auto; width: 100%; }
  .hero-cards { grid-template-columns: repeat(2, 1fr); }
  .post-row-thumb { flex-basis: 180px; width: 180px; }
  .post-row h3 { font-size: 16px; }
  .site-title { font-size: 19px; }
  .header-search { flex-basis: 180px; }
  /* Tombol "Ke atas" disembunyikan di tablet/handphone: di layar kecil
     tombol mengambang ini menutupi judul, peta, dan copyright saat scroll. */
  .to-top { display: none; }
}
@media (max-width: 560px) {
  /* Header satu baris yang pendek: hamburger + logo/judul + pencarian
     dalam satu baris, bukan dua baris. Tinggi header turun dari
     ~110-140px menjadi ~56px, jadi konten tidak lagi tertutup. */
  .header-inner { padding: 8px 12px; gap: 8px; flex-wrap: nowrap; }
  .hamburger { width: 40px; height: 40px; }
  .site-brand { gap: 8px; }
  .site-brand .custom-logo { height: 32px; }
  .site-title { font-size: 15px; white-space: normal; line-height: 1.2; }
  .site-tagline { display: none; }
  .header-search { display: block; flex: 1 1 auto; min-width: 0; margin-left: 0; }
  .header-search input[type="search"] { padding: 8px 10px; font-size: 13px; }
  /* Saat di-scroll, baris pencarian disembunyikan (kelas is-compact
     dipasang oleh js/nav.js) supaya header makin pendek. */
  .header-bar.is-compact .header-search { display: none; }
  .header-bar.is-compact .header-inner { padding-top: 6px; padding-bottom: 6px; }
  .hero-cards { grid-template-columns: 1fr; }
  /* Hero: judul dipindah ke bawah gambar, di atas latar biru solid.
     Gambar poster jadi terlihat utuh — teks, tanggal, dan QR di poster
     tidak lagi tertutup judul. */
  .hero-featured { display: flex; flex-direction: column; }
  .hero-featured img { aspect-ratio: 16 / 9; }
  .hero-featured .hero-overlay,
  .hero-overlay {
    position: static;
    background: var(--mpi-blue);
    padding: 14px 16px;
  }
  .hero-overlay h2 { font-size: 18px; }
  .hero-featured.hero-no-image { min-height: 180px; }
  .hero-featured.hero-no-image .hero-overlay { background: var(--mpi-blue); }
  /* Slideshow News: slide jadi kolom — gambar di atas, judul di bawah
     di atas latar biru solid, supaya poster tidak tertutup. */
  .news-slider-track { aspect-ratio: auto; height: 360px; }
  .news-slide { display: flex; flex-direction: column; }
  .news-slide-link { flex: 0 0 58%; height: 58%; }
  .news-slide img { height: 100%; }
  .news-slide .hero-overlay {
    position: static; flex: 1;
    background: var(--mpi-blue);
    padding: 12px 14px;
  }
  .news-slide .hero-overlay h2 { font-size: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .news-slide.slide-no-image { display: flex; }
  .news-slide.slide-no-image .hero-overlay { position: static; background: var(--mpi-blue); }
  .news-slider-arrow { width: 48px; height: 48px; font-size: 28px; }
  .news-slider-dots { bottom: 8px; }
  .post-row { flex-direction: row; gap: 12px; }
  .post-row-thumb { flex: 0 0 96px; width: 96px; }
  .post-row h3 { font-size: 15px; }
  .post-excerpt { display: none; }
  .social-icons a { width: 40px; height: 40px; }
  .article-head h1, .page-title { font-size: 23px; }
  /* Peta: di layar sentuh, peta tidak bisa di-scroll paksa — petunjuk
     "ctrl + scroll" tidak berlaku di handphone dan menutupi pin.
     Peta dibuat non-interaktif, bukanya lewat tautan di bawahnya. */
  .footer-map-inner iframe { pointer-events: none; height: 220px; }
  .footer-bottom { padding-bottom: 24px; }
}
