/* ============================================================
   MacCMS 2025 · Layout System
   Grid / Flex 布局工具类 + 全局布局模式
   ============================================================ */

/* ── 背景工具类 ── */
.bg-base { background: var(--bg-primary); color: var(--text-primary); }

/* ── 全局容器 ── */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--page-padding);
  padding-right: var(--page-padding);
}

.container--wide {
  max-width: 1440px;
}

.container--narrow {
  max-width: 960px;
}

/* ── 页面区块间距 ── */
.section {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}
.section--sm { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }
.section--lg { padding-top: var(--space-3xl); padding-bottom: var(--space-3xl); }

/* ── Grid 系统 ── */
.grid { display: grid; gap: var(--space-md); }

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--5 { grid-template-columns: repeat(5, 1fr); }
.grid--6 { grid-template-columns: repeat(6, 1fr); }

/* 自动填充列 */
.grid--auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
}
.grid--auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}

/* ── Flex 快捷 ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ── 隐藏/显示 ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.hidden-mobile {}
.hidden-desktop {}
.show-mobile { display: none; }

/* ── 文本截断 ── */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── 粘性元素 ── */
.sticky-top {
  position: sticky; top: 0; z-index: var(--z-sticky);
}

/* ── 全局页面骨架 ── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.page-main {
  flex: 1;
}

/* ── 全局导航栏占位 ── */
.nav-spacer {
  height: 56px;
}

/* ── 底部固定播放栏 (移动端) ── */
.mobile-play-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(8,8,16,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: var(--space-sm) var(--page-padding);
  z-index: var(--z-sticky);
  display: none;
}

@media (max-width: 767px) {
  .grid--4, .grid--5, .grid--6 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 479px) {
  .grid--2, .grid--3, .grid--4, .grid--5, .grid--6 {
    grid-template-columns: 1fr;
  }
  .grid--auto-fill, .grid--auto-fit {
    grid-template-columns: repeat(2, 1fr);
  }
  .hidden-mobile { display: none !important; }
  .show-mobile { display: block; }
  .mobile-play-bar { display: flex; }
}

/* ── Breadcrumb (global) ── */
.breadcrumb {
  padding: clamp(8px, 1.5vh, 16px) 0;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--text-secondary); }
.breadcrumb__sep { margin: 0 4px; color: var(--text-tertiary); }
.breadcrumb__cur { color: var(--text-secondary); }

/* ── Section Title (global) ── */
.section-title {
  font-family: var(--serif);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* ── Search Bar ── */
.search-bar {
  padding: clamp(24px, 4vh, 48px) var(--page-padding);
}
.search-bar__form {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
}
.search-bar__input {
  flex: 1;
  height: 48px;
  padding: 0 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  font-size: var(--fs-b1);
  color: var(--text-primary);
}
.search-bar__input:focus { border-color: var(--gold); }
.search-bar__submit {
  height: 48px;
  padding: 0 24px;
  background: var(--gold);
  color: var(--bg-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--fs-b1);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
.search-bar__hot {
  display: flex; gap: 8px; flex-wrap: wrap;
  max-width: 640px;
  margin: 16px auto 0;
}
.search-bar__hot-label {
  font-size: var(--fs-c2); color: var(--text-tertiary);
  line-height: 28px; flex-shrink: 0;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: clamp(3rem, 5vw, 5rem) var(--page-padding);
  background: var(--bg-card);
  text-align: center;
  margin-top: clamp(3rem, 6vw, 6rem);
}
.footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}
.footer__brand {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: var(--fw-normal);
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.footer__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 56ch;
  margin: 0 auto 1.5rem;
  line-height: 1.8;
}
.footer__links {
  display: flex;
  gap: clamp(1rem, 2vw, 2rem);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.footer__links a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--dur-instant);
}
.footer__links a:hover { color: var(--text-primary); }
.footer__copyright {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  line-height: 1.8;
}
.footer__copyright a {
  color: var(--text-tertiary);
  text-decoration: none;
}
.footer__motto {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.15);
  margin-top: 1rem;
  font-style: italic;
  letter-spacing: 0.04em;
}
