/* ==========================================================================
   projects.css — Selected Work section
   Layout: 2-col card (left: name → desc → tags stacked; right: GitHub link)
   Hover: translateX(12px)
   Entrance: scale+fade stagger via initProjectsAnimation() in main.js
   ========================================================================== */

.projects {
  min-height: 100vh;
  min-height: 100svh;   /* constant small-viewport height — no address-bar reflow jitter */
  padding: var(--space-4xl) 0;
  position: relative;
  overflow: hidden;
}

.projects-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-gutter);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

/* Label + hint stacked tightly; the wrapper is one flex child of .projects-inner
   so the large --space-2xl column gap sits between this head and the grid, not
   between the label and its hint. */
.projects-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.projects-label {
  font-family: var(--font-mono);
  /* minhpham section labels (.body-text uppercase) are 0.875rem (14px) — was 11px. */
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Small affordance telling users the cards open case studies. */
.projects-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  opacity: 0.72;
  margin: 0;
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card — 2-col grid: [content 1fr] [link auto]
   Children placed explicitly so name/desc/tags stack in col 1
   and the GitHub link sits top-right in col 2. */
.project-card {
  background: transparent;
  border: 1px solid rgba(var(--color-text-rgb), 0.1);
  border-radius: 14px;
  padding: var(--space-xl) var(--space-xl);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: var(--space-2xl);
  align-items: start;
  position: relative;
  transition: color 0.25s ease, transform 0.25s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
}

.project-card:hover {
  transform: translateX(12px);
  border-color: rgba(74, 158, 255, 0.45);
  box-shadow: 0 0 24px rgba(74, 158, 255, 0.12), 0 0 48px rgba(74, 158, 255, 0.06);
}

/* Overlay link — wraps the card title on linked cards.
   ::after covers the entire card so clicking anywhere navigates to the case study. */
.project-card-overlay-link {
  color: inherit;
  text-decoration: none;
}

.project-card-overlay-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Name — col 1, row 1 */
.project-card-name {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 52px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--color-text);
  margin: 0 0 var(--space-sm);
}

/* Description — col 1, row 2 */
.project-card-desc {
  grid-column: 1;
  grid-row: 2;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--color-muted);
  margin: 0 0 var(--space-md);
  max-width: 62ch;
}

/* Tags — col 1, row 3 */
.project-card-tags {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--color-text);
  background: rgba(var(--color-text-rgb), 0.06);
  border: 1px solid rgba(var(--color-text-rgb), 0.1);
  border-radius: 999px;
  padding: 4px 10px;
}

/* Single link (AML card) — col 2, row 1, top-aligned */
.project-card-link {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.project-card-link:hover {
  color: #4a9eff;
  text-shadow: 0 0 8px rgba(74, 158, 255, 0.7), 0 0 20px rgba(74, 158, 255, 0.35);
  opacity: 1;
}

/* Multi-link wrapper (non-AML cards) — sits in same grid slot, links flex inside.
   position: relative + z-index: 1 lifts it above the ::after overlay so links are clickable. */
.project-card-links {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  position: relative;
  z-index: 1;
}

/* Links inside wrapper lose their grid placement — they are flex children */
.project-card-links .project-card-link {
  grid-column: unset;
  grid-row: unset;
  align-self: auto;
}

.project-card.is-animating {
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .project-card {
    opacity: 1 !important;
    transition: none;
  }
  .project-card:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .projects {
    padding: var(--space-4xl) 10vw;
  }
}

/* Mobile — collapse to single column, link drops below tags */
@media (max-width: 768px) {
  .projects {
    padding: var(--space-3xl) 0;
  }

  .project-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    padding: var(--space-lg) var(--space-md);
    column-gap: 0;
  }

  .project-card-name { grid-column: 1; grid-row: 1; }
  .project-card-desc { grid-column: 1; grid-row: 2; }
  .project-card-tags { grid-column: 1; grid-row: 3; }

  .project-card-link {
    grid-column: 1;
    grid-row: 4;
    align-self: auto;
    margin-top: var(--space-sm);
  }

  .project-card-links {
    grid-column: 1;
    grid-row: 4;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: var(--space-sm);
  }

  .project-card-links .project-card-link {
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .projects {
    padding: var(--space-2xl) var(--space-sm);
  }

  .project-card {
    padding: var(--space-md) var(--space-sm);
  }

  .project-card-name {
    font-size: 20px;
  }
}
