/* ============================================================
 * タブで切り替える項目の一覧（template-parts/topic-list.php）
 * ご利用ガイド・FAQページ・トップ、商品カテゴリ、商品詳細のFAQ欄
 * ============================================================ */

/* 全ページの包みの overflow: hidden の中では sticky が貼り付かない＝レビュー一覧と同じく clip にする（はみ出しは切ったまま） */
body:is(.page-guide, .page-qa, .home, .tax-item_category, .single-item) {
  overflow-x: clip;
}

body:is(.page-guide, .page-qa, .home, .tax-item_category, .single-item) .u-hidden,
.tax-item_category .l-lower-content-items {
  overflow: clip;
}

.p-topics {
  margin-top: -1px;
  padding-top: 40px;
  padding-bottom: 100px;
}

.p-topics__inner {
  max-width: 1080px;
  margin-inline: auto;
}

/* タブ（色と札の形はレビュー一覧のタブと同じ。4つが同じ幅で横に収まる） */
.p-topics__tabs {
  position: sticky;
  top: 95px;
  z-index: 5;
  margin: 28px -20px 0;
  padding: 10px 20px;
  background: #fff;
}

.p-topics__tabs-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

#lp-qa .p-topics__tabs {
  background: #f6f6f6;
}

#item-faq {
  background-color: transparent;
}

.l-qa {
  scroll-margin-top: 67px; /* スクロール後のヘッダーの高さ */
}

.l-qa .p-topics__tab {
  scroll-margin-top: 95px;
}

.p-topics__tab {
  padding: 7px 2px;
  border: 1.5px solid #01a273;
  border-radius: 999px;
  background: #fff;
  color: #01a273;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.p-topics__tab.is-active {
  background: #01a273;
  color: #fff;
}

/* カテゴリの一覧 */
.p-topics__panel {
  display: none;
  margin-top: 4px;
}

.p-topics__panel.is-active {
  display: block;
}

.p-topics__panel-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* ガイドはカード、FAQは質問の間に区切り線を引く */
.page-guide .p-topics__item {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  background: #fff;
}

.page-guide .p-topics__item[open] {
  border-color: #01a273;
}

.p-topics--qa .p-topics__item + .p-topics__item {
  border-top: 1px solid #ddd;
}

.p-topics__summary {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.page-guide .p-topics__item[open] .p-topics__summary {
  background: #f0faf6;
}

.p-topics__summary::-webkit-details-marker {
  display: none;
}

.p-topics__summary::after {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid #01a273;
  border-bottom: 2px solid #01a273;
  transform: translateY(-2px) rotate(45deg);
}

.p-topics__item[open] .p-topics__summary::after {
  transform: translateY(2px) rotate(-135deg);
}

/* 題名の左の緑の棒 */
.p-topics__title {
  position: relative;
  padding-left: 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.p-topics__title::before {
  content: "";
  position: absolute;
  top: 0.15em;
  bottom: 0.15em;
  left: 0;
  width: 4px;
  border-radius: 2px;
  background: #01a273;
}

/* FAQの回答の左端を質問の文字にそろえる */
.p-topics--qa {
  --qa-label-width: 22px;
}

.p-topics--qa .p-topics__summary {
  padding-inline: 0;
}

.p-topics--qa .p-topics__title {
  padding-left: var(--qa-label-width);
}

.p-topics--qa .p-topics__title::before {
  content: "Q";
  top: 0;
  bottom: auto;
  width: auto;
  border-radius: 0;
  background: none;
  color: #01a273;
}

/* 本文 */
.p-topics__text {
  padding: 14px 16px 18px;
  font-size: 14px;
  line-height: 1.7;
}

.p-topics--qa .p-topics__text {
  padding-top: 0;
  padding-left: var(--qa-label-width);
}

.p-topics__text p + p,
.p-topics__text :is(ul, ol) + p,
.p-topics__text p + :is(ul, ol),
.p-topics__text :is(ul, ol) + :is(ul, ol) {
  margin-top: 10px;
}

.p-topics__text a {
  color: #01a273;
  text-decoration: underline;
}

.p-topics__text a:hover {
  text-decoration: none;
}

.p-topics__text ul {
  padding-left: 1.3em;
}

.p-topics__text li {
  list-style: disc;
}

.p-topics__text li::marker {
  color: #01a273;
}

/* 手順（行頭の「１）」＝緑の太い番号） */
.p-topics__text ol {
  padding-left: 1.5em;
}

.p-topics__text ol > li {
  list-style: decimal;
}

.p-topics__text ol > li::marker {
  font-weight: 700;
}

.p-topics__text li + li {
  margin-top: 4px;
}

/* 本文の中の小見出し（【見出し】＝緑の文字と下線） */
.p-topics__sub {
  margin-top: 20px;
  padding-bottom: 4px;
  border-bottom: 1px solid #01a273;
  color: #01845d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.p-topics__sub:first-child {
  margin-top: 0;
}

.p-topics__sub + p,
.p-topics__sub + :is(ul, ol) {
  margin-top: 8px;
}

/* 注記（※＝灰色の面） */
.p-topics__text .p-topics__note {
  margin-top: 10px;
  padding: 8px 10px 8px calc(10px + 1em);
  border-radius: 6px;
  background: #f6f6f6;
  font-size: 13px;
  line-height: 1.6;
  text-indent: -1em;
}

.p-topics__note:first-child {
  margin-top: 0;
}

.p-topics__text .p-topics__note + .p-topics__note {
  margin-top: 6px;
}

@media (min-width: 769px) {
  .p-topics {
    padding-top: 45px;
  }

  .p-topics--qa .p-topics__inner {
    max-width: 800px;
    padding-inline: 40px;
  }

  .p-topics__tabs {
    margin-inline: 0;
    padding-inline: 0;
  }

  .p-topics__tabs-list {
    gap: 10px;
  }

  .p-topics__tab {
    padding-block: 9px;
    font-size: 15px;
  }

  .page-guide .p-topics__item {
    margin-top: 12px;
  }

  .p-topics__summary {
    min-height: 60px;
    padding: 14px 20px;
  }

  .p-topics__title {
    font-size: 17px;
  }

  .p-topics--qa {
    --qa-label-width: 26px;
  }

  .p-topics__text {
    padding: 20px 24px 26px;
  }

  .p-topics__text,
  .p-topics__sub {
    font-size: 16px;
  }

  .p-topics__text .p-topics__note {
    font-size: 14px;
  }
}
