/* ============================================
   トップの「キャンペーン」（2026-11-01。嶋さんのモック 10/31 をもとに）
   ・トップ（index.html）だけが読む。style.css は変えない（全ページの ?v= を変えないため）
   ・カードを押すと、詳しい内容の窓（<dialog class="cp-modal">）が開く。動きは assets/js/campaign.js
   ・3列にするのは枠の幅が 960px 以上のときだけ。それより狭いと 1件を1行の短い形にする
   ============================================ */
.campaign {
  padding: 72px 0 0;
}

/* カードの並びは、画面ではなく枠の幅で切り替える */
.cp-wrap {
  container-type: inline-size;
}

.cp-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.cp-grid > li {
  display: flex;
  min-width: 0;
}

.cp-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  font: inherit;
  color: var(--text-on-light);
  text-align: left;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(255, 62, 122, 0.35);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(255, 62, 122, 0.08);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(255, 62, 122, 0.18);
}

.cp-card:focus-visible,
.cp-modal button:focus-visible,
.cp-modal a:focus-visible {
  outline: 3px solid var(--color-pink);
  outline-offset: 2px;
}

/* 画像は枠に重ねて置く（画像の比率で枠が伸びないように）。ポスターは上側（題）を見せる */
.cp-card__img {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f6f1e6;
}

.cp-card__img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* 横長のキービジュアル（ココフォリア）は真ん中を見せる */
.cp-card__img--wide {
  background: #f3f3f3;
}

.cp-card__img--wide img {
  object-position: center;
}

.cp-chip {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 3px 10px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
}

.cp-chip--on { color: #0b8a5a; }
.cp-chip--soon { color: #c4570a; }

/* 狭い形のときだけ、札を名前の上に出す */
.cp-chip--inline { display: none; }

.cp-card__body {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 8px;
  padding: 16px 18px 18px;
}

.cp-card__by {
  font-size: 0.78rem;
  font-weight: 500;
  color: #5d6a85;
}

.cp-card__name {
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.4;
  color: #0d4ea3;
}

.cp-card__text {
  font-size: 0.9rem;
  font-weight: 700;
}

.cp-card__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin-top: 4px;
  font-size: 0.84rem;
}

.cp-card__dt {
  font-weight: 700;
  color: #ff3e7a;
}

.cp-card__more {
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ff3e7a;
}

/* 日本語は語のまとまりで折り返す（「試遊会」が「試／遊会」に割れないように。対応していないブラウザではふつうの折り返し） */
.cp-card__name,
.cp-card__text,
.cp-modal__title {
  word-break: auto-phrase;
}

/* 枠の幅が 960px 未満（ノートパソコンの狭い画面・タブレット・スマホ）は、1件を1行の短い形にする */
@container (max-width: 959px) {
  .cp-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    max-width: 720px;
    margin: 0 auto;
  }
  .cp-card {
    flex-direction: row;
    align-items: center;
    border-radius: 14px;
  }
  .cp-card:hover { transform: none; }
  .cp-card__img {
    flex: 0 0 96px;
    width: 96px;
    aspect-ratio: 1 / 1;
  }
  /* 正方形では横長の絵が切れるので、全体を入れる */
  .cp-card__img--wide img { object-fit: contain; }
  .cp-card__img .cp-chip,
  .cp-card__by,
  .cp-card__more { display: none; }
  .cp-card__body {
    position: relative;
    gap: 2px;
    min-width: 0;
    padding: 10px 40px 10px 14px;
  }
  .cp-card__body::after {
    content: "›";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ff3e7a;
  }
  .cp-chip--inline {
    display: inline-block;
    position: static;
    justify-self: start;
    padding: 0 8px;
    font-size: 0.7rem;
  }
  .cp-card__name { font-size: 1.05rem; }
  .cp-card__text { font-size: 0.85rem; }
  .cp-card__meta {
    margin: 0;
    font-size: 0.8rem;
  }
}

/* スマホの幅では、さらに詰める（期間などは1つだけ） */
@container (max-width: 520px) {
  .cp-card__img {
    flex-basis: 76px;
    width: 76px;
  }
  .cp-card__body { padding: 8px 34px 8px 12px; }
  .cp-card__body::after { right: 12px; }
  .cp-card__name { font-size: 1rem; }
  .cp-card__text { font-size: 0.8rem; }
  .cp-card__meta { font-size: 0.78rem; }
  .cp-card__meta > :nth-child(n+3) { display: none; }
}

/* ---- 詳しい内容の窓 ----
   窓（dialog）は動かさず、中（.cp-modal__box）だけを動かす。×・‹・› は窓に付けて、動かしても見えるままにする */
/* reset.css が margin を 0 にするので、真ん中に置くために auto に戻す */
.cp-modal {
  margin: auto;
  width: min(860px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100% - 32px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  color: var(--text-on-light);
  box-shadow: 0 20px 60px rgba(20, 22, 48, 0.35);
}

.cp-modal[open] {
  display: flex;
}

.cp-modal::backdrop {
  background: rgba(20, 22, 48, 0.6);
}

html:has(.cp-modal[open]) {
  overflow: hidden;
}

.cp-modal__box {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.cp-modal__img {
  margin: 0;
  background: #f6f1e6;
}

.cp-modal__img img {
  display: block;
  width: 100%;
  height: auto;
}

/* 横長の画像（ココフォリアのキービジュアル）は、左の欄の上下の真ん中に置く。縁の色は絵の背景に合わせる（2026-11-01） */
.cp-modal__img--wide {
  display: flex;
  align-items: center;
  background: #f3f3f3;
}

.cp-modal__body {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 26px 26px 72px;
}

/* 右上の × に重ならないように */
.cp-modal__by {
  padding-right: 40px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #5d6a85;
}

.cp-modal__title {
  margin: 0;
  padding-right: 36px;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.4;
  color: #0d4ea3;
}

.cp-modal__text {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.8;
}

.cp-modal__dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.cp-modal__dl dt {
  font-weight: 700;
  color: #ff3e7a;
  white-space: nowrap;
}

.cp-modal__dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.cp-modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cp-modal__tags span {
  padding: 1px 8px;
  border: 1.5px solid var(--text-on-light);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.cp-modal__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cp-modal__links a {
  padding: 8px 14px;
  border: 1.5px solid #ff3e7a;
  border-radius: 999px;
  background: #ff3e7a;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.cp-modal__links a.is-ghost {
  background: transparent;
  color: #ff3e7a;
}

.cp-modal__btn {
  position: absolute;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--text-on-light);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cp-modal__close { right: 12px; top: 12px; }
.cp-modal__prev { right: 58px; bottom: 14px; }
.cp-modal__next { right: 14px; bottom: 14px; }

/* 狭い画面の窓は画面いっぱいにし、説明を先に、画像をその下に */
@media (max-width: 640px) {
  .cp-modal {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .cp-modal__box { grid-template-columns: minmax(0, 1fr); }
  .cp-modal__img { order: 2; }
  .cp-modal__body { padding: 22px 18px 16px; }
  .cp-modal__img { padding-bottom: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-card { transition: none; }
}
