/* ========================================
   Works Archive (作品一覧)
   Loaded on is_post_type_archive('works') only (#166)
======================================== */

/* ----------------------------------------
   Page Shell
---------------------------------------- */
.works-archive {
  --max-width: calc(820px + 2 * var(--content-padding));

  padding-bottom: 127px;

  @media screen and (min-width: 768px) {
    padding-bottom: 137px;
  }
}

.works-archive__header {
  padding-top: 47px;

  @media screen and (min-width: 768px) {
    padding-top: 69px;
    text-align: center;
  }
}

.works-archive__title {
  font-size: 32px;
  font-weight: var(--font-weight-regular);
  line-height: 1.6;
  /* Both lines are single sentences that only wrap on narrow viewports; balancing
     them avoids a stray orphan (SP wrapped the ja note to 「…ランドスケープデザ／イン）」).
     Inherited by the note below. Degrades to normal wrapping where unsupported. */
  text-wrap: balance;

  @media screen and (min-width: 768px) {
    font-size: 48px;
  }
}

/* Parenthetical supplement on the heading's second line (#204).
   display:block (not <br>) gives it its own line box, so the smaller
   font-size is not stretched by the h2's 32/48px strut. */
.works-archive__title-note {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: 16px;
  line-height: 1.6;

  @media screen and (min-width: 768px) {
    margin-top: 12px;
    font-size: 20px;
  }
}

/* ----------------------------------------
   通学路 Map
---------------------------------------- */
/* Full-bleed on mobile: the negative margins cancel the container padding
   (no 50vw hack, so scrollbar width can't offset it) */
.works-archive__map {
  margin-top: 40px;
  margin-inline: calc(-1 * var(--content-padding));

  @media screen and (min-width: 768px) {
    margin-top: 49px;
    margin-inline: 0;
  }

  /* PC / SP images render at their natural aspect ratio (#188): no forced
     box + object-fit crop. width/height on <source>/<img> supply the ratio
     per breakpoint, so there is no layout shift on load. */
  img {
    display: block;
    width: 100%;
    height: auto;
    background-color: var(--color-card-background);
  }
}

/* ----------------------------------------
   Legend (numbered work index)
---------------------------------------- */
.works-archive__index {
  margin-top: 40px;
  padding: 25px 21px;
  background-color: var(--color-background-warm);
  border-radius: 8px;
  list-style: none;

  @media screen and (min-width: 768px) {
    margin-top: 60px;
    padding: 22px 45px;
  }
}

.works-archive__index-item {
  font-size: 15px;
  font-weight: var(--font-weight-medium);
  line-height: 1.75;

  &:not(:last-child) {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 0.5px solid var(--color-border-warm);

    @media screen and (min-width: 768px) {
      padding-bottom: 8px;
      margin-bottom: 9px;
    }
  }

  @media screen and (min-width: 768px) {
    font-size: 20px;
  }
}

/* ----------------------------------------
   Card Grid
---------------------------------------- */
.works-archive__list {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 40px;
  margin-top: 67px;
  list-style: none;

  @media screen and (min-width: 768px) {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 60px;
    row-gap: 45px;
    margin-top: 60px;
  }
}

.works-archive__empty {
  margin-top: 45px;
  text-align: center;
}

/* ----------------------------------------
   Work Card
   Same visual design as .highlights__card (front page); independent block
   so the front page styles stay untouched
---------------------------------------- */
.work-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease;

  @media (hover: hover) {
    &:hover {
      transform: translateY(-4px);
    }
  }
}

.work-card__image {
  overflow: hidden;
  border-radius: 5px;
  transition: box-shadow 0.2s ease;

  @media (hover: hover) {
    .work-card__link:hover & {
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    }
  }

  img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }
}

.work-card__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-top: 13px;

  @media screen and (min-width: 768px) {
    margin-top: 10px;
  }
}

.work-card__text {
  flex: 1;
  min-width: 0;
}

.work-card__title {
  font-size: 18px;
  font-weight: var(--font-weight-medium);
  line-height: 1.75;
}

.work-card__artist {
  margin-top: 5px;
  font-size: 16px;
  font-weight: var(--font-weight-medium);
  line-height: 1.75;
}

.work-card__arrow {
  flex-shrink: 0;
  width: 55px;
  height: 45px;
  transition: transform 0.2s ease;

  @media (hover: hover) {
    .work-card__link:hover & {
      transform: translateX(4px);
    }
  }
}
