/* ==========================================================================
   Campus Wall v5.0 — Clean-Sheet Editorial Campus Quartz Design System
   零旧版遗留、四套学术色板、明暗双模、物理弹簧曲线与 GPU 安全动效
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, Monaco, Consolas, monospace;

  --accent: #1e40af;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(30, 64, 175, 0.09);
  --accent-ring: rgba(30, 64, 175, 0.22);
  --accent-contrast: #ffffff;

  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.11);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.10);

  --bg-canvas: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #eef1f6;
  --bg-hover: #e5e9f2;
  --bg-header: rgba(255, 255, 255, 0.94);

  --text-main: #111827;
  --text-secondary: #374151;
  --text-sub: #6b7280;
  --text-muted: #9ca3af;

  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 22px 54px rgba(15, 23, 42, 0.15), 0 6px 16px rgba(15, 23, 42, 0.06);

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 9999px;

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snappy: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur-base: 240ms;
  --dur-slow: 360ms;

  /* 后台兼容别名 */
  --primary: var(--accent);
  --bg-card: var(--bg-surface);
  --border-color: var(--border-strong);
}

html[data-palette="garnet"] {
  --accent: #9b2c3e;
  --accent-hover: #b43449;
  --accent-soft: rgba(155, 44, 62, 0.09);
  --accent-ring: rgba(155, 44, 62, 0.22);
}
html[data-palette="terracotta"] {
  --accent: #a84929;
  --accent-hover: #c25732;
  --accent-soft: rgba(168, 73, 41, 0.10);
  --accent-ring: rgba(168, 73, 41, 0.22);
}
html[data-palette="jade"] {
  --accent: #166534;
  --accent-hover: #15803d;
  --accent-soft: rgba(22, 101, 52, 0.10);
  --accent-ring: rgba(22, 101, 52, 0.22);
}

html[data-theme="dark"] {
  --bg-canvas: #0d1016;
  --bg-surface: #141923;
  --bg-elevated: #1b2230;
  --bg-subtle: #1e2636;
  --bg-hover: #253044;
  --bg-header: rgba(20, 25, 35, 0.95);

  --text-main: #f3f6fb;
  --text-secondary: #cbd5e1;
  --text-sub: #94a3b8;
  --text-muted: #64748b;

  --border: rgba(241, 245, 249, 0.08);
  --border-strong: rgba(241, 245, 249, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.62);

  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --accent-ring: rgba(96, 165, 250, 0.30);
  --accent-contrast: #0b1120;
}
html[data-theme="dark"][data-palette="garnet"] {
  --accent: #fb7185;
  --accent-hover: #fda4af;
  --accent-soft: rgba(251, 113, 133, 0.14);
  --accent-ring: rgba(251, 113, 133, 0.28);
  --accent-contrast: #1f0a10;
}
html[data-theme="dark"][data-palette="terracotta"] {
  --accent: #fb923c;
  --accent-hover: #fdba74;
  --accent-soft: rgba(251, 146, 60, 0.14);
  --accent-ring: rgba(251, 146, 60, 0.28);
  --accent-contrast: #1c0f06;
}
html[data-theme="dark"][data-palette="jade"] {
  --accent: #34d399;
  --accent-hover: #6ee7b7;
  --accent-soft: rgba(52, 211, 153, 0.14);
  --accent-ring: rgba(52, 211, 153, 0.28);
  --accent-contrast: #052014;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  background: var(--bg-canvas);
  overflow-x: clip;
}
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  background: var(--bg-canvas);
  overflow-x: clip;
  transition: background-color var(--dur-base) ease, color var(--dur-base) ease;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
svg { flex-shrink: 0; }

.cw-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 5px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--badge-color, var(--accent));
  background: color-mix(in srgb, var(--badge-color, var(--accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color, var(--accent)) 22%, transparent);
  vertical-align: middle;
}
.cw-role-badge svg { width: 12px; height: 12px; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.big { width: 68px; height: 68px; font-size: 24px; }
.avatar.fallback { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

@keyframes cwFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cwPopIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes cwHeartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  75% { transform: scale(0.92); }
  100% { transform: scale(1); }
}
@keyframes cwShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.cw-skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--bg-hover) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: cwShimmer 1.3s ease-in-out infinite;
}
.cw-anim-enter { animation: cwFadeUp var(--dur-slow) var(--ease-spring) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* 全局 [hidden] 强制隐藏（防止 display:flex 覆盖原生 hidden 属性） */
[hidden] { display: none !important; }

/* 前台禁止双击缩放与聚焦放大，提升移动端原生触控响应 */
html, body, button, a, input, select, textarea {
  touch-action: manipulation;
}
.app-shell {
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}
@media (max-width: 820px) {
  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select,
  .cw-input,
  .cw-textarea {
    font-size: 16px !important;
  }
}
