/* 手机/平板：上一页、下一页固定在屏幕底部，正文在其上方滚动，单手好点。
   断点与 Material 的抽屉导航一致（≤ 76.1875em）；桌面端保持原样。 */
@media screen and (max-width: 76.1875em) {
  .md-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3; /* 高于正文，低于抽屉导航与图片放大层 */
    padding-bottom: env(safe-area-inset-bottom);
    /* 必须是实色：默认的 --md-footer-bg-color--dark 是半透明，会透出下面的正文 */
    background-color: var(--md-primary-fg-color);
    box-shadow: 0 -0.05rem 0.4rem rgba(0, 0, 0, 0.18);
  }

  /* 版权、主题署名对手机没用，隐藏后底栏更矮 */
  .md-footer-meta {
    display: none;
  }

  /* Material 默认给链接留了很高的上内边距、把「上一页/下一页」绝对定位在上方，
     固定在底部会占掉太多屏幕：改成两行紧凑排版。 */
  /* 底栏高度写死，下面 .md-main 的留白才能和它对上 */
  .md-footer__inner {
    height: 3.2rem;
    padding: 0;
    overflow: hidden;
    align-items: center;
  }

  .md-footer__link {
    align-items: center;
    padding: 0 0.6rem;
  }

  /* 小屏下 Material 会藏起上一页的标题、只剩箭头，这里让两边都显示 */
  .md-footer__link--prev {
    flex-shrink: 1;
    min-width: 0;
  }

  .md-footer__link--prev .md-footer__title {
    display: block;
  }

  .md-footer__direction {
    position: static;
    font-size: 0.6rem;
    opacity: 0.75;
  }

  .md-footer__title {
    margin-bottom: 0;
    font-size: 0.75rem;
    line-height: 1.3;
  }

  /* 正文底部 = 底栏高度 + 一段呼吸间距，最后一行不会贴着或被底栏挡住 */
  .md-main {
    padding-bottom: calc(3.2rem + 1.6rem + env(safe-area-inset-bottom));
  }
}

/* 截图缩小显示：原先撑满正文宽度，手机截图又细又长，一屏只能看到半张。
   点图仍会用 glightbox 打开原图放大。尺寸改这里的变量即可。 */
:root {
  --shot-max-width: 280px;
}

@media screen and (max-width: 44.984375em) {
  :root {
    --shot-max-width: 220px;
  }
}

.md-typeset a.glightbox img {
  display: block;
  width: auto;
  max-width: min(100%, var(--shot-max-width));
  height: auto;
  border-radius: 0.4rem;
  box-shadow: 0 0.05rem 0.4rem rgba(0, 0, 0, 0.15);
}

/* 搜索结果：页面标题是 <h1>（左边带文档图标），小节标题是 <h2>。
   页面标题原先是普通黑字，看起来像分组标题而不是能点的链接：
   统一成链接色 + 加粗 + 右侧箭头，悬停/选中时加下划线；小节标题保持较小的深色字。 */
.md-search-result__link {
  cursor: pointer;
}

.md-search-result__article h1 {
  color: var(--md-typeset-a-color);
  font-weight: 600;
}

.md-search-result__article h1::after {
  content: " ›";
  opacity: 0.6;
}

.md-search-result__article h2 {
  margin: 0.6em 0 0.3em;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.md-search-result__link:hover h1,
.md-search-result__link[data-md-state="active"] h1 {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* 左侧导航：分组（如「账号」）是标题，不是链接。
   字号、字重比下面的章节更大更重；章节用链接色，悬停下划线，表示可以点。 */
.md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item--section > .md-nav__link {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--md-default-fg-color);
}

.md-sidebar--primary .md-nav--primary a.md-nav__link {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--md-typeset-a-color);
}

.md-sidebar--primary .md-nav--primary a.md-nav__link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.md-sidebar--primary .md-nav--primary a.md-nav__link--active {
  font-weight: 700;
  text-decoration: none;
  background-color: var(--md-accent-fg-color--transparent);
  border-radius: 0.2rem;
}
