@charset "UTF-8";

/* ========================================================================== */
/* SUB_PAGE_HEADER */
/* ========================================================================== */
.sub_page_header { background-image: url("../images/products/sub_header_bg_custom.jpg"); }


/* ========================================================================== */
/* LINEUP_INNER / FLEX */
/* ========================================================================== */
.lineup_inner {
   max-width: 1340px;
   width: calc(100% - 80px);
   margin: 0 auto;
}

.lineup_flex {
   display: flex;
   align-items: flex-end;
   gap: 60px;
   margin-bottom: 50px;
}

.lineup_flex .lead {
   font-size: 16px;
   line-height: 2.1;
}

/* ========================================================================== */
/* CUSTOM PICS GRID (画像変則グリッドエリア - PC 769px以上) */
/* ========================================================================== */
@media screen and (min-width: 769px) {
   /* 【最重要】グリッドの親を「コンテナ（横幅の絶対基準）」として認識させます */
   .lineup_inner {
      container-type: inline-size;
   }

   .custom_pics_grid {
      display: grid;
      /* 横方向を均等に6分割（2マス分＝横幅414px） */
      grid-template-columns: repeat(6, 1fr);
      
      /* 【修正】figure全体の高さを揃える命令を完全に解除（auto）し、
         縦の gap（50px）を段ごとに正しく発生させます */
      grid-template-rows: repeat(3, auto);
      
      gap: 50px 49px; /* 縦の隙間50px、横の隙間49px */
      
      /* 【最重要】figureの高さを揃える stretch を完全にやめ、上揃え（start）にします。
         これで文字の高さのせいで画像枠の高さが歪むバグを100%遮断します。 */
      align-items: start;
   }

   .custom_pics_grid figure {
      margin: 0;
      display: flex;
      flex-direction: column;
      /* 他ページからの figure への比率や高さ・固定幅の干渉をすべて強制解除します */
      aspect-ratio: unset !important;
      height: auto !important;
      width: 100% !important;
   }

   /* -----------------------------------------------------------------
      【最重要】画像枠（.img_wrapper）のサイズ自給自足ルール
      文字（figcaption）に引っ張られないよう、画像枠単体で完璧な高さを削り出します。
      全体の最大幅（1340px）のときは、正確に【縦414px】になり、
      ウィンドウ幅を縮めたときには、横幅の縮小と1ミリの狂いもなく連動します。
      ----------------------------------------------------------------- */
   .custom_pics_grid figure .img_wrapper {
      position: relative; /* 中の img を絶対配置するために必要 */
      width: 100%;
      overflow: hidden;
      background-color: #EEE;
      flex-grow: 0; /* 親に引っ張られて伸びるのを禁止 */
   }

   /* ① 横幅に2枠分使う標準アイテム（正方形グループ）
      自分自身の横幅と100%同じ高さを常に保ちます。
      これにより、1340pxのときは【縦414px×横414px】の完全な正方形になり、
      画面を縮めても完璧な正方形の比率のまま右端にくっつかずに滑らかに自動縮小します。 */
   .grid_item_top_right .img_wrapper,
   .grid_item_bottom_left .img_wrapper,
   .custom_pics_grid figure:not(.grid_item_top_left):not(.grid_item_top_right):not(.grid_item_bottom_left):not(.grid_item_bottom_right) .img_wrapper {
      /* 横隙間 49px を引いて3等分する「正方形の1辺（1340pxのときは414px）」を強制適用 */
      height: calc((100cqw - 49px * 2) / 3) !important;
   }

   /* ② 横幅に4枠分使う大きな横長アイテム（長方形グループ）
      横幅の自動縮小に追随しながら、高さだけを隣の正方形の高さに完璧に一致させるため、
      同じ『正方形の1辺（1340pxのときは414px）』を縦の高さとして強制指定します。
      これで、中に画像がない状態でも、隣の正方形と画像枠の上端・下端がミリ単位で完全にフラットに揃います。 */
   .grid_item_top_left .img_wrapper,
   .grid_item_bottom_right .img_wrapper {
      height: calc((100cqw - 49px * 2) / 3) !important;
   }

   /* 空っぽの img タグが、altの文字数（32px）で枠を押し潰さないように絶対配置でフィットさせます */
   .custom_pics_grid figure .img_wrapper img {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
   }
   
   /* 製品名テキスト：画像枠の下に配置され、何行になっても画像枠（414px）を歪ませません */
   .custom_pics_grid figcaption {
      margin-top: 10px;
      font-size: 15px;
      line-height: 1.4;
      flex-shrink: 0;
      position: relative !important;
      top: unset !important;
      bottom: unset !important;
   }

   /* -----------------------------------------------------------------
      各個別アイテムの配置（横幅の枠数のみを指定。固定幅pxはすべて撤廃）
      ----------------------------------------------------------------- */
   .grid_item_top_left { grid-column: span 4; }
   .grid_item_top_right { grid-column: span 2; }
   .custom_pics_grid figure:not(.grid_item_top_left):not(.grid_item_top_right):not(.grid_item_bottom_left):not(.grid_item_bottom_right) { grid-column: span 2; }
   .grid_item_bottom_left { grid-column: span 2; }
   .grid_item_bottom_right { grid-column: span 4; }
}

