/* AccuFolio - Project List w/Isotope 3 - used by _ASL-ProjectList-Isotope3--v20.cshtml */

/*
  Layout strategy (smooth first paint):
  - Every card is a fixed 320x280 box with 12px top/bottom margin => a 320x304 cell.
  - Before JS: CSS grid draws exactly the layout Isotope masonry (columnWidth 320, fitWidth) produces:
    centered columns of 320px, rows every 304px. No tall single-column stack, no reflow.
  - After JS: Isotope positions the same cards absolutely at the same coordinates and handles filtering.
*/

#container {
  position: relative;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, 320px);
  justify-content: center;
}

/* Once Isotope runs it sets an explicit width (fitWidth) and absolute positions; grid no longer matters */
#container.is-isotope {
  display: block;
}

.grid-item {
  position: relative;
  width: 320px;
  height: 280px;
  margin: 12px 0;
  /* no overflow:hidden / paint containment here: the badge (mt-n2) intentionally sticks out above the card */
}

/* Image is 290px wide, centered in the 320px card => the 30px white gap between columns */
#container .grid-item .card-img {
  position: absolute;
  top: 0;
  left: 15px;
  width: 290px;
  height: 280px;
  object-fit: cover;
  object-position: center top;
  background: #eef1f4; /* placeholder while the image loads */
}

#container .grid-item span.badge {
  position: absolute;
  right: 9px;
  top: 0;
  z-index: 9;
}

#container .grid-item .bottom-fade2white {
  background: linear-gradient(transparent, 90%, white, white);
}

/* Hover/focus overlay: text is hidden with opacity (cheap to paint) instead of text-indent:-9999px */
#container .grid-item .project-details {
  position: relative;
  z-index: 1;
  display: block;
  width: 320px;
  height: 280px;
  color: white;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  overflow: hidden;
  transition: background-color 0.2s ease-in-out;
  /* undo legacy portal.css a.project-details { text-indent:-9999px } (its hover reset targets old .isotope-item
     classes that no longer exist) and its mobile padding-top:280px */
  text-indent: 0;
  padding: 0;
}

#container .grid-item .project-details-inner {
  width: 320px;
  height: 280px;
  padding: 20px;
  box-sizing: border-box;
}

#container .grid-item .project-details-inner > * {
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

#container .grid-item .project-details:hover,
#container .grid-item .project-details:focus-visible {
  background-color: rgba(7, 103, 177, 0.9);
  text-decoration: none;
  outline: none;
}

#container .grid-item .project-details:hover .project-details-inner > *,
#container .grid-item .project-details:focus-visible .project-details-inner > * {
  opacity: 1;
}

#container .grid-item a.project-details:hover {
  cursor: pointer;
}

.accufolio-readme summary {
  cursor: pointer;
  font-weight: bold;
  padding: 0.5rem 0;
}

@media (prefers-reduced-motion: reduce) {
  #container .grid-item .project-details,
  #container .grid-item .project-details-inner > * {
    transition: none;
  }
}
