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

html,
body {
  height: 100%;
}

/* ローディング */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0a;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #4ade80;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

body {
  font-family: 'BIZ UDPGothic', sans-serif;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.9);
  background-color: #0a0a0a;
  background-image: url('../img/top-bg1.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  z-index: 0;
}

/* パーティクル */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: float-particle linear infinite;
}

@keyframes float-particle {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    transform: translateY(-10vh) scale(1);
    opacity: 0;
  }
}

.cursor-particle {
  position: fixed;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  background: rgba(100, 255, 218, 0.8);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  animation: fadeOut 1s forwards;
  box-shadow: 0 0 6px rgba(100, 255, 218, 0.6);
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 50px 24px 30px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 各要素の初期状態 */
.logo,
.container h1,
.description,
.section-divider,
.section-title,
.project-card {
  opacity: 0;
  transform: translateY(20px);
}

/* ロード後のアニメーション */
.loaded .logo {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0s;
}

.loaded h1 {
  animation: fadeInUp 0.6s ease forwards, gradient-flow 3s ease-in-out infinite;
  animation-delay: 0.1s, 0s;
}

.loaded .description {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.2s;
}

.loaded .section-divider {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.3s;
}

.loaded .section-title {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.35s;
}

.loaded .project-card:nth-child(1) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.45s;
}

.loaded .project-card:nth-child(2) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.55s;
}

.loaded .project-card:nth-child(3) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.65s;
}

.loaded .project-card:nth-child(4) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.75s;
}

.loaded .project-card:nth-child(5) {
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.85s;
}

/* アニメーション完了後 */
.animation-done .project-card,
.animation-done .project-card:nth-child(1),
.animation-done .project-card:nth-child(2),
.animation-done .project-card:nth-child(3),
.animation-done .project-card:nth-child(4),
.animation-done .project-card:nth-child(5) {
  animation: none !important;
  opacity: 1;
  transform: translateY(0);
}

h1 {
  font-family: 'M PLUS 1', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, #4ade80, #22d3ee, #4ade80);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes gradient-flow {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.description {
  font-size: 1rem;
  line-height: 2.0;
  /* 行間を引き締める */
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 40px;
  max-width: 760px;
  /* 一行の長さを制限して読みやすく */
  margin-left: auto;
  margin-right: auto;
}

.description a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  transition: all 0.3s ease;
}

.description a::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  vertical-align: middle;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.description a:hover {
  text-decoration-color: rgba(255, 255, 255, 0.9);
}

.logo {
  display: block;
  max-width: 240px;
  height: auto;
  margin-bottom: 24px;
}

/* セクション区切り */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.section-divider-icon {
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.3);
}

.section-title {
  font-family: 'M PLUS 1', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 16px;
}

.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: all 0.3s ease;
  min-height: 100px;
  position: relative;
}

/* グラデーションボーダー用（アウトラインのみ） */
/* グラデーションボーダー用（アウトラインのみ） - Spotlight Effect用に調整 */
.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 16px;
  padding: 1.5px;
  background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      rgba(255, 255, 255, 0.4),
      transparent 40%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

/* Spotlight Effectのバックグラウンド光沢 */
.project-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 16px;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      rgba(255, 255, 255, 0.08),
      transparent 40%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.animation-done .project-card:hover,
.animation-done .project-card:nth-child(1):hover,
.animation-done .project-card:nth-child(2):hover,
.animation-done .project-card:nth-child(3):hover,
.animation-done .project-card:nth-child(4):hover,
.animation-done .project-card:nth-child(5):hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.animation-done .project-card:hover::before,
.animation-done .project-card:nth-child(1):hover::before,
.animation-done .project-card:nth-child(2):hover::before,
.animation-done .project-card:nth-child(3):hover::before,
.animation-done .project-card:nth-child(4):hover::before,
.animation-done .project-card:nth-child(5):hover::before,
.animation-done .project-card:hover::after,
.animation-done .project-card:nth-child(1):hover::after,
.animation-done .project-card:nth-child(2):hover::after,
.animation-done .project-card:nth-child(3):hover::after,
.animation-done .project-card:nth-child(4):hover::after,
.animation-done .project-card:nth-child(5):hover::after {
  opacity: 1;
}

.project-card.no-link {
  cursor: default;
}

.animation-done .project-card.no-link:hover,
.animation-done .project-card.no-link:nth-child(3):hover,
.animation-done .project-card.no-link:nth-child(4):hover,
.animation-done .project-card.no-link:nth-child(5):hover {
  transform: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.animation-done .project-card.no-link:hover::before,
.animation-done .project-card.no-link:nth-child(3):hover::before,
.animation-done .project-card.no-link:nth-child(4):hover::before,
.animation-done .project-card.no-link:nth-child(5):hover::before {
  opacity: 0;
}

.project-content {
  display: flex;
  flex-direction: column;
}

.project-icon {
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.project-card:hover .project-icon {
  color: rgba(255, 255, 255, 0.8);
}

.project-name {
  font-family: 'M PLUS 1', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  transition: text-shadow 0.3s ease;
}

.project-card:hover .project-name {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.project-arrow {
  align-self: flex-end;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.project-card:hover .project-arrow {
  transform: translateX(4px);
}

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 24px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  opacity: 0;
}

footer.loaded {
  animation: fadeIn 0.6s ease 0.8s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

footer p {
  margin: 0;
}

@media (max-width: 768px) {
  .container {
    padding: 60px 20px;
  }

  .logo {
    max-width: 200px;
    margin-bottom: 32px;
  }

  h1 {
    font-size: 1.8rem;
    margin-bottom: 32px;
  }

  .description {
    font-size: 0.95rem;
    margin-bottom: 48px;
  }

  .projects {
    grid-template-columns: 1fr;
  }

  .project-card {
    padding: 24px 20px;
    min-height: auto;
  }

  .project-name {
    font-size: 1rem;
  }
}