main {
  --space-s: 0.5rem;
  --space-m: 1rem;
  --space-l: 2rem;
  --radius-base: 12px;
  --color-bg-light: #e7eff5;
  --color-accent: #2962c1;
}

/* ==== Research Themes compact grid ==== */
.research-themes {
  margin: 2.5rem auto;
  max-width: 1200px;         /* 横幅を制限して“のっぺり縦長”を防ぐ */
  padding: 0 1rem;
}

.research-themes h2 {
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 1.2rem;
}

.theme-grid {
  display: grid !important;  /* 万一の競合に備えて強制 */
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* PCは3列 */
  gap: 16px;
}

@media (max-width: 1024px) {
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* タブは2列 */
}
@media (max-width: 640px) {
  .theme-grid { grid-template-columns: 1fr; } /* スマホは1列 */
}

.theme-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
}

/* ←ここを限定適用に変更（以前は main img） */
.theme-card img {
  width: 100%;
  aspect-ratio: 4 / 3;   /* 画像が無くても高さが暴れない */
  object-fit: cover;
  display: block;
}

/* タイトルと本文も詰め気味に */
.theme-card h3 {
  font-size: 1.05rem;
  margin: 0.7rem 0 0.3rem;
  line-height: 1.3;
}
.theme-card p {
  font-size: 0.92rem;
  color: #555;
  margin: 0 0 0.9rem;
  line-height: 1.45;
  display: -webkit-box;          /* 2行で省略して縦長を抑制（任意） */
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hover effects: simple pop effects */
.theme-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.theme-card:hover img {
  transform: scale(1.03);
  filter: saturate(1.05);
}
.theme-card:hover h3,
.theme-card p {
  transition: color 0.25s ease;
}
.theme-card:hover p {
  color: #444;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  .theme-card {
    background: rgba(30,30,30,0.8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  }
  .theme-card:hover {
    background: rgba(30,30,30,0.8);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6), 0 0 12px var(--color-accent);
  }
  .theme-card h3,
  .theme-card p {
    color: #ddd;
  }
}

/* ───── LAST SECTION ───── */
#last-section {
  position: relative;
  width: 100%; height: 100vh;
  background: #000;
  overflow: hidden;
}

/* Mobile fine-tune for theme cards */
@media (max-width: 640px) {
  .theme-card img {
    height: 180px;          /* 好みで 160〜200px 程度に */
    aspect-ratio: auto;
    object-fit: cover;
  }
  .theme-card h3 { font-size: 1.0rem; }
  .theme-card p  { font-size: 0.9rem; }
}