/* ========================================
   MODERN DARK GLASSMORPHISM PROJECT CARDS
   Sleek dark design with gradient headers matching the reference
   ======================================== */

/* Portfolio Container with Smooth Grid */
.portfolio-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 30px;
  padding: 40px 20px;
  perspective: 1500px;
  transform-style: preserve-3d;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  max-width: 1400px;
  margin: 0 auto;
}

/* Modern Dark Glassmorphism Card */
.portfolio-box {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(10, 10, 12, 0.98) 0%,
    rgba(8, 8, 10, 1) 100%
  );
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  transform-origin: center center;
  will-change: transform, box-shadow;

  /* Deep Dark Shadow */
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.8), 0 2px 8px 0 rgba(0, 0, 0, 0.6),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.03);
}

/* Enhanced Hover Effect */
.portfolio-box:hover {
  background: linear-gradient(
    135deg,
    rgba(15, 15, 18, 1) 0%,
    rgba(12, 12, 15, 1) 100%
  );
  border: 1px solid rgba(138, 43, 226, 0.5);
  transform: translateY(-12px) scale(1.02);

  /* Enhanced Glow Shadow on Hover */
  box-shadow: 0 20px 60px 0 rgba(0, 0, 0, 0.9),
    0 0 50px 0 rgba(138, 43, 226, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.08);

  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Glassmorphism Shine Effect */
.portfolio-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(138, 43, 226, 0.1),
    transparent
  );
  transition: left 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 1;
}

.portfolio-box:hover::before {
  left: 100%;
}

/* Top Accent Border */
.portfolio-box::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(138, 43, 226, 0.8),
    rgba(75, 0, 130, 0.8),
    rgba(138, 43, 226, 0.8)
  );
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  border-radius: 20px 20px 0 0;
}

.portfolio-box:hover::after {
  opacity: 1;
}

/* Portfolio Image Container with Gradient Header */
.portfolio-image {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(
    135deg,
    rgba(138, 43, 226, 0.25) 0%,
    rgba(75, 0, 130, 0.35) 50%,
    rgba(10, 10, 15, 0.95) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.portfolio-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s ease;
  will-change: transform;
  opacity: 0.9;
}

.portfolio-box:hover .portfolio-image img {
  transform: scale(1.08);
  opacity: 1;
}

/* Gradient Overlay for Header */
.portfolio-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(138, 43, 226, 0.15) 0%,
    rgba(75, 0, 130, 0.2) 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  opacity: 1;
  mix-blend-mode: overlay;
}

