/* ============================================
   PROJECTS / GALLERY PAGE - ROBUST GRID
   Fixed Layout Logic
   ============================================ */

/* ====================
   VARIABLES & THEME
   ==================== */
:root {
  /* Color Palette - Steel & Gold */
  --steel-dark: #0a0c10;
  --steel-darker: #050709;
  --steel-medium: #1a1d24;
  --steel-light: #2a2f3a;
  --gold-primary: #d4af37;
  --gold-secondary: #ffd700;
  --gold-dim: #b8941f;

  /* Gradients */
  --gradient-steel: linear-gradient(
    145deg,
    #050709 0%,
    #0a0c10 30%,
    #1a1d24 70%,
    #2a2f3a 100%
  );
  --gradient-gold: linear-gradient(
    90deg,
    #b8941f 0%,
    #d4af37 50%,
    #ffd700 100%
  );

  /* Spacing */
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xxl: 5rem;

  /* Shadows */
  --radius-lg: 12px;
}

/* ====================
   GRID CONTAINER (The Fix)
   ==================== */
#projects-grid {
  max-width: 1400px;
  min-height: 60vh;
  margin: 30px auto;
  padding: 0 var(--space-md);

  /* CSS Grid Setup */
  display: grid;
  /* Auto-fill columns: fits as many 300px cards as possible */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));

  /* ✅ FIXED: Use 'auto' instead of '20px'. 
     This lets rows grow to fit the card content automatically. */
  grid-auto-rows: auto;

  gap: 30px; /* Space between cards */
  width: 100%;
}

/* ====================
   PROJECT CARD SIZING
   ==================== */
.project-card {
  position: relative;
  width: 100%;

  /* Aspect Ratio Hack to keep images nice */
  aspect-ratio: 4 / 3;

  /* Styling */
  background: rgba(26, 29, 36, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: var(--radius-lg);
  overflow: hidden;

  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  animation: cardAppear 0.6s ease-out forwards;
}

/* ====================
   IMAGE/VISUAL STYLING
   ==================== */
.project-card .media-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.project-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: all 0.5s ease;
  filter: brightness(0.9) contrast(105%);
}

.project-card:hover img {
  filter: brightness(1.05) contrast(110%);
  transform: scale(1.08);
}

/* ====================
   VIDEO STYLING
   ==================== */
.project-card[data-type="video"] .video-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Play button overlay */
.video-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
}

.video-play-button {
  width: 60px;
  height: 60px;
  background: rgba(212, 175, 55, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0c10;
  font-size: 1.5rem;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
  transition: transform 0.3s ease;
}

.project-card:hover .video-play-button {
  transform: scale(1.1);
  background: #ffd700;
}

/* ====================
   CAPTION & OVERLAY
   ==================== */
.project-card .content-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(10, 12, 16, 0.95), transparent);
  padding: 20px;
  transform: translateY(100%); /* Hidden by default */
  transition: transform 0.3s ease;
  z-index: 3;
}

.project-card:hover .content-overlay {
  transform: translateY(0); /* Slide up on hover */
}

.project-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.project-card figcaption {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  margin-top: 5px;
}

/* ====================
   HOVER EFFECTS
   ==================== */
.project-card:hover {
  transform: translateY(-5px);
  border-color: var(--gold-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Gold Top Border */
.project-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-gold);
  transform: scaleX(0);
  transition: transform 0.4s ease;
  transform-origin: left;
}

.project-card:hover::after {
  transform: scaleX(1);
}

/* ====================
   ANIMATION
   ==================== */
@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger Children */
.project-card:nth-child(1) {
  animation-delay: 0.1s;
}
.project-card:nth-child(2) {
  animation-delay: 0.2s;
}
.project-card:nth-child(3) {
  animation-delay: 0.3s;
}
.project-card:nth-child(4) {
  animation-delay: 0.4s;
}
.project-card:nth-child(5) {
  animation-delay: 0.5s;
}
.project-card:nth-child(6) {
  animation-delay: 0.6s;
}

/* ====================
   RESPONSIVE
   ==================== */
@media (max-width: 768px) {
  #projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
  }

  /* On mobile, show title always, slightly dimmed */
  .project-card .content-overlay {
    transform: translateY(0);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.4));
  }
}

.no-projects {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: white;
}
