* {
  margin: 0; 
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-theme-light: #3D58D6;
  --color-theme-dark: #2D42AD;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* 全局背景、字体、dark mode */
body {
  font-family: 'Bricolage Grotesque', sans-serif;
  background-color: #C2D3EB;
  background: url('../cards/bg/bg.webp') no-repeat top center;
  background-size: cover;
  transition: background 0.3s;
  color: #1f1f1f;
}
body.dark-mode {
  background-color: #2A3545;
  background: url('../cards/bg/darkbg.webp') no-repeat top center;
  background-size: cover;
  color: #f5f5f5;
}

body.theme-transition {
  transition: background 0.4s ease, color 0.4s ease;
}
body.theme-transition .container {
  transition: background 0.4s ease;
}

/* 容器样式 */
.container {
  display: none;
  max-width: 960px;
  margin: 40px auto;
  padding: 50px 80px 100px 80px;
  background: rgba(255,255,255,0.4);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.05);
  transition: background 0.3s;
}
body.dark-mode .container {
  background: rgba(12,12,12,0.5);
}

/* Loading提示 */
.loading {
  text-align: center;
  margin-top: 80px;
  font-size: 16px;
  color: #aaa;
}

/* 切换主题按钮 */
.toggle-theme {
  position: fixed;
  top: 20px;
  right: 20px;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 18px;
  z-index: 5;
}

/* 头部标题 */
h1 {
  font-size: 28px;
  margin: 24px 0 16px;
}
.highlighted {
  color: #4a6ee0;
}

/* 段落 */
p {
  font-size: 16px;
  margin-bottom: 24px;
}

/* 二级标题：初始隐藏（动画） */
h2 {
  margin-top: 60px;
  margin-bottom: 16px;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #aaa;
  font-weight: 400;
}
.animated-title {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: var(--delay, 0s);
}
.animated-title.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Grid布局，卡片之间间隔20px */
.grid {
  display: grid;
  gap: 20px !important; /* 强制20px */
}

/* 大网格(3列) */
.grid-large {
  grid-template-columns: repeat(3, 1fr);
}

/* 小网格(4列) */
.grid-small {
  grid-template-columns: repeat(4, 1fr);
}

/* 卡片：无padding，透明背景，统一圆角 + overflow hidden */
/* reveal动画使用 opacity 和 transform 的transition-delay (仅 opacity 使用延迟) */
.card {
  background: transparent;
  border-radius: 20px;
  overflow: hidden;
  opacity: 0;
  position: relative;
  transform: translateY(20px);
  transition: 
    opacity 0.6s ease var(--delay, 0s),
    transform 0.6s ease 0s,
    box-shadow 0.3s ease 0s;
}
body.dark-mode .card {
  background: transparent;
}
/* reveal状态 */
.card.visible {
  opacity: 1;
  transform: translateY(0);
  box-shadow: 8px 10px 30px rgba(0,0,0,0.05);
}

/* 卡片hover：轻微放大 + 阴影，hover时不受 reveal 延迟影响 */
.card:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 30px rgba(0,0,0,0.1);
  cursor: pointer; 
}

.card img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.3s ease; /* 默认快速过渡时间 */
}

/* magic-overlay 图片样式 */
.magic-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: relative;
  opacity: 0;
  transition: opacity 0.7s ease; /* 默认快速过渡时间 */
  z-index: 2;
  overflow: hidden;
}

/* 当鼠标进入卡片时（慢速过渡） */
.card:hover img,
.card:hover .magic-overlay {
  transition: opacity 1s ease; /* 进入时的较慢过渡时间 */
  overflow: hidden;
}

/* 基础图片：添加 base 类 */
.card img.base {
  /* 默认直接显示 */
}

.card::before {
  content: "";
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 200%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 80%,
    rgba(255, 255, 255, 0) 100%
  );
  filter: blur(20px);
  transform: skewX(-10deg);
  z-index: 3;
  pointer-events: none;
}

.card:hover::before {
  animation: sweepLight 1s ease-out;
}

@keyframes sweepLight {
  0% {
    left: -100%;
  }
  100% {
    left: 120%;
  }
}

/* 弹窗背景 */
.popover {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
  z-index: 999;
}
.popover.active {
  opacity: 1;
  visibility: visible;
}

/* 弹窗内容 */
.popover-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 320px;
  position: relative;
}
body.dark-mode .popover-content {
  background: #222;
  color: #fff;
}
/* 弹窗内部 */
.popover-content img {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 16px;
}
.popover-title {
  font-size: 18px;
  margin-bottom: 8px;
  color: #333;
  margin-top: 0px;
}
body.dark-mode .popover-title {
  color: #fff;
}
.popover-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}
body.dark-mode .popover-description {
  color: #ccc;
}

/* Footer 基础样式 */
.site-footer {
  text-align: center;
  margin: 60px auto 40px;
  padding: 10px 0;
  font-size: 14px;
  color: #777;
}
body.dark-mode .site-footer {
  color: #aaa;
}
.linkedin-icon {
  width: 20px;
  margin: 0px 2px 5px 8px;
  vertical-align: middle;
}
.site-footer a {
  color: #0A66C2;
  text-decoration: none;
  font-weight: 500;
}
body.dark-mode .site-footer a {
  color: #79b1eb;
}
.site-footer a:hover {
  text-decoration: none;
}

/* 关闭按钮 */
.popover-close {
  position: absolute;
  top: 8px; right: 12px;
  background: none; 
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* 弹窗链接 */
.popover-link {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
  color: #4a6ee0;
  font-weight: 500;
}
body.dark-mode .popover-link {
  color: #4a6ee0;
}

/* 响应式 */
@media (max-width: 768px) {
  .grid-large {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-small {
    grid-template-columns: repeat(3, 1fr);
  }
  .container {
    margin: 0px auto;
    padding: 28px;
    border-radius: 0px;
  }
}