/* ================= TOOLBAR ================= */
.portfolio-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 50px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tabs button {
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
  transition: all 0.35s var(--ease);
}

.filter-tabs button.is-active,
.filter-tabs button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

.search-box {
  position: relative;
  width: 280px;
  max-width: 100%;
}

.search-box input {
  width: 100%;
  padding: 13px 44px 13px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--white);
  font-size: 0.9rem;
}

.search-box input::placeholder {
  color: var(--dim);
}

.search-box i {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
}

.results-count {
  font-size: 0.82rem;
  color: var(--dim);
  margin-bottom: 30px;
}

/* ================= PROJECT GRID ================= */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.project-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease), opacity 0.35s ease, box-shadow .5s var(--ease);
  display: flex;
  flex-direction: column;
}

.project-card.is-hidden {
  display: none;
}

.project-card .thumb {
  position: relative;
  aspect-ratio: 1/1;
  overflow: hidden;
}

.project-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}

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

.project-card .thumb .badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--white);
  background: rgba(9, 9, 10, 0.6);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.project-card .thumb .expand {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6) rotate(-45deg);
  transition: all 0.4s var(--ease);
}

.project-card:hover .thumb .expand {
  opacity: 1;
  transform: scale(1) rotate(0);
}

.project-card .info {
  padding: 22px 22px 24px;
}

.project-card .info .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.project-card .info h3 {
  font-size: 1.08rem;
}

.project-card .info .year {
  font-size: 0.8rem;
  color: var(--dim);
}

.project-card .info .role {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.project-card .tech-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-card .tech-badges span {
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--dim);
}

.project-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

@media (max-width: 1100px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .project-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    width: 100%;
  }
}

/* Card title is a real link to the project page; its ::after stretches over the whole card. */
.project-card .info h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

.project-card .info h3 a:focus-visible {
  outline: none;
}

.project-card:has(h3 a:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
