/*
 * MistingPazar — Journal3 akıcı mobil menü v2
 * - Yalnızca transform + opacity animasyonu (GPU dostu)
 * - Senkron layout/reflow gerektirmez
 * - Tekrarlı dokunma kilidi ve daha hızlı kapanış
 * - Telefon/tablet için modern, erişilebilir çekmece görünümü
 */

@media (max-width: 1024px) {
  html.mobile-header-active .mobile-main-menu-container,
  html.mobile-menu-active .mobile-main-menu-container,
  html.phone .mobile-main-menu-container,
  html.tablet .mobile-main-menu-container {
    display: block !important;
    width: min(88vw, 420px) !important;
    max-width: 420px !important;
    height: 100dvh;
    min-height: 100vh;
    box-sizing: border-box;
    overflow: hidden;

    /* Kapalı durum */
    visibility: hidden;
    pointer-events: none;
    opacity: 0.985;
    transform: translate3d(calc(-100% - 14px), 0, 0) scale(0.985) !important;
    transform-origin: left center;

    /* "transition: all" yerine yalnızca kompozitör dostu özellikler */
    transition:
      transform 280ms cubic-bezier(0.22, 0.8, 0.24, 1),
      opacity 180ms ease-out,
      visibility 0s linear 280ms !important;

    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    will-change: transform, opacity;
    contain: layout paint;
    background: #fff;
    border-radius: 0 18px 18px 0;
    box-shadow: 18px 0 50px rgba(13, 24, 45, 0.18);
  }

  html.mobile-main-menu-container-open .mobile-main-menu-container {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s !important;
  }

  html.mobile-main-menu-container-open .mobile-main-menu-container.animating {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1) !important;
  }

  /* Menü kapanırken yanlışlıkla tekrar tıklanmasını engeller. */
  .mobile-main-menu-container.mp-menu-closing {
    pointer-events: none;
  }

  .mobile-main-menu-container .mobile-wrapper-header,
  .mobile-main-menu-container .mobile-main-menu-wrapper,
  .mobile-main-menu-container .main-menu {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .mobile-main-menu-container .mobile-wrapper-header {
    height: 56px;
    min-height: 56px;
    padding-left: max(4px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.98);
  }

  .mobile-main-menu-container .mobile-wrapper-header > span {
    padding: 0 14px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #172033;
  }

  .mobile-main-menu-container .mobile-wrapper-header > .x {
    width: 40px;
    height: 40px;
    margin: 8px;
    border-radius: 12px;
    color: #263247;
    background: rgba(15, 23, 42, 0.055);
    transition: transform 160ms ease, background-color 160ms ease;
    touch-action: manipulation;
  }

  .mobile-main-menu-container .mobile-wrapper-header > .x:active {
    transform: scale(0.92);
    background: rgba(15, 23, 42, 0.11);
  }

  .mobile-main-menu-container .mobile-main-menu-wrapper {
    height: calc(100dvh - 56px);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .mobile-main-menu-container .mobile-main-menu-wrapper .main-menu {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: thin;
  }

  .mobile-main-menu-container .mobile-main-menu-wrapper .main-menu .main-menu .menu-item > a {
    min-height: 46px;
    height: auto;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .mobile-main-menu-container .open-menu {
    touch-action: manipulation;
  }

  /* Journal3'ün pahalı "all" overlay geçişini sadeleştirir. */
  .mobile-header-active .site-wrapper::before {
    transition:
      opacity 220ms ease-out,
      visibility 0s linear 220ms !important;
    background: rgba(7, 13, 24, 0.52) !important;
  }

  html.mobile-overlay .site-wrapper::before {
    transition-delay: 0s !important;
  }

  .menu-trigger,
  .menu-trigger a {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Sağdan sola diller için çekmece yönü. */
@media (max-width: 1024px) {
  html[dir='rtl'].mobile-header-active .mobile-main-menu-container,
  html[dir='rtl'].mobile-menu-active .mobile-main-menu-container,
  html[dir='rtl'].phone .mobile-main-menu-container,
  html[dir='rtl'].tablet .mobile-main-menu-container {
    left: auto;
    right: 0;
    border-radius: 18px 0 0 18px;
    transform-origin: right center;
    transform: translate3d(calc(100% + 14px), 0, 0) scale(0.985) !important;
    box-shadow: -18px 0 50px rgba(13, 24, 45, 0.18);
  }

  html[dir='rtl'].mobile-main-menu-container-open .mobile-main-menu-container.animating {
    transform: translate3d(0, 0, 0) scale(1) !important;
  }
}

/* Hareket azaltma tercihini destekler. */
@media (prefers-reduced-motion: reduce) {
  .mobile-main-menu-container,
  .mobile-header-active .site-wrapper::before {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
