.profile-portfolio {
  padding: 145px 72px;
}

.profile-section-head h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 154px;
  text-transform: uppercase;
  line-height: 0.48;
  color: #14110d;
  margin-bottom: 24px;
}

.profile-section-head em {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 84px;
  line-height: 0.9;
  color: var(--mark);
}

.portfolio-filter {
  display: block;
  margin-bottom: clamp(18px, 2.5vw, 30px);
  border: 1px solid rgba(20, 17, 13, 0.22);
  background: rgba(240, 234, 220, 0.38);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.portfolio-filter__viewport {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 17, 13, 0.35) transparent;
}

.portfolio-filter__track {
  display: flex;
  width: max-content;
  min-width: 100%;
  align-items: stretch;
}

.portfolio-filter__button {
  position: relative;
  flex: 0 0 auto;
  min-height: 46px;
  padding: 12px 16px;
  border: 0;
  border-right: 1px solid rgba(20, 17, 13, 0.14);
  background: transparent;
  color: var(--ink);
  font: 800 12px/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.portfolio-filter__button:hover,
.portfolio-filter__button.is-active {
  background: var(--ink);
  color: var(--paper);
}
.portfolio-filter__button--clear {
  margin-left: auto;
  color: var(--mark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portfolio-filter__button--clear[hidden] {
  display: none;
}

.portfolio-filter__button--clear:hover,
.portfolio-filter__button--clear:focus-visible {
  background: rgba(78, 58, 138, 0.08);
  color: var(--mark);
}

.portfolio-photo-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(9px, 1vw, 15px);
}

.portfolio-photo {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: #14110d;
  box-shadow: 0 12px 28px rgba(20, 17, 13, 0.11);

  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.portfolio-photo[hidden] {
  display: none;
}

.portfolio-photo > img,
.portfolio-photo > picture > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}

.portfolio-photo:hover > img,
.portfolio-photo:hover > picture > img {
  transform: scale(1.04);
}

/* "Load more" under the grid: reveals the next page of works. */
.portfolio-more {
  display: flex;
  justify-content: center;
  margin-top: clamp(28px, 3vw, 44px);
}

.portfolio-more[hidden] {
  display: none;
}

/* The plus is symmetric, so centre it in the whole area right of the divider:
   fold the button's right padding into the icon cell (same total width). */
.portfolio-more__button {
  padding-right: 0;
}

.portfolio-more__button .btn-icon {
  width: 48px;
  flex-basis: 48px;
}

/* Plus icon: no directional nudge like the arrows, a quarter turn on hover instead. */
.portfolio-more__button svg.tart-arrow--plus {
  --tart-arrow-x: 0px;
  --tart-arrow-y: 0px;
}

.portfolio-more__button:is(:hover, :focus-visible) svg.tart-arrow--plus {
  transform: rotate(90deg);
}

@media (max-width: 767px) {
  .portfolio-more {
    margin-top: 20px;
  }

  .portfolio-more__button {
    width: 100%;
    justify-content: space-between;
  }
}

.portfolio-photo::after {
  position: absolute;
  z-index: 1;
  inset: 42% 0 0;
  display: block;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 8, 7, 0.82) 100%);
  content: '';
  pointer-events: none;
}

.portfolio-photo__ribbons {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  left: 8px;

  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 5px;

  margin: 0;
  padding: 0;
}

.portfolio-photo__ribbons span {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 5px 8px;

  border: 1px solid rgba(240, 234, 220, 0.32);
  background: rgba(18, 16, 13, 0.9);
  color: var(--paper);

  font: 800 12px/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;

  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);

  backdrop-filter: blur(5px);
}

@media (max-width: 1200px) {
  .profile-portfolio {
    padding: clamp(80px, 10vw, 120px) clamp(32px, 5vw, 56px);
  }

  .profile-section-head h2 {
    font-size: 146px;
  }

  .profile-section-head em {
    font-size: 78px;
  }

  .portfolio-photo-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .profile-portfolio {
    padding: 72px 24px;
  }

  .profile-section-head h2 {
    font-size: 104px;
    line-height: 0.58;
  }

  .profile-section-head em {
    font-size: 64px;
  }

  .portfolio-photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .profile-portfolio {
    padding: 0;
  }

  .profile-section-head h2 {
    margin-bottom: 20px;
    font-size: var(--tart-display-mobile, 100px);
    line-height: 0.62;
  }

  .profile-section-head em {
    font-size: 44px;
  }

  .portfolio-filter {
    margin-bottom: 8px;
  }

  .portfolio-filter__button {
    min-height: 40px;
    padding: 8px 10px;
  }

  .portfolio-photo-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .portfolio-photo__ribbons {
    right: 6px;
    bottom: 6px;
    left: 6px;
    gap: 4px;
  }

  .portfolio-photo__ribbons span {
    min-height: 20px;
    padding: 4px 6px;
  }
}


/* Lightbox: click a work to see it large (portofoliu.js). */
.portfolio-photo {
  cursor: zoom-in;
}

.portfolio-photo:focus-visible {
  outline: 2px solid var(--mark, #4e3a8a);
  outline-offset: 3px;
}

.portfolio-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: clamp(56px, 7vw, 88px) clamp(16px, 7vw, 112px);
  background: rgba(13, 11, 9, 0.94);
  opacity: 0;
  transition: opacity 0.2s ease;
  touch-action: pan-y;
}

.portfolio-lightbox[hidden] {
  display: none;
}

.portfolio-lightbox.is-open {
  opacity: 1;
}

.portfolio-lightbox__stage {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
}

.portfolio-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  align-self: center;
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.portfolio-lightbox.is-loading .portfolio-lightbox__image {
  opacity: 0.35;
}

.portfolio-lightbox__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  color: #f0eadc;
}

.portfolio-lightbox__styles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portfolio-lightbox__styles span {
  padding: 5px 10px;
  border: 1px solid rgba(240, 234, 220, 0.35);
  font: 700 11px/1 var(--mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portfolio-lightbox__count {
  font: 700 12px/1 var(--mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.12em;
  color: rgba(240, 234, 220, 0.7);
}

.portfolio-lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(240, 234, 220, 0.4);
  background: rgba(20, 17, 13, 0.6);
  color: #f0eadc;
  cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.portfolio-lightbox__btn[hidden] {
  display: none;
}

.portfolio-lightbox__btn:hover,
.portfolio-lightbox__btn:focus-visible {
  background: var(--mark, #4e3a8a);
  border-color: var(--mark, #4e3a8a);
  outline: none;
}

.portfolio-lightbox__close {
  top: clamp(12px, 2vw, 24px);
  right: clamp(12px, 2vw, 24px);
}

.portfolio-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
}

.portfolio-lightbox__nav--prev {
  left: clamp(8px, 2vw, 28px);
}

.portfolio-lightbox__nav--prev svg {
  transform: rotate(180deg);
}

.portfolio-lightbox__nav--next {
  right: clamp(8px, 2vw, 28px);
}

@media (max-width: 767px) {
  .portfolio-lightbox {
    padding: 64px 12px 84px;
  }

  .portfolio-lightbox__nav {
    top: auto;
    bottom: 16px;
    transform: none;
  }

  .portfolio-lightbox__nav--prev {
    left: calc(50% - 60px);
  }

  .portfolio-lightbox__nav--next {
    right: calc(50% - 60px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-lightbox,
  .portfolio-lightbox__image {
    transition: none;
  }
}
