/* ============================================
   Works Listing Page Styles
   kichi - ワクワクをつくる基地
   ============================================ */

/* ── Works Hero ── */
.works-hero {
  padding: calc(80px + var(--space-12)) 0 var(--space-8);
  position: relative;
}

.works-hero__title {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--font-black);
  margin-bottom: var(--space-2);
}

.works-hero__label {
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.works-hero__desc {
  font-size: var(--text-base);
  color: var(--color-text-light);
  max-width: 600px;
  margin-bottom: var(--space-6);
}

/* ── Filter Buttons ── */
.works-filter {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}

.works-filter__btn {
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  border: 2px solid var(--color-gray);
  border-radius: var(--radius-full);
  color: var(--color-text-light);
  background: var(--color-white);
  transition: all 0.3s ease;
  position: relative;
}

.works-filter__btn:hover {
  border-color: var(--color-text);
  color: var(--color-text);
}

.works-filter__btn.is-active {
  background-color: var(--color-dark);
  border-color: var(--color-dark);
  color: var(--color-white);
  transform: scale(1.02);
}

.works-filter__btn-en {
  margin-right: var(--space-1);
}

.works-filter__btn-jp {
  font-size: var(--text-xs);
  opacity: 0.7;
}

/* ── Confetti Background ── */
.works-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  opacity: 0.4;
  border-radius: 2px;
  animation: confettiFall var(--confetti-duration, 8s) linear infinite;
  animation-delay: var(--confetti-delay, 0s);
}

/* ── Works Grid (Horizontal Row-first Grid) ── */
.works-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  padding-bottom: var(--space-16);
  align-items: stretch;
}

@media (max-width: 1024px) {
  .works-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
  }
}

@media (max-width: 768px) {
  .works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

@media (max-width: 480px) {
  .works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}

/* ── Work Card ── */
.work-card {
  position: relative;
  transform: rotate(var(--card-rotate, 0deg));
  transition: transform 0.4s var(--ease-out-back), box-shadow 0.3s ease, z-index 0s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.work-card:hover {
  transform: translateY(-8px) rotate(0deg);
  z-index: var(--z-card-hover);
}

.work-card__inner {
  background: var(--color-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.work-card:hover .work-card__inner {
  box-shadow: var(--shadow-card-hover);
}

/* ── Card Image ── */
.work-card__image {
  position: relative;
  overflow: hidden;
}

.work-card__image img {
  width: 100%;
  height: auto;
  transition: transform 0.4s ease;
}

.work-card:hover .work-card__image img {
  transform: scale(1.05);
}

/* ── Category Tag ── */
.work-card__category {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-handwrite);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--color-white);
  border-radius: 2px;
  transform: rotate(-2deg);
}

.work-card__category--puzzle {
  background-color: var(--color-sky-blue);
}

.work-card__category--event {
  background-color: var(--color-green);
}

/* ── Card Body ── */
.work-card__body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.work-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.work-card__memo {
  font-family: var(--font-handwrite);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ── Masking Tape on Card ── */
.work-card__tape {
  position: absolute;
  z-index: var(--z-tape);
  pointer-events: none;
}

.work-card__tape--top {
  top: -6px;
  right: 16px;
  width: 50px;
  height: 16px;
  transform: rotate(15deg);
}

/* ── Card Seal (sticker) ── */
.work-card__seal {
  position: absolute;
  bottom: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  z-index: var(--z-tape);
  transition: transform 0.3s ease;
}

.work-card:hover .work-card__seal {
  animation: sealWiggle 0.4s ease-in-out 2;
}

/* ── Transition animation for filter ── */
.work-card.is-hiding {
  opacity: 0;
  transform: scale(0.8) rotate(0deg);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.work-card.is-showing {
  animation: cardShuffle 0.5s var(--ease-out-back) forwards;
}