/* ==========================================================================
   SIFF 移动端导航（≤1200px）
   1. 桌面大菜单收起为「logo + 搜索 / 语言 / 汉堡」，下拉面板由 mobile-nav.js 生成
      （模板里不再重复维护一份移动导航，与电视节 stvf-new 同一套做法）
   2. 顶部快速访问工具条移入菜单面板，窄屏不再单独占一行
   3. 只替换导航本身：各页为固定导航预留的间距保持不动，避免影响已适配好的版式
   ========================================================================== */

.mobile-header {
  display: none;
}

/* 桌面大菜单要 1280px 才排得开，1200px 以下（与 common.css 的旧断点一致）换成移动顶栏。
   html 前缀提高权重：base.css / 各页样式的 body{min-width:1280px} 会被它盖住 */
@media only screen and (max-width: 1200px) {
  html body {
    min-width: 0;
  }

  /* ---------- 桌面导航让位给移动版 ---------- */
  .header-top-bar,
  .main-header {
    display: none;
  }

  /* .main-nav 是固定定位，由 .main-nav-bar 补出占位；桌面是 40px 工具条，
     移动端换成 60px 顶栏，页面内容不会被盖住 */
  html .main-nav-bar {
    padding-top: 60px;
  }

  /* 首页（.rd-page）桌面上靠 80px 内边距避开 120px 的固定导航；
     移动端 .main-nav-bar 已经补了 60px 占位，这里必须清零，
     否则 60px 占位 + 80px 内边距会在导航下顶出一条空白 */
  html .rd-page {
    padding-top: 0;
  }

  /* ---------- 顶栏 ---------- */
  .mobile-header {
    display: block;
    position: relative;
    z-index: 2;
    height: 60px;
    background-color: #fff;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .12);
  }

  .mh-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 16px;
  }

  .mh-logo {
    display: flex;
    align-items: center;
  }

  .mh-logo img {
    display: block;
    height: 34px;
    width: auto;
  }

  .mh-actions {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .mh-search img {
    display: block;
    width: 20px;
    height: 20px;
  }

  .mh-lang {
    color: #403830;
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
  }

  /* 汉堡按钮：两横一竖收成 X，不依赖图片 */
  .mh-toggle {
    position: relative;
    width: 24px;
    height: 16px;
    margin-left: 2px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }

  .mh-toggle span {
    position: absolute;
    left: 0;
    display: block;
    width: 100%;
    height: 2px;
    background-color: #403830;
    transition: transform .3s cubic-bezier(.22, .61, .36, 1), opacity .2s ease;
  }

  .mh-toggle span:nth-child(1) {
    top: 0;
  }

  .mh-toggle span:nth-child(2) {
    top: 7px;
  }

  .mh-toggle span:nth-child(3) {
    top: 14px;
  }

  .mobile-header.is-open .mh-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-header.is-open .mh-toggle span:nth-child(2) {
    opacity: 0;
  }

  .mobile-header.is-open .mh-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ---------- 下拉菜单面板 ---------- */
  .mobile-menu {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    display: none;
    /* 占满剩余视口，面板打开时后面不再露出半截内容 */
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: #fff;
    border-top: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 24px 40px -28px rgba(60, 20, 15, .45);
  }

  .mobile-header.is-open .mobile-menu {
    display: block;
    animation: mm-in .22s ease both;
  }

  @keyframes mm-in {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* 顶部快速访问工具条（原 .header-top-bar） */
  .mm-utils {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin: 0;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    list-style: none;
  }

  .mm-utils a {
    color: rgba(64, 56, 48, .78);
    font-size: 13px;
    text-decoration: none;
  }

  .mm-list {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .mm-item {
    border-bottom: 1px solid rgba(0, 0, 0, .08);
  }

  .mm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    border: 0;
    background: none;
    color: #403830;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
  }

  .mm-head::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 2px;
    border-right: 1.5px solid #9a8f88;
    border-bottom: 1.5px solid #9a8f88;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .3s ease;
  }

  .mm-item.is-open .mm-head::after {
    transform: rotate(225deg) translateY(-2px);
  }

  .mm-sub {
    display: none;
    margin: 0;
    padding: 0 20px 8px;
    list-style: none;
  }

  .mm-item.is-open .mm-sub {
    display: block;
  }

  .mm-sub a {
    display: block;
    padding: 11px 0 11px 12px;
    border-left: 1px solid rgba(0, 0, 0, .1);
    color: #5c534b;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    text-decoration: none;
  }

  .mm-sub a:hover,
  .mm-sub a:active {
    color: #b61b11;
    border-left-color: #b61b11;
  }

  /* 面板打开时锁住正文滚动 */
  body.mobile-menu-open {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mh-toggle span,
  .mm-head::after {
    transition: none;
  }

  .mobile-header.is-open .mobile-menu {
    animation: none;
  }
}
