/* ============================
   topics.css  (統合・整理版)
   2025-09-06 + icon hover fade（色薄見え対策）
============================ */

/* ===== Base (共通) ===== */
.topics {
  background-color: #fff;
  padding: 60px 0;
}
.topics__inner {
  display: flex;
  gap: 40px;
  max-width: 1460px;
  padding: 0 20px;
  margin: 0 auto;
  box-sizing: border-box;
}
.topics__left {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
}

.topics__container {
  margin-bottom: 100px;
}

.topics__container .topics-article p {
  font-weight: 400;
  font-size: 24px;
}

.topics__container .topics-article a {
  color: #0072ba;
  text-decoration: underline;
}

.topics__container .topics-article__title {
  font-weight: 700;
  font-size: 28px;
}

.topics__container .topics__date {
  font-weight: 200;
  font-size: 24px;
}

.topics__container .topics__label {
  font-size: 16px;
  font-weight: 500;
}

@media (max-width: 879px) {
  .topics__container {
    margin-bottom: 40px;
  }
  .topics__container .topics-article p {
    font-size: 14px;
  }
  .topics__container .topics-article__title {
    font-weight: 500;
    font-size: 16px;
  }
  .topics__container .topics__date {
    font-size: 14px;
  }
  .topics__container .topics__label {
    font-size: 12px;
  }
  .topics__container .topics--archive .topics__label__single {
    width: auto;
  }
}

/* ===== ボタン（共通） ===== */
.topics__buttons {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.topics__button-outline,
.topics__button-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  font-weight: 700;
  font-size: 24px;
  text-align: center;
  border-radius: 30px;
  text-decoration: none;
  line-height: 1;
}
.topics__button-outline {
  border: 1px solid #0072ba;
  color: #0072ba;
  background: #fff;
}
.topics__button-solid {
  background: #0072ba;
  color: #fff;
}

/* PCボタン：狭い(240)→広い(280)／左基準・透過なし */
@media (min-width: 880px) {
  .topics__buttons--pc .topics__button-outline,
  .topics__buttons--pc .topics__button-solid {
    width: 240px;
    transition: width 0.3s ease !important;
  }
  .topics__buttons--pc .topics__button-outline:hover,
  .topics__buttons--pc .topics__button-solid:hover {
    width: 280px;
    opacity: 1 !important;
  }
}
.topics__buttons--pc {
  margin-top: auto;
} /* 左カラム下ぞろえ */

/* ===== 右カラム（リスト） ===== */
.topics__right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== 行（共通ベース） ===== */
.topics__item {
  display: grid;
  grid-template-columns: 120px 120px 1fr;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px dashed #ccc;
  padding: 16px 0;
  position: relative;
}
.topics__date {
  font-size: 14px;
  color: #555;
}
.topics__label {
  justify-self: start;
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  background-color: #eee;
  width: 100%;
  text-align: center;
}
.topics--archive .topics__label__single {
  width: 142px;
}
.topics__text {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.6;
  position: relative;
  padding-right: 14px;
}

/* === 矢印アイコン：CSSだけでarrow→arrow_hをフェード === */
.topics__icon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  pointer-events: none;
}
.topics__icon::before,
.topics__icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.topics__icon::before {
  background-image: url("../images/common/arrow.svg");
  opacity: 1;
  transition: opacity 0s linear; /* 通常矢印は即座に消して重なりを無くす */
}
.topics__icon::after {
  background-image: url("../images/common/arrow_h.svg");
  opacity: 0;
  transition: opacity 0.3s ease; /* 青矢印のみフェードイン */
  will-change: opacity;
}
/* hoverで入れ替え（beforeは即0、afterを0→1） */
.topics__item:hover .topics__icon::before {
  opacity: 0;
}
.topics__item:hover .topics__icon::after {
  opacity: 1;
}
/* レイアウト保持用<img>は不可視（1回に統合） */
.topics__icon img {
  width: 100%;
  height: 100%;
  opacity: 0;
}

/* ===== ラベル色 ===== */
.topics__label--important {
  background: #ffc6c6 !important;
  color: #b30000 !important;
}
.topics__label--sns {
  background: #ffeba8 !important;
  color: #a85700 !important;
}
.topics__label--event {
  background: #c6e8ff !important;
  color: #004383 !important;
}
.topics__label--study {
  background: #b7f2d1 !important;
  color: #1c5033 !important;
}

