/* =====================================================================
   GRAPHIC カテゴリページ専用（page-works-graphic.php でのみ読み込み）
   - カード自体は既存の works-index-card / works-index__grid をそのまま流用し、
     見た目を統一する（このファイルでは上書きしない）。
   - 追加するのは「カードをボタン化するための最小限のリセット」「モーダル」のみ。
     既存の works-banner.css / works-banner.js は変更しない。
   ===================================================================== */

/* ---- カードをボタンとして使うための最小限のリセット ----
   見た目（枠・角丸・影・ホバー）は works-index-card__link のスタイルを
   そのまま引き継ぐため、ここではボタン固有の既定スタイルだけを消す。 */
.works-graphic-card__trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

/*
 * works-index-card__thumb / __body / __category / __title は
 * 既存の名刺カードでは div / p / h2（すべて既定でブロック要素）に
 * 付けているためCSS側にdisplay指定が無い。
 * GRAPHICカードは button の中身として使えるよう span で組んでいるため、
 * span の既定表示（inline）のままだと横並びに崩れてしまう。
 * 見た目を完全に一致させるため、GRAPHICカードの中でだけ明示的に
 * ブロック表示へ戻す（works-index.css 側の元のクラスや、
 * page-works.php 側のdiv/h2構成には一切影響しない）。
 */
.works-graphic-card .works-index-card__thumb,
.works-graphic-card .works-index-card__body,
.works-graphic-card .works-index-card__category,
.works-graphic-card .works-index-card__title {
  display: block;
}

.works-graphic-card .works-index-card__image {
  object-position: var(--obj-pos, center);
}

/* タイトルが1〜2行のどちらでも情報欄の高さが揃うよう最低高さを確保 */
.works-graphic-card .works-index-card__title {
  min-height: 2.8rem;
  line-height: 1.4;
}

/* ---- モーダル（works-banner-modal の仕組みを踏襲。クラス名はGRAPHIC専用） ---- */
.works-graphic-modal[hidden] {
  display: none;
}

.works-graphic-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}

.works-graphic-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 24, 0.42);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.works-graphic-modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, 88vw);
  max-height: 85vh;
  overflow: hidden;
  border-radius: 0.6rem;
  background: var(--color-bg);
  box-shadow: 0 1.5rem 3rem rgba(15, 20, 24, 0.25);
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.works-graphic-modal.is-open .works-graphic-modal__overlay {
  opacity: 1;
}

.works-graphic-modal.is-open .works-graphic-modal__panel {
  opacity: 1;
  transform: none;
}

.works-graphic-modal__x {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--color-accent-dark);
  cursor: pointer;
}

.works-graphic-modal__content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 3rem 3rem 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.works-graphic-modal__close {
  flex: none;
  align-self: center;
  margin: 0 0 1.5rem;
  padding: 0.6rem 2.5rem;
  border: 1px solid var(--color-accent-dark);
  border-radius: 999px;
  background: transparent;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: var(--color-accent-dark);
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.works-graphic-modal__close:hover,
.works-graphic-modal__close:focus-visible {
  background: var(--color-accent-dark);
  color: #ffffff;
}

/* モーダル内部（共通構造） */
.works-graphic-modal__eyebrow {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  color: var(--color-accent);
}

.works-graphic-modal__title {
  margin: 0.4rem 0 1.25rem;
  font-family: "Zen Old Mincho", serif;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-accent-dark);
}

.works-graphic-modal__figure {
  margin: 0 0 1.4rem;
  text-align: center;
}

/* 縦長のPOP/チラシ/ポスター画像を想定し、トリミングせず等倍以下で中央表示 */
.works-graphic-modal__image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 60vh;
  margin: 0 auto;
  border: 1px solid var(--color-line);
  border-radius: 0.4rem;
}

.works-graphic-modal__list {
  margin: 0;
}

.works-graphic-modal__list > div {
  padding: 1rem 0;
  border-top: 1px solid var(--color-line);
}

.works-graphic-modal__list > div:last-child {
  border-bottom: 1px solid var(--color-line);
}

.works-graphic-modal__list dt {
  margin-bottom: 0.35rem;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--color-accent);
}

.works-graphic-modal__list dd {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--color-text);
}

/* デザインの工夫点（箇条書き） */
.works-graphic-modal__points {
  margin: 0;
  padding-left: 1.1rem;
  list-style: disc;
}

.works-graphic-modal__points li {
  margin: 0 0 0.4rem;
}

.works-graphic-modal__points li:last-child {
  margin-bottom: 0;
}

body.works-graphic-modal-open {
  overflow: hidden;
}

/* ---- SP（既存サイトの 680px ブレークに合わせる） ---- */
@media (max-width: 680px) {
  .works-graphic-modal {
    padding: 0;
  }

  .works-graphic-modal__panel {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .works-graphic-modal__content {
    padding: 3rem 1.4rem 1.25rem;
  }

  .works-graphic-modal__title {
    font-size: 1.3rem;
  }

  .works-graphic-modal__image {
    max-height: 50vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .works-graphic-modal__overlay,
  .works-graphic-modal__panel {
    transition: none;
  }
}
