/* stretch-contents-responsive.css
 * stretch-housouki.htm の #contents 配下のみでレスポンシブ対応（PCデザイン維持）。
 * 既存 style.css は変更せず、本CSSを後読みしてください。
 */

/* 画像は基本リキッド */
#contents img { max-width: 100%; height: auto !important; }

/* --- グリッド（3列／2列） --- */
#contents .img-grid {
  display: grid;
  gap: 12px;
  align-items: start;
  margin: 8px 0 14px;
}
#contents .img-grid figure { margin: 0; text-align: center; }
#contents .img-grid figcaption { margin-top: 4px; font-size: 13px; }

/* 3列：同一比率（縦横比は画像に依存、列数のみ可変） */
#contents .img-grid-3 { grid-template-columns: repeat(3, 1fr); }
/* タブレット */
@media (max-width: 960px) {
  #contents .img-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
/* スマホ */
@media (max-width: 639px) {
  #contents .img-grid-3 { grid-template-columns: 1fr; }
}

/* 2列：右側画像の幅に合わせて統一（右画像の見え方を基準化） */
#contents .img-grid-2 { grid-template-columns: 1fr 1fr; align-items: stretch; }
/* スマホで1列 */
@media (max-width: 639px) {
  #contents .img-grid-2 { grid-template-columns: 1fr; }
}

/* 右画像基準 */
#contents .right-image-basis figure { display: flex; flex-direction: column; }
#contents .right-image-basis figure img { width: 100%; height: auto; object-fit: contain; }

/* --- 2カラム（テキスト＋画像） --- */
#contents .two-column {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: start;
  margin: 10px 0 18px;
}
@media (max-width: 960px) {
  #contents .two-column { grid-template-columns: 1fr; }
}
#contents .two-column .col { min-width: 0; }
#contents .two-column .col-text ul { margin-left: 1.25em; }
#contents .two-column .col-text li { margin-bottom: .4em; }
#contents .two-column .col-image figure { margin: 0; text-align: center; }

/* --- 既存のテーブルベース要素をSP時は縦積みに変換（横スクロール解除） --- */
@media (max-width: 639px) {
  #contents .table_scroll,
  #contents .table-stack-on-mobile {
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
  #contents .table-stack-on-mobile table,
  #contents .table-stack-on-mobile tbody,
  #contents .table-stack-on-mobile tr,
  #contents .table-stack-on-mobile td {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
  }
  /* 余白用セルは幅調整 */
  #contents .table-stack-on-mobile td[width],
  #contents .table-stack-on-mobile td[height] {
    width: 100% !important;
    height: auto !important;
  }
}

/* --- YouTube（PCは中央寄せ、SPは全幅16:9） --- */
#contents .youtube { width: 70%; margin: 0 auto; }
#contents .youtube_wrap { position: relative; width: 100%; padding-top: 56.25%; }
#contents .youtube_wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
/* スマホは全幅 */
@media (max-width: 639px) { #contents .youtube { width: 100%; } }

/* --- 細かな余白調整 --- */
#contents h2 { margin-top: 4px; }
#contents h3 { margin-top: 8px; }

/* --- 旧インライン固定幅の打消し（SP優先） --- */
@media (max-width: 639px) {
  #contents img[width], #contents img[height] { width: 100% !important; height: auto !important; }
  #contents iframe[width], #contents iframe[height] { width: 100% !important; height: auto !important; }
}

/* --- モバイル時にカタログバナーを縮小（ロールオーバー両画像対応） --- */
@media (max-width: 639px) {
  #contents img[src$="catalog.gif"],
  #contents img[src$="catalog1.gif"] {
    width: 45vw !important;  /* 画面幅の45%に縮小 */
    height: auto !important;
    max-width: 100%;
  }
}

/* 規格表を横スクロール可能にする */
#contents .spec-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* iOS慣性スクロール */
  margin: 10px 0 18px;
}

