/* ============================================================
   MagicBento (React Bits) — vanilla port, LIGHT MODE
   白底卡片 + 番茄红辉光，适配 Neo-Brutalist 博客原型
   布局：5 卡仿生 bento（4×3 网格）
   交互：星点粒子 / 聚光 / 边框辉光 / 3D 倾斜 / 磁吸 / 点击涟漪
   ============================================================ */

.card-grid {
  display: grid;
  gap: 0.75em;
  padding: 0.75em;
  max-width: 54em;
  margin: 0 auto;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.5rem);
}

.magic-bento-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  min-height: 160px;
  width: 100%;
  max-width: 100%;
  padding: 1em;
  border-radius: 20px;
  border: 1px solid #e6e6e6;
  background: #ffffff;
  color: #111111;
  font-weight: 300;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;

  --glow-x: 50%;
  --glow-y: 50%;
  --glow-intensity: 0;
  --glow-radius: 200px;
}

.magic-bento-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.10);
}

.magic-bento-card__header,
.magic-bento-card__content {
  display: flex;
  position: relative;
  color: #111111;
}

.magic-bento-card__header {
  gap: 0.75em;
  justify-content: space-between;
}

.magic-bento-card__content {
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
}

.magic-bento-card__label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #FF4438;
}

.magic-bento-card__title {
  font-weight: 600;
  font-size: 18px;
  margin: 0 0 0.35em;
  font-family: var(--heavy);
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

.magic-bento-card__description {
  font-size: 14px;
  line-height: 1.5;
  color: #444;
  opacity: 1;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

/* 保证文字完整显示：彻底关闭任何折叠/省略 */
.magic-bento-card--text-autohide .magic-bento-card__title,
.magic-bento-card--text-autohide .magic-bento-card__description {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
  text-overflow: unset;
}

/* ---------- 桌面端 4×3 网格（>=1024px） ---------- */
@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row dense;
    height: min(54vh, 480px);   /* 拉扁：降低整体高度，避免滑动条 */
    width: 100%;                /* 拉长：占满左侧直到名片左缘 */
    max-width: none;
    margin: 0;
    font-size: clamp(0.85rem, 0.75rem + 0.4vw, 1.2rem);
  }

  .magic-bento-card {
    min-height: 0;
    height: 100%;
  }

  /* ① 娱乐：左上 2×1 宽块 */
  .magic-bento-card:nth-child(1) {
    grid-column: 1 / span 2;
    grid-row: 1;
  }

  /* ② 项目：左下 2×2 大竖块 */
  .magic-bento-card:nth-child(2) {
    grid-column: 1 / span 2;
    grid-row: 2 / span 2;
  }

  /* ③ 学习：右上 2×2 大竖块 */
  .magic-bento-card:nth-child(3) {
    grid-column: 3 / span 2;
    grid-row: 1 / span 2;
  }

  /* ④ 关于：右下 1×1 */
  .magic-bento-card:nth-child(4) {
    grid-column: 3;
    grid-row: 3;
  }

  /* ⑤ 联系：右下 1×1 */
  .magic-bento-card:nth-child(5) {
    grid-column: 4;
    grid-row: 3;
  }

  /* 不同尺寸卡片的字号/内边距 —— 放大且自动换行，保证完整可见 */
  .bento-size-wide .magic-bento-card__label {
    font-size: 15px;
  }
  .bento-size-wide .magic-bento-card__title {
    font-size: 28px;
    margin-bottom: 0.2em;
  }
  .bento-size-wide .magic-bento-card__description {
    font-size: 16px;
  }

  .bento-size-large .magic-bento-card__label {
    font-size: 18px;
  }
  .bento-size-large .magic-bento-card__title {
    font-size: 42px;
  }
  .bento-size-large .magic-bento-card__description {
    font-size: 22px;
  }

  .bento-size-small {
    padding: 0.875em;
  }
  .bento-size-small .magic-bento-card__label {
    font-size: 13px;
  }
  .bento-size-small .magic-bento-card__title {
    font-size: 24px;
    margin-bottom: 0.25em;
  }
  .bento-size-small .magic-bento-card__description {
    font-size: 15px;
    line-height: 1.45;
  }
}

@media (max-width: 1023px) and (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: dense;
  }
  .magic-bento-card:nth-child(1),
  .magic-bento-card:nth-child(2),
  .magic-bento-card:nth-child(3) {
    grid-column: span 1;
    grid-row: auto;
  }
  .magic-bento-card:nth-child(4),
  .magic-bento-card:nth-child(5) {
    grid-column: span 1;
    grid-row: auto;
  }
}

@media (max-width: 599px) {
  .card-grid {
    grid-template-columns: 1fr;
    width: 90%;
    margin: 0 auto;
    padding: 0.5em;
  }

  .magic-bento-card {
    min-height: 180px;
  }
}

/* ---------- 边框辉光（跟随光标，番茄红） ---------- */
.magic-bento-card--border-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  padding: 6px;
  background: radial-gradient(
    var(--glow-radius) circle at var(--glow-x) var(--glow-y),
    rgba(var(--glow-color), calc(var(--glow-intensity) * 0.85)) 0%,
    rgba(var(--glow-color), calc(var(--glow-intensity) * 0.4)) 30%,
    transparent 60%
  );
  border-radius: inherit;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.magic-bento-card--border-glow:hover {
  box-shadow:
    0 4px 20px rgba(255, 68, 56, 0.18),
    0 0 30px rgba(255, 68, 56, 0.12);
}

.particle-container {
  position: relative;
  overflow: hidden;
}

.particle::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: rgba(var(--glow-color), 0.2);
  border-radius: 50%;
  z-index: -1;
}

.particle-container:hover {
  box-shadow:
    0 4px 20px rgba(255, 68, 56, 0.12),
    0 0 30px rgba(255, 68, 56, 0.10);
}

/* ---------- 全局聚光（白底上用正常混合，呈现红色光晕） ---------- */
.global-spotlight {
  will-change: transform, opacity;
  z-index: 200 !important;
  pointer-events: none;
}

.bento-section {
  position: relative;
  user-select: none;
}
