/* ============================================================
 * KabarKini — Mobile Bottom Navbar
 * Style: HITAM-PUTIH CLEAN (NYT mobile app inspired)
 * ============================================================
 * Replaces: glassmorphism version
 * Behavior: auto-hide on scroll-down, slide-up drawer
 * Visible: ≤ 720px only
 * ============================================================ */

/* ---------------- Body padding (cegah konten ketutup navbar) ---------------- */
@media (max-width: 720px) {
  body.has-mobile-nav {
    padding-bottom: 64px; /* tinggi navbar */
  }
}

/* ============================================================
 * BOTTOM NAVBAR
 * ============================================================ */
.mobile-nav {
  display: none; /* hidden by default; show via @media below */
}

@media (max-width: 720px) {
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 64px;

    /* Solid white — no blur, no transparency */
    background: #ffffff;

    /* Top border: hairline ink (NYT-style) */
    border-top: 1px solid #0d0d0d;

    /* Subtle shadow upward for separation when content scrolls behind */
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);

    /* Animate the auto-hide */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Distribute items evenly */
    align-items: stretch;
    justify-content: space-around;

    /* Safe area for iPhone notch / home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Auto-hide state (toggled by mobile-nav.js when scrolling down) */
  .mobile-nav.is-hidden {
    transform: translateY(100%);
  }

  /* ---------------- Tab item ---------------- */
  .mobile-nav__item {
    flex: 1;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;

    /* Reset button defaults */
    background: transparent;
    border: none;
    cursor: pointer;

    /* Typography & color: ink + light gray inactive */
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #999;
    text-decoration: none;
    letter-spacing: 0.2px;

    transition: color 0.15s ease;

    /* Top accent bar for active state (will fill in .is-active) */
    position: relative;
  }

  .mobile-nav__item:hover {
    color: #0d0d0d;
  }

  /* Active state: black accent bar on top + ink text */
  .mobile-nav__item.is-active {
    color: #0d0d0d;
  }

  .mobile-nav__item.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: #0d0d0d;
    border-radius: 0 0 2px 2px;
  }

  .mobile-nav__item.is-active .mobile-nav__label {
    font-weight: 700;
  }

  /* Icon */
  .mobile-nav__icon {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.15s ease;
  }
  .mobile-nav__item:active .mobile-nav__icon {
    transform: scale(0.9);
  }

  /* Label */
  .mobile-nav__label {
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 9.5px;
  }
}

/* ============================================================
 * DRAWER BACKDROP (overlay gelap di belakang drawer)
 * ============================================================ */
.mobile-drawer__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(13, 13, 13, 0.55);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.mobile-drawer__backdrop.is-open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
 * DRAWER (slide-up sheet)
 * ============================================================ */
.mobile-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 120;
  max-height: 85vh;
  overflow-y: auto;

  background: #ffffff;
  border-top: 1px solid #0d0d0d;
  border-radius: 16px 16px 0 0;
  padding: 12px 20px 32px;

  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
}
.mobile-drawer.is-open {
  transform: translateY(0);
}

/* Drag handle (visual cue di top drawer) */
.mobile-drawer__handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 4px;
  margin: 0 auto 16px;
}

/* Title */
.mobile-drawer__title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: #0d0d0d;
}
.mobile-drawer__sub {
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  color: #777;
  margin: 0 0 20px;
}

/* Sections inside drawer */
.mobile-drawer__section {
  padding: 16px 0;
  border-top: 1px solid #f0f0f0;
}
.mobile-drawer__section:first-of-type {
  border-top: none;
  padding-top: 0;
}
.mobile-drawer__section h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #999;
  font-weight: 600;
  margin: 0 0 12px;
}

/* Grid (kategori) */
.mobile-drawer__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.mobile-drawer__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  text-decoration: none;
  color: #0d0d0d;
  font-family: 'Manrope', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.mobile-drawer__link:hover,
.mobile-drawer__link:active {
  background: #0d0d0d;
  color: white;
  border-color: #0d0d0d;
}
.mobile-drawer__link-emoji {
  font-size: 16px;
  line-height: 1;
}

/* Plain list */
.mobile-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mobile-drawer__list li {
  border-bottom: 1px solid #f5f5f5;
}
.mobile-drawer__list li:last-child {
  border-bottom: none;
}
.mobile-drawer__list a {
  display: block;
  padding: 12px 0;
  text-decoration: none;
  color: #333;
  font-family: 'Manrope', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  transition: color 0.15s ease;
}
.mobile-drawer__list a:hover,
.mobile-drawer__list a:active {
  color: #b91d3f;
}

/* CTA button */
.mobile-drawer__cta {
  display: block;
  text-align: center;
  padding: 14px 20px;
  background: #0d0d0d;
  color: white;
  text-decoration: none;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: background 0.15s ease;
}
.mobile-drawer__cta:hover,
.mobile-drawer__cta:active {
  background: #b91d3f;
}

/* ---------------- Hide drawer + backdrop on desktop ---------------- */
@media (min-width: 721px) {
  .mobile-drawer,
  .mobile-drawer__backdrop {
    display: none !important;
  }
}
