/* ==========================================================================
   XFM Theme · adaptive.css
   与「档位」无关的两类适配：动效降级 / 打印

   注意：mobile / tablet / desktop 三档的布局、令牌、组件形态全部由
   layout/_partials/adaptive-style.ejs 依据 _config.yml 的 adaptive 一节
   动态生成为 html[data-tier="…"] 规则，改档位请改配置，不要在本文件里写宽度。
   本文件只保留无法归入档位的规则。
   ========================================================================== */

/* --------------------------------------------------------------------------
   档位切换：避免跨档瞬间跳变时的生硬闪烁
   -------------------------------------------------------------------------- */
html[data-tier] .site-body,
html[data-tier] .site-nav,
html[data-tier] .toc-column,
html[data-tier] .widget-column {
  transition: none;
}

/* --------------------------------------------------------------------------
   降级：用户偏好减少动效
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* 入场动画直接呈现终态，避免内容不可见 */
  .reveal,
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --------------------------------------------------------------------------
   打印样式
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .drawer,
  .drawer-mask,
  .nav-fab,
  .site-nav,
  .toc-column,
  .widget-column,
  .reading-progress,
  .floating-btn,
  .search-modal,
  .lightbox,
  .xfm-toast,
  .pagination,
  .comments-area,
  .post-share,
  .post-related,
  .post-reward,
  .post-nav,
  .breadcrumb {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000;
  }

  .site-body {
    display: block;
    max-width: none;
    padding: 0;
  }

  .content-wrap {
    max-width: none;
  }

  .post-view,
  .page-view {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .post-cover-hero {
    display: none;
  }

  .xfm-content {
    font-size: 12pt;
    line-height: 1.7;
    color: #000;
  }

  .xfm-content a {
    color: #000;
    border-bottom: 0;
  }

  .xfm-content a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555;
    word-break: break-all;
  }

  figure.highlight,
  .xfm-note,
  .xfm-fold,
  .xfm-tabs,
  .mermaid {
    break-inside: avoid;
  }

  .xfm-content .headline {
    break-after: avoid;
  }

  /* 折叠内容在打印时全部展开 */
  .fold-content,
  .xfm-fold.is-collapsed .fold-body {
    display: block !important;
    max-height: none !important;
  }

  @page {
    margin: 16mm 14mm;
  }
}