/* =========================
   アーカイブ（/topics/）
========================= */

/* 件数バー（PC初期） */
.search-meta-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
@media (min-width: 880px) {
  .search-meta-bar {
    align-items: flex-end;
    margin: 40px 0;
  }
}
.search-meta-bar__left p {
  margin: 0;
  font-size: 16px;
  line-height: 1.8;
}
.search-meta-bar__left strong {
  font-size: 26px;
}
.search-meta-bar__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

/* ===== meta-pill（PC見た目） ===== */
.meta-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  width: 264px;
  max-width: 100%;
  height: 38px;
  border: 1px solid #f4f4f4;
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(to right, #f4f4f4 50%, #fff 50%);
}
@media (min-width: 880px) {
  .meta-pill::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 6px;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
  .meta-pill select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0 6px;
    background: none;
  }
}
.meta-pill__icon {
  width: 21px;
  height: 21px;
  display: block;
  margin-left: 8px;
  z-index: 1;
}
.meta-pill__label {
  font-weight: 600;
  white-space: nowrap;
  z-index: 1;
  text-align: center;
  flex: 0 0 calc(50% - 21px - 16px);
  font-size: 16px;
  padding: 0 8px;
}
.meta-pill select {
  flex: 0 0 50%;
  height: 38px;
  font-size: 16px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-left: 1px solid #f4f4f4;
  background: transparent;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  text-align: center;
  text-align-last: center;
}
.meta-pill select:focus,
.meta-pill select:focus-visible {
  outline: none !important;
  box-shadow: inset 0 0 0 2px #0072ba;
  background: #fff;
}

/* ===== アーカイブ行（ベース） ===== */
.topics__item--archive {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px dashed #ccc;
  padding: 16px 0;
  position: relative;
}
.topics__item--archive .topics__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.topics__item--archive .topics__text {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  padding-right: 14px;
}

/* /topics/ PC時拡張（front と分離） */
@media (min-width: 880px) {
  .topics--archive .topics__item--archive {
    gap: 50px;
    padding: 16px 0 16px 20px;
    border-bottom: 2px dashed #ccc;
  }
  .topics--archive .topics__item--archive .topics__date {
    font-size: 24px;
  }
  .topics--archive .topics__item--archive .topics__label {
    font-size: 16px;
  }
  .topics--archive .topics__item--archive .topics__text {
    font-size: 24px;
    font-weight: 500;
    padding-right: 54px;
  }
  .topics--archive .topics__item--archive .topics__icon {
    right: 20px !important;
  }
  .topics--archive .topics__icon img {
    width: 30px;
    height: 30px;
  } /* 擬似要素が主役 */
}

/* ===== ページャー（PC基準） ===== */
.topics__pager {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 60px;
}
.topics__pager .page-numbers {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 10px -6px rgba(0, 0, 0, 0.28), 0 14px 18px -14px rgba(0, 0, 0, 0.26);
}
.topics__pager .page-numbers.prev,
.topics__pager .page-numbers.next {
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  color: transparent;
  font-size: 0;
  line-height: 0;
}
.topics__pager .page-numbers.prev {
  background-image: url("../images/common/arrow_left.svg");
}
.topics__pager .page-numbers.next {
  background-image: url("../images/common/arrow_right.svg");
}
.topics__pager .page-numbers.current {
  background: #0072ba;
  color: #fff;
  box-shadow: none;
}
.topics__pager a.page-numbers:hover {
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.22), 0 8px 12px -6px rgba(0, 0, 0, 0.34), 0 16px 22px -16px rgba(0, 0, 0, 0.3);
}

/* =========================
   単一（/topics/%post_id%/）
========================= */
.topics-article__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}
.topics-article__title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
}
.topics-article__content {
  font-size: 16px;
  line-height: 1.9;
}
.topics-article__content p {
  margin: 1em 0;
}

.topics-article__content img {
  display: block;
  margin: 16px auto;
  height: auto;
  max-width: 100%;
}
.topics-article__content .wp-block-image,
.topics-article__content figure {
  text-align: center;
}
.topics-article__content .wp-block-gallery {
  max-width: 920px;
  margin: 16px auto 20px;
  justify-content: center;
  gap: 16px;
}
.topics-article__content .wp-block-gallery.has-nested-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  justify-items: center;
}
.topics-article__content .wp-block-gallery.has-nested-images figure.wp-block-image {
  margin: 0;
}
.topics-article__content .blocks-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 920px;
  margin: 16px auto 20px;
}
.topics-article__content .is-layout-flex > .wp-block-image {
  margin: 0 8px;
}

