/* ═══════════════════════════════════════════════════
   components.css — 全站共用组件与全局增强
   由 includes/navbar.php 统一引入，所有前台页生效
   ═══════════════════════════════════════════════════ */

/* ─── 全局：消除偶发横向滚动（clip 不创建滚动容器，不破坏 sticky）─── */
html, body { overflow-x: clip; }

/* ─── 焦点可见性（键盘导航辅助）─── */
:focus-visible {
  outline: 3px solid var(--primary, #3B82F6);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── 尊重系统动画偏好 ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .ticker-scroll { animation: none !important; }
}

/* ─── 统一空状态组件 ─── */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
}
.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.4;
}

/* ─── 常用语义工具类（#6 抽取，先落地于 blog）─── */
.link-ink { color: var(--text-heading); }
.link-ink:hover { color: var(--primary); text-decoration: none; }
.icon-sm { font-size: 0.75em; }
.card-title-sm { font-size: 1.05rem; }
.recent-title-flex { flex: 1; margin-right: 0.5rem; min-width: 0; }
.badge-xs { font-size: 0.65em; padding: 0.1em 0.4em; margin-right: 4px; }
@media (prefers-reduced-motion: reduce) { .link-ink, .icon-sm { transition: none !important; } }

/* ─── 统一页头（#9 全站复用：标题+副标题 / 右侧操作区）─── */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 24px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.page-header h1 { font-weight: 800; font-size: 1.5rem; color: var(--text-heading); margin: 0; letter-spacing: 0.3px; }
.page-header .page-header-sub { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; margin-left: 10px; }

/* ─── 卡片统一 hover / 动效基础（#13，低优先级不覆盖既有专属样式）─── */
.card {
  transition: transform 0.25s var(--ease-out-quart, ease), box-shadow 0.25s ease;
}
@media (prefers-reduced-motion: reduce) { .card { transition: none !important; } }

/* ═══════════════════════════════════════════════════
   #13 动效统一 + #10 排版与响应式加固（纯追加，:where 零特异性不覆盖既有）
   ═══════════════════════════════════════════════════ */

/* 流动字号令牌（复用 style.css 的 clamp 体系）*/
:root {
  --fs-h3: clamp(1.15rem, 1.05rem + 0.4vw, 1.4rem);
  --fs-h4: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  --fs-body-sm: clamp(0.875rem, 0.85rem + 0.15vw, 0.95rem);
}

/* ── 统一过渡节奏（:where 零特异性，不压过各页专属规则）── */
:where(.card, .btn, .badge, a, button, .nav-link, .dropdown-item, .filter-btn, .category-tab) {
  transition:
    color var(--transition-fast, 0.15s) ease,
    background-color var(--transition-fast, 0.15s) ease,
    border-color var(--transition-fast, 0.15s) ease,
    transform 0.28s var(--ease-out-quart, cubic-bezier(0.16,1,0.3,1)),
    box-shadow 0.28s ease,
    opacity 0.2s ease;
}

/* 卡片 hover 影子：只在未单独定义时兜底（低特异性）*/
.card:hover { box-shadow: var(--shadow-hover, 0 14px 30px rgba(15,23,42,0.1)); }

/* 可点击卡片整体点击提示 */
:where(.card, .btn)[style*="cursor: pointer"], .card[onclick], .music-card, .movie-card-new, .img-card {
  cursor: pointer;
}

/* ── #10 排版排版响应式加固 ── */
img, video, canvas, iframe, svg { max-width: 100%; }
pre { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { max-width: 100%; }

/* 长串文本（长链接/长英文）自动换行，防撑破 */
.break-anywhere { overflow-wrap: anywhere; word-break: break-word; }
.blog-content, .card-text, .article-content, p { overflow-wrap: break-word; }

/* 小屏收紧正文尺寸，保持可读层级 */
@media (max-width: 575px) {
  .lead { font-size: 0.95rem; }
  .display-5 { font-size: 1.55rem !important; }
  .page-header h1 { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  :where(.card, .btn, .badge, a, button) { transition: none !important; }
}
