/* =========================================================
   SiteHub UI Module: FAQ (THEME SIDE / FINAL)
   - 構造＆JS：プラグイン側
   - 見た目：このCSS（ui-faq.css）
   - 業種切替：body.ui-tax / body.ui-construction
   - 競合を避けるため、旧Baseは使わない（この1本で完結）
========================================================= */

/* =========================
   1) BASE TOKENS
========================= */
.sh-faq{
  /* palette / tokens */
  --faq-accent: var(--sh-accent, #53BBD3);
  --faq-bg: transparent;

  --faq-surface: #ffffff;
  --faq-surface-open: color-mix(in srgb, var(--faq-accent) 4%, white);

  --faq-border: rgba(0,0,0,.08);
  --faq-border-hover: color-mix(in srgb, var(--faq-accent) 18%, var(--faq-border));
  --faq-border-open: color-mix(in srgb, var(--faq-accent) 32%, var(--faq-border));

  --faq-radius: 16px;
  --faq-gap: 12px;

  --faq-q: #0f172a;
  --faq-a: rgba(15,23,42,.78);
  --faq-muted: rgba(15,23,42,.55);

  --faq-icon-bg: color-mix(in srgb, var(--faq-accent) 12%, transparent);
  --faq-icon-fg: var(--faq-accent);

  --faq-focus: color-mix(in srgb, var(--faq-accent) 55%, white);

  background: var(--faq-bg);
}

/* list wrapper (あれば) */
.sh-faq__list{
  display: grid;
  gap: var(--faq-gap);
}

/* =========================
   2) CARD / ITEM
========================= */
.sh-faq__item{
  background: var(--faq-surface);
  border: 1px solid var(--faq-border);
  border-radius: var(--faq-radius);
  box-shadow: none;
  overflow: clip;
  position: relative;
}

/* left accent line */
.sh-faq__item::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: color-mix(in srgb, var(--faq-accent) 55%, white);
  opacity: .55;
}

/* =========================
   3) QUESTION ROW
   - .sh-faq__q が button / a / div どれでもOK
========================= */
.sh-faq__q{
  display: grid;
  grid-template-columns: 40px 1fr 28px; /* icon / title / +/- */
  align-items: center;
  gap: 12px;

  padding: 16px 16px 16px 14px;
  cursor: pointer;
  user-select: none;

  color: var(--faq-q);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.4;
}

/* icon circle */
.sh-faq__icon{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--faq-icon-bg);
  color: var(--faq-icon-fg);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
}

/* title (プラグイン側に .sh-faq__title があるなら効く / 無くてもOK) */
.sh-faq__title{
  font-size: 16px;
  font-weight: inherit;
}

/* 右端の「＋/－」演出（chevron不要・競合防止のためこれ1本に統一） */
.sh-faq__q::after{
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  margin-left: auto;
  font-weight: 900;
  color: var(--faq-muted);
  background: rgba(0,0,0,.02);
  transform: translateY(-1px);
  transition: transform .18s ease, color .18s ease, background .18s ease;
}

/* focus (accessibility) */
.sh-faq__q:focus,
.sh-faq__q:focus-visible{
  outline: 3px solid var(--faq-focus);
  outline-offset: 2px;
  border-radius: calc(var(--faq-radius) - 6px);
}

/* =========================
   4) ANSWER
========================= */
.sh-faq__a{
  padding: 0 16px 16px 66px; /* アイコン分のインデント */
  color: var(--faq-a);
  line-height: 1.9;
  font-size: 0.98rem;
}

/* inner がある場合にも対応 */
.sh-faq__a-inner{
  padding: 0;
}
.sh-faq__a-inner p{
  margin: 10px 0 0 0;
}

/* divider */
.sh-faq__a::before{
  content: "";
  display: block;
  height: 1px;
  background: color-mix(in srgb, var(--faq-border) 70%, white);
  margin: 0 0 12px 0;
}

/* =========================
   5) HOVER / OPEN STATE
========================= */
@media (hover:hover){
  .sh-faq__item:hover{
    border-color: var(--faq-border-hover);
    box-shadow: 0 6px 20px rgba(0,0,0,.05);
    transform: translateY(-1px);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  }
}

/* JS側で .is-open が付く想定 */
.sh-faq__item.is-open{
  border-color: var(--faq-border-open);
  background: linear-gradient(
    180deg,
    var(--faq-surface-open),
    white 60%
  );
}
.sh-faq__item.is-open::before{
  opacity: .95;
  background: var(--faq-accent);
}
.sh-faq__item.is-open .sh-faq__q::after{
  content: "–";
  color: color-mix(in srgb, var(--faq-accent) 70%, var(--faq-muted));
  background: color-mix(in srgb, var(--faq-accent) 10%, transparent);
}

/* =========================
   6) MOBILE TUNING
========================= */
@media (max-width: 640px){
  .sh-faq__q{
    grid-template-columns: 36px 1fr 26px;
    padding: 14px 14px 14px 12px;
  }
  .sh-faq__icon{
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .sh-faq__q::after{
    width: 26px;
    height: 26px;
  }
  .sh-faq__a{
    padding: 0 14px 14px 58px;
    font-size: .96rem;
  }
}

/* =========================
   1) BASE TOKENS
========================= */
.sh-faq{
  --faq-accent: var(--sh-accent, #53BBD3);
  --faq-bg: transparent;

  --faq-surface: #ffffff;
  --faq-surface-open: color-mix(in srgb, var(--faq-accent) 4%, white);

  --faq-border: color-mix(in srgb, var(--faq-accent) 14%, rgba(0,0,0,.08));
  --faq-border-hover: color-mix(in srgb, var(--faq-accent) 22%, rgba(0,0,0,.08));
  --faq-border-open: color-mix(in srgb, var(--faq-accent) 34%, rgba(0,0,0,.08));

  --faq-radius: 16px;
  --faq-gap: 12px;

  --faq-q: #0f172a;
  --faq-a: rgba(15,23,42,.78);
  --faq-muted: rgba(15,23,42,.55);

  --faq-icon-bg: color-mix(in srgb, var(--faq-accent) 12%, transparent);
  --faq-icon-fg: var(--faq-accent);

  --faq-focus: color-mix(in srgb, var(--faq-accent) 55%, white);

  background: var(--faq-bg);
}

/* =========================================================
   FIX: HTMLの順番が逆でも崩れないように強制配置
========================================================= */
.sh-faq__qtext,
.sh-faq__title{
  grid-column: 2;      /* 真ん中(1fr)に固定 */
  min-width: 0;
  word-break: break-word;
}

.sh-faq__icon{
  grid-column: 1;      /* 左(40px)に固定 */
}

/* =========================
   FAQ セクション下の余白
========================= */
.sh-faq{
  margin-bottom: 80px;
}

/* =========================================
   FAQ 文字サイズ調整（読みやすさUP）
========================================= */

/* 見出し「よくある質問」 */
.sh-faq > .sh-container > h2,
.sh-faq__heading {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 18px;
}

/* 質問テキスト */
.sh-faq__qtext,
.sh-faq__title {
  font-size: 25px;
  line-height: 1.6;
}

/* 回答テキスト */
.sh-faq__a {
  font-size: 22px;
  line-height: 1.9;
}

body.ui-tax .sh-faq{
  --faq-radius: 18px;
}
body.ui-tax .sh-faq__q{
  font-weight: 800;
}

body.ui-construction .sh-faq__q{
  letter-spacing: .04em;
}