/* =========================
   トップ（最新情報3件）
========================= */
.topics--front .topics__right {
  gap: 16px;
}
.topics--front .topics__item {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 16px;
  border-bottom: 2px dashed #ccc;
  padding: 16px 0;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.topics--front .topics__item .topics__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.topics--front .topics__date {
  font-size: 24px;
  color: #555;
}
.topics--front .topics__label {
  font-size: 16px;
}
.topics--front .topics__item .topics__text {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.6;
  padding-right: 14px;
}

.topics__left .info-eyebrow,
.topics__left .info-title {
  text-align: left;
}

/* ===== SPボタン既定非表示（PC誤表示防止） ===== */
.topics__buttons--sp {
  display: none;
}

/* ===== PCガード ===== */
@media (min-width: 880px) {
  .topics__buttons--sp {
    display: none !important;
  }
  .topics__buttons--pc {
    display: flex !important;
  }
}

/* ===== SP（≤879px） ===== */
@media (max-width: 879px) {
  /* 共通の小型化（front/home 共通） */
  .topics__inner {
    flex-direction: column;
    gap: 20px;
  }
  .topics__left {
    flex: none;
    width: 100%;
    margin-bottom: 0;
    text-align: center;
  }
  .topics__en {
    font-size: 12px !important;
    text-align: center;
  }
  .topics__ja {
    font-size: 22px !important;
    text-align: center;
    margin-bottom: 0 !important;
  }

  /* === /topics/ 見出し（中央） === */
  .topics--archive .topics__en {
    font-size: 12px !important;
    text-align: center;
    margin-bottom: 2px !important;
  }
  .topics--archive .topics__ja {
    font-size: 22px !important;
    text-align: center;
    margin: 0 0 40px !important;
  }

  /* === /topics/ 件数バー（両端揃え） === */
  .topics--archive .search-meta-bar {
    display: flex;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100%;
    gap: 12px;
    margin: 0 0 10px;
  }
  .topics--archive .search-meta-bar__left p {
    font-size: 14px !important;
  }
  .topics--archive .search-meta-bar__left strong {
    font-size: 20px !important;
  }
  .topics--archive .search-meta-bar__controls {
    margin-left: auto !important;
  }

  /* SPボタン（frontの見た目維持） */
  .topics__buttons {
    flex-direction: row;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .topics__button-outline,
  .topics__button-solid {
    min-width: 184px;
    height: 48px;
    font-size: 18px;
    width: auto;
    transition: none;
  }
  .topics__buttons--sp {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 30px;
  }
  .topics__buttons--pc {
    display: none !important;
  }

  /* 行（SPフォント強制） */
  .topics__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    padding-right: 24px;
  }
  .topics__item .topics__date {
    font-size: 14px !important;
  }
  .topics__item .topics__text {
    font-size: 14px !important;
    padding-right: 0;
  }
  .topics__label,
  .topics__label--important {
    font-size: 12px !important;
  }
  .topics__icon {
    top: 62px;
  }

  /* front（SP）：余白を揃える */
  .topics--front .topics__right {
    gap: 0 !important;
  }
  .topics--front .topics__item {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 0;
    padding-right: 24px;
  }
  .topics--front .topics__item .topics__meta {
    flex-direction: column;
    gap: 8px;
  }

  /* /topics/（SP）：1カラム */
  .topics__item--archive {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-right: 0;
  }
  .topics__item--archive .topics__meta {
    flex-direction: column;
    gap: 8px;
  }

  /* === /topics/ ページャー（SP小型化） === */
  .topics--archive .topics__pager {
    gap: 20px;
    margin: 40px 0;
  }
  .topics--archive .topics__pager .page-numbers {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background-size: 14px 14px;
  }

  /* アイコン（SPでは 24×24） */
  .topics__icon {
    width: 24px;
    height: 24px;
  }

  /* === SP メタピル（一覧だけ） === */
  .topics--archive .meta-pill {
    width: 168px !important;
    height: 26px !important;
    border-radius: 6px !important;
    border: 1px solid #f4f4f4 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
    position: relative !important;
  }
  .topics--archive .meta-pill::before {
    content: "";
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -1px;
    width: calc(53% + 1px) !important;
    background: #f4f4f4 !important;
    z-index: 0;
  }
  .topics--archive .meta-pill__icon {
    position: relative;
    z-index: 1;
    width: 16px !important;
    height: 16px !important;
    margin-left: 6px !important;
  }
  .topics--archive .meta-pill__label {
    position: relative;
    z-index: 1;
    font-size: 10px !important;
    flex: 0 0 60px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px !important;
    text-align: center !important;
  }
  .topics--archive .meta-pill select {
    position: relative;
    z-index: 1;
    flex: 0 0 84px !important;
    width: 84px !important;
    height: 26px !important;
    box-sizing: border-box;
    font-size: 10px !important;
    margin: 0 !important;
    padding: 0 14px 0 20px !important;
    border: 0 !important;
    border-left: 1px solid #f4f4f4 !important;
    background: transparent !important;
    text-align: center !important;
    text-align-last: center !important;
    border-top-right-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
  }

  .topics__label {
    width: 105px;
  }
  .topics__left .info-eyebrow,
  .topics__left .info-title {
    text-align: center;
  }
}

/* ★ 一覧（.topics--archive）だけ、395px以下で左揃え */
@media (max-width: 395px) {
  .topics--archive .search-meta-bar {
    justify-content: flex-start !important;
    align-items: flex-start !important;
    column-gap: 12px;
    row-gap: 8px;
  }
  .topics--archive .search-meta-bar__controls {
    margin-left: 0 !important;
  }
}

/* クリック不可 */
.topics__item.is-static {
  cursor: default;
}
.topics__item.is-static .topics__icon {
  display: none;
}

/* ==== PC時：左カラムを可変（最大320px） ==== */
@media (min-width: 880px) {
  .topics--front .topics__left {
    width: clamp(260px, 24vw, 320px);
    flex: 0 0 auto;
  }
  .topics--front .topics__right {
    min-width: 0;
  }
}

/* タッチ環境では hover 無効化（SPの“薄くなる”防止） */
@media (hover: none), (pointer: coarse) {
  .topics__item:hover .topics__meta,
  .topics__item:hover .topics__text {
    opacity: 1 !important;
  }
}

/* 880〜1460px：左右パディングの担保（親セレクタを明示） */
@media (min-width: 880px) and (max-width: 1460px) {
  .topics .topics__inner {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ===== 単一のタイポグラフィ（見出し/本文/リンク） ===== */
.topics--single .info-eyebrow,
.topics--single .info-title {
  text-align: center;
}
.topics--single .info-eyebrow {
  color: #0072ba;
  font-size: 20px;
  margin-bottom: 10px;
}
.topics--single .info-title {
  font-weight: 500;
  font-size: 36px;
}
.topics--single .topics__date {
  font-weight: 200;
  font-size: 24px;
}
.topics--single .topics-article__title {
  font-weight: 700;
  font-size: 28px;
}
.topics--single .wp-element-caption {
  font-size: 18px;
  font-weight: 400;
}
.topics--single p {
  font-size: 24px;
  font-weight: 400;
}
.topics--single a {
  font-size: 24px;
  font-weight: 400;
}

/* SP（単一） */
@media (max-width: 879px) {
  .topics--single header {
    margin: 48px 0;
  }
  .topics--single .info-eyebrow {
    font-size: 12px;
    margin-bottom: 8px;
  }
  .topics--single .info-title {
    font-size: 22px;
  }
  .topics--single .topics__date {
    font-size: 14px;
  }

  .topics--single .topics-article__title {
    font-size: 16px;
  }

  .topics--single h2 {
    font-size: 14px;
  }
  .topics--single h3 {
    font-size: 10px;
  }
  .topics--single h4 {
    font-size: 8px;
  }

  /* 単一見出しの左バー（SPは細く） */
  .topics-article__content h2::before,
  .topics-article__content h3::before,
  .topics-article__content h4::before {
    width: 4px;
  }

  .topics--single .wp-element-caption {
    font-size: 10px;
  }
  .topics--single p {
    font-size: 14px;
  }
  .topics--single a {
    font-size: 14px;
  }

  .topics--single .topics-article__meta {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
  }
}
