/**
 * Card Styles
 * (generic helpers like .wrapper/.radius/.shadowDepth* live in base.css)
 */

.card {
  background-color: #fff;
  margin-bottom: 1.6rem;
  box-shadow: -4px 8px 16px 0 rgba(0, 0, 0, 0.24);
}

.card__padding {
  padding: 1.6rem;
  padding-top: 0.8rem;
}

.card__image {
  position: relative;
  min-height: 100px;
  background-color: #eee;
  width: 100%;
  max-height: 180px;
  overflow: hidden;
  border-bottom: solid 1px lightgray;
}

/* fullscreen-gallery trigger, only rendered when a project has multiple images */
.card__gallery-trigger {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.card__gallery-trigger:hover {
  background: rgba(0, 0, 0, 0.7);
}

.card__content {
  position: relative;
}

/* card header (title + external link) */
.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.card__title {
  margin: 0;
}

.card__external-link {
  flex-shrink: 0;
  color: #bbb;
  font-size: 1.2rem;
  margin-top: 0.2rem;
  transition: color 0.3s ease;
}

.card__external-link:hover {
  color: #2980b9;
}

/* card image carousel */
.carousel {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-track {
  position: relative;
  width: 100%;
  height: 180px;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition:
    opacity 0.4s ease,
    transform 0.5s ease;
  pointer-events: none;
}

.carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.carousel-slide.active:hover {
  transform: scale(1.1);
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
  z-index: 2;
}

.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.7);
}

.carousel-prev {
  left: 8px;
}

.carousel-next {
  right: 8px;
}

/* card meta */
.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.card__meta time {
  font-size: 1rem;
  color: #bbb;
  margin-left: 0.8rem;
  float: right;
}

/* live stats (e.g. commit count), fetched at build time — see
   _plugins/remote_git_stats.rb. Grid so a project with several stats lines
   them up two per row instead of stacking one per line. */
.card__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.card__stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #666;
}

.card__stat i {
  color: #999;
}

/* card article */
.card__article a {
  text-decoration: none;
  color: #444;
  transition: all 0.5s ease;
}

.card__article a:hover {
  color: #2980b9;
}

/* image popup, blurring the page behind it, toggled by .open (see assets/js/gallery.js) */
.gallery-modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0s linear 0.25s;
}

.gallery-modal.open {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.25s ease,
    visibility 0s linear 0s;
}

.gallery-modal-image {
  max-width: 80%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.25s ease;
}

.gallery-modal.open .gallery-modal-image {
  transform: scale(1);
}

.gallery-modal-prev,
.gallery-modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-modal-prev {
  left: 24px;
}

.gallery-modal-next {
  right: 24px;
}
