/* ========================================
   Projects Section
   ======================================== */
.projects-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  padding: 0 20px;
}

.projects-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, 340px);
  justify-content: center;
  gap: 40px;
  padding: 20px 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Interaction: Scale down cards when legend is open */
.projects-wrapper.legend-open .projects-container {
  transform: scale(0.95) translateY(10px);
  opacity: 0.6;
  filter: blur(1px);
}

.project-card {
  background: linear-gradient(145deg, var(--pure-white), var(--light-cream));
  border-radius: 16px;
  padding: 30px;
  width: 100%; /* Let grid control width */
  max-width: 340px;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.05),
    0 4px 6px -2px rgba(0, 0, 0, 0.025),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-main);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-color);
  box-shadow: 0 0 20px -5px var(--accent-color);
}

/* Card Header & Icon */
.card-header {
  margin-bottom: 20px;
}

.card-icon {
  font-size: 2.2rem;
  color: var(--accent-color, var(--dark-charcoal));
  transition: transform 0.3s ease, color 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.project-card:hover .card-icon {
  transform: scale(1.1) rotate(5deg);
}

/* Card Title */
.card-title {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark-charcoal);
  margin-bottom: 12px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Card Description */
.card-description {
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  color: var(--slate-gray);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Badges */
.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  background-color: #f1f5f9;
  color: #334155;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  border: 1px solid var(--border-gray);
  transition: var(--transition);
}

.badge:hover {
  background-color: var(--button-bg-hover, #e2e8f0);
  color: var(--dark-charcoal);
}

/* Progress Bar */
.progress-section {
  width: 100%;
  margin-bottom: 20px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--slate-gray);
  font-weight: 500;
}

.progress-track {
  width: 100%;
  height: 6px;
  background-color: var(--progress-track-bg);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  width: var(--prog-width);
  background: var(--accent-color);
  border-radius: 999px;
  transition: width 1s ease-out;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%);
  animation: shimmer 2s infinite;
}

/* Phase Legend (Global) */
.phase-legend-container {
  width: 100%;
  margin: 0 0 10px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: relative;
  z-index: 20;
}

.legend-toggle {
  background: transparent;
  border: 1px solid var(--border-gray);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--slate-gray);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 21;
  background: var(--off-white);
}

.legend-toggle:hover {
  background: var(--pure-white);
  color: var(--dark-charcoal);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.legend-toggle i {
  transition: transform 0.3s ease;
}

.legend-toggle.active i {
  transform: rotate(180deg);
}

.phase-legend {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.4s ease-out,
    opacity 0.4s ease-out;
  opacity: 0;
  text-align: left;
  margin-top: 10px;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
}

.phase-legend.active {
  max-height: 300px;
  opacity: 1;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  background: var(--pure-white);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-gray);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.legend-item h4 {
  font-size: 0.85rem;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.mvp {
  background-color: #059669;
}
.legend-dot.spiral {
  background-color: #2563eb;
}
.legend-dot.developing {
  background-color: #f1c40f;
}
.legend-dot.vmodel {
  background-color: #7c3aed;
}

.legend-item p {
  font-size: 0.8rem;
  color: var(--slate-gray);
  line-height: 1.4;
  margin-left: 18px;
}

/* Inline Collapsible Schedule */
.progress-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
  opacity: 0;
}

.progress-details.active {
  max-height: 400px;
  opacity: 1;
  margin-bottom: 15px;
  margin-top: 10px;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--slate-gray);
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-icon {
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
}

.checklist-icon.done {
  color: var(--accent-green);
}
.checklist-icon.pending {
  color: var(--border-subtle);
}
.checklist-icon.in-progress {
  color: #f39c12;
}

.checklist-text {
  font-weight: 500;
  color: var(--dark-charcoal);
}

.checklist-date {
  font-size: 0.75rem;
  color: var(--slate-gray);
  opacity: 0.8;
}

.details-toggle {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-gray);
  padding: 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--dark-charcoal);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.details-toggle:hover {
  background: var(--lighter-gray);
  color: var(--dark-charcoal);
}

.details-toggle i {
  transition: transform 0.3s ease;
}
.details-toggle.active i {
  transform: rotate(180deg);
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Status Badges */
.status-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--accent-color);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 10px -2px var(--accent-color);
  z-index: 10;
}

@media (max-width: 480px) {
  .project-card {
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
  }
}

/* Loader for dynamic projects */
.projects-loader {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--slate-gray);
  gap: 15px;
  animation: fadeIn 0.5s ease-out;
}

.projects-loader i {
  font-size: 2.5rem;
  color: var(--accent-blue);
}

.projects-loader p {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.filter-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color, #ccc);
    background: transparent;
    color: var(--text-secondary, #888);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.03em;
}

.filter-btn:hover {
    border-color: var(--accent-blue, #3b82f6);
    color: var(--accent-blue, #3b82f6);
}

.filter-btn.active {
    background: var(--accent-blue, #3b82f6);
    border-color: var(--accent-blue, #3b82f6);
    color: #fff;
}