/* =========================================
   1. මූලික සැකසුම් සහ විචල්‍යයන් (Variables)
   ========================================= */
:root {
  --primary-color: #2563eb;       /* ප්‍රධාන වර්ණය (Blue) */
  --secondary-color: #1e293b;     /* අඳුරු වර්ණය (Dark Blue/Grey) */
  --text-color: #333333;          /* අකුරු වල වර්ණය */
  --bg-color: #ffffff;            /* පසුබිම් වර්ණය */
  --light-bg: #f3f4f6;            /* ලා අළු පසුබිම */
  --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --transition: all 0.3s ease;    /* Smooth Animation */
  --card-bg: #ffffff;
}

/* Dark Mode Support */
[data-bs-theme="dark"] {
  --bg-color: #212529;
  --text-color: #f8f9fa;
  --light-bg: #343a40;
  --card-bg: #2b3035;
}

/* සියලුම මූලද්‍රව්‍ය සඳහා පොදු සැකසුම් (Reset) */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.5s ease, color 0.5s ease;
  /* වෙබ් පිටුවේ Scroll Bar එක සැඟවීම (Firefox/IE/Edge) */
  scrollbar-width: none;
  -ms-overflow-style: none;
  overflow-x: hidden;
  width: 100%;
  cursor: none; /* Default Cursor එක සැඟවීම */
}

/* අන්තර්ක්‍රියාකාරී මූලද්‍රව්‍ය මතදීද Default Cursor එක සැඟවීම */
a, button, input, textarea, .btn, .nav-link {
  cursor: none;
}

html {
  overflow-x: hidden;
}

/* වෙබ් පිටුවේ Scroll Bar එක සැඟවීම (Chrome/Safari/Opera) */
::-webkit-scrollbar {
  display: none;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* =========================================
   2. Navigation Bar (මෙනුව)
   ========================================= */

/* Custom Nav Link Styles */
.custom-nav-link {
  font-weight: 500;
  position: relative;
  padding: 5px 10px !important;
  color: var(--text-color) !important;
  transition: var(--transition);
}

.custom-nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 50%;
  background-color: var(--primary-color);
  transition: var(--transition);
  transform: translateX(-50%);
}

.custom-nav-link:hover::after {
  width: 100%;
}

.custom-nav-link:hover {
  color: var(--primary-color) !important;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--text-color);
  background: transparent;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  cursor: pointer;
}

.theme-toggle-btn:hover {
  background: var(--text-color);
  color: var(--bg-color);
  transform: rotate(15deg);
}

/* =========================================
   3. Hero Section (මුල් කොටස)
   ========================================= */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background-color: var(--light-bg);
  padding: 80px 20px 20px 20px; /* Navbar එකට ඉඩ තැබීම */
  cursor: default; /* Home එකේදී සාමාන්‍ය cursor එක පෙන්වීම */
}

/* Home එක ඇතුළත ඇති Button සහ Links සඳහා Pointer Cursor එක පෙන්වීම */
.hero a, .hero button, .hero .btn {
  cursor: pointer;
}

