/* ===== PORTFOLIO PAGE ===== */

.portfolio-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.portfolio-toolbar__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 220px;
  min-width: 220px;
  flex: 0 0 220px;
}

.portfolio-toolbar__group--search {
  width: 220px;
  min-width: 220px;
  flex: 0 0 220px;
  position: relative;
}

.portfolio-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #777;
  pointer-events: none;
  z-index: 2;
}

.portfolio-toolbar--inline .portfolio-toolbar__group {
  gap: 0;
}

.portfolio-toolbar--inline .portfolio-toolbar__label {
  display: none;
}

.portfolio-toolbar__label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(196, 168, 130, 0.9);
}

.portfolio-toolbar__control {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #f0ece4;
  background: #1f1f1f;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.portfolio-toolbar__group--search .portfolio-toolbar__control {
  padding-left: 36px;
}

.portfolio-toolbar__control:focus {
  border-color: rgba(196, 168, 130, 0.55);
  background: #242424;
}

.portfolio-search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: #111111;
  border: 1px solid rgba(196, 168, 130, 0.35);
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  padding: 6px;
  display: grid;
  gap: 4px;
}

.portfolio-search-suggestions[hidden],
.portfolio-search-suggestions:empty {
  display: none !important;
}

.portfolio-search-suggestions__item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #efefef;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  cursor: pointer;
}

.portfolio-search-suggestions__item:hover {
  background: rgba(196, 168, 130, 0.14);
  border-color: rgba(196, 168, 130, 0.35);
}

.portfolio-filter {
  position: relative;
}

.portfolio-filter__toggle {
  width: 100%;
  min-width: 220px;
  height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #f0ece4;
  background: #1f1f1f;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 10px 12px;
  line-height: 1;
  cursor: pointer;
}

.portfolio-filter__arrow {
  width: 12px;
  height: 8px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.portfolio-filter.is-open .portfolio-filter__arrow {
  transform: rotate(180deg);
}

.portfolio-filter__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #121212;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
  max-height: min(60vh, 360px);
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
  z-index: 5000;
}

.portfolio-filter__menu::-webkit-scrollbar {
  width: 10px;
}

.portfolio-filter__menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.portfolio-filter__menu::-webkit-scrollbar-thumb {
  background: rgba(196, 168, 130, 0.65);
  border-radius: 999px;
}

.portfolio-filter.is-open .portfolio-filter__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.portfolio-filter__item {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #f0ece4;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.portfolio-filter__item:hover,
.portfolio-filter__item.is-active {
  background: rgba(196, 168, 130, 0.12);
  color: #c4a882;
}

.portfolio-filter__item--main {
  font-weight: 500;
}

.portfolio-filter__item--sub {
  padding-left: 24px;
  font-size: 12px;
  color: #c6c1b9;
}

.portfolio-filter__all-tag {
  color: #8d867b;
  font-size: 11px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

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

.portfolio-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  cursor: pointer;
}

.portfolio-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, filter 0.6s ease;
}

.portfolio-card__poetry-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #7f6544;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.4)),
    url('../Poems/blue-siren.jpg');
  background-size: cover;
  background-position: center;
  filter: blur(2px);
  transform: scale(1.08);
  transform-origin: center;
  transition: transform 0.6s ease, filter 0.6s ease;
}

.portfolio-card:hover img {
  transform: scale(1.05);
  filter: brightness(1.3) contrast(1.1) blur(1.5px);
}

.portfolio-card .card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  transition: background 0.4s ease;
}

.portfolio-card:hover .card-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.portfolio-card .card-overlay h2 {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    0 0 8px rgba(0, 0, 0, 0.85),
    0 3px 12px rgba(0, 0, 0, 0.6);
  padding: 20px;
  transition: color 0.35s ease, text-shadow 0.35s ease;
}

.portfolio-card[data-type="poetry"] .card-overlay h2 {
  text-shadow:
    0 0 5px rgba(0, 0, 0, 1),
    0 0 12px rgba(0, 0, 0, 0.9),
    0 2px 8px rgba(0, 0, 0, 0.8),
    0 4px 16px rgba(0, 0, 0, 0.6);
}

.portfolio-card[data-type="poetry"]:hover .portfolio-card__poetry-fill {
  transform: scale(1.12);
  filter: blur(3px) brightness(1.3) contrast(1.1);
}

.portfolio-card:hover .card-overlay h2 {
  color: #111111;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.95),
    0 0 10px rgba(255, 255, 255, 0.55),
    0 1px 4px rgba(0, 0, 0, 0.18);
}

/* Remove overlay fade from both category cards */
.portfolio-card .card-overlay {
  background: transparent;
}

.portfolio-card:hover .card-overlay {
  background: transparent;
}

/* Animations */
.portfolio-card:nth-child(1) { animation: fadeInUp 0.8s ease-out 0.2s both; }
.portfolio-card:nth-child(2) { animation: fadeInUp 0.8s ease-out 0.4s both; }
.portfolio-card:nth-child(3) { animation: fadeInUp 0.8s ease-out 0.6s both; }

/* Responsive */
@media (max-width: 768px) {
  .portfolio-toolbar {
    gap: 10px;
  }

  .portfolio-toolbar__group,
  .portfolio-toolbar__group--search {
    width: 100%;
    min-width: 0;
  }

  .portfolio-filter__toggle {
    min-width: 0;
    width: 100%;
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .portfolio-card .card-overlay h2 {
    font-size: 22px;
  }
}

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

  .portfolio-card .card-overlay h2 {
    font-size: 22px;
  }
}

/* Touch devices: avoid sticky hover effects while keeping desktop unchanged */
@media (hover: none) and (pointer: coarse) {
  .portfolio-card:hover img {
    transform: none;
    filter: none;
  }

  .portfolio-card[data-type="poetry"]:hover .portfolio-card__poetry-fill {
    transform: scale(1.08);
    filter: blur(2px);
  }

  .portfolio-card:hover .card-overlay h2 {
    color: #ffffff;
    text-shadow:
      0 0 2px rgba(0, 0, 0, 0.95),
      0 3px 12px rgba(0, 0, 0, 0.6);
  }
}
