/**
 * nhp：移动端顶栏「分类」抽屉 — 仅从右侧滑出；大屏完全隐藏控件，不改 PC 顶栏排版
 * 断点与同主题 Elementor 顶栏约定一致（见 post-9447.css）
 */

/* 桌面和平板大屏：不出现触发器也不参与交互 */
@media (min-width: 1025px) {
  .nhp-mobile-cat-trigger {
    display: none !important;
  }

  /* 兜底：即使有脚本误加状态，亦不展示遮罩与面板 */
  .nhp-mobile-cat-drawer {
    display: none !important;
  }
}

/* 打开时锁住背景滚动，避免穿透到底层页面 */
@media (max-width: 1024px) {
  html.oc-mobile-cat-drawer-open,
  body.oc-mobile-cat-drawer-open {
    overflow: hidden;
    overscroll-behavior: contain;
  }
}

@media (max-width: 1024px) {
  /*
   * 顶栏区域内提高优先级（避免 Elementor/Flex 或主题字体规则把按钮「压没」）；
   * 图标改用纯 CSS 三道杠：不依赖 Font Awesome 是否在移动端就绪。
   */
  #haru-header .elementor-element-609242e > button.nhp-mobile-cat-trigger,
  #haru-header .nhp-mobile-cat-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important;
    margin-left: 10px !important;
    padding: 6px 8px !important;
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: transparent;
    color: #4a4a4a !important;
    cursor: pointer;
    vertical-align: middle;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 15;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box !important;
  }

  /* 纯 CSS 汉堡线（居中堆叠三根） */
  #haru-header .nhp-mobile-cat-trigger__bars {
    display: block;
    flex: 0 0 auto;
    width: 20px;
    height: 2px;
    border-radius: 1px;
    background-color: currentColor;
    box-shadow: 0 7px 0 0 currentColor, 0 -7px 0 0 currentColor;
  }

  /* 若模板里仍有 Font Awesome 图标，顺带保证可见尺寸 */
  #haru-header .nhp-mobile-cat-trigger i {
    font-size: 1.15rem !important;
    line-height: 1 !important;
    color: inherit !important;
    display: inline-block !important;
    opacity: 1 !important;
  }

  /* 可见标签：兜底避免「仅能点到、看不见控件」的情况 */
  #haru-header .nhp-mobile-cat-trigger__label {
    display: inline !important;
    margin-left: 6px !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    line-height: 1 !important;
    clip: unset !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    max-width: 4.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit !important;
  }

  #haru-header .nhp-mobile-cat-trigger:focus-visible {
    outline: 2px solid #768869;
    outline-offset: 2px;
  }
}

.nhp-mobile-cat-drawer {
  box-sizing: border-box;
}

.nhp-mobile-cat-drawer,
.nhp-mobile-cat-drawer * {
  box-sizing: inherit;
}

/* 未打开时不抢占点击、不参与焦点环 */
.nhp-mobile-cat-drawer:not(.is-open) {
  visibility: hidden;
  pointer-events: none;
}

.nhp-mobile-cat-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.nhp-mobile-cat-drawer__backdrop {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.nhp-mobile-cat-drawer.is-open .nhp-mobile-cat-drawer__backdrop {
  opacity: 1;
}

.nhp-mobile-cat-drawer__panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100051;
  display: flex;
  flex-direction: column;
  width: min(88vw, 320px);
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.nhp-mobile-cat-drawer.is-open .nhp-mobile-cat-drawer__panel {
  transform: translateX(0);
}

/* 关闭钮：面板左上角（用户指定） */
.nhp-mobile-cat-drawer__close {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #333;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nhp-mobile-cat-drawer__close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.nhp-mobile-cat-drawer__close:focus-visible {
  outline: 2px solid #768869;
  outline-offset: 2px;
}

.nhp-mobile-cat-drawer__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 56px 16px 24px 16px;
}

.nhp-mobile-cat-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nhp-mobile-cat-drawer__item {
  border-bottom: 1px solid #ecece8;
}

.nhp-mobile-cat-drawer__item:last-child {
  border-bottom: none;
}

.nhp-mobile-cat-drawer__link {
  display: block;
  padding: 14px 4px;
  color: #333;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.35;
}

.nhp-mobile-cat-drawer__link:hover,
.nhp-mobile-cat-drawer__link:focus-visible {
  color: #5f6f57;
  text-decoration: underline;
}

/* 减少动画干扰（系统偏好） */
@media (prefers-reduced-motion: reduce) {
  .nhp-mobile-cat-drawer__backdrop,
  .nhp-mobile-cat-drawer__panel {
    transition: none;
  }
}
