/*
 * 本站仅保留「布局」用的少量 CSS。
 * 所有颜色 / 圆角 / 阴影 / 字体排版一律使用 MD3 design token（--md-sys-color-* 等），
 * 不自定义任何主题色。深浅色由系统 prefers-color-scheme 自动切换。
 */

:root {
  color-scheme: light dark;
  --app-max-width: 880px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  /* MD3 官方 token：surface / on-surface */
  background: var(--md-sys-color-surface, #fef7ff);
  color: var(--md-sys-color-on-surface, #1d1b20);
  font-family: Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 布局工具类 ---------- */
.wrap {
  width: 100%;
  max-width: var(--app-max-width);
  margin: 0 auto;
  padding: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-nowrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spacer {
  flex: 1 1 auto;
}

.full {
  width: 100%;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 横向滚动容器（省份 chips 用） */
.scroll-x {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.scroll-x > * {
  flex: 0 0 auto;
}

/* ---------- 顶部应用栏 ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px;
  background: var(--md-sys-color-surface-container, #f3edf7);
  color: var(--md-sys-color-on-surface, #1d1b20);
}

.app-bar__title {
  font-weight: 700;
}

.app-bar__spacer {
  flex: 1 1 auto;
}

/* ---------- 视图区 ---------- */
.view {
  flex: 1 1 auto;
  width: 100%;
}

/* ---------- 卡片 / 列表 ---------- */
md-elevated-card,
md-filled-card,
md-outlined-card {
  display: block;
  padding: 16px;
}

.card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* 详情页信息网格：移动端单列，宽屏两列 */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

/* ---------- 校徽（详情页标题左侧） ---------- */
.school-logo-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: var(--md-sys-shape-corner-medium, 12px);
  background: var(--md-sys-color-surface-container-high, #ece6f0);
  overflow: hidden;
}

.school-logo-slot md-icon {
  font-size: 28px;
  width: 28px;
  height: 28px;
}

img.school-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--md-sys-shape-corner-medium, 12px);
  background: #fff; /* 校徽多为透明底 PNG，白底保证可见 */
}

/* ---------- 文本 ---------- */
.muted {
  color: var(--md-sys-color-on-surface-variant, #49454f);
}

.summary-text {
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 0;
}

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 空状态 / 加载态 ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 16px;
  text-align: center;
}

.empty-state md-icon {
  font-size: 48px;
  width: 48px;
  height: 48px;
  color: var(--md-sys-color-on-surface-variant, #49454f);
}

/* ---------- 评论（Giscus iframe） ---------- */
.giscus-box {
  width: 100%;
  min-height: 240px;
}

.giscus-box iframe {
  width: 100%;
  border: none;
}

/* ---------- 后台 ---------- */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 840px) {
  .admin-layout {
    grid-template-columns: 220px 1fr;
  }
}

.admin-pane {
  min-width: 0;
}

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 32px;
  padding: 16px 0 32px;
  border-top: 1px solid var(--md-sys-color-outline-variant, #cac4d0);
  color: var(--md-sys-color-on-surface-variant, #49454f);
}

.footer__muted {
  opacity: 0.85;
}

/* ---------- 全局提示条（对应 MD3 Snackbar，颜色/圆角/阴影均取自 MD3 token） ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  z-index: 100;
  max-width: min(90vw, 480px);
  padding: 14px 16px;
  background: var(--md-sys-color-inverse-surface, #313033);
  color: var(--md-sys-color-inverse-on-surface, #f4eff4);
  border-radius: var(--md-sys-shape-corner-extra-small, 4px);
  box-shadow: var(--md-sys-elevation-level3);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 隐藏元素 */
[hidden] {
  display: none !important;
}