/* පොදු Full Screen Section Style එක */
.section-fullscreen {
  min-height: 100vh;
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

/* Dark mode fix for Hero H1 */
[data-bs-theme="dark"] .hero h1 {
  color: #ffffff;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  max-width: 600px;
}

.btn {
  display: inline-block;
  /* Gradient Background Setup */
  background-image: linear-gradient(to right, var(--primary-color) 0%, #8b5cf6 51%, var(--primary-color) 100%);
  background-size: 200% auto;
  color: #fff !important; /* අකුරු සැමවිටම සුදු පාටින් */
  padding: 10px 30px;
  border-radius: 5px;
  transition: 0.5s;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  background-position: right center; /* Gradient Animation */
  color: #fff;
  text-decoration: none;
  /* Bounce/Pulse Animation */
  animation: btn-bounce 0.4s ease-in-out;
}

/* Vibrant Button for Hero Section */
.btn-vibrant {
  background-image: linear-gradient(to right, #FF512F 0%, #DD2476 51%, #FF512F 100%);
  color: #fff !important;
  border: none;
  box-shadow: 0 4px 15px rgba(221, 36, 118, 0.4);
}

/* =========================================
   Hero Visual Animation (3D Cube & Shapes)
   ========================================= */
.hero-visual {
  position: relative;
  width: 100%;
  height: 400px;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px; /* 3D ගැඹුර */
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 0;
  will-change: transform;
  transition: none;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background: rgba(37, 99, 235, 0.3); /* Primary Color */
  top: -10%;
  left: -10%;
  animation: float 6s ease-in-out infinite;
}

.shape-2 {
  width: 250px;
  height: 250px;
  background: rgba(139, 92, 246, 0.3); /* Purple */
  bottom: -10%;
  right: -10%;
  animation: float 8s ease-in-out infinite reverse;
}

/* 3D Cube Styles */
.cube-wrapper {
  transform-style: preserve-3d;
  will-change: transform;
  transition: none;
}

.cube-container {
  width: 200px;
  height: 200px;
  transform-style: preserve-3d;
  animation: rotate-cube 20s linear infinite;
}

.cube-face {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1); /* Glassmorphism Effect */
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--primary-color);
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.2);
}

/* Cube Faces Positioning */
.front  { transform: translateZ(100px); }
.back   { transform: rotateY(180deg) translateZ(100px); }
.right  { transform: rotateY(90deg) translateZ(100px); }
.left   { transform: rotateY(-90deg) translateZ(100px); }
.top    { transform: rotateX(90deg) translateZ(100px); }
.bottom { transform: rotateX(-90deg) translateZ(100px); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes rotate-cube {
  0% { transform: rotateX(0) rotateY(0); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

/* Button Bounce Animation */
@keyframes btn-bounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* =========================================
   4. Projects / Portfolio Grid
   ========================================= */
.portfolio {
  min-height: 100vh;
  padding: 80px 0; /* Navbar එකට ඉඩ තැබීම */
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 40px;
  color: var(--secondary-color);
}

.marquee-container {
  overflow: hidden;
  padding: 20px 0;
  width: 100%;
}

.marquee-track {
  display: flex;
  gap: 30px;
  width: max-content;
  /* වමේ සිට දකුණට ගමන් කිරීම (Left to Right Animation) */
  animation: scroll-left-to-right 40s linear infinite;
}

.marquee-container:hover .marquee-track {
  animation-play-state: paused;
}

.project-card {
  position: relative;
  height: 350px; /* කාඩ් එකේ උස ස්ථිරව තබා ගැනීම */
  width: 22vw;   /* එකවර items 4ක් පෙන්වීමට පළල සකස් කිරීම */
  min-width: 300px;
  flex-shrink: 0; /* Flex container එක තුළ හැකිලීම වැළැක්වීම */
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  border: 1px solid transparent;
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top; /* පින්තූරය ඉහළ සිට පෙන්වීම */
  transition: transform 0.5s ease, object-position 3s ease; /* Zoom සහ Scroll Animation */
}

/* Project Card Hover Effects (Scale & Color) */
.project-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 30px rgba(0,0,0,0.2);
  border-color: var(--primary-color);
}

.project-card:hover .project-image {
  transform: scale(1.1); /* Zoom වීම */
  object-position: bottom; /* පහළට Scroll වීම (දිග පින්තූර සඳහා) */
}

.project-info {
  position: absolute;
  inset: 0; /* කාඩ් එක සම්පූර්ණයෙන්ම ආවරණය කිරීම */
  background: rgba(0, 0, 0, 0.75); /* අඳුරු ආවරණය (Overlay) */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  opacity: 0; /* මුලින් සැඟවී තිබීම */
  transform: translateY(20px);
  transition: all 0.4s ease;
}

.project-card:hover .project-info {
  opacity: 1;
  transform: translateY(0);
}

/* Overlay එක තුළ ඇති අකුරු සැමවිටම සුදු පාටින් */
.project-info h3 {
  color: #fff;
  margin-bottom: 10px;
}

.project-info p {
  color: #ddd;
  margin-bottom: 20px;
}

/* Marquee Animation Keyframes (Left to Right) */
@keyframes scroll-left-to-right {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* Testimonial Cards */
.testimonial-card {
  transition: transform 0.3s ease;
}

.testimonial-card:hover {
  transform: translateY(-5px);
}

/* Blog Cards */
.blog-card {
  transition: transform 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-5px);
}

/* Blog Image Styles for High Quality & Consistent Layout */
.blog-card .card-img-top {
  height: 250px;
  object-fit: cover;
}

/* =========================================
   5. Contact Section & Footer
   ========================================= */

/* =========================================
   6. Footer & Social Icons
   ========================================= */
.social-links {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.social-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
  transition: var(--transition);
}

.social-icon:hover {
  background: var(--primary-color);
  color: #fff;
  transform: translateY(-5px);
}

/* =========================================
   7. Back to Top Button
   ========================================= */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--secondary-color);
  transform: translateY(-5px);
}

