@charset "UTF-8";
@import url("./components/guide-row.css");

/* ========================================
   Magazine
======================================== */

.p-magazine {
  overflow: hidden;
  background: #efefef;
  color: #111;
}

.p-magazine__body {
  width: min(100%, 996px);
  margin-inline: auto;
}

.p-magazine__inner {
  width: min(100vw, 1000px);
  margin-inline: auto;
}

/* Filters
---------------------------------------- */

.p-magazine__filters {
  margin-top: 20px;
}

.p-magazine__filter-group + .p-magazine__filter-group {
  margin-top: 45px;
}

.p-magazine__filter-label {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}

.p-magazine__category-list,
.p-magazine__tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.p-magazine__filter-button {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 140px;
  min-height: 44px;
  padding: 9px 18px;
  border: 0;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
}

.p-magazine__filter-button:not(.is-active)::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 7px;
  left: 18px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.p-magazine__filter-button.is-active {
  background: #111;
  color: #fff;
}

.p-magazine__tag-button {
  min-width: 110px;
  padding: 8px 16px;
  border: 0;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
}

/* Cards
---------------------------------------- */

.p-magazine__list-wrap {
  margin-top: 95px;
}

.p-magazine__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.p-magazine__item {
  position: relative;
  min-width: 0;
}

.p-magazine__card {
  display: block;
  height: 100%;
  padding: 18px 18px 24px;
  text-decoration: none;
}

.p-magazine__thumbnail {
  overflow: hidden;
  width: 290px;
  height: 290px;
  aspect-ratio: 1 / 1;
  margin: 0;
  background: #ddd;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: center;
  will-change: transform;
}

.p-magazine__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.p-magazine__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
}

.p-magazine__date {
  font-size: 14px;
  line-height: 1.5;
}

.p-magazine__category {
  font-size: 16px;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.p-magazine__card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.p-magazine__card-tags li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 10px;
  background: #fff;
  font-size: 12px;
  line-height: 1.5;
}

.p-magazine__item-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Pagination
---------------------------------------- */

.p-magazine__pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-top: 95px;
}