/* ========================================================================== */
/* RESPONSIVE (レスポンシブ対応) */
/* ========================================================================== */

/* -------------------------------------------------------------
   【タブレットサイズ（1024px以下〜769px）】
   ------------------------------------------------------------- */
@media screen and (max-width: 1024px) {
   .lineup_inner {
      width: 100%;
      padding: 0 20px;
   }
   .lineup_flex {
      flex-direction: column;
      align-items: flex-start;
      gap: 15px;
      margin-bottom: 40px;
   }
   .lineup_flex .lead br {
      display: none;
   }
   /* 【リファイン】タブレットサイズでもPCの変則グリッドを維持しつつ、
      横の隙間（gap）が広すぎて窮屈になるのを防ぐため、30pxにタイト化させて美しさを保ちます */
   @media screen and (min-width: 769px) {
      .custom_pics_grid {
         gap: 40px 30px;
         grid-template-rows: repeat(3, calc((100cqw - 30px * 2) / 3));
      }
   }
}

/* -------------------------------------------------------------
   【スマートフォンサイズ（768px以下）】
   ------------------------------------------------------------- */
@media screen and (max-width: 768px) {
   .lineup_inner {
      padding: 0 15px;
   }
   .lineup_flex {
      margin-bottom: 30px;
   }
   .section_title {
      display: block;
      width: 100%;
   }
   .section_title .en {
      display: block;
      width: 100%;
      box-sizing: border-box;
   }
   .lineup_flex .lead {
      font-size: 14px;
      line-height: 1.6;
   }

   /* スマホでは変則グリッドを解除し、綺麗に「2列の正方形」に統一して見やすさを担保 */
   .custom_pics_grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-template-rows: auto; /* スマホでは縦縛りを解除 */
      gap: 30px 15px;
   }
   
   .custom_pics_grid figure {
      grid-column: span 1 !important; /* すべて均等に1マスの幅にする */
      margin: 0;
   }

   .custom_pics_grid figure .img_wrapper {
      width: 100%;
      aspect-ratio: 1 / 1 !important; /* スマホでは全てをスクエア型にしてすっきり見せる */
      overflow: hidden;
   }

   .custom_pics_grid figure img {
      width: 100%;
      height: 100%;
      object-fit: cover;
   }

   .custom_pics_grid figcaption {
      margin-top: 8px;
      font-size: 13px;
      line-height: 1.4;
   }
}

/* 576px以下の極小スマホでは1列にして文字潰れを防ぐ */
@media screen and (max-width: 576px) {
   .custom_pics_grid {
      grid-template-columns: 1fr;
      gap: 25px;
   }
   .custom_pics_grid figure .img_wrapper {
      aspect-ratio: 16 / 10 !important; /* 縦並びの時は少し横長の方が見栄えが良くなります */
   }
}
