/* ============================================================
   KABAR UTAMA - Premium Indonesian News Portal
   responsive.css — Responsive Stylesheet
   ============================================================ */

/* ============================================================
   LARGE DESKTOP  ≥ 1400px
   ============================================================ */
@media (min-width: 1400px) {
  :root { --container: 1320px; }
}

/* ============================================================
   DESKTOP  ≤ 1199px
   ============================================================ */
@media (max-width: 1199px) {
  :root { --container: 960px; }

  .news-grid-4 { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 200px 1fr 1fr 1fr; gap: 24px; }
  .hero-grid { grid-template-columns: 1fr 280px; }
  .hero-caption h2 { font-size: 22px; }
  .ad-leaderboard { width: 468px; height: 60px; }
  .sticky-share { left: 8px; }
}

/* ============================================================
   TABLET  ≤ 991px
   ============================================================ */
@media (max-width: 991px) {
  /* Nav */
  .site-nav { display: none; }
  .btn-hamburger { display: flex; }
  .mobile-nav { display: block; }

  /* Layout */
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { display: grid; grid-template-columns: repeat(2, 1fr); }

  .content-wrap { grid-template-columns: 1fr; }
  /* Reset sticky di tablet/mobile */
  .content-wrap > *:first-child { align-self: auto; }
  .sidebar { align-self: auto; }
  .sidebar-sticky {
    position: static;
    top: auto;
    max-height: none;
    overflow-y: visible;
  }

  .news-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .news-grid-3 { grid-template-columns: repeat(2, 1fr); }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }

  .contact-grid { grid-template-columns: 1fr; }
  .author-hero-inner { flex-direction: column; text-align: center; }

  /* Header */
  .header-ad-leaderboard { display: none; }
  .logo-text .tagline { display: none; }

  /* Mobile leaderboard ad (di luar header, muncul hanya ≤ 991px) */
  .mobile-leaderboard-ad {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    /* Sticky tepat di bawah header — top = tinggi header (logo 36px + padding 12px×2 = 60px) */
    position: sticky;
    top: 60px;
    z-index: 998;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
  }

  /* Article */
  .sticky-share { display: none; }

  .viral-grid { grid-template-columns: 1fr 1fr; }

  .mega-menu { display: none; }

  .ad-halfpage { width: 100%; max-width: 300px; }
}

/* ============================================================
   MOBILE  ≤ 767px
   ============================================================ */
@media (max-width: 767px) {
  /* Topbar */
  .topbar { display: none; }

  /* Base */
  html { font-size: 15px; }

  /* Header */
  .header-main { padding: 10px 0; }
  .btn-login { display: none; }

  /* Mobile leaderboard ad — sesuaikan top karena header lebih pendek di mobile */
  /* logo 28px + padding-top 10px + padding-bottom 10px = 48px */
  .mobile-leaderboard-ad { top: 48px; }

  /* Hero */
  .hero-section { padding: 12px 0 0; }
  .hero-slide img { height: 240px; }
  .hero-caption h2 { font-size: 16px; }
  .hero-caption { padding: 20px 14px 14px; }
  .hero-side { display: none; }

  /* Grids */
  .news-grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .news-grid-3 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .news-grid-2 { grid-template-columns: 1fr; }

  .viral-grid { grid-template-columns: 1fr; }
  .viral-card img { height: 200px; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; }
  .footer-top { padding: 32px 0 20px; }

  /* Newsletter */
  .newsletter-form { flex-direction: column; }
  .newsletter-form button { width: 100%; }
  .newsletter-inner h2 { font-size: 20px; }

  /* Article */
  .article-title { font-size: 22px; }
  .article-meta-row { gap: 10px; }
  .article-share { width: 100%; }
  .article-content p { font-size: 15px; }
  .article-body { padding: 16px; }
  .article-header { padding: 16px; }

  /* Form */
  .form-row { grid-template-columns: 1fr; }

  /* Login */
  .login-card { padding: 28px 20px; }

  /* Contact */
  .contact-form-wrap { padding: 20px; }

  /* Search overlay */
  .search-box { padding: 20px; }
  .search-box h3 { font-size: 15px; }

  /* Mobile sticky ad */
  .mobile-sticky-ad { display: flex; }

  /* Back to top position */
  #back-to-top { bottom: 70px; }

  /* Section */
  .section { padding: 20px 0; }
  .section-title h2 { font-size: 15px; }

  /* Author */
  .author-stats { gap: 16px; }
  .author-hero-info h1 { font-size: 22px; }

  /* Category block */
  .category-block { margin-bottom: 16px; }

  /* Counted widget */
  .countdown-box .num { font-size: 22px; min-width: 40px; }
}

