@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&display=swap");

:root {
  --primary-bg: #0a0a0a;
  --secondary-bg: #1a1a1a;
  --card-bg: rgba(26, 26, 26, 0.8);
  --accent-blue: #60a5fa;
  --accent-teal: #34d399;
  --accent-purple: #a78bfa;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --shadow-glow: 0 0 20px rgba(96, 165, 250, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
  background: var(--primary-bg);
  background-image: radial-gradient(
      circle at 20% 80%,
      rgba(96, 165, 250, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(52, 211, 153, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(167, 139, 250, 0.05) 0%,
      transparent 50%
    );
  color: var(--text-primary);
  font-family: "Prompt", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Inter", sans-serif;
  color: var(--text-primary);
}

.font-code {
  font-family: "Fira Code", monospace;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
}

.glass-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-glow), var(--shadow-card);
  border-color: rgba(96, 165, 250, 0.3);
}

/* Custom Scrollbar (ยังคงเดิม) */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--primary-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #2563eb; /* Tailwind Blue-600 */
}

#hero {
  background: var(--primary-bg);
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 30% 20%,
      rgba(96, 165, 250, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 70% 80%,
      rgba(52, 211, 153, 0.1) 0%,
      transparent 50%
    );
  z-index: 0;
}

#hero > * {
  position: relative;
  z-index: 1;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--border-color);
}

.timeline-item .timeline-dot {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  width: 18px; /* ลดขนาด dot */
  height: 18px;
  border-radius: 50%;
  background-color: var(--accent-blue);
  border: 3px solid var(--secondary-bg); /* เปลี่ยนสี border ให้เข้ากับพื้นหลัง card */
  z-index: 1;
}
.timeline-item:nth-child(even) .timeline-content {
  margin-left: auto;
  padding-left: 2.25rem; /* 36px */
  padding-right: 0;
}
.timeline-item:nth-child(odd) .timeline-content {
  margin-right: auto;
  padding-right: 2.25rem; /* 36px */
  padding-left: 0;
}

.skill-icon-placeholder {
  width: 36px; /* ลดขนาด */
  height: 36px;
  background-color: var(--secondary-bg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem; /* 4px */
  font-size: 0.7rem; /* 11px */
}

/* ปุ่ม 기본 스타일 (สามารถใช้ Tailwind classes เป็นหลัก) */
.btn {
  display: inline-block;
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: 0.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient-accent);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(96, 165, 250, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(96, 165, 250, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-teal);
  border: 2px solid var(--accent-teal);
  position: relative;
}

.btn-secondary:hover {
  background: var(--accent-teal);
  color: var(--primary-bg);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(52, 211, 153, 0.3);
}

.btn-neutral-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.btn-neutral-outline:hover {
  background: var(--secondary-bg);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-2px);
}

.lightbox {
  position: fixed;
  inset: 0; /* top, right, bottom, left = 0 */
  background-color: rgba(0, 0, 0, 0.85); /* พื้นหลังสีดำโปร่งแสง */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000; /* ให้อยู่บนสุด */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-out, visibility 0s linear 0.3s; /* Transition for fade effect */
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease-out, visibility 0s linear 0s;
}

.lightbox-content {
  position: relative;
  background-color: var(--secondary-bg); /* หรือ var(--primary-bg) ถ้าต้องการ */
  padding: 0.5rem; /* Padding รอบรูปภาพ */
  border-radius: 0.375rem; /* 6px */
  max-width: 90vw; /* ความกว้างสูงสุด 90% ของ viewport width */
  max-height: 90vh; /* ความสูงสูงสุด 90% ของ viewport height */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden; /* ป้องกันไม่ให้รูปทะลุขอบ */
  transform: scale(0.95);
  transition: transform 0.3s ease-out;
}

.lightbox.active .lightbox-content {
  transform: scale(1);
}

.lightbox-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: calc(90vw - 1rem); /* (90vw - padding*2) */
  max-height: calc(
    90vh - 1rem - 40px
  ); /* (90vh - padding*2 - close button space) */
  object-fit: contain; /* ให้รูปภาพแสดงเต็มขนาดโดยไม่ถูกตัด */
  border-radius: 0.25rem; /* 4px */
}

