/* ==========================================================================
   responsive.css
   Berisi: Semua @media queries (Mobile-first, Tablet, Desktop)
   Urutan load: 5 (harus terakhir)
   ========================================================================== */

/* --------------------------------------------------------------------------
   GLOBAL RESPONSIVE FIXES (Mencegah elemen keluar batas layar)
   -------------------------------------------------------------------------- */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   ≤ 1024px — Tablet landscape / small desktop
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .fp-hero {
    grid-template-columns: 1fr;
  }

  .fp-hero__sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .fp-side-card {
    flex: 1 1 240px;
  }

  .fp-cat-block__content {
    grid-template-columns: 1fr;
  }

  .related-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   ≤ 992px — Tablet portrait
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .single-layout-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
  }

  .social-sidebar-inner {
    display: none;
  }

  .right-sidebar {
    width: 100%;
    display: block;
  }

  .hero-section {
    grid-template-columns: 1fr;
  }

  .hero-sidebar {
    border-left: none;
    padding-left: 0;
  }

  .footer-widgets {
    grid-template-columns: 1fr 1fr;
    gap: 24px 36px;
  }
}

/* --------------------------------------------------------------------------
   ≤ 768px — Tablet kecil / landscape phone
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .fp-sub-hero__grid,
  .fp-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .fp-cat-block {
    padding: 18px 20px;
  }

  .block-content {
    grid-template-columns: 1fr;
  }

  .sub-hero-section,
  .post-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .menu-toggle {
    display: block;
    position: relative;
    z-index: 20;
  }

  /* 3. Logo ditengah header (Mobile) */
  body > .container > .site-header > .site-branding {
    position: absolute;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: auto; /* Jangan gunakan 100% agar tidak menutupi tombol */
    z-index: 10;
    text-align: center;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  body > .container > .site-header > .site-branding a {
    pointer-events: auto;
    display: inline-flex;
    justify-content: center;
    margin: 0;
    padding: 0;
  }

  body > .container > .site-header > .site-branding .custom-logo {
    margin: 0 auto !important;
    max-width: 130px !important; /* Batas logo utama mobile */
    display: block !important;
  }

  .header-icons {
    position: relative;
    z-index: 5;
    gap: 12px;
  }

  .header-divider,
  .desktop-social-icons {
    display: none !important;
  }

  /* ============================================================
     MENU DRAWER — Modern Redesign
     ============================================================ */
  .menu-drawer {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100dvh;
    background: var(--surface, #fff);
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    border-radius: 0 20px 20px 0;
    overflow: hidden;
  }

  .menu-drawer.is-active {
    left: 0;
    opacity: 1;
  }

  body.dark-mode .menu-drawer {
    background: #0f172a;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  }

  /* -- Header panel -- */
  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
  }

  body.dark-mode .drawer-header {
    border-bottom-color: #1e293b;
  }

  body .site-header .menu-drawer .drawer-logo .custom-logo {
    max-width: 130px !important;
    height: auto !important;
    display: block !important;
    margin: 0 !important;
  }

  .drawer-site-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.3px;
  }

  body .site-header .menu-drawer .menu-close-btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: var(--bg, #f8fafc) !important;
    border: 1px solid var(--border, #e5e7eb) !important;
    color: var(--text, #111) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: all 0.2s ease !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
  }

  body .site-header .menu-drawer .menu-close-btn:hover {
    background: var(--blue, #0056b3) !important;
    border-color: var(--blue, #0056b3) !important;
    color: #fff !important;
  }

  body.dark-mode .site-header .menu-drawer .menu-close-btn {
    background: #1e293b !important;
    border-color: #2d3748 !important;
    color: #e2e8f0 !important;
  }

  /* -- Scrollable body -- */
  .drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border, #e5e7eb) transparent;
  }

  .drawer-body::-webkit-scrollbar {
    width: 3px;
  }
  .drawer-body::-webkit-scrollbar-track {
    background: transparent;
  }
  .drawer-body::-webkit-scrollbar-thumb {
    background: var(--border, #e5e7eb);
    border-radius: 3px;
  }

  .drawer-section {
    padding: 4px 0;
  }

  .drawer-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted, #9ca3af);
    padding: 10px 20px 6px;
    margin: 0;
  }

  /* -- Nav items (link & button) -- */
  .drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1a1a1a);
    text-decoration: none;
    transition:
      background 0.18s ease,
      color 0.18s ease;
    text-align: left;
    position: relative;
  }

  body.dark-mode .drawer-nav-item {
    color: #e2e8f0;
  }

  .drawer-nav-item:hover,
  .drawer-nav-item:focus-visible {
    background: var(--blue-light, #eff6ff);
    color: var(--blue, #0056b3);
    outline: none;
  }

  body.dark-mode .drawer-nav-item:hover,
  body.dark-mode .drawer-nav-item:focus-visible {
    background: rgba(79, 156, 249, 0.1);
    color: var(--blue-mid, #4a9eff);
  }

  /* Ikon nav */
  .drawer-nav-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg, #f8fafc);
    border: 1px solid var(--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--blue, #0056b3);
    transition: all 0.18s ease;
  }

  body.dark-mode .drawer-nav-icon {
    background: #1e293b;
    border-color: #2d3748;
    color: var(--blue-mid, #4a9eff);
  }

  .drawer-nav-item:hover .drawer-nav-icon {
    background: var(--blue, #0056b3);
    border-color: var(--blue, #0056b3);
    color: #fff;
  }

  body.dark-mode .drawer-nav-item:hover .drawer-nav-icon {
    background: var(--blue, #0056b3);
    border-color: var(--blue, #0056b3);
    color: #fff;
  }

  .drawer-nav-label {
    flex: 1;
  }

  .drawer-nav-arrow {
    color: var(--text-muted, #9ca3af);
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.18s ease;
  }

  .drawer-nav-item:hover .drawer-nav-arrow {
    opacity: 1;
    transform: translateX(0);
  }

  /* -- Chevron toggle untuk kategori -- */
  .drawer-chevron {
    color: var(--text-muted, #9ca3af);
    transition: transform 0.25s ease;
    flex-shrink: 0;
  }

  .drawer-cat-toggle[aria-expanded="true"] .drawer-chevron {
    transform: rotate(180deg);
  }

  .drawer-cat-toggle[aria-expanded="true"] {
    color: var(--blue, #0056b3);
  }

  body.dark-mode .drawer-cat-toggle[aria-expanded="true"] {
    color: var(--blue-mid, #4a9eff);
  }

  /* -- Kategori dropdown -- */
  .drawer-cat-dropdown {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .drawer-cat-dropdown.is-open {
    max-height: 400px;
  }

  .drawer-cat-list {
    list-style: none;
    margin: 0;
    padding: 4px 0 8px 68px;
  }

  .drawer-cat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px 8px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text, #374151);
    text-decoration: none;
    transition: color 0.15s ease;
  }

  body.dark-mode .drawer-cat-item {
    color: #94a3b8;
  }

  .drawer-cat-item:hover {
    color: var(--blue, #0056b3);
  }

  body.dark-mode .drawer-cat-item:hover {
    color: var(--blue-mid, #4a9eff);
  }

  .drawer-cat-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border, #d1d5db);
    flex-shrink: 0;
    transition: background 0.15s ease;
  }

  .drawer-cat-item:hover .drawer-cat-dot {
    background: var(--blue, #0056b3);
  }

  .drawer-cat-count {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    background: var(--bg, #f3f4f6);
    padding: 1px 7px;
    border-radius: 20px;
    font-weight: 600;
  }

  body.dark-mode .drawer-cat-count {
    background: #1e293b;
  }

  /* -- Divider -- */
  .drawer-divider {
    height: 1px;
    background: var(--border, #e5e7eb);
    margin: 8px 20px;
  }

  body.dark-mode .drawer-divider {
    background: #1e293b;
  }

  /* -- Footer sosial media -- */
  .drawer-footer {
    border-top: 1px solid var(--border, #e5e7eb);
    padding: 16px 20px 20px;
    flex-shrink: 0;
    background: var(--bg, #f8fafc);
  }

  body.dark-mode .drawer-footer {
    border-top-color: #1e293b;
    background: #0a0f1e;
  }

  .drawer-footer-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted, #9ca3af);
    margin: 0 0 12px;
  }

  .drawer-social {
    display: flex;
    gap: 10px;
  }

  .drawer-social-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6b7280);
    transition: all 0.2s ease;
  }

  body.dark-mode .drawer-social-btn {
    background: #1e293b;
    border-color: #2d3748;
    color: #94a3b8;
  }

  .drawer-social-btn:hover {
    background: var(--blue, #0056b3);
    border-color: var(--blue, #0056b3);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.3);
  }

  /* ============================================================
     FALLBACK PAKSA — Pastikan konten drawer selalu terlihat
     Mengatasi bug Safari iOS dengan animation-fill-mode: both
     ============================================================ */
  .menu-drawer .drawer-header,
  .menu-drawer .drawer-body,
  .menu-drawer .drawer-footer,
  .menu-drawer .drawer-section,
  .menu-drawer .drawer-nav-item,
  .menu-drawer .drawer-nav-icon,
  .menu-drawer .drawer-nav-label,
  .menu-drawer .drawer-section-label,
  .menu-drawer .drawer-footer-label,
  .menu-drawer .drawer-social,
  .menu-drawer .menu-close-btn {
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Sembunyikan menu bawaan desktop saat masuk ke tampilan mobile */
  .desktop-menu {
    display: none !important;
  }

  /* =========================================================
     Tampilan Search Fullscreen Mobile (Layar Hitam & Animasi)
     ========================================================= */

  body .site-header .header-icons,
  body .site-header .search-container {
    position: static !important;
  }

  /* Wujud Layar Fullscreen Awal (Tersembunyi tapi ada di layar) */
  body .site-header .search-form {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.92) !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding-top: 130px !important; /* Diubah agar kotak pencarian turun */
    opacity: 0 !important;
    visibility: hidden !important;
    transform: none !important;
    transition:
      opacity 0.4s ease,
      visibility 0.4s ease !important;
  }

  /* Saat Terbuka */
  body .site-header .search-form.active {
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Setup Awal Kotak Input & Tombol (Sebelum muncul, posisi ditarik ke atas) */
  body .site-header .search-form .search-field,
  body .site-header .search-form .search-close-btn {
    opacity: 0 !important;
    transform: translateY(-40px) !important;
    transition:
      opacity 0.4s ease,
      transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  }

  /* Saat Muncul (Diturunkan dan diperlihatkan) */
  body .site-header .search-form.active .search-field,
  body .site-header .search-form.active .search-close-btn {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }

  /* Styling Visual Kotak Input */
  body .site-header .search-form .search-field {
    position: relative !important;
    width: 88% !important;
    max-width: 380px !important;
    padding: 16px 20px !important;
    font-size: 16px !important;
    background: #1f1f1f !important;
    color: #fff !important;
    border: 1px solid #444 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
    top: auto !important;
    right: auto !important;
  }

  /* Styling Visual Tombol Close */
  body .site-header .search-form .search-close-btn {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: fixed !important;
    top: 30px !important; /* Diubah agar memberi jarak aman dari atas layar */
    right: 20px !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    cursor: pointer !important;
    z-index: 100000 !important;
  }
  /* --- Memperbaiki Overlay Menu agar Full Layar & Instan --- */

  /* Menghilangkan transisi pada container agar tidak ada sisa warna putih */
  body.menu-open .container {
    transition: none !important;
  }

  /* Membuat background header transparan secara instan */
  body.menu-open .site-header {
    background: transparent !important;
    border-bottom: none !important;
    transition: none !important;
    box-shadow: none !important;
  }

  /* Menyembunyikan ikon secara instan */
  body.menu-open .menu-toggle,
  body.menu-open .site-branding,
  body.menu-open .header-icons {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: none !important;
  }

  /* Memastikan overlay muncul tanpa animasi delay */
  body.menu-open .menu-overlay {
    transition: none !important;
    background: rgba(0, 0, 0, 0.5) !important;
  }
}

/* --------------------------------------------------------------------------
   ≤ 640px — Smartphone besar
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .main-navigation ul {
    gap: 10px;
  }

  .main-navigation a {
    font-size: 13px;
  }

  .fp-sub-hero__grid,
  .fp-grid,
  .sub-hero-section,
  .post-grid {
    grid-template-columns: 1fr !important;
  }

  .footer-widgets {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .site-footer {
    padding-top: 36px;
  }

  .related-grid-4 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .comment-form-wrap {
    padding: 18px 16px;
  }

  .cf-field,
  #mt-comment-form .cf-field {
    min-width: 100%;
  }

  .comment-list .children {
    padding-left: 22px;
  }

  .single-content {
    font-size: 15px;
    overflow-wrap: break-word;
  }

  .single-title {
    font-size: 24px;
  }
}

/* --------------------------------------------------------------------------
   ≤ 560px — Smartphone standar
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  .fp-hero__sidebar {
    flex-direction: column;
  }

  .fp-side-card {
    flex: 1 1 100%;
  }

  .fp-hero__body {
    padding: 16px 16px 20px;
  }

  .author-box {
    flex-direction: column;
    text-align: center;
  }
}

/* --------------------------------------------------------------------------
   ≤ 400px — Smartphone kecil
   -------------------------------------------------------------------------- */
@media (max-width: 400px) {
  body .site-header .site-branding .custom-logo {
    max-width: 200px !important;
  }

  .fp-hero__title {
    font-size: 20px;
  }
}

/* ============================================================
   FORCE FIX V2: TAMPILAN HERO & SIDEBAR DI MOBILE
   ============================================================ */

@media (max-width: 992px) {
  /* --- 1. ARTIKEL UTAMA (HERO) --- */
  .fp-hero__primary {
    display: block !important;
    width: 100% !important;
    margin-bottom: 24px !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .fp-hero__card {
    display: flex !important;
    flex-direction: column !important; /* Paksa susunan atas-bawah */
    width: 100% !important;
  }

  /* Paksa gambar dan teks untuk mengambil lebar penuh layar */
  .fp-hero__thumb-link,
  .fp-hero__thumb,
  .fp-hero__body {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .fp-hero__thumb {
    margin-bottom: 16px !important; /* Memberi jarak antara gambar dan judul di bawahnya */
  }

  .fp-hero__thumb img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
  }
}

@media (max-width: 640px) {
  /* --- 2. ARTIKEL SIDEBAR (BAWAHNYA) --- */
  .fp-side-card {
    display: flex !important;
    flex-direction: column !important; /* Paksa susunan atas-bawah */
    width: 100% !important;
    margin-bottom: 24px !important;
  }

  /* Paksa gambar dan teks sidebar mengambil lebar penuh */
  .fp-side-card__thumb-link,
  .fp-side-card__thumb,
  .fp-side-card__body {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .fp-side-card__thumb {
    margin-bottom: 12px !important; /* Jarak gambar ke judul */
  }

  .fp-side-card__thumb img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
  }
}
/* ============================================================
   MENCEGAH HALAMAN BISA DIGESER KE KANAN (STICKY FIX)
   ============================================================ */
html,
body {
  overflow-x: clip !important; /* Mengubah hidden menjadi clip agar sticky tetap hidup */
  overflow-y: visible !important; /* Memastikan scroll vertikal aman */
  width: 100% !important;
  max-width: 100vw !important;
  position: static !important; /* Mengubah relative menjadi static */
}

.container,
.fp-main {
  width: 100% !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding-left: 36px !important;
  padding-right: 36px !important;
  box-sizing: border-box !important;
}

.fp-hero,
.fp-sub-hero__grid,
.fp-grid {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* ============================================================
   ARTIKEL UTAMA TIDAK TAMPIL & HALAMAN BISA DIGESER KANAN
   ============================================================ */

/* Pastikan semua child fp-hero tidak overflow */
.fp-hero__primary,
.fp-hero__sidebar,
.fp-hero__card,
.fp-hero__thumb-link,
.fp-hero__thumb,
.fp-hero__body {
  box-sizing: border-box !important;
  max-width: 100% !important;
}

@media (max-width: 992px) {
  /* Reset grid fp-hero menjadi 1 kolom penuh */
  .fp-hero {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  /* Artikel utama ambil lebar penuh */
  .fp-hero__primary {
    width: 100% !important;
    min-width: 0 !important; /* ← INI KUNCI: cegah min-width paksa lebar keluar */
    flex-shrink: 0 !important;
  }

  /* Sidebar juga ambil lebar penuh */
  .fp-hero__sidebar {
    width: 100% !important;
    min-width: 0 !important;
  }
}

body.dark-mode > .container:first-of-type {
  background: var(--bg, #0f172a);
}
