@charset "UTF-8";
/* トップ #home_material：Material Library のカード表示
   ------------------------------------------------------------------
   すべて #home_material の中で閉じる（全体の style.css には手を入れない）。
   カードの体裁は /material/（style-materials.css の .card まわり）に合わせ、
   トップ用にサイズだけ詰めている。

   data-layout（index.html の section 属性）で2案を切り替える：
     cards  4枠すべてカード（写真スライダーは隠す）
     mixed  上段は写真スライダーの先頭2枠、下段はカード2枚

   幅と余白は .material_cont（style.scss）に揃えてある：
     PC/TB  幅 87%（左右 6.5%）、1枠の内側余白 1.5% → 87vw × 1.5% ≒ 1.3vw
     SP     幅 96%（左右 2%）、  1枠の内側余白 3%   → 96vw × 3%   ≒ 2.9vw */

#home_material .material_library {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.6vw;
  width: calc(100% - 13%);
  margin: 0 6.5%;
  padding: 1.3vw;
}

/* 表示枚数を超えたカードは隠す（どれを先頭に置くかは js が決める） */
#home_material[data-layout="cards"] .material_library .card:nth-child(n+5),
#home_material[data-layout="mixed"] .material_library .card:nth-child(n+3) {
  display: none;
}

/* cards：写真スライダーを隠し、4枠すべてカード */
#home_material[data-layout="cards"] .material_cont {
  display: none;
}

/* mixed：上段は写真スライダーの先頭2枠、下段はカード2枚 */
#home_material[data-layout="mixed"] .material_cont_slider:nth-child(n+3) {
  display: none;
}

#home_material[data-layout="mixed"] .material_library {
  grid-template-columns: repeat(2, 1fr);
  padding-top: 0;
}

/* ---- カード ---- */

#home_material .material_library .card {
  display: block;
  color: inherit;
  text-decoration: none;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  transition: opacity .6s ease, transform .6s ease, box-shadow .25s ease;
}

/* 画面に入るまでは隠し、入ったら順にふわっと出す（js が動かないときは最初から表示） */
#home_material .material_library.is-waiting .card {
  opacity: 0;
  transform: translateY(10px);
}

#home_material .material_library.is-waiting.is-shown .card {
  opacity: 1;
  transform: translateY(0);
}

#home_material .material_library.is-shown .card:nth-child(2) { transition-delay: .08s, .08s, 0s; }
#home_material .material_library.is-shown .card:nth-child(3) { transition-delay: .16s, .16s, 0s; }
#home_material .material_library.is-shown .card:nth-child(4) { transition-delay: .24s, .24s, 0s; }

#home_material .material_library:not(.is-waiting) .card:hover,
#home_material .material_library.is-waiting.is-shown .card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  transition-delay: 0s;
}

#home_material .material_library .card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f0f0f0;
}

#home_material[data-layout="mixed"] .material_library .card img {
  aspect-ratio: 3 / 2;
}

#home_material .material_library .card-body {
  display: block;
  padding: 1em;
  font-size: 15px;
  font-size: max(13px, 0.97vw);
  line-height: 1.5;
}

#home_material .material_library .title {
  display: block;
  font-weight: bold;
  margin-bottom: 0.6em;
  overflow-wrap: anywhere;
}

#home_material .material_library .meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

#home_material .material_library .meta-label {
  font-weight: 600;
  color: #777;
  margin-right: 4px;
}

/* 原料が長いときにカード幅をはみ出さないよう、flex アイテムの最小幅を解除して折り返させる */
#home_material .material_library .meta-text {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* 色玉。色の値は /material/ の colorStyles と同じ */
#home_material .material_library .color-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #333;
}
#home_material .material_library .color-dot.-black  { background: #111; }
#home_material .material_library .color-dot.-gray   { background: #9e9e9e; }
#home_material .material_library .color-dot.-white  { background: #ffffff; border: 1px solid #333; }
#home_material .material_library .color-dot.-beige  { background: #e8d8b0; }
#home_material .material_library .color-dot.-brown  { background: #8b5a2b; }
#home_material .material_library .color-dot.-blue   { background: #4a90e2; }
#home_material .material_library .color-dot.-green  { background: #4caf50; }
#home_material .material_library .color-dot.-red    { background: #e53935; }
#home_material .material_library .color-dot.-purple { background: #9c27b0; }
#home_material .material_library .color-dot.-yellow { background: #fbc02d; }
#home_material .material_library .color-dot.-clear  { background: transparent; border: 1px solid #333; }

/* TB：4枚は窮屈なので 2枚×2段 */
@media only screen and (min-width: 481px) and (max-width: 1025px) {
  #home_material .material_library {
    grid-template-columns: repeat(2, 1fr);
  }

  #home_material .material_library .card-body {
    font-size: max(13px, 1.6vw);
  }
}

/* SP：2枚×2段。写真スライダーも mixed のときは横に2枠並べる */
@media only screen and (max-width: 481px) {
  #home_material .material_library {
    grid-template-columns: repeat(2, 1fr);
    gap: 3vw;
    width: calc(100% - 4%);
    margin: 0 2%;
    padding: 2.9vw;
  }

  #home_material[data-layout="mixed"] .material_cont {
    flex-direction: row;
  }

  #home_material[data-layout="mixed"] .material_cont_slider {
    width: 50%;
  }

  /* 上段の写真（1枠の内側余白 2.9vw × 左右）と縦の線を揃える */
  #home_material[data-layout="mixed"] .material_library {
    column-gap: 5.8vw;
    padding-top: 0;
  }

  #home_material .material_library .card {
    border-radius: 8px;
  }

  #home_material[data-layout="mixed"] .material_library .card img {
    aspect-ratio: 1 / 1;
  }

  #home_material .material_library .card-body {
    padding: 0.7em 0.75em 0.8em;
    font-size: 3.2vw;
  }

  #home_material .material_library .meta-row {
    gap: 4px;
    margin-top: 4px;
  }

  #home_material .material_library .color-dot {
    width: 12px;
    height: 12px;
  }
}