/* ============================================================
   SMALL MOBILE  ≤ 480px
   ============================================================ */
@media (max-width: 480px) {
  .news-grid-4 { grid-template-columns: 1fr; }
  .news-grid-3 { grid-template-columns: 1fr; }
  .hero-side { display: none; }
  .hero-slide img { height: 200px; }
  .news-card-img { height: 160px; }
  .reactions-btns { gap: 8px; }
  .react-btn { padding: 8px 10px; min-width: 54px; font-size: 18px; }
  .author-stats { flex-wrap: wrap; }
}

/* ============================================================
   MOBILE NAV OVERLAY
   ============================================================ */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1050;
  display: none;
}
.mobile-nav-overlay.open { display: block; }

.mobile-nav-panel {
  position: fixed;
  top: 0; left: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg-white);
  z-index: 1051;
  overflow-y: auto;
  transition: left .3s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.mobile-nav-panel.open { left: 0; }
.mobile-nav-header {
  background: var(--primary);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mobile-nav-header .logo-text .name,
.mobile-nav-header .logo-text .tagline { color: #fff; }
.mobile-nav-close {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.mobile-nav-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.mobile-nav-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-soft);
  outline: none;
  color: var(--text-dark);
  font-family: var(--font-body);
}
.mobile-nav-menu { padding: 8px 0; }
.mobile-nav-menu .menu-item {
  border-bottom: 1px solid var(--border);
}
.mobile-nav-menu .menu-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  transition: background var(--transition);
}
.mobile-nav-menu .menu-item a:hover { background: var(--bg-soft); color: var(--primary); }
.mobile-nav-menu .menu-item a.active { color: var(--primary); font-weight: 700; }
.mobile-nav-sub {
  background: var(--bg-soft);
  display: none;
}
.mobile-nav-sub a {
  padding: 9px 28px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  color: var(--text-mid) !important;
  border-top: 1px solid var(--border);
}
.mobile-nav-sub a:hover { color: var(--primary) !important; }
.mobile-nav-actions {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-nav-actions .btn-login {
  display: flex;
  justify-content: center;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .site-header, .site-nav, .topbar, .breaking-banner,
  .sidebar, .newsletter-section, .site-footer,
  .sticky-share, #back-to-top, .mobile-sticky-ad,
  .ad-box, .reactions-box, .comment-section,
  .related-articles { display: none !important; }

  body { background: #fff; color: #000; }
  .article-body { border: none; padding: 0; }
  .article-title { font-size: 24px; }
  .article-content p { font-size: 14px; }
  .content-wrap { grid-template-columns: 1fr; }
}

/* ============================================================
   DARK MODE ADJUSTMENTS
   ============================================================ */
body.dark-mode .news-card { background: var(--bg-soft); }
body.dark-mode .article-header,
body.dark-mode .article-body,
body.dark-mode .comment-section,
body.dark-mode .reactions-box { background: var(--bg-soft); }
body.dark-mode .search-box { background: #1F2937; }
body.dark-mode .search-input-wrap input { background: #111827; color: #F3F4F6; }
body.dark-mode .toc-box { background: #1F2937; }
body.dark-mode .author-box { background: #1F2937; }
body.dark-mode .sidebar-widget { background: var(--bg-soft); }
body.dark-mode .form-control { background: #1F2937; color: #F3F4F6; border-color: #374151; }
body.dark-mode .mobile-nav-panel { background: #111827; }
body.dark-mode .mobile-nav-sub { background: #1F2937; }
body.dark-mode .mobile-nav-menu .menu-item a { color: #F3F4F6; }
body.dark-mode .topbar { background: #0d1a2e; }
body.dark-mode .site-nav { background: #003B70; }
body.dark-mode .mega-menu { background: #111827; }
body.dark-mode .mega-col ul li a { color: #D1D5DB; }
body.dark-mode .login-card { background: #1F2937; }
body.dark-mode .contact-form-wrap,
body.dark-mode .contact-info-wrap { background: var(--bg-soft); }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .topbar-trending .ticker,
  .breaking-ticker ul { animation: none; }
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
