/* ===== 变量 ===== */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-sec: #6b7280;
  --text-ter: #9ca3af;
  --accent: #6366f1;
  --radius: 20px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

/* ===== Dark ===== */
[data-theme="dark"] {
  --bg: #0b0f1a;
  --card: rgba(255, 255, 255, 0.06);
  --text: #e5e5e5;
  --text-sec: #9ca3af;
  --text-ter: #6b7280;
  --shadow: none;
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 40px 20px;
  transition:
    background 0.3s,
    color 0.3s;
}

/* ===== Bento ===== */
.bento {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ===== Card ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .card:hover {
  border-color: rgba(99, 102, 241, 0.35);
}

/* ===== Hero ===== */
.card--hero {
  grid-column: span 2;
}

.card--hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.5px;
}

.card--hero p {
  margin-top: 10px;
  color: var(--text-sec);
}

/* ===== Icon ===== */
.card h2 {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card p {
  color: var(--text-ter);
}
.card i {
  stroke: var(--accent);
  width: 28px;
  height: 28px;
}

/* ===== Links ===== */
.card--links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card--links h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 4px;
}

.card--links a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.25s;
}

/* ===== Theme Switch ===== */
/* 图标容器 */
.theme-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;

  width: 64px;
  height: 32px;
  border-radius: 999px;
  background: #e5e5ea;
  cursor: pointer;
  display: flex;
  /* align-items: center; */
  padding: 4px;
  transition: background 0.3s;
}

[data-theme="dark"] .theme-switch .moon i {
  color: #e5e5e5;
}

/* 滑块 */
.theme-switch .knob {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: opacity 0.3s;
}

.theme-switch .sun {
  left: 8px;
}
.theme-switch .moon {
  right: 8px;
  opacity: 0;
}

/* 切换状态 */
#theme-toggle:checked ~ .theme-switch {
  background: #1c1c1e;
}

#theme-toggle:checked ~ .theme-switch .sun {
  opacity: 0;
}

#theme-toggle:checked ~ .theme-switch .moon {
  opacity: 1;
}

#theme-toggle:checked ~ .theme-switch .knob {
  transform: translateX(32px);
}

.theme-switch i {
  width: 18px;
  height: 18px;
  position: absolute;
}

.theme-switch i:last-child {
  opacity: 0;
}

#theme-toggle:checked ~ .theme-switch i:first-child {
  opacity: 0;
}
#theme-toggle:checked ~ .theme-switch i:last-child {
  opacity: 1;
}

/* ===== Dark Toggle ===== */
#theme-toggle:checked ~ * {
  --bg: #0b0f1a;
  --card: rgba(255, 255, 255, 0.06);
  --text: #e5e5e5;
  --text-sec: #9ca3af;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .bento {
    grid-template-columns: 1fr;
  }
  .card--hero {
    grid-column: span 1;
  }
  /* 标题距离顶部太长不符合审美 */
  body {
    padding: 20px 16px;
  }
  .card {
    padding: 20px;
  }
  /* 手机版字体调小一些 */
  .card h2 {
    font-size: 1.1rem;
  }
  .links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}