/* =========================================
   8. Mobile Responsiveness (ජංගම දුරකථන සඳහා)
   ========================================= */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .navbar-toggler {
    margin-right: 15px; /* මෙනු බටන් එක වමට ගැනීම */
  }

  /* Orbit Animation Responsive Adjustments */
  .orbit-system {
    width: 220px;
    height: 220px;
  }
  .skill-item {
    transform: rotate(calc(360deg / var(--total) * var(--i))) translate(110px);
  }
  .skill-card {
    width: 70px;
    height: 70px;
    margin-top: -35px;
    margin-left: -35px;
  }
  .skill-card i {
    font-size: 1.5rem !important;
  }
}

/* =========================================
   9. Skills Orbit Animation
   ========================================= */
.orbit-container {
  position: relative;
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.orbit-center {
  position: absolute;
  z-index: 10;
}

.center-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 20px var(--primary-color);
  animation: pulse 2s infinite;
}

.orbit-system {
  position: relative;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  border: 1px dashed rgba(128, 128, 128, 0.3);
  animation: orbit-spin 20s linear infinite;
}

.skill-item {
  position: absolute;
  top: 50%;
  left: 50%;
  /* අයිකන රවුම වටා පිහිටුවීම */
  transform: rotate(calc(360deg / var(--total) * var(--i))) translate(200px);
}

.skill-rotator {
  /* අයිකන කෙළින් තබා ගැනීමට විරුද්ධ දිශාවට කරකැවීම */
  animation: orbit-counter-spin 20s linear infinite;
}

.skill-card {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  margin-top: -45px; /* Center anchor */
  margin-left: -45px;
  border: 1px solid rgba(0,0,0,0.05);
  transform: rotate(calc(-360deg / var(--total) * var(--i)));
}

.skill-card:hover {
  transform: rotate(calc(-360deg / var(--total) * var(--i))) scale(1.3);
  z-index: 100;
  box-shadow: 0 0 25px var(--primary-color);
}

/* Hover කළ විට Animation නැවැත්වීම */
.orbit-system:hover,
.orbit-system:hover .skill-rotator {
  animation-play-state: paused;
}

@keyframes orbit-spin {
  100% { transform: rotate(360deg); }
}

@keyframes orbit-counter-spin {
  100% { transform: rotate(-360deg); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* =========================================
   10. Terminal Styles
   ========================================= */
#terminal-window {
    display: none;
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    height: 300px;
    background-color: #222;
    color: #fff;
    border-radius: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    flex-direction: column;
}

#terminal-resizer {
    width: 100%;
    height: 12px;
    background-color: #333;
    cursor: ns-resize; /* මවුස් එක උඩට/පහළට පෙන්වන ඊතලයක් ලෙස වෙනස් කිරීම */
    border-top: 1px solid #444;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#terminal-resizer::after {
    content: '';
    width: 40px;
    height: 4px;
    background-color: #555;
    border-radius: 2px;
}