#contents .spec-table {
  border-collapse: collapse;
  min-width: 800px; /* 横幅が狭い画面でもスクロールを発生させる */
}

#contents .spec-table th,
#contents .spec-table td {
  border: 1px solid #999;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap; /* 折り返さず横スクロール */
}

#contents .spec-table thead th {
  background: #f7f7f7;
  font-weight: bold;
}

/* 11項目の規格表：PC/モバイルとも横スクロール。枠線は常時表示。 */
#contents .spec-scroll {
  width: 100%;
  overflow-x: auto;                 /* 横スクロールを常時許可 */
  -webkit-overflow-scrolling: touch;/* iOS慣性スクロール */
  margin: 10px 0 18px;
}
#contents .spec-scroll table {
  border-collapse: collapse;
  min-width: 1600px;                /* 列が詰まらない程度の最低幅（必要に応じて調整） */
}
#contents .spec-scroll th,
#contents .spec-scroll td {
  border: 1px solid #999;           /* 枠線 */
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;               /* 折り返さず横スクロール */
}
#contents .spec-scroll thead th {
  background: #f7f7f7;
  font-weight: 600;
}
/* 「使用フィルム」列（11列目）は箇条書きのため折返しOKにして読みやすく */
#contents .spec-scroll td:nth-child(11) {
  white-space: normal;               /* 11列目だけ折返し */
}
#contents .spec-scroll td:nth-child(11) ul { margin: 0; padding-left: 1em; }
#contents .spec-scroll td:nth-child(11) li { margin: 0; }

/* 既存の“行カード化（display:block化）”が他所で定義されていても、この表には適用しない */
@media (max-width: 639px) {
  #contents .spec-scroll table,
  #contents .spec-scroll thead,
  #contents .spec-scroll tbody,
  #contents .spec-scroll tr,
  #contents .spec-scroll th,
  #contents .spec-scroll td {
    display: table;                  /* ブロック化を打ち消し */
    width: auto;
  }
}

/* 1) 包含関係で overflow が潰されないように */
@media (max-width: 639px) {
  #contents .spec-scroll {
    position: relative;
    overflow-x: auto !important;         /* 必ず横スクロール */
    overflow-y: hidden;                   /* 不要な縦スクロールは抑止 */
    max-width: 100vw;                     /* 画面幅をはみ出さない */
    -webkit-overflow-scrolling: touch;    /* iOS慣性スクロール */
  }

  /* 他所の“カード化”を確実に打ち消し（優先度強化） */
  #contents .spec-scroll table,
  #contents .spec-scroll thead,
  #contents .spec-scroll tbody,
  #contents .spec-scroll tr,
  #contents .spec-scroll th,
  #contents .spec-scroll td {
    display: table !important;            /* block化を上書き */
    width: auto !important;
    white-space: nowrap !important;       /* 基本は折返さず横に流す */
  }
  /* 11列目（使用フィルム）だけは折返し許可して読みやすく */
  #contents .spec-scroll td:nth-child(11) {
    white-space: normal !important;
  }

  /* 2) スクロールヒント（右端にグラデーション＋矢印） */
  #contents .spec-scroll::after {
    content: "横にスワイプ →";
    position: sticky;                     /* 中身の右端に張り付く */
    right: 0;
    bottom: 0;
    display: inline-block;
    padding: 6px 10px 6px 28px;
    margin-left: 8px;
    font-size: 12px;
    color: #333;
    background:
      linear-gradient(90deg, rgba(255,255,255,0) 0%, #fff 40%) ; /* 右端を白でフェード */
  }
}

/* 3) 横スクロールを促す見た目（PCでも可） */
#contents .spec-scroll {
  scrollbar-gutter: stable both-edges;    /* スクロールバーでレイアウトが揺れにくい（対応ブラウザのみ） */
}
#contents .spec-scroll table {
  min-width: 1800px;                      /* さらに広げて横スクロールを確実に発生させる（必要に応じて調整） */
}