.lightbox-close {
  position: absolute;
  top: -10px; /* ปรับตำแหน่งปุ่มปิด */
  right: -10px;
  background-color: var(--accent-blue); /* หรือสีแดง เช่น #E53E3E */
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px; /* ขนาดปุ่ม */
  height: 32px;
  font-size: 1.25rem; /* ขนาดไอคอน X */
  line-height: 32px; /* จัดให้อยู่กลาง */
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease;
}

.lightbox-close:hover {
  background-color: #2563eb; /* สีเข้มขึ้นเมื่อ hover */
}

/* Class to prevent body scroll when lightbox is active */
.overflow-hidden-body {
  overflow: hidden;
}

/* Ensure certificate items have a pointer cursor */
.cert-item {
  cursor: pointer;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}
.cert-item:hover {
  transform: scale(1.03); /* ขยายเล็กน้อยเมื่อ hover */
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.2); /* เงาสีฟ้าอ่อนๆ */
}
/* Enhanced Animations */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(96, 165, 250, 0.6);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Floating Animation for Hero Image - Optimized */
.hero-image {
  animation: float 6s ease-in-out infinite;
  will-change: transform;
}

/* Glowing Effect for Skills */
.skill-glow {
  animation: glow 3s ease-in-out infinite alternate;
}

/* Enhanced Timeline */
.timeline-item {
  opacity: 1;
  transform: translateY(0);
}

/* Gradient Text Effect */
.gradient-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced Skill Tags */
.skill-tag {
  background: linear-gradient(135deg, var(--secondary-bg), var(--card-bg));
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.skill-tag::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(96, 165, 250, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.skill-tag:hover::before {
  left: 100%;
}

.skill-tag:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 15px rgba(96, 165, 250, 0.2);
}

/* Enhanced Project Cards */
.project-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  position: relative;
  will-change: transform;
}

.project-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(96, 165, 250, 0.1),
    rgba(52, 211, 153, 0.1)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 1rem;
  pointer-events: none;
}

.project-card:hover::after {
  opacity: 1;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(96, 165, 250, 0.2);

/* Enhanced Certificate Grid */
.cert-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.cert-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(96, 165, 250, 0.2),
    rgba(52, 211, 153, 0.2)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 1rem;
}

.cert-item:hover::before {
  opacity: 1;
}

.cert-item:hover {
  transform: scale(1.05) rotateY(5deg);
  box-shadow: 0 10px 30px rgba(96, 165, 250, 0.3);
}

/* Enhanced Navigation */
nav a {
  position: relative;
  transition: all 0.3s ease;
}

nav a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-accent);
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

/* Scroll Progress Indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient-accent);
  z-index: 9999;
  transition: width 0.1s ease;
}

/* Enhanced Typography */
h1,
h2,
h3 {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Particle Effect Background */
.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: float 8s infinite linear;
  opacity: 0.6;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
  .btn {
    padding: 0.625rem 1.5rem;
    font-size: 0.9rem;
  }

  .glass-card:hover {
    transform: translateY(-4px) scale(1.01);
  }

  .project-card:hover {
    transform: translateY(-5px);
  }
}

/* Loading Animation */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(96, 165, 250, 0.3);
  border-top: 4px solid var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
} /* I
nitial state for project cards */
.project-card {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loaded state */
body.loaded .project-card {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced form styles */
input:focus,
textarea:focus {
  outline: none !important;
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1) !important;
}

/* Enhanced mobile responsiveness */
@media (max-width: 640px) {
  .hero-title {
    font-size: 2.5rem !important;
    line-height: 1.1;
  }

  .typing-effect {
    font-size: 1.25rem !important;
  }

  .skill-tag {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-image {
    animation: none !important;
  }
}

/* Focus styles for better accessibility */
.btn:focus,
.cert-item:focus,
.skill-tag:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .scroll-progress,
  .lightbox,
  nav,
  footer {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .glass-card {
    border: 1px solid #ccc !important;
    background: white !important;
  }
}