#terminal-header {
    background-color: #333;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-title {
    font-size: 1.2rem;
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace; /* Terminal Font */
    letter-spacing: 1px;
}

#close-terminal {
    cursor: pointer;
    font-size: 2rem; /* බටන් එක ලොකු කිරීම */
    line-height: 1;
    transition: color 0.2s;
}

#close-terminal:hover {
    color: #ef4444; /* මවුස් එක ගෙන ගිය විට රතු පැහැය */
}

#terminal-body {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#terminal-output {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    font-family: monospace;
    /* Terminal එක ඇතුළත Scroll Bar එක සැඟවීම */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#terminal-output::-webkit-scrollbar {
    display: none;
}

#terminal-input {
    width: 100%;
    background-color: #444;
    color: #fff;
    border: none;
    padding: 5px;
    border-radius: 5px;
    font-family: monospace;
}

#terminal-icon i:active{
    color: white;
}

#terminal-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    color: white;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    cursor: pointer;
    z-index: 1001;
    transition: var(--transition);
}

#terminal-icon.move-up {
    bottom: 90px;
}

/* =========================================
   Starry Background Animation
   ========================================= */
.stars-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle linear infinite;
}

@keyframes twinkle {
  0% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.2; transform: scale(0.8); }
}

/* =========================================
   11. Form Focus Effects
   ========================================= */
.form-control:focus {
  border: 1px solid var(--primary-color) !important;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.3) !important;
}

[data-bs-theme="dark"] .form-control:focus {
  background-color: #000;
  color: #fff;
}

/* =========================================
   12. Custom Mouse Cursor
   ========================================= */
body {
  cursor: none; /* සාමාන්‍ය මවුස් කර්සර් එක සඟවයි */
}

.cursor-dot {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary-color); /* රවුම පැහැදිලිව පෙනීමට ඝනකම වැඩි කිරීම */
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%); /* කර්සර් එක මැදට ගැනීමට */
  pointer-events: none; /* කර්සර් එක හරහා click කිරීමට ඉඩ දීම */
  z-index: 9999;
  transition: width 0.3s, height 0.3s, background-color 0.3s, transform 0.1s; /* Smooth animation */
}

/* Button එකක් උඩට ගිය විට ක්‍රියාත්මක වන class එක */
.cursor-dot.active {
  width: 50px; /* විශාල වන ප්‍රමාණය */
  height: 50px;
  background-color: rgba(37, 99, 235, 0.4); /* බටන් මතදී හොඳින් පෙනීමට පාට තද කිරීම */
  border-color: transparent;
}

/* Click කරන විට කුඩා වීම (Click Effect) */
.cursor-dot.clicked {
  transform: translate(-50%, -50%) scale(0.75);
  background-color: var(--primary-color);
}

/* Custom Cursor එක සැඟවීමට (Terminal එක මතදී) */
.cursor-dot.hidden {
  opacity: 0;
}

/* Navbar එක මතදී සාමාන්‍ය Cursor එක පෙන්වීම */
.navbar {
  cursor: default;
}
.navbar a, .navbar button, .navbar .btn, .navbar .nav-link, .theme-toggle-btn {
  cursor: pointer; /* Link සහ Button මතදී අතක සලකුණ පෙන්වීම */
}

/* Terminal එක සඳහා Cursor සැකසුම් */
#terminal-window {
  cursor: default; /* සාමාන්‍ය ඊතලය */
}
#terminal-input {
  cursor: text; /* Type කිරීමට පහසු I-beam cursor එක */
}

/* Skills Section - Show normal cursor alongside custom cursor */
#skills {
  cursor: default !important;
}

#skills .skill-hex {
  cursor: pointer !important;
}

