/* =========================
   防災カテゴリ 共通
========================= */
.bosai-category-title{
  font-size: 15px;
  font-weight: bold;
  border-left: 4px solid #2f6fde;
  padding-left: 8px;
  margin-bottom: 10px;
}

.pc-only{ display:block; }
.sp-only{ display:none; }

.bosai-category-box {
  background: #f7fbff;
  border: 1px solid #dbe8f5;
  border-radius: 8px;
  padding: 12px 14px;
}

.bosai-category-box ul{
  list-style: disc;
  padding-left: 18px;
}

.bosai-category-box .bosai-category-list li a{
  font-size: 13px;
  line-height: 2.1;
}

.bosai-category-box .bosai-category-list li a:hover{
  color:#0097DE;
}

/* =========================
   PC（1024〜）：2カラム + 左カテゴリsticky（安定版）
   ※ grid-row を固定しないのがポイント
========================= */
@media screen and (min-width:1024px){

  /* 2カラム（左：カテゴリ / 右：コンテンツ） */
  .fs-body-search .fs-c-productList,
  .fs-body-category .fs-c-productList{
    display: grid !important;
    grid-template-columns: 220px minmax(0,1fr) !important;
    /* 行は固定しない（autoで必要分増える） */
    grid-auto-rows: auto !important;
    column-gap: 24px !important;
    row-gap: 16px !important;
    align-items: start !important;

    /* theme.css などの余白対策 */
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 左：カテゴリ（列だけ固定、行は指定しない） */
  .fs-body-search .bosai-category-box,
  .fs-body-category .bosai-category-box{
    grid-column: 1 !important;
    grid-row: auto !important;      /* ←固定しない */
    position: sticky !important;
    top: 110px !important;
    align-self: start !important;
    width: auto !important;
    margin: 0 !important;
  }

  /* 左：長いので中だけスクロール */
  .fs-body-search .bosai-category-list,
  .fs-body-category .bosai-category-list{
    max-height: calc(100vh - 160px);
    overflow: auto;
    padding-right: 8px;
    margin: 0;
  }

  /* 右：この3つは全部「右列」に流し込む（行指定しない） */
  .fs-body-category .category-lead,
  .fs-body-search .fs-c-productList__controller,
  .fs-body-category .fs-c-productList__controller,
  .fs-body-search .fs-c-productList__list,
  .fs-body-category .fs-c-productList__list{
    grid-column: 2 !important;
    min-width: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* 右：商品一覧をグリッド（カード整列） */
  .fs-body-search .fs-c-productList__list,
  .fs-body-category .fs-c-productList__list{
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px,1fr)) !important;
    gap: 24px !important;
  }

  /* 商品カードが幅固定なら解除 */
  .fs-c-productList__list__item{
    width: auto !important;
    max-width: none !important;
  }

  /* 見出し(h1)下の余白が空白の犯人になりやすいので詰める */
  .fs-body-search .fs-c-heading--page,
  .fs-body-category .fs-c-heading--page{
    margin: 0 0 12px !important;
  }

  /* pageMain側の上余白も念のため */
  .fs-body-search .fs-l-pageMain,
  .fs-body-category .fs-l-pageMain{
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
}

/* =========================
   SP/タブレット（〜1023）：ドロップダウン
   ※ grid-row 指定はしない（崩れの元）
========================= */
@media screen and (max-width:1023px){

  .bosai-category-box{
    width: 100%;
    margin: 12px 0 0;
  }

  .pc-only{ display:none; }
  .sp-only{ display:inline-flex; }

  .bosai-category-toggle{
    width: 100%;
    background: transparent;
    border: none;
    padding: 4px 0 6px;
    font-size: 14px;
    color: #333;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    cursor: pointer;
  }

  .bosai-category-toggle::before{
    content: "カテゴリで絞り込む";
    font-size: 13px;
  }

  .bosai-category-toggle::after{
    content: "▼";
    font-size: 10px;
    transition: transform .2s ease;
  }

  .bosai-category-toggle.is-open::after{
    transform: rotate(180deg);
  }

  .bosai-category-list{
    display: none;
    margin-top: 6px;
    padding: 10px 14px;
    border-radius: 4px;
  }

  .bosai-category-list.open{ display:block; }

  .bosai-category-box ul{ padding-left: 30px; }
}



@media (min-width: 1024px){

  /* カテゴリ内ページだけ：上段を 2カラム（説明文＋カテゴリ）にする */
  body.fs-body-category .fs-c-productList{
    display: grid;
    grid-template-columns: 1fr 260px; /* 右側にカテゴリBOX */
    grid-template-areas:
      "lead cat"
      "ctrl ctrl"
      "list list";
    gap: 16px 24px;
    align-items: start;
  }

  /* 説明文 */
  body.fs-body-category .fs-c-productList > .category-lead{
    grid-area: lead;
    margin: 0;
  }

  /* 商品カテゴリ（左メニュー） */
  body.fs-body-category .fs-c-productList > .bosai-category-box{
    text-align: left;
  }

  /* 並び替え */
  body.fs-body-category .fs-c-productList > .fs-c-productList__controller{
    grid-area: ctrl;
    margin: 0;
  }

  /* 商品一覧 */
  body.fs-body-category .fs-c-productList > .fs-c-productList__list{
    grid-area: list;
    margin: 0;
    width: 100%;
  }
}




/* =========================
   カテゴリ内ページ：説明文（category-lead）共通
   ※ 商品トップ（fs-body-search）には影響しない
========================= */
body.fs-body-category .fs-c-productList > .category-lead{
  /* 見た目 */
  background: #f7fbff;
  border-radius: 8px;
  color: #333;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.7;
  padding: 10px 14px;
  text-align: left;

  /* 幅：青背景を「中身にフィット」させる（gridの伸びを止める） */
  justify-self: start;
  align-self: start;
  display: inline-block;     /* ← ここが効く */
  width: auto;               /* ← fit-content をやめる */
  max-width: 100%;           /* ← はみ出し防止 */
}

/* いったん全カテゴリでは画像を出さない */
body.fs-body-category .fs-c-productList > .category-lead::after{
  content: none;
}

/* 非常食だけ画像を表示 */
body.fs-body-category-food .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-food .fs-c-productList > .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */
  margin-top: 16px;

  background-image: url("https://lease1988.itembox.design/item/bousaifood.png?d=20260121093239");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* 保存水だけ：画像 */
body.fs-body-category-Water .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-Water .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */
  margin-top: 16px;

  background-image: url("https://lease1988.itembox.design/item/bousaiWoter.png?d=20260121112641");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

body.fs-body-category-Toilet .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

/* トイレだけ：画像 */
body.fs-body-category-Toilet .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */
  margin-top: 16px;

  background-image: url("https://lease1988.itembox.design/item/bousaitoilet.png?d=20260121115952");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* ライトだけ：画像 */
body.fs-body-category-light .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-light .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */
  margin-top: 16px;

  background-image: url("https://lease1988.itembox.design/item/bousailight.png?d=20260121172420");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* 防寒だけ：画像 */
body.fs-body-category-boukan .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-boukan .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */
  margin-top: 16px;

  background-image: url("https://lease1988.itembox.design/item/bousaiboukan.png?d=20260121143217");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* 避難だけ：画像 */
body.fs-body-category-evacuation .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-evacuation .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */
  margin-top: 16px;

  background-image: url("https://lease1988.itembox.design/item/bousaihinan.png?d=20260121170402");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* ベットだけ：画像 */
body.fs-body-category-Bet .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-Bet .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */
  margin-top: 16px;

  background-image: url("https://lease1988.itembox.design/item/bousaieamat.png?d=20260123145844");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* リュックサックだけ：画像 */
body.fs-body-category-Rucksack .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-Rucksack .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */

  background-image: url("https://lease1988.itembox.design/item/bousaiRucksack.png?d=20260121175846");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* ペットだけ：画像 */
body.fs-body-category-pet .fs-c-productList > .category-lead{
  padding: 12px 16px;
}

body.fs-body-category-pet .fs-c-productList .category-lead::after{
  content: "";
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;   /* 見切れ防止＆自然なサイズ */

  background-image: url("https://lease1988.itembox.design/item/bousaipet.png?d=20260121181356");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* fit-content が効かない環境向けの保険（必要な場合だけ残す） */
@supports not (width: fit-content){
  body.fs-body-category .fs-c-productList > .category-lead{
    display: inline-block;
  }
}