/* ==========================================================================
   AO3 中文档案库 · 手机 / 平板端样式
   --------------------------------------------------------------------------
   电脑端样式在 css/style.css，本文件只在窄屏生效，
   所有规则都写在 @media 里，不会影响电脑端。

   >> 想调手机端的距离，只改下面这段数字（单位 px，想离得近就改小、想离得远就改大）：
        --gap-hero-mobile     首屏：文字区 ↔ 三张截图 的垂直距离
        --gap-section-mobile  每个区块（热门分类 / 核心功能 / 常见问题…）之间的上下距离
   >> 想让三张截图整体往下移，改 style.css 里的 --showcase-offset。
   ========================================================================== */

@media (max-width: 1399px) {
  :root {
    --gap-hero-mobile: 15px;
    --gap-section-mobile: 62px;
  }
}

/* ==========================================================================
   1. 流式布局（窄屏放弃 12rem 定宽体系，尺寸统一用 px）
   ========================================================================== */

@media (max-width: 1399px) {
  body {
    font-size: 16px;
  }

  .fluid-container {
    min-width: 0;
    min-height: 0;
  }

  .content-container {
    width: 100%;
    max-width: 1120px;
    padding: 0 24px;
  }

  /* ---------- 顶部导航 ---------- */

  .nav {
    padding: 16px 0;
  }

  /* 间距统一用 margin 而不是 flex gap，兼容老华为 / 老安卓自带浏览器 */
  .brand-text {
    margin-left: 10px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .brand-name {
    font-size: 20px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .nav-links {
    align-items: center;
  }

  .nav-links li + li {
    margin-left: 18px;
  }

  .nav-links a {
    font-size: 15px;
  }

  .nav-links .nav-download {
    padding: 7px 18px;
  }

  /* ---------- 首屏 ---------- */

  .main-box {
    min-height: 0;
    padding: 20px 0 16px;
  }

  .intro {
    max-width: 560px;
    margin-right: 40px;
  }

  .eyebrow {
    padding: 5px 14px;
    font-size: 13px;
  }

  .intro-title {
    margin-top: 20px;
    font-size: 38px;
    line-height: 52px;
  }

  .intro-desc {
    margin-top: 16px;
    max-width: 540px;
    font-size: 17px;
    line-height: 28px;
  }

  .intro-desc--sub {
    margin-top: 14px;
    font-size: 15px;
    line-height: 26px;
  }

  .chips {
    /* 上 24px、左右 10px */
    margin: 19px -5px -5px;
  }

  .chip {
    margin: 5px;
    padding: 5px 12px;
    font-size: 13px;
  }

  .chip svg {
    width: 13px;
    height: 13px;
    margin-right: 5px;
  }

  .cta-row {
    /* 上 30px、按钮之间 16px */
    margin: 22px -8px -8px;
  }

  .btn {
    margin: 8px;
    height: 52px;
    font-size: 17px;
  }

  .btn svg {
    width: 19px;
    height: 19px;
    margin-right: 8px;
  }

  .btn-primary {
    padding: 0 32px;
    box-shadow: 0 10px 22px rgba(153, 0, 0, 0.26);
  }

  .btn-ghost {
    padding: 0 24px;
    font-size: 16px;
  }

  /* ---------- 三张截图 ---------- */

  .phone-glow {
    width: 700px;
    height: 580px;
  }

  .showcase-phones {
    width: 560px;
  }

  .shot {
    border-radius: 10px;
  }

  .shot--main {
    border-radius: 12px;
  }

  /* ---------- 区块通用 ---------- */

  .section {
    padding: var(--gap-section-mobile) 0 0;
    scroll-margin-top: 16px;
  }

  .section-head {
    gap: 20px;
    padding-bottom: 12px;
  }

  .section-title {
    font-size: 26px;
    line-height: 36px;
  }

  .section-sub {
    margin-top: 6px;
    font-size: 14px;
  }

  .section-more {
    font-size: 15px;
  }

  /* ---------- 热门分类 ---------- */

  .fandom-grid {
    gap: 14px;
    margin-top: 28px;
  }

  .fandom-card {
    padding: 18px;
    border-radius: 12px;
  }

  .fandom-name {
    font-size: 16px;
  }

  .fandom-en {
    margin-top: 4px;
    font-size: 11px;
  }

  .fandom-count {
    margin-top: 12px;
    font-size: 13px;
  }

  /* ---------- 核心功能 ---------- */

  .feature-list {
    gap: 14px;
    margin-top: 28px;
  }

  .feature-item {
    padding: 20px;
    border-radius: 12px;
  }

  .feature-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    border-radius: 11px;
  }

  .feature-icon svg {
    width: 22px;
    height: 22px;
  }

  .feature-title {
    font-size: 16px;
  }

  .feature-desc {
    margin-top: 7px;
    font-size: 13px;
    line-height: 22px;
  }

  /* ---------- 常见问题 ---------- */

  .faq-list {
    margin-top: 20px;
  }

  .faq-item summary {
    gap: 20px;
    padding: 18px 2px;
    font-size: 17px;
  }

  .faq-item summary::after {
    width: 8px;
    height: 8px;
  }

  .faq-answer {
    max-width: 100%;
    padding: 0 2px 20px;
    font-size: 15px;
    line-height: 26px;
  }

  /* ---------- 关于本站（展开按钮） ---------- */

  .about-more-btn {
    padding: 9px 20px;
    font-size: 15px;
  }

  .about-more-btn svg {
    width: 15px;
    height: 15px;
    margin-left: 8px;
  }

  .about-more-body {
    max-width: 100%;
    margin-top: 16px;
  }

  /* ---------- 正文 ---------- */

  .seo-text p {
    font-size: 15px;
    line-height: 27px;
  }

  .seo-text p + p {
    margin-top: 10px;
  }

  /* ---------- 底部行动区 ---------- */

  .cta-panel {
    margin-top: var(--gap-section-mobile);
    padding: 44px 24px;
    border-radius: 18px;
  }

  .cta-title {
    font-size: 26px;
    line-height: 38px;
  }

  .cta-sub {
    margin-top: 10px;
    max-width: 620px;
    font-size: 15px;
    line-height: 26px;
  }

  .cta-panel .btn-primary {
    margin-top: 24px;
  }

  /* ---------- 页脚 ---------- */

  .footer {
    margin-top: var(--gap-section-mobile);
    padding: 28px 0 32px;
    font-size: 13px;
    line-height: 22px;
  }

  .footer-links {
    margin-bottom: 10px;
  }

  .footer-links a + a {
    margin-left: 18px;
  }

  .footer-links a {
    font-size: 14px;
  }

  .footer-disclaimer {
    max-width: 760px;
    font-size: 12px;
    line-height: 21px;
  }

  /* ---------- 文档页（用户协议 / 隐私政策） ---------- */

  .doc {
    max-width: 800px;
    padding-top: 20px;
  }

  .doc h1 {
    font-size: 28px;
    line-height: 40px;
  }

  .doc .doc-meta {
    margin-top: 8px;
    font-size: 13px;
  }

  .doc .doc-body {
    margin-top: 22px;
    padding-top: 22px;
  }

  .doc h2 {
    margin: 26px 0 8px;
    font-size: 19px;
    line-height: 30px;
  }

  .doc p,
  .doc li {
    font-size: 15px;
    line-height: 27px;
  }
}

/* ==========================================================================
   2. 平板：分类 / 功能改两列，首屏改成上下结构
   ========================================================================== */

@media (max-width: 1000px) {
  .fandom-grid,
  .feature-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-box {
    flex-direction: column;
    align-items: flex-start;
  }

  /* 改成上下排列后，文字与截图的距离改用 margin-bottom */
  .intro {
    margin-right: 0;
    margin-bottom: var(--gap-hero-mobile);
  }

  /* 宽度上限放在 .showcase 上：这样里面的截图容器宽度才是确定的，
     老浏览器（不支持 aspect-ratio）靠父级宽度撑高度时才不会算错 */
  .showcase {
    align-self: center;
    width: 100%;
    max-width: 560px;
  }

  .showcase-phones {
    width: 100%;
    margin: 0 auto;
  }
}

/* ==========================================================================
   3. 手机：单列布局 + 抽屉式导航菜单
   ========================================================================== */

@media (max-width: 768px) {
  .content-container {
    padding: 0 16px;
  }

  /* ---------- 导航：左 Logo、右汉堡按钮 ---------- */

  .nav {
    position: relative;
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .brand-sub {
    display: none;
  }

  /* 没有 JS 时：导航退化成可以换行的普通链接，所有入口都点得到 */
  .nav-links {
    flex-wrap: wrap;
  }

  /* 有 JS 时：一行放不下就交给下面的抽屉菜单处理 */
  .js .nav {
    flex-wrap: nowrap;
  }

  /* 汉堡按钮：三条线，点开后变成叉 */
  .js .nav-toggle {
    display: flex;
    flex: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .js .nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform 0.25s ease, opacity 0.2s ease;
  }

  .js .nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .js .nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .js .nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* 抽屉面板：默认收起，点按钮后从导航栏下方滑出 */
  .js .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.13);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  }

  .js .nav-links li + li {
    margin-left: 0;
    margin-top: 2px;
  }

  .js .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  /* 这两项只在手机端菜单里出现 */
  .nav-only-mobile {
    display: block;
  }

  .js .nav-links a {
    display: block;
    padding: 12px;
    border-radius: 9px;
    font-size: 15px;
    color: var(--ink-2);
  }

  .js .nav-links a:hover {
    background: var(--brand-tint-2);
    color: var(--brand);
  }

  .js .nav-links .nav-download {
    margin-top: 4px;
    padding: 12px;
    border: 0;
    border-radius: 9px;
    background-color: var(--brand);
    background-image: linear-gradient(135deg, #b31414 0%, #8d0000 100%);
    color: #fff;
    text-align: center;
    font-weight: 600;
  }

  .js .nav-links .nav-download:hover {
    color: #fff;
  }

  /* ---------- 首屏 ---------- */

  .main-box {
    padding: 12px 0 6px;
  }

  .intro {
    max-width: 100%;
  }

  .intro-title {
    margin-top: 14px;
    font-size: 30px;
    line-height: 42px;
  }

  .intro-desc {
    font-size: 16px;
    line-height: 27px;
  }

  .intro-desc--sub {
    font-size: 14px;
    line-height: 24px;
  }

  .cta-row {
    /* 上 26px、按钮之间 14px */
    margin: 19px -7px -7px;
  }

  .btn {
    margin: 7px;
    height: 50px;
    font-size: 16px;
  }

  .btn-primary {
    flex: 1;
    min-width: 168px;
    padding: 0 22px;
  }

  /* 三张截图：中间大图在前、两侧被遮挡的叠放效果 */
  .showcase-phones {
    max-width: 100%;
  }

  .shot {
    border-radius: 8px;
  }

  .shot--main {
    border-radius: 10px;
  }

  /* ---------- 区块 ---------- */

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-title {
    font-size: 22px;
    line-height: 32px;
  }

  .fandom-card {
    padding: 16px;
  }

  .feature-list {
    grid-template-columns: 1fr;
  }

  .faq-item summary {
    font-size: 16px;
    line-height: 26px;
  }

  /* ---------- 底部行动区 ---------- */

  .cta-panel {
    padding: 34px 18px;
  }

  .cta-title {
    font-size: 22px;
    line-height: 34px;
  }

  .cta-panel .btn-primary {
    width: 100%;
    margin-top: 20px;
  }

  /* ---------- 页脚 ---------- */

  .footer {
    padding: 24px 0 28px;
  }

  .footer-disclaimer {
    text-align: left;
  }

  /* ---------- 文档页 ---------- */

  .doc h1 {
    font-size: 24px;
    line-height: 36px;
  }
}