.p-magazine__page-number {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 28px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.p-magazine__page-number.is-current {
  background: #111;
  color: #fff;
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  .p-magazine__tag-button:hover {
    opacity: 0.65;
  }

  .p-magazine__filter-button:not(.is-active):hover::after {
    transform: scaleX(1);
  }

  .p-magazine__card:hover .p-magazine__thumbnail,
  .p-magazine__item:focus-within .p-magazine__thumbnail {
    transform: translate(
        var(--guide-hover-x, 0),
        var(--guide-hover-y, -18px)
      )
      scale(var(--guide-hover-scale, 1.12));
  }
}

.p-magazine__sp-guide {
  display: none;
}

.p-magazine__item.is-history-hover-reset .p-magazine__thumbnail {
  transform: none !important;
}

/* ========================================
   Magazine / Responsive
======================================== */

@media (min-width: 768px) and (max-width: 1199px) {
  .p-magazine__inner {
    width: min(calc(100% - 40px), 1000px);
  }

  .p-magazine__thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

/* 3カラムではカードが窮屈になる幅から2カラムへ切り替える */
@media (min-width: 768px) and (max-width: 900px) {
  .p-magazine__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* PC 3カラム用ガイドを止め、PHPに既設の2カラム用ガイドへ切り替える */
  .p-magazine__item > .c-guide-point {
    display: none;
  }

  .p-magazine__sp-guide {
    display: none;
  }

  .p-magazine__sp-guide--tl {
    top: 0;
    left: 0;
    display: block;
    transform: translate(-50%, -50%);
  }

  .p-magazine__item:first-child .p-magazine__sp-guide--tl {
    --guide-h-size: 50%;
    --guide-h-position: right;
    --guide-v-size: 50%;
    --guide-v-position: bottom;
  }

  .p-magazine__item:nth-child(2) .p-magazine__sp-guide--tl {
    --guide-v-size: 50%;
    --guide-v-position: bottom;
  }

  .p-magazine__item:nth-child(odd):not(:first-child) .p-magazine__sp-guide--tl {
    --guide-h-size: 50%;
    --guide-h-position: right;
  }

  .p-magazine__item:nth-child(even) .p-magazine__sp-guide--tr {
    top: 0;
    right: 0;
    display: block;
    transform: translate(50%, -50%);
  }

  .p-magazine__item:nth-child(2) .p-magazine__sp-guide--tr {
    --guide-h-size: 50%;
    --guide-h-position: left;
    --guide-v-size: 50%;
    --guide-v-position: bottom;
  }

  .p-magazine__item:nth-child(even):not(:nth-child(2))
    .p-magazine__sp-guide--tr {
    --guide-h-size: 50%;
    --guide-h-position: left;
  }

  .p-magazine__item:nth-last-child(2):nth-child(odd) .p-magazine__sp-guide--bl,
  .p-magazine__item:last-child:nth-child(odd) .p-magazine__sp-guide--bl {
    bottom: 0;
    left: 0;
    display: block;
    transform: translate(-50%, 50%);
    --guide-h-size: 50%;
    --guide-h-position: right;
    --guide-v-size: 50%;
    --guide-v-position: top;
  }

  .p-magazine__item:last-child:nth-child(even) .p-magazine__sp-guide--bl {
    bottom: 0;
    left: 0;
    display: block;
    transform: translate(-50%, 50%);
    --guide-v-size: 50%;
    --guide-v-position: top;
  }

  .p-magazine__item:last-child .p-magazine__sp-guide--br {
    right: 0;
    bottom: 0;
    display: block;
    transform: translate(50%, 50%);
    --guide-h-size: 50%;
    --guide-h-position: left;
    --guide-v-size: 50%;
    --guide-v-position: top;
  }
}

@media (max-width: 767px) {
  .p-magazine__inner {
    width: calc(100% - 40px);
    max-width: none;
  }

  .p-magazine__filter-group + .p-magazine__filter-group {
    margin-top: 25px;
  }

  .p-magazine__filter-button,
  .p-magazine__tag-button {
    min-width: 0;
  }

  .p-magazine__filter-button {
    min-height: 36px;
  }

  .p-magazine__list-wrap {
    margin-top: 40px;
  }

  .p-magazine__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .p-magazine__card {
    padding: 12px 10px 18px;
  }

  .p-magazine__thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .p-magazine__date {
    font-size: 11px;
  }

  .p-magazine__category {
    font-size: 12px;
  }

  .p-magazine__card-tags {
    gap: 4px 6px;
  }

  .p-magazine__card-tags li {
    padding: 0 8px;
    font-size: 10px;
  }

  .p-magazine__item-title {
    font-size: 12px;
    line-height: 1.6;
  }

  /* SP 2カラム用ガイド装飾
     描画本体・線幅・ガイド長は guide-row.css に集約。
     このページでは2カラム時の「位置・形状」だけを指定する。 */
  .p-magazine__item > .c-guide-point {
    display: none;
  }

  .p-magazine__sp-guide {
    display: none;
  }

  /* 左上点は全カードで使用 */
  .p-magazine__sp-guide--tl {
    top: 0;
    left: 0;
    display: block;
    transform: translate(-50%, -50%);
  }

  /* 1件目：┌ */
  .p-magazine__item:first-child .p-magazine__sp-guide--tl {
    --guide-h-size: 50%;
    --guide-h-position: right;
    --guide-v-size: 50%;
    --guide-v-position: bottom;
  }

  /* 1行目2列目：┬ */
  .p-magazine__item:nth-child(2) .p-magazine__sp-guide--tl {
    --guide-v-size: 50%;
    --guide-v-position: bottom;
  }

  /* 2行目以降・左列：├ */
  .p-magazine__item:nth-child(odd):not(:first-child) .p-magazine__sp-guide--tl {
    --guide-h-size: 50%;
    --guide-h-position: right;
  }

  /* 2行目以降・右列：＋ は共通初期状態 */

  /* 右列の右上点のみ使用 */
  .p-magazine__item:nth-child(even) .p-magazine__sp-guide--tr {
    top: 0;
    right: 0;
    display: block;
    transform: translate(50%, -50%);
  }

  /* 1行目右端：┐ */
  .p-magazine__item:nth-child(2) .p-magazine__sp-guide--tr {
    --guide-h-size: 50%;
    --guide-h-position: left;
    --guide-v-size: 50%;
    --guide-v-position: bottom;
  }

  /* 2行目以降右端：┤ */
  .p-magazine__item:nth-child(even):not(:nth-child(2))
    .p-magazine__sp-guide--tr {
    --guide-h-size: 50%;
    --guide-h-position: left;
  }

  /* 最終行左側の左下：└
     偶数件なら「最後から2件目」、奇数件なら「最後の1件」 */
  .p-magazine__item:nth-last-child(2):nth-child(odd) .p-magazine__sp-guide--bl,
  .p-magazine__item:last-child:nth-child(odd) .p-magazine__sp-guide--bl {
    bottom: 0;
    left: 0;
    display: block;
    transform: translate(-50%, 50%);
    --guide-h-size: 50%;
    --guide-h-position: right;
    --guide-v-size: 50%;
    --guide-v-position: top;
  }

  /* 偶数件の最終カード左下：┴ */
  .p-magazine__item:last-child:nth-child(even) .p-magazine__sp-guide--bl {
    bottom: 0;
    left: 0;
    display: block;
    transform: translate(-50%, 50%);
    --guide-v-size: 50%;
    --guide-v-position: top;
  }

  /* 最終カード右下：┘ */
  .p-magazine__item:last-child .p-magazine__sp-guide--br {
    right: 0;
    bottom: 0;
    display: block;
    transform: translate(50%, 50%);
    --guide-h-size: 50%;
    --guide-h-position: left;
    --guide-v-size: 50%;
    --guide-v-position: top;
  }

  .p-magazine__pagination {
    gap: 22px;
    margin-top: 44px;
  }
}

/* ========================================
   Magazine / Dynamic guide
   線の描画は guide-row.css の .c-guide-point を使用。
   page-magazine.css では表示切り替えのみ行う。
======================================== */

.p-magazine__item > .p-magazine__guide--compact {
  display: none;
}

@media (max-width: 900px) {
  .p-magazine__item > .p-magazine__guide--pc {
    display: none;
  }

  .p-magazine__item > .p-magazine__guide--compact {
    display: block;
  }
}

/* ========================================
   Magazine / Last row bottom guide
   最下端ガイドは grid の子要素にせず list-wrap 基準で配置する。
   描画本体は guide-row.css の .c-guide-point を使用。
======================================== */

.p-magazine__list-wrap {
  position: relative;
  overflow: visible;
}

.p-magazine__bottom-guides {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--magazine-bottom-width);
  height: 1px;
  pointer-events: none;
  z-index: 5;
}

.p-magazine__bottom-point {
  top: 0;
  bottom: auto;
  transform: translate(-50%, -50%);
}

.p-magazine__bottom-point--left {
  left: 0;
}

.p-magazine__bottom-point--right {
  right: 0;
  left: auto;
  transform: translate(50%, -50%);
}

.p-magazine__bottom-guides--compact {
  display: none;
}

@media (max-width: 900px) {
  .p-magazine__bottom-guides--pc {
    display: none;
  }

  .p-magazine__bottom-guides--compact {
    display: block;
  }
}
