/* ============================================================
   PROJECTS SECTION — projects.css
   Glassmorphic category tiles + filterable project grid
   ============================================================ */

/* CSS custom property for perimeter border trace animation */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotateBorder {
  to {
    --angle: 360deg;
  }
}


/* ---------- Layout ---------- */
.projects-layout {
  display: flex;
  gap: clamp(2rem, 5vw, 4rem);
  width: 100%;
  max-width: 1400px; /* Aligns with landing content boundaries */
  align-items: flex-start;
  margin: 0 auto;
}

/* ---------- Category Tiles (Left Sidebar) ---------- */
.project-categories {
  position: relative; /* Crucial for absolute positioning of shared indicator */
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  width: 150px; /* Slightly wider for larger names */
  position: sticky;
  top: 10rem;
}

/* Shared traveling glow indicator */
.category-glow-indicator {
  position: absolute;
  pointer-events: none;
  border-radius: 14px;
  border: 1px solid var(--tile-accent);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 0;
  transition: all 0.38s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow:
    0 0 16px color-mix(in srgb, var(--tile-accent) 40%, transparent),
    0 0 35px color-mix(in srgb, var(--tile-accent) 15%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Traveling accent bar on indicator edge */
.category-glow-indicator::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 45%;
  border-radius: 0 3px 3px 0;
  background: var(--tile-accent);
  box-shadow: 0 0 10px var(--tile-accent);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

/* Individual tile */
.category-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  padding: 20px 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font);
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.35s ease;
  overflow: hidden;
  z-index: 1;
}

/* Subtle glass hover border */
.category-tile:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.tile-label {
  font-size: 0.95rem; /* Larger font size as requested */
  font-weight: 300;   /* Centered, sleek, and thinner weight */
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.35s ease, font-weight 0.35s ease;
  pointer-events: none;
}

.category-tile:hover .tile-label {
  color: var(--text-primary);
}

/* Active class changes text style, leaving glow to shared indicator */
.category-tile.active .tile-label {
  color: #ffffff;
  font-weight: 500;
}

/* ---------- Per-category accent colors ---------- */
.category-tile[data-category="all"]  { --tile-accent: #a3a3a3; }
.category-tile[data-category="python"]  { --tile-accent: #f6c643; }
.category-tile[data-category="sql"]     { --tile-accent: #4db8ff; }
.category-tile[data-category="excel"]   { --tile-accent: #2dc653; }
.category-tile[data-category="powerbi"] { --tile-accent: #f59e0b; }
.category-tile[data-category="tableau"] { --tile-accent: #7c3aed; }

/* ---------- Project Cards Grid ---------- */
.projects-grid-wrapper {
  flex: 1;
  min-width: 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.8rem;
}

/* Individual project card */
.project-card {
  position: relative; /* Essential for border tracing positioning */
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-decoration: none;
  color: inherit;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Traveling border trace line */
.project-card::before {
  content: '';
  position: absolute;
  inset: 0px; /* Drawn on the inside boundary so overflow: hidden doesn't clip it */
  border-radius: inherit;
  padding: 2.5px; /* Thicker and much more noticeable border line */
  background: conic-gradient(from var(--angle), transparent 20%, #888888 38%, #ffffff 50%, #888888 62%, transparent 80%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 5;
}

.project-card:hover {
  border-color: transparent; /* Hide original static border to showcase the traveling line */
  transform: translateY(-6px) scale(1.015);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.6),
    0 0 25px rgba(255, 255, 255, 0.15); /* Stronger glow on hover */
}

.project-card:hover::before {
  opacity: 1;
  animation: rotateBorder 2s linear infinite;
}

.card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0d0d0d;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .card-image img {
  transform: scale(1.06);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 60%);
  pointer-events: none;
}

.card-title {
  padding: 16px 18px;
  font-size: 0.92rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.project-card:hover .card-title {
  color: var(--accent-2);
}

/* ---------- Filter animations ---------- */
.project-card.hidden {
  opacity: 0;
  transform: scale(0.92) translateY(15px);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.project-card.showing {
  animation: cardIn 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes cardIn {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(15px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.projects-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 1rem;
}

.projects-empty p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

/* ============================================================
   RESPONSIVE — TABLET (≤1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .projects-layout {
    gap: 2rem;
  }

  .project-categories {
    width: 130px;
  }

  .category-tile {
    padding: 16px 10px;
  }

  .tile-label {
    font-size: 0.85rem;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  .projects-layout {
    flex-direction: column;
    gap: 2rem;
  }

  .project-categories {
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    gap: 10px;
    position: static;
    padding-bottom: 12px;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .project-categories::-webkit-scrollbar {
    display: none;
  }

  .category-tile {
    padding: 12px 20px;
    min-width: max-content;
    border-radius: 12px;
  }

  .tile-label {
    font-size: 0.85rem;
  }

  /* Shared indicator matches bottom layout on mobile */
  .category-glow-indicator {
    border-radius: 12px;
  }

  /* Bottom accent bar on mobile */
  .category-glow-indicator::after {
    left: 50%;
    top: auto;
    bottom: 0;
    transform: translateX(-50%);
    width: 40%;
    height: 3px;
    border-radius: 3px 3px 0 0;
  }

  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.2rem;
  }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (≤480px)
   ============================================================ */
@media (max-width: 480px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
  }

  .card-title {
    font-size: 0.8rem;
    padding: 10px 12px;
  }

  .category-tile {
    padding: 10px 14px;
  }
}