/* =========================================
   13. Contact Form Success Popup
   ========================================= */
.success-popup {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: inherit;
  text-align: center;
  animation: fadeIn 0.3s ease-in-out;
}

[data-bs-theme="dark"] .success-popup {
  background-color: rgba(33, 37, 41, 0.95);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================
   14. Skeleton Loading Animation
   ========================================= */
.skeleton {
  background: #e0e0e0;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

[data-bs-theme="dark"] .skeleton {
  background: #2b3035;
  background: linear-gradient(90deg, #2b3035 25%, #343a40 50%, #2b3035 75%);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-img { width: 100%; height: 200px; }
.skeleton-text { height: 1rem; margin-bottom: 0.5rem; border-radius: 2px; }
.skeleton-title { height: 1.5rem; margin-bottom: 1rem; width: 80%; border-radius: 2px; }

/* =========================================
   15. Mobile Menu Animation
   ========================================= */
@media (max-width: 991px) {
  .navbar-collapse {
    display: block !important; /* Bootstrap default එක override කිරීම */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out;
  }

  .navbar-collapse.show {
    max-height: 500px; /* මෙනුවේ අන්තර්ගතයට සරිලන උසක් */
    opacity: 1;
  }
}

/* =========================================
   16. Glassmorphism Navbar (Backdrop Blur)
   ========================================= */
.navbar {
  background-color: rgba(255, 255, 255, 0.85) !important; /* අර්ධ-පාරදෘශ්‍ය පසුබිම */
  backdrop-filter: blur(12px); /* Blur Effect එක */
  -webkit-backdrop-filter: blur(12px); /* Safari Browser එක සඳහා */
}

[data-bs-theme="dark"] .navbar {
  background-color: rgba(33, 37, 41, 0.85) !important;
}

/* =========================================
   17. 3D Hexa-Sphere Skills Section
   ========================================= */
.skills-scene {
  width: 100%;
  height: 600px;
  perspective: 1000px; /* 3D ගැඹුර */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  cursor: grab;
  touch-action: none; /* Mobile scroll වැළැක්වීමට */
}

.skills-scene:active {
  cursor: grabbing;
}

.skills-sphere {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  /* Rotation JS මගින් පාලනය වේ */
}

.skill-hex-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
}

.skill-hex {
  position: relative;
  width: 100px;
  height: 110px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy Flip Effect */
  cursor: pointer;
  /* Floating Animation (JS මගින් delay එකතු කරයි) */
  animation: float-hex 3s ease-in-out infinite;
}

@keyframes float-hex {
  0%, 100% { transform: translateZ(0); }
  50% { transform: translateZ(15px); } /* හුස්ම ගන්නා ආකාරයේ චලනය */
}

.skill-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  /* Hexagon Shape Clip Path */
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: rgba(30, 41, 59, 0.9);
  border: 2px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
  color: white;
  padding: 10px;
}

.skill-face.front:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.6);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .skills-scene {
    height: 450px;
  }
  .skill-hex {
    width: 80px;
    height: 88px;
  }
}

.gradient-text {
  background: linear-gradient(to right, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =========================================
   18. Skill Detail Popup
   ========================================= */
.skill-detail-popup {
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  width: 300px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 25px;
  color: white;
  z-index: 100;
  box-shadow: 0 15px 40px rgba(0,0,0,0.4);
  animation: slideInRight 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-close-popup {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-close-popup:hover {
  background: #ef4444;
  transform: rotate(90deg);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translate(50px, -50%); }
  to { opacity: 1; transform: translate(0, -50%); }
}

@media (max-width: 768px) {
  .skill-detail-popup {
    right: 50%;
    transform: translate(50%, -50%); /* Center on mobile */
    width: 90%;
  }
  
  @keyframes slideInRight {
    from { opacity: 0; transform: translate(50%, -40%); }
    to { opacity: 1; transform: translate(50%, -50%); }
  }
}
