/* ==========================================================================
   STVF 移动端适配（≤1100px）
   1. 桌面大菜单收起为「logo + 搜索 / 语言 / 汉堡」，下拉面板由 mobile-nav.js 生成
   2. 解除 base.css 的 body{min-width:1280px}，各页自带的窄屏断点才会生效
   3. 顶部工具条在窄屏移入菜单面板
   ========================================================================== */

.mobile-header {
  display: none;
}

/* 桌面大菜单要 1280px 才排得开，1100px 以下统一换成移动顶栏。
   html body 提高权重：base.css / index-en.css 的 body{min-width:1280px}
   在模板里是后加载的，同等权重会被它们盖回 1280。 */
@media only screen and (max-width: 1100px) {
  html body {
    min-width: 0;
  }

  /* ---------- 桌面导航让位给移动版 ---------- */
  .header-top-bar,
  .main-header {
    display: none;
  }

  .main-nav-bar {
    padding-top: 60px;
  }

  /* .main-nav-bar 已为 60px 顶栏占位，各页面去掉桌面版为固定导航补的偏移，
     只保留设计本身需要的间距。
     统一加 html 前缀提高权重：各页样式表在模板里是后加载的，同权重会被盖回。 */
  html .stvf-home .rd-page {
    padding-top: 0;
  }

  html body.ab-body {
    padding-top: 0;
  }

  html .ab-hero {
    padding-top: 32px;
  }

  html .summary-hero {
    padding-top: 48px;
  }

  html .apply-page {
    padding-top: 48px;
  }

  /* 搜索页 / 视频列表页的外壳：list.css 里是固定 960px + 245px 上边距 */
  html .list-box {
    width: auto;
    min-height: 0;
    margin: 24px 16px 56px;
  }

  /* index.css 里搜索框固定 1016px、上边距 250px */
  html .search-panel {
    width: auto;
    margin: 20px 16px 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: #203a2c;
    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: #203a2c;
    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(11, 51, 32, .55);
  }

  .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);
    }
  }

  .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(32, 58, 44, .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: #203a2c;
    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 #8a978f;
    border-bottom: 1.5px solid #8a978f;
    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: #4f6157;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    text-decoration: none;
  }

  .mm-sub a:hover,
  .mm-sub a:active {
    color: #00974b;
    border-left-color: #00974b;
  }

  /* 面板打开时锁住正文滚动 */
  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;
  }
}