@media (max-width: 639px) {
  #contents { overflow: visible !important; }
}

/* ===== 規格表（11項目）：PC/モバイルとも横スクロール・枠線常時表示 ===== */
#contents .spec-scroll {
  width: 100%;
  overflow-x: auto !important;           /* 常に横スクロール可 */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;     /* iOS慣性スクロール */
  margin: 10px 0 18px;
}
#contents .spec-scroll table {
  border-collapse: collapse;
  min-width: 1800px;                      /* 列が詰まらない最低幅（必要に応じて調整） */
}
#contents .spec-scroll th,
#contents .spec-scroll td {
  border: 1px solid #999;                 /* 枠線 */
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;                     /* 基本は折返さず横に流す */
}
#contents .spec-scroll thead th {
  background: #f7f7f7;
  font-weight: 600;
}
/* 使用フィルム（11列目）は可読性のため折返し許可 */
#contents .spec-scroll td:nth-child(11) {
  white-space: normal;
}
#contents .spec-scroll td:nth-child(11) ul { margin: 0; padding-left: 1em; }
#contents .spec-scroll td:nth-child(11) li { margin: 0; }

/* ▼ 他の“縦積みルール（display:block化）”をこの表では無効化（優先度強化） */
@media (max-width: 9999px) {
  #contents .spec-scroll table      { display: table !important; }
  #contents .spec-scroll thead      { display: table-header-group !important; }
  #contents .spec-scroll tbody      { display: table-row-group !important; }
  #contents .spec-scroll tr         { display: table-row !important; }
  #contents .spec-scroll th,
  #contents .spec-scroll td         { display: table-cell !important; width: auto !important; }
}

/* ▼ 親コンテナ側で overflow が潰される場合の保険（必要に応じて有効化） */
/*
@media (max-width: 639px) {
  #contents { overflow: visible !important; }
}
*/

/* 規格表を横スクロール可能にする */
#contents .spec-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* iOS慣性スクロール */
  margin: 10px 0 18px;
}

#contents .spec-table {
  border-collapse: collapse;
  min-width: 800px; /* 横幅が狭い画面でもスクロールを発生させる */
}

#contents .spec-table th,
#contents .spec-table td {
  border: 1px solid #999;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap; /* 折り返さず横スクロール */
}

#contents .spec-table thead th {
  background: #f7f7f7;
  font-weight: bold;
}

/* 見出し行のカタログバナーを文字サイズに追従させる（ロールオーバー両画像対応） */

/* タブレット以下：h2 の行高に合わせる（比率維持のため width は auto） */
@media (max-width: 1024px) {
  #contents h2 a#HPB_ROLLOVER1 img,
  #contents h2 img[src$="catalog.gif"],
  #contents h2 img[src$="catalog1.gif"] {
    height: 1.6em !important;     /* 見出し文字の約1.6倍の高さに統一（好みで1.4〜1.8em） */
    width: auto !important;        /* 比率維持 */
    vertical-align: middle;        /* 文字と上下センタリング */
  }
  /* 極端に大きくならないように上限も設定 */
  #contents h2 a#HPB_ROLLOVER1 img,
  #contents h2 img[src$="catalog.gif"],
  #contents h2 img[src$="catalog1.gif"] {
    max-height: clamp(18px, 2.2em, 36px) !important; /* 端末によって上限微調整 */
    max-width: min(32vw, 180px) !important;          /* 横幅の上限（画面幅の32%か180pxの小さい方） */
  }
}

/* スマホ幅でさらに小さめに（必要なら） */
@media (max-width: 639px) {
  #contents h2 a#HPB_ROLLOVER1 img,
  #contents h2 img[src$="catalog.gif"],
  #contents h2 img[src$="catalog1.gif"] {
    height: 1.4em !important;             /* スマホは少し低めに */
    max-height: clamp(16px, 2em, 32px) !important;
    max-width: min(40vw, 160px) !important;
  }
}