.portfolio-box:hover .portfolio-overlay {
  background: linear-gradient(
    135deg,
    rgba(138, 43, 226, 0.25) 0%,
    rgba(75, 0, 130, 0.3) 50%,
    rgba(0, 0, 0, 0.3) 100%
  );
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Portfolio Content */
.portfolio-content {
  padding: 28px 24px;
  position: relative;
  z-index: 2;
  background: linear-gradient(
    180deg,
    rgba(8, 8, 10, 0.8) 0%,
    rgba(5, 5, 8, 0.95) 100%
  );
}

/* Project Category Badge */
.project-category {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(138, 43, 226, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(138, 43, 226, 0.25);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 14px;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.portfolio-box:hover .project-category {
  background: rgba(138, 43, 226, 0.2);
  border-color: rgba(138, 43, 226, 0.4);
  color: #c4b5fd;
}

/* Project Title */
.project-title {
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 14px;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  line-height: 1.3;
  letter-spacing: -0.5px;
}

.portfolio-box:hover .project-title {
  color: #ffffff;
  text-shadow: 0 0 20px rgba(138, 43, 226, 0.4);
}

/* Project Description */
.project-description {
  font-size: 0.95rem;
  color: rgba(170, 170, 180, 0.85);
  line-height: 1.7;
  margin-bottom: 22px;
  transition: color 0.3s ease;
}

.portfolio-box:hover .project-description {
  color: rgba(200, 200, 210, 0.95);
}

/* Tech Badges Container */
.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

/* Dark Tech Badges */
.tech-badge {
  padding: 7px 14px;
  background: rgba(15, 15, 18, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(180, 180, 190, 0.95);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: default;
  letter-spacing: 0.3px;
}

.tech-badge:hover {
  background: rgba(25, 25, 30, 1);
  border-color: rgba(138, 43, 226, 0.6);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

/* Project Links Container */
.project-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Modern Dark Buttons */
.project-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 18px;
  background: rgba(12, 12, 15, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: rgba(200, 200, 210, 0.95);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}

.project-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  transition: left 0.5s ease;
}

.project-btn:hover::before {
  left: 100%;
}

.project-btn:hover {
  background: rgba(20, 20, 25, 1);
  border-color: rgba(138, 43, 226, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.35);
  color: #ffffff;
}

.project-btn i {
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  z-index: 1;
}

.project-btn span {
  position: relative;
  z-index: 1;
}

.project-btn:hover i {
  transform: scale(1.15);
}

/* Live Demo Button Variant */
.btn-live {
  background: rgba(15, 15, 18, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-live:hover {
  background: rgba(25, 25, 30, 1);
  border-color: rgba(138, 43, 226, 0.7);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.4);
}

/* Code Button Variant */
.btn-code {
  background: rgba(12, 12, 15, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-code:hover {
  background: rgba(22, 22, 27, 1);
  border-color: rgba(138, 43, 226, 0.6);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.35);
}

/* Smooth Entrance Animation */
@keyframes smoothGlassEntry {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.9);
    filter: blur(10px);
  }
  50% {
    opacity: 0.7;
    transform: translateY(20px) scale(0.95);
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.portfolio-box {
  animation: smoothGlassEntry 0.8s cubic-bezier(0.23, 1, 0.32, 1) backwards;
}

/* Staggered Animation */
.portfolio-box:nth-child(1) {
  animation-delay: 0.1s;
}
.portfolio-box:nth-child(2) {
  animation-delay: 0.2s;
}
.portfolio-box:nth-child(3) {
  animation-delay: 0.3s;
}
.portfolio-box:nth-child(4) {
  animation-delay: 0.4s;
}
.portfolio-box:nth-child(5) {
  animation-delay: 0.5s;
}
.portfolio-box:nth-child(6) {
  animation-delay: 0.6s;
}

/* Smooth Group Hover Effect */
.portfolio-container:hover .portfolio-box:not(:hover) {
  transform: scale(0.96);
  opacity: 0.6;
  filter: blur(2px);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Focus States for Accessibility */
.portfolio-box:focus-within {
  outline: 2px solid rgba(138, 43, 226, 0.5);
  outline-offset: 4px;
  transform: translateY(-8px) scale(1.02);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .portfolio-container {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 25px;
    transition: all 0.5s ease;
  }
}

@media (max-width: 768px) {
  .portfolio-container {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 20px 10px;
  }

  .portfolio-box {
    border-radius: 18px;
  }

  .portfolio-box:hover {
    transform: translateY(-8px) scale(1.01);
  }

  .portfolio-image {
    height: 200px;
  }

  .portfolio-content {
    padding: 24px 20px;
  }

  .project-title {
    font-size: 1.8rem;
  }

  .project-links {
    flex-direction: column;
  }

  .project-btn {
    min-width: 100%;
  }
}

@media (max-width: 520px) {
  .portfolio-container {
    gap: 20px;
  }

  .portfolio-image {
    height: 180px;
  }

  .portfolio-content {
    padding: 20px 18px;
  }

  .project-title {
    font-size: 1.6rem;
  }

  .project-description {
    font-size: 0.9rem;
  }

  .tech-badge {
    font-size: 0.7rem;
    padding: 6px 12px;
  }
}

/* Performance Optimizations */
.portfolio-box,
.portfolio-image img,
.project-btn,
.tech-badge {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .portfolio-box,
  .portfolio-image img,
  .project-btn,
  .tech-badge,
  .portfolio-overlay {
    transition: none;
    animation: none;
  }

  .portfolio-box:hover {
    transform: none;
  }
}
