/* --------------------------------
Stacking Cards Widget
Description: Cards stack effect on vertical scrolling
-------------------------------- */

.stack-cards {
  --stack-cards-gap: 0.75rem;
  --stack-cards-translate: 0.3rem;
  --stack-cards-item-ratio: 2/1;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 64rem) {
  .stack-cards {
    --stack-cards-gap: 1.125rem;
    --stack-cards-translate: 0.45rem;
  }
}

.stack-cards__item {
  position: relative;
  position: -webkit-sticky;
  position: sticky;
  top: 1.25rem;
  height: 0;
  padding-bottom: calc(100% / (var(--stack-cards-item-ratio)));
  transform-origin: center top;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* For items with templates, allow natural height */
.stack-cards__item--template {
  height: auto;
  padding-bottom: 0;
  min-height: 200px;
  overflow: visible;
}

@media (min-width: 64rem) {
  .stack-cards__item {
    top: 2rem;
  }
}

.stack-cards__item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stack-cards__content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  text-align: center;
  box-sizing: border-box;
}

.stack-cards__content h3 {
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.stack-cards__content div {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

/* Card content styles */
.stack-cards__card-content {
  /* padding: 2rem; */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stack-cards__card-image {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: 0.25rem;
}

/* Edit mode - disable stacking effect */
.stack-cards--edit-mode .stack-cards__item {
  position: relative;
  top: auto;
  height: auto;
  padding-bottom: 0;
  margin-bottom: 2rem;
}

.stack-cards--edit-mode {
  padding-bottom: 0 !important;
}

.stack-cards__card-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.stack-cards__card-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.stack-cards__card-excerpt {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #666;
}

.flex {
  display: flex;
}

.justify-center {
  justify-content: center;
}

.items-center {
  align-items: center;
}

.flex-col {
  flex-direction: column;
}
