
/* SESSION ARCHIVE */

.sessions-archive-items {
  display: flex;
  align-items: center;
  width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;                 /* Enable wrapping */
  justify-content: flex-start;        /* Center items horizontally */
  align-content: center;          /* Center multiple rows vertically */
  height: 100%;  
}

.sessions-archive-item {
  position: relative;
  flex: 0 0 33.3333%;
  max-width: 33.3333%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--main-background-color); /* fallback color */
  color: white;
  border-top: 1px solid var(--main-background-color);
  border-right: 1px solid var(--main-background-color);
  border-bottom: 1px solid var(--main-background-color);
  border-left: 1px solid var(--main-background-color);
  transition: border-color var(--transition-time) ease;
}

/* Background image as pseudo-element */
.sessions-archive-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-image: var(--bg-url); /* Set via inline style in PHP */
  opacity: 0;
  transition: opacity var(--transition-time) ease-in-out;
  z-index: 0;
}

.sessions-archive-item:hover::before {
  opacity: 1;
}

/* Hide actual <img> */
.sessions-archive-item .artist-main-image {
  display: none;
}

/* Text content always on top */
.sessions-archive-item h2 {
  z-index: 1;
  position: relative;
  width: 100%;
  height: 100%;
  font-size: 1.6vw;
  letter-spacing: var(--main-uppercase-spacing);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sessions-archive-item h2 a {
  color: inherit;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}


.archive-preview-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
}

.archive-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hide preview image on hover to show main image */
.sessions-archive-item:hover .archive-preview-image {
  opacity: 0;
  transition: opacity var(--transition-time) ease-in-out;
}












/* DESKTOP — 3 items per row (assumes .sessions-archive-item is flex: 0 0 33.3333%) */
@media (min-width: 901px) {

  /* Right border only (first in row) */
  .sessions-archive-item:nth-child(3n+1) {
    border-left-color: var(--main-background-color);
    border-right-color: rgb(49, 49, 49);
  }

  /* Left and Right borders (middle in row) */
  .sessions-archive-item:nth-child(3n+2) {
    border-left-color: rgb(49, 49, 49);
    border-right-color: rgb(49, 49, 49);
  }

  /* Left border only (last in row) */
  .sessions-archive-item:nth-child(3n) {
    border-left-color: rgb(49, 49, 49);
    border-right-color: var(--main-background-color);
  }

  /* Bottom border for items NOT in last row */
  .sessions-archive-item {
    border-bottom-color: var(--main-background-color);
  }

  /* Add bottom border if row is not last row */
  .sessions-archive-item:not(:nth-last-child(-n+3)) {
    border-bottom-color: rgb(49, 49, 49);
  }

  /* Add top border to items in last row ONLY if there's more than 1 row */
  .sessions-archive-item:nth-last-child(-n+3):nth-child(n+4) {
    border-top-color: rgb(49, 49, 49);
  }

  /* Add top and bottom to middle rows (neither first nor last row) */
  .sessions-archive-item:nth-child(n+4):not(:nth-last-child(-n+3)) {
    border-top-color: rgb(49, 49, 49);
    border-bottom-color: rgb(49, 49, 49);
  }

  /* Optional: remove bottom border from ONLY row */
  .sessions-archive-item:nth-last-child(-n+3):nth-child(-n+3) {
    border-bottom-color: var(--main-background-color);
  }
}








/* Mobile */
@media (max-width: 900px) {
  
  /* SESSIONS ARCHIVE */

  .sessions-archive-items {
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: stretch;
  }

  .sessions-archive-item {
    flex: none; /* Prevent growing/shrinking */
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0; /* Remove any gaps */
    border-left-color: var(--main-background-color);
    border-right-color: var(--main-background-color);
  }

  .sessions-archive-item h2 {
    font-size: 4.2vw;
  }

  /* First element (only bottom if not the only one) */
  .sessions-archive-item:first-child:not(:last-child) {
    border-bottom-color: rgb(49, 49, 49);
    border-top-color: var(--main-background-color);
  }

  /* Last element (only top if not the only one) */
  .sessions-archive-item:last-child:not(:first-child) {
    border-top-color: rgb(49, 49, 49);
    border-bottom-color: var(--main-background-color);
  }

  /* Middle elements (top and bottom) */
  .sessions-archive-item:not(:first-child):not(:last-child) {
    border-top-color: rgb(49, 49, 49);
    border-bottom-color: rgb(49, 49, 49);
  }

  /* Only element: no borders */
  .sessions-archive-item:only-child {
    border-top-color: var(--main-background-color);
    border-bottom-color: var(--main-background-color);
  }
}

