/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Thai', sans-serif;
  background: #07070e;
  color: #e4e4e7;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: default;
}

/* ===== Animated Mesh Gradient Background ===== */
#mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  will-change: transform;
}

.mesh-orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  top: -200px;
  left: -150px;
  animation: orbFloat1 18s ease-in-out infinite;
}

.mesh-orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
  top: 30%;
  right: -180px;
  animation: orbFloat2 22s ease-in-out infinite;
}

.mesh-orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #db2777 0%, transparent 70%);
  bottom: -100px;
  left: 25%;
  animation: orbFloat3 19s ease-in-out infinite;
}

.mesh-orb-4 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #0891b2 0%, transparent 70%);
  bottom: 20%;
  right: 10%;
  animation: orbFloat4 16s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(80px, 60px) scale(1.1); }
  66% { transform: translate(-40px, 100px) scale(0.95); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40% { transform: translate(-100px, -60px) scale(1.15); }
  70% { transform: translate(-50px, 40px) scale(0.9); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  35% { transform: translate(120px, -80px) scale(1.05); }
  65% { transform: translate(60px, 60px) scale(1.1); }
}
@keyframes orbFloat4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  45% { transform: translate(-70px, 50px) scale(1.2); }
  75% { transform: translate(40px, -30px) scale(0.95); }
}

/* ===== Floating Stars ===== */
.star {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.5); }
}

/* ===== Container ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
}

/* ===== Cards ===== */
.card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 2.2rem;
  margin-bottom: 1.5rem;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.15s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}

/* Glimmer shimmer line on hover */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(168, 85, 247, 0.04) 40%,
    rgba(168, 85, 247, 0.08) 50%,
    rgba(168, 85, 247, 0.04) 60%,
    transparent 100%
  );
  transition: left 0.6s ease;
  pointer-events: none;
  border-radius: 24px;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  border-color: rgba(147, 51, 234, 0.25);
  box-shadow:
    0 12px 40px rgba(147, 51, 234, 0.12),
    0 0 0 1px rgba(147, 51, 234, 0.05),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ===== Profile ===== */
.profile {
  text-align: center;
  padding-top: 3.5rem;
  padding-bottom: 3rem;
  border: 1px solid rgba(147, 51, 234, 0.18);
  overflow: hidden;
}

.profile::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%;
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(147, 51, 234, 0.4), transparent);
}

.avatar {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(#07070e, #07070e) padding-box,
              linear-gradient(135deg, #7c3aed, #a855f7, #ec4899, #7c3aed) border-box;
  animation: ringRotate 6s linear infinite;
  background-size: 100% 100%, 300% 300%;
}

@keyframes ringRotate {
  0% { background-position: 0% 50%, 0% 50%; }
  50% { background-position: 0% 50%, 100% 50%; }
  100% { background-position: 0% 50%, 0% 50%; }
}

.avatar-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.25) 0%, transparent 70%);
  animation: avatarPulse 3s ease-in-out infinite;
}

@keyframes avatarPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

.avatar-inner {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(147, 51, 234, 0.4);
}

.avatar-emoji {
  font-size: 2.8rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  animation: avatarBounce 4s ease-in-out infinite;
}

@keyframes avatarBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.profile h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f4f4f5 0%, #c084fc 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.tagline {
  color: #71717a;
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
  letter-spacing: 0.03em;
}

/* ===== Social Links ===== */
.social-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.social-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.social-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(147,51,234,0.2), rgba(236,72,153,0.2));
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 14px;
}

.social-btn:hover::before {
  opacity: 1;
}

.social-btn:hover {
  color: #e4e4e7;
  border-color: rgba(147, 51, 234, 0.3);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 24px rgba(147, 51, 234, 0.25);
}

.social-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
}

/* ===== Section Headings ===== */
.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #c084fc;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.03em;
}

.card h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(147, 51, 234, 0.3), transparent);
  margin-left: 0.5rem;
}

/* ===== About ===== */
.about p {
  color: #a1a1aa;
  margin-bottom: 0.6rem;
  font-size: 0.97rem;
}

.about p:last-child {
  margin-bottom: 0;
}

/* ===== Project List ===== */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.project-item::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background: radial-gradient(circle, rgba(147,51,234,0.3), transparent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s, right 0.3s;
}

.project-item:hover {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(147, 51, 234, 0.15);
  transform: translateX(6px);
}

.project-item:hover::after {
  opacity: 1;
  right: 15px;
}

.project-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.project-item h3 {
  font-size: 0.97rem;
  font-weight: 700;
  color: #e4e4e7;
  margin-bottom: 0.15rem;
}

.project-item p {
  font-size: 0.82rem;
  color: #71717a;
  line-height: 1.4;
}

/* ===== Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(147, 51, 234, 0.08);
  border: 1px solid rgba(147, 51, 234, 0.15);
  color: #c084fc;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.tag::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(147, 51, 234, 0.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.tag:hover {
  background: rgba(147, 51, 234, 0.18);
  border-color: rgba(147, 51, 234, 0.35);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.2);
}

.tag:active::before {
  width: 200px;
  height: 200px;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 2rem 0 1rem;
  color: #52525b;
  font-size: 0.85rem;
  position: relative;
}

footer::before {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(147,51,234,0.4), transparent);
  margin: 0 auto 1.5rem;
}

/* ===== Card Entrance Animations ===== */
.card {
  opacity: 0;
  transform: translateY(30px) scale(0.97);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger delay for each card */
.card:nth-child(1) { transition-delay: 0.05s; }
.card:nth-child(2) { transition-delay: 0.15s; }
.card:nth-child(3) { transition-delay: 0.25s; }
.card:nth-child(4) { transition-delay: 0.35s; }

/* ===== Running Cat ===== */
#running-cat {
  position: fixed;
  z-index: 10;
  font-size: 2rem;
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  will-change: transform;
  user-select: none;
}

/* ===== Custom Cursor Glow ===== */
#cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .container {
    padding: 2rem 1rem;
  }

  .card {
    padding: 1.6rem;
    border-radius: 20px;
  }

  .profile h1 {
    font-size: 1.8rem;
  }

  .avatar {
    width: 88px;
    height: 88px;
  }

  .avatar-inner {
    width: 76px;
    height: 76px;
  }

  .avatar-emoji {
    font-size: 2.4rem;
  }

  .mesh-orb-1 { width: 350px; height: 350px; }
  .mesh-orb-2 { width: 300px; height: 300px; }
  .mesh-orb-3 { width: 280px; height: 280px; }
  .mesh-orb-4 { width: 220px; height: 220px; }
}