/**
 * index.css —— 首页样式
 *
 * 设计令牌（CSS 自定义属性）+ Hero + 公告卡片 + 工具网格 + 页脚。
 * 浅色系、indigo/violet 主色，卡片白底细边大圆角多层柔影，
 * 入场「上浮渐显」动画并错峰，支持 prefers-reduced-motion。
 */

/* ========== 设计令牌 ========== */
:root {
  --font-stack: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'MiSans',
    'Microsoft YaHei', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;

  --color-primary: #6366f1;        /* indigo-500 */
  --color-primary-strong: #4f46e5; /* indigo-600 */
  --color-violet: #7c3aed;         /* violet-600 */
  --gradient-brand: linear-gradient(120deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);

  --text-strong: #221f3a;
  --text-body: #4a4760;
  --text-muted: #8a87a3;

  --bg-page: #f5f6fb;
  --bg-card: #ffffff;
  --border-soft: #e7e7f4;
  --border-strong: #d8d8ee;

  --shadow-sm: 0 1px 2px rgba(34, 31, 58, 0.05);
  --shadow-md: 0 1px 2px rgba(34, 31, 58, 0.04), 0 8px 24px rgba(34, 31, 58, 0.07);
  --shadow-lg: 0 2px 6px rgba(34, 31, 58, 0.06), 0 18px 40px rgba(79, 70, 229, 0.16);

  --radius-card: 18px;
  --radius-pill: 999px;
  --container-width: 1080px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ========== hidden 属性兜底 ========== */
/* 防止组件级 display 规则覆盖浏览器 UA 默认样式 [hidden] { display: none } */
[hidden] {
  display: none !important;
}

/* ========== 基础 ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-body);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(99, 102, 241, 0.22);
  color: var(--text-strong);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cfcfe4;
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-page);
}

::-webkit-scrollbar-thumb:hover {
  background: #b6b6d6;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

a {
  color: var(--color-primary-strong);
  text-decoration: none;
}

/* ========== 背景装饰 ========== */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
}

.blob-a {
  width: 520px;
  height: 520px;
  top: -160px;
  left: -120px;
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.32), rgba(99, 102, 241, 0) 70%);
}

.blob-b {
  width: 620px;
  height: 620px;
  top: -220px;
  right: -180px;
  background: radial-gradient(circle at 70% 30%, rgba(168, 85, 247, 0.26), rgba(168, 85, 247, 0) 70%);
}

.dot-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(99, 102, 241, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 78%);
}

/* ========== 布局 ========== */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Hero ========== */
.hero {
  text-align: center;
  padding: 76px 0 52px;
}

.date-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
}

.hero-title {
  margin: 22px 0 10px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  margin: 0 0 14px;
  font-size: clamp(15px, 2.4vw, 18px);
  font-weight: 500;
  color: var(--text-body);
}

.welcome {
  margin: 0 auto;
  max-width: 560px;
  color: var(--text-muted);
}

/* ========== 栏目标题 ========== */
.section {
  margin: 40px 0;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-strong);
}

.section-head h2::before {
  content: '';
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--gradient-brand);
}

.count-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(99, 102, 241, 0.1);
  color: var(--color-primary-strong);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ========== 卡片通用 ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  transition:
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out),
    border-color 0.25s var(--ease-out);
}

/* ========== 公告卡片 ========== */
.notice-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notice-card {
  padding: 20px 22px;
}

.notice-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.notice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notice-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-strong);
}

.pin-badge {
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: #8a5a00;
  background: linear-gradient(135deg, #fde68a, #fcd34d);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 1px 2px rgba(245, 158, 11, 0.25);
  white-space: nowrap;
}

.notice-date {
  display: block;
  margin: 6px 0 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.notice-content {
  margin: 0;
  white-space: pre-line;
  font-size: 14.5px;
  color: var(--text-body);
}

/* ========== 工具链接网格 ========== */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  color: inherit;
}

.link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.link-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

.link-icon-letter {
  color: #ffffff;
  font-weight: 700;
  font-size: 19px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.link-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.link-name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 13px;
  color: var(--color-primary);
  opacity: 0;
  transform: translate(-2px, 2px);
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.link-card:hover .link-arrow,
.link-card:focus-visible .link-arrow {
  opacity: 1;
  transform: none;
}

/* ========== 空状态 / 加载失败 ========== */
.empty-state {
  text-align: center;
  padding: 44px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-muted);
}

.empty-icon {
  display: block;
  font-size: 30px;
  margin-bottom: 8px;
}

.empty-state p {
  margin: 0;
}

.load-error {
  margin: 20px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13.5px;
}

/* ========== 页脚 ========== */
.footer {
  margin-top: auto;
  padding: 28px 0 34px;
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-text {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
}

.beian-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.beian-link:hover {
  color: var(--color-primary-strong);
}

.beian-badge {
  flex: none;
  color: #6b7280;
}

.admin-entry {
  font-size: 12.5px;
  color: var(--text-muted);
  opacity: 0.45;
  transition:
    opacity 0.2s var(--ease-out),
    color 0.2s var(--ease-out);
}

.admin-entry:hover {
  opacity: 1;
  color: var(--color-primary-strong);
}

/* ========== 入场动画 ========== */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.animate-in {
  animation: rise-in 0.55s var(--ease-out) backwards;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .hero {
    padding: 56px 0 40px;
  }

  .link-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    justify-content: center;
    text-align: center;
  }
}

/* ========== 动效减弱 ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
