/* ==========================================================================
   BENTO DESIGN SYSTEM & CONFIGURATION
   ========================================================================== */
:root {
  /* Font Family */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  /* Transitions */
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;

  /* Dark Theme Colors (Default) */
  --bg-app: #030712;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #8b5cf6; /* Violet */
  --primary-hover: #7c3aed;
  --primary-glow: rgba(139, 92, 246, 0.15);
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: #312e81; /* Indigo-900 for dark mode */
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);
}

/* Light Theme Colors */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(241, 245, 249, 0.9);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --primary: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.1);
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: #c7d2fe; /* Indigo-200 */
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 16px;
  overflow-x: hidden;
  position: relative;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

/* ==========================================================================
   GLOWING BACKGROUND ORBS (MESH DECORATION)
   ========================================================================== */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.12;
  z-index: -1;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

[data-theme="light"] .glow-orb {
  opacity: 0.06;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background-color: var(--primary);
  top: -50px;
  left: -50px;
  animation: float 20s ease-in-out infinite alternate;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background-color: #3b82f6; /* Soft blue */
  bottom: -100px;
  right: -50px;
  animation: float 25s ease-in-out infinite alternate-reverse;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.05); }
}

/* ==========================================================================
   THEME SWITCHER
   ========================================================================== */
.top-controls {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
}

.theme-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.theme-btn:hover {
  transform: scale(1.05);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

[data-theme="light"] .light-icon,
[data-theme="dark"] .dark-icon {
  display: none;
}

/* ==========================================================================
   BENTO CONTAINER & GRID
   ========================================================================== */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  z-index: 1;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  grid-auto-rows: minmax(190px, auto);
}

/* Bento Card Base with Glassmorphism */
.bento-card {
  background-color: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-normal);
  position: relative;
  overflow: hidden;
  /* Staggered fade-in animation */
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.6s ease forwards;
}

.bento-card:nth-child(1) { animation-delay: 0.05s; }
.bento-card:nth-child(2) { animation-delay: 0.12s; }
.bento-card:nth-child(3) { animation-delay: 0.19s; }
.bento-card:nth-child(4) { animation-delay: 0.26s; }
.bento-card:nth-child(5) { animation-delay: 0.33s; }
.bento-card:nth-child(6) { animation-delay: 0.40s; }

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

.bento-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow), var(--shadow-md);
}

/* Custom background glow effects for cards on hover */
.bento-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(800px circle at var(--x, 0px) var(--y, 0px), rgba(255, 255, 255, 0.04), transparent 40%);
  z-index: -1;
  pointer-events: none;
}

.bento-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ==========================================================================
   CARD 1: PROFILE/HERO (Spans 2 columns)
   ========================================================================== */
.hero-card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.hero-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.age-badge {
  background-color: var(--primary-glow);
  color: var(--primary);
  border: 1px solid var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-info h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.4;
}

.location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.location i {
  color: var(--primary);
}

/* ==========================================================================
   CARD 2: เกี่ยวกับผม (About Me)
   ========================================================================== */
.about-card {
  display: flex;
  flex-direction: column;
}

.about-card p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ==========================================================================
   CARD 3: การศึกษา & เป้าหมาย (Education & Goals)
   ========================================================================== */
.education-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.edu-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
  flex-grow: 1;
  justify-content: center;
}

.edu-item h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.edu-level {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 700;
  margin-top: 2px;
}

.goal-item {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 4px;
}

.goal-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.goal-desc {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ==========================================================================
   CARD 4: สิ่งที่ผมชอบ (Hobbies & Interests)
   ========================================================================== */
.hobbies-card {
  grid-column: span 1;
}

.hobbies-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hobby-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all var(--transition-fast);
}

[data-theme="light"] .hobby-item {
  background-color: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.04);
}

.hobby-item:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateX(2px);
}

.hobby-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.hobby-item:hover .hobby-icon-wrapper {
  transform: scale(1.1);
}

.hobby-icon-wrapper i,
.hobby-icon-wrapper svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff !important;
  color: #ffffff !important;
}

.hobby-details h4 {
  font-size: 0.85rem;
  font-weight: 700;
}

.hobby-details p {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ==========================================================================
   CARD 5: ทักษะ & เทคโนโลยี (Tech Stack)
   ========================================================================== */
.tech-card {
  grid-column: span 1;
}

.tech-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tech-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  gap: 12px;
}

.tech-item:hover {
  border-color: var(--primary);
  background-color: var(--bg-card-hover);
}

[data-theme="light"] .tech-item {
  background-color: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.04);
}

.tech-name {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tech-status {
  font-size: 0.7rem;
  color: var(--primary);
  background-color: var(--primary-glow);
  padding: 2px 10px;
  border-radius: 100px;
  border: 1px solid var(--primary);
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   CARD 6: ช่องทางติดต่อ (Social Links — Spans 3 columns)
   ========================================================================== */
.socials-card {
  grid-column: span 3;
}

.socials-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
}

.social-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  filter: brightness(1.1);
}

.social-btn i {
  width: 18px;
  height: 18px;
}

/* Social Custom Colors */
.github-btn {
  background-color: #24292e;
  border-color: #2f363d;
}
.github-btn:hover {
  box-shadow: 0 0 15px rgba(36, 41, 46, 0.5);
}

.instagram-btn {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
.instagram-btn:hover {
  box-shadow: 0 0 15px rgba(220, 39, 67, 0.4);
}

.facebook-btn {
  background-color: #1877f2;
}
.facebook-btn:hover {
  box-shadow: 0 0 15px rgba(24, 119, 242, 0.4);
}

.discord-btn {
  background-color: #5865f2;
}
.discord-btn:hover {
  box-shadow: 0 0 15px rgba(88, 101, 242, 0.4);
}

.email-btn {
  background-color: #ea4335; /* Google Red */
}
.email-btn:hover {
  box-shadow: 0 0 15px rgba(234, 67, 53, 0.4);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  width: 100%;
  text-align: center;
  padding: 32px 16px 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  z-index: 1;
  opacity: 0;
  animation: cardFadeIn 0.6s 0.55s ease forwards;
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 290px;
  pointer-events: auto;
  transform: translateY(20px);
  opacity: 0;
  animation: slideIn var(--transition-normal) forwards;
}

.toast-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.8rem;
  font-weight: 700;
}

.toast-msg {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */
@keyframes slideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 900px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .hero-card {
    grid-column: span 2;
  }
  
  .about-card {
    grid-column: span 2;
  }
  
  .socials-card {
    grid-column: span 2;
  }
  
  .socials-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  body {
    padding: 24px 12px;
  }
  
  .top-controls {
    top: 12px;
    right: 12px;
  }
  
  .bento-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  
  .hero-card {
    grid-column: span 1;
    flex-direction: column;
    text-align: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
  }
  
  .hero-info {
    align-items: center;
  }
  
  .about-card {
    grid-column: span 1;
  }
  
  .socials-card {
    grid-column: span 1;
  }
  
  .socials-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .theme-btn {
    width: 38px;
    height: 38px;
  }
}
