/* =========================================================================
   ceks100.d9lab.net — 移动端适配 v2  (2026-10-23)
   替换 user/themes/ceks/templates/partials/mobile.css
   注意：本文件必须在 ceks-fix.css 之后加载，否则 !important 冲突时会被覆盖
   ========================================================================= */

/* 移动端专属组件：>768px 一律不显示（媒体查询内的规则在后面，会覆盖这里） */
.ceks-burger, #ceks-mnav, .ceks-mask, #ceks-quickbar, #ceks-to-top { display: none; }

/* ---------- 0. 基础 ---------- */
@media (max-width: 768px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 16px; line-height: 1.75; overflow-x: hidden; }
  img, video, iframe { max-width: 100% !important; height: auto !important; }

  .container, .container-layout { width: 100% !important; padding: 0 14px !important; box-sizing: border-box; }
  .layout .line > [class*="x"] { width: 100% !important; float: none !important; }
  .line > .xl12, .line > .xs12 { width: 100% !important; float: none !important; }

  .padding-large { padding: 18px 14px !important; }
  .padding-big   { padding: 14px !important; }
  .blank-large, .blank-big { height: 22px !important; }
  .font-30 { font-size: 20px !important; }

  /* ---------- 1. 页头：logo + 搜索 + 汉堡，高度 184px → 56px ---------- */
  #pc-header .navbar {
    height: auto !important;
    position: sticky !important;
    top: 0;
    z-index: 1050;              /* 高于抽屉，汉堡在抽屉打开时仍可点（变 X 关闭） */
    backdrop-filter: saturate(140%) blur(6px);
  }
  #pc-header .navbar .line {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: nowrap; min-height: 56px;
  }
  #pc-header .logo { flex: 0 0 auto; width: auto !important; float: none !important; }
  #pc-header .logo img { width: auto !important; max-width: 128px; max-height: 40px; display: block; }
  /* 桌面导航在手机上隐藏，改由 #ceks-mnav 抽屉承载 */
  #pc-header .nav.nav-inline { display: none !important; }
  #pc-header .x1 { flex: 1 1 auto; float: none !important; width: auto !important;
    display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
  #pc-header .searchBar { position: static !important; right: auto !important; }
  #pc-header .searchBar .search-ico {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; font-size: 18px;
  }

  /* 汉堡按钮（模板注入 .ceks-burger） */
  .ceks-burger {
    flex: 0 0 auto; width: 44px; height: 44px; margin-left: 2px;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    background: none; border: 0; padding: 0; cursor: pointer;
  }
  .ceks-burger span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; transition: .25s; }
  .ceks-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .ceks-burger.open span:nth-child(2) { opacity: 0; }
  .ceks-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* 抽屉导航（模板注入 #ceks-mnav） */
  .ceks-mask {
    display: block;
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    opacity: 0; visibility: hidden; transition: .25s; z-index: 999;
  }
  .ceks-mask.open { opacity: 1; visibility: visible; }
  #ceks-mnav {
    display: block;
    position: fixed; top: 0; right: 0; bottom: 0; width: min(82vw, 320px);
    background: #1e1e1e; transform: translateX(100%); transition: transform .28s ease;
    z-index: 1000; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 66px 0 90px; box-shadow: -8px 0 24px rgba(0,0,0,.3);
  }
  #ceks-mnav.open { transform: none; }
  #ceks-mnav ul { list-style: none; margin: 0; padding: 0; }
  #ceks-mnav a {
    display: flex; align-items: center; min-height: 48px; padding: 12px 18px;
    color: #eee; font-size: 16px; text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.07);
  }
  #ceks-mnav li { position: relative; }
  #ceks-mnav li.active > a { color: #18c5d3; }
  #ceks-mnav .mnav-toggle {
    position: absolute; top: 2px; right: 4px; width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: 0; color: #9aa3ab; font-size: 16px; cursor: pointer;
  }
  #ceks-mnav li.expanded > .mnav-toggle i { transform: rotate(180deg); }
  #ceks-mnav .drop-menu { display: none; background: #141414; }
  #ceks-mnav li.expanded > .drop-menu { display: block; }
  #ceks-mnav .drop-menu a { padding-left: 34px; font-size: 15px; color: #b9c0c6; min-height: 44px; }
  #ceks-mnav .drop-menu a:before { content: "·"; margin-right: 8px; color: #18c5d3; }

  /* ---------- 2. 正文：不裁切 + 可读 ---------- */
  .article { overflow: visible !important; }              /* 原 .article{overflow:hidden} 会切掉内容 */
  .content, .content * { max-width: 100% !important; box-sizing: border-box; }
  .content { overflow-wrap: break-word; word-break: break-word; }
  .content p, .content li, .article .post p {
    font-size: 16px !important; line-height: 1.85 !important; margin-bottom: 14px;
  }
  .content img, .content video, .content iframe, .content svg { max-width: 100% !important; height: auto !important; }
  .content table { display: block; width: 100% !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .content pre { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .article .post h1 { font-size: 22px !important; line-height: 1.45 !important; }
  .article .post h2 { font-size: 19px !important; }
  .article .post h3 { font-size: 17px !important; }
  .nav-x { font-size: 13px; padding: 10px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ---------- 3. 列表 / 轮播 ---------- */
  .channel-banner { min-height: 120px !important; }
  .channel-banner h1 { font-size: 22px !important; }
  .list-news .media-img img { aspect-ratio: 16 / 10; object-fit: cover; }
  .owl-nav .owl-prev, .owl-nav .owl-next {
    width: 44px !important; height: 44px !important; line-height: 44px !important; font-size: 20px !important;
  }
  .slides-arrow.dot-center .owl-dots { top: -26px !important; }

  /* ---------- 4. 页脚 ---------- */
  .footer-contact .x4, footer ul li[class*="item-"] {
    width: 100% !important; float: none !important; display: block !important;
  }
  .footer-contact .contact-content {
    height: auto !important; min-height: 0 !important;
    padding: 18px 14px !important; margin: 10px 0 !important;
  }
  footer .qr { margin-left: 0 !important; }
  footer .contact .media { display: flex; align-items: flex-start; }
  footer .contact .media span { flex: 0 0 32px; width: 32px !important; height: 32px !important; line-height: 32px !important; }
  footer .contact .media i { font-size: 15px !important; line-height: 32px !important; }
  footer .contact .media .media-body { padding-left: 10px; }
  footer a { min-height: 44px; display: inline-flex; align-items: center; }

  /* ---------- 5. 表单：竖排、16px 防 iOS 缩放、≥44px 触摸 ---------- */
  .form-wrapper .form-field { display: block !important; margin: 0 0 14px !important; }
  .form-wrapper .form-label {
    display: block !important; width: 100% !important; float: none !important;
    text-align: left !important; padding: 0 0 6px !important; margin: 0 !important;
    font-size: 15px !important; color: #303030 !important; white-space: normal !important;
  }
  .form-wrapper .form-label label { font-size: 15px !important; }
  .form-wrapper .form-data, .form-wrapper .form-input-wrapper { display: block !important; width: 100% !important; }
  .form-wrapper input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]),
  .form-wrapper select, .form-wrapper textarea {
    display: block; width: 100% !important; min-height: 46px; height: 46px;
    padding: 10px 12px !important; font-size: 16px !important; line-height: 1.4;
    border: 1px solid #d8dee5; border-radius: 6px; background: #fff;
    box-sizing: border-box; -webkit-appearance: none; appearance: none;
  }
  .form-wrapper select { background-image: none; }
  .form-wrapper textarea { height: auto !important; min-height: 120px; }
  .form-wrapper .button, .form-wrapper button, .form-wrapper input[type="submit"] {
    width: 100% !important; min-height: 48px; font-size: 16px !important; border-radius: 6px;
  }
  .form-wrapper .form-errors, .form-wrapper .form-message { font-size: 15px; }
  .search-form input, .searchBar-m input, .simplesearch input[type="text"] {
    font-size: 16px !important; height: 44px !important;
  }

  /* ---------- 6. 底部快捷条 + 回到顶部 ---------- */
  body { padding-bottom: 56px; }                    /* 给固定底栏留空间 */
  #ceks-quickbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
    display: flex; height: 56px; background: #f5c942;
    box-shadow: 0 -2px 12px rgba(0,0,0,.12);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #ceks-quickbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: #3a3320; font-size: 12px; text-decoration: none;
  }
  #ceks-quickbar a i { font-size: 18px; }
  #ceks-to-top {
    position: fixed; right: 14px; bottom: 72px; z-index: 940;
    width: 44px; height: 44px; border-radius: 50%; border: 0;
    background: rgba(30,30,30,.72); color: #fff; font-size: 18px;
    display: none; align-items: center; justify-content: center;
  }
  #ceks-to-top.show { display: flex; }
}

/* ---------- 7. 平板竖屏：两列内容、页头仍压缩 ---------- */
@media (min-width: 769px) and (max-width: 1024px) {
  body { font-size: 16px; }
  .content p, .article .post p { font-size: 16px !important; line-height: 1.8 !important; }
}
