/* ===== Projects — Section 2: Filters + project grid ===== */
.section2 {
  background: #1c1c1f;
  padding: 0 0 clamp(70px, 8vw, 120px);
}

/* ----- Filters ----- */
.filters {
  position: relative;
  display: flex;
  gap: clamp(20px, 3vw, 48px);
  list-style: none;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(30px, 4vw, 50px);
  overflow-x: auto;
  scrollbar-width: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.filters::-webkit-scrollbar { display: none; }
.section2.is-visible .filters { opacity: 1; transform: none; }

.filter {
  padding: 14px 4px;
  font-size: 15px;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.3s;
}
.filter:hover { color: var(--white); }
.filter.is-active { color: var(--blue); font-weight: 600; }

/* sliding underline (positioned by JS) */
.filters__bar {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--blue);
  transition: transform 0.5s var(--ease), width 0.5s var(--ease);
}

/* ----- Grid ----- */
.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(30px, 3vw, 44px) clamp(18px, 2.2vw, 30px);
}

/* each card reveals on its own as it scrolls in (set by js/main.js) */
.project {
  display: block;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.project.is-in { opacity: 1; transform: none; }
.project.is-in:nth-child(3n + 2) { transition-delay: 0.1s; }
.project.is-in:nth-child(3n + 3) { transition-delay: 0.2s; }

/* filtered-out cards collapse away */
.project.is-hidden { display: none; }
.project.is-entering { animation: projectIn 0.7s var(--ease) both; }
@keyframes projectIn { from { opacity: 0; transform: translateY(30px) scale(0.97); } to { opacity: 1; transform: none; } }

.project__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--ink);
  margin-bottom: 18px;
}
.project__media img,
.project__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--ease), filter 0.6s;
}
.project:hover .project__media > img,
.project:hover .project__media > video { transform: scale(1.06); }

/* TBK placeholder (same as home) until the cover image arrives */
.project__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 70% 20%, rgba(47, 91, 255, 0.35), transparent 50%),
    radial-gradient(circle at 20% 90%, rgba(46, 232, 111, 0.2), transparent 50%),
    #121214;
  transition: transform 1.1s var(--ease);
}
.project__placeholder img { width: 46%; height: auto; object-fit: contain; }
.project:hover .project__placeholder { transform: scale(1.06); }

.project__meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.project__name { font-size: clamp(18px, 1.6vw, 22px); font-weight: 600; margin-bottom: 2px; transition: color 0.3s; }
.project__cat { color: var(--muted); font-size: 15px; }
.project:hover .project__name { color: var(--green); }

.project__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  transition: color 0.3s, border-color 0.3s;
}
.project__link svg { width: 14px; height: 14px; transition: transform 0.4s var(--ease); }
.project:hover .project__link { color: var(--green); border-color: var(--green); }
.project:hover .project__link svg { transform: translate(3px, -3px); }

.projects__empty {
  display: none;
  grid-column: 1 / -1;
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
}
.projects__empty.is-shown { display: block; animation: projectIn 0.7s var(--ease) both; }

@media (max-width: 1000px) {
  .projects { grid-template-columns: 1fr 1fr; }
  .project.is-in:nth-child(n) { transition-delay: 0s; }
}
@media (max-width: 600px) {
  .projects { grid-template-columns: 1fr; }
}

/* ----- Client logo cover on each card (added by tools/build-projects.js when a logo exists) -----
   Same look as the TBK card: blue/green gradient with the client's logo in white, centred.
   Hovering fades it away to show the project photo underneath. */
.project__logo {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 18%;
  background:
    radial-gradient(circle at 70% 20%, rgba(47, 91, 255, 0.35), transparent 50%),
    radial-gradient(circle at 20% 90%, rgba(46, 232, 111, 0.2), transparent 50%),
    #121214;
  transition: opacity 0.6s var(--ease), transform 1.1s var(--ease);
}
.project__logo img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 34%;
  object-fit: contain;
  filter: brightness(0) invert(1);   /* every logo in white */
  transition: transform 0.8s var(--ease);
}
/* square symbol logos (Metric, Travel Time) can be a bit taller */
.project__logo--badge img { max-height: 40%; }

.project:hover .project__logo { opacity: 0; }
.project:hover .project__logo img { transform: scale(0.9); }
