/* tejime-responsive-v6.css
 * tejime.htm 専用 第4版。
 * 共通 style.css は変更せず、PCの基本レイアウトを維持。
 * スマートフォンでは商品写真と説明を上下配置し、写真の視認性と説明文の読みやすさを両立します。
 */

#page-tejime #sealer,
#page-tejime #double-tightener,
#page-tejime #single-tightener,
#page-tejime #push-tightener,
#page-tejime #wind-tightener,
#page-tejime #combination-tool {
  scroll-margin-top: 12px;
}

#page-tejime .tejime-intro-text { line-height: 1.65; }

#page-tejime .tejime-note {
  margin: 6px 0 10px;
  padding: 7px 9px;
  border-left: 4px solid #4169e1;
  background: #f4f8ff;
  line-height: 1.55;
}

#page-tejime .tejime-jump-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
  padding: 8px;
  border: 1px solid #c8c8c8;
  background: #f8f8f8;
}

#page-tejime .tejime-jump-nav a {
  display: inline-block;
  padding: 5px 9px;
  color: #11319d;
  font-weight: bold;
  text-decoration: none;
  border: 1px solid #9aa7cf;
  background: #fff;
}

#page-tejime .tejime-jump-nav a:hover,
#page-tejime .tejime-jump-nav a:focus {
  color: #d00;
  background: #fffbd2;
}

/* ===== PC商品表 =====
 * 写真列・資料列の余白を詰め、説明欄を広く取る。
 */
#page-tejime .product_table {
  width: 100%;
  table-layout: fixed;
}

#page-tejime .product_table th,
#page-tejime .product_table td {
  box-sizing: border-box;
}

#page-tejime .product_table tbody th {
  width: 120px;
  padding-left: 7px;
  padding-right: 7px;
}

#page-tejime .product_table tbody td:nth-of-type(1) {
  width: 180px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

#page-tejime .product_table tbody td:nth-of-type(1) img {
  max-width: 171px;
  height: auto;
}

#page-tejime .product_table tbody td:nth-of-type(2) {
  width: auto;
  line-height: 1.55;
  overflow-wrap: break-word;
}

#page-tejime .product_table tbody td:nth-of-type(3) {
  width: 100px;
  padding-left: 5px;
  padding-right: 5px;
  text-align: center;
}

#page-tejime .product_table a img { transition: opacity .15s ease; }
#page-tejime .product_table a:hover img { opacity: .82; }

/* YouTube */
#page-tejime .youtube iframe { border: 0; }
#page-tejime .youtube-caption {
  margin: 5px 0 0;
  font-weight: bold;
  text-align: center;
}
#page-tejime .youtube-fallback {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
#page-tejime .youtube-fallback a { font-weight: bold; }

/* ================================
 * スマートフォン
 * ================================ */
@media only screen and (max-width: 639px) {
  #page-tejime #container {
    width: 100%;
    margin: 0;
    padding: 3px;
  }

  #page-tejime #contents { overflow: visible; }

  #page-tejime #contents h2 {
    font-size: 17px;
    line-height: 1.35;
  }

  #page-tejime #contents h3,
  #page-tejime #contents h4 {
    line-height: 1.45;
    padding: 5px 6px;
  }

  #page-tejime #contents h3 .text_small,
  #page-tejime #contents h4 .text_small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    font-weight: normal;
  }

  #page-tejime .tejime-jump-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
  }

  #page-tejime .tejime-jump-nav a {
    padding: 8px 4px;
    text-align: center;
  }

  /* 冒頭 */
  #page-tejime #contents > .box_float:first-of-type .box_left { text-align: center; }
  #page-tejime #contents > .box_float:first-of-type .box_left img {
    width: auto;
    max-width: 70%;
    margin: 0 auto 8px;
  }

  /* 商品表：1商品を「機種名 → 写真 → 説明 → 資料」の順に縦配置 */
  #page-tejime .table_scroll {
    width: 100%;
    overflow: visible !important;
  }

  #page-tejime .product_table,
  #page-tejime .product_table tbody {
    display: block;
    width: 100% !important;
    border: 0;
    background: transparent;
  }

  #page-tejime .product_table tr {
    display: flex;
    flex-direction: column;
    width: 100% !important;
    margin: 0 0 13px;
    border: 1px solid #888;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
  }

  #page-tejime .product_table tbody th {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    padding: 6px 8px;
    white-space: normal !important;
    border: 0;
    border-bottom: 1px solid #999;
    line-height: 1.4;
  }

  #page-tejime .product_table tbody td {
    display: block;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    white-space: normal !important;
    border: 0;
    line-height: 1.5;
  }

  /* 写真欄：横幅を十分に使い、縦に伸び過ぎない寸法で統一 */
  #page-tejime .product_table tbody td:nth-of-type(1) {
    width: 100% !important;
    max-width: none !important;
    padding: 8px 8px 7px;
    text-align: center;
    border-right: 0;
    border-bottom: 1px solid #e2e2e2;
    background: #fff;
    overflow: visible;
  }

  #page-tejime .product_table tbody td:nth-of-type(1) img {
    display: block;
    width: min(56vw, 200px) !important;
    height: 125px !important;
    max-width: 200px !important;
    max-height: 125px !important;
    margin: 0 auto 4px;
    object-fit: contain;
  }

  /* 説明欄：写真の下で画面幅をすべて使用 */
  #page-tejime .product_table tbody td:nth-of-type(2) {
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px 9px 9px;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  #page-tejime .product_table tbody td:nth-of-type(2) p,
  #page-tejime .product_table tbody td:nth-of-type(2) ul,
  #page-tejime .product_table tbody td:nth-of-type(2) li,
  #page-tejime .product_table tbody td:nth-of-type(2) span {
    max-width: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  #page-tejime .product_table .list_disc li {
    padding-left: 1em;
    text-indent: -.6em;
    margin-bottom: 4px;
  }

  /* カタログ・動画欄 */
  #page-tejime .product_table tbody td:nth-of-type(3) {
    width: 100% !important;
    padding: 7px;
    text-align: center;
    border-top: 1px solid #ddd;
    background: #fafafa;
  }

  #page-tejime .product_table tbody td:nth-of-type(3):empty { display: none; }

  #page-tejime .product_table tbody td:nth-of-type(3) img[src$="catalog.gif"],
  #page-tejime .product_table tbody td:nth-of-type(3) img[src$="douga.gif"] {
    width: auto !important;
    height: auto !important;
    max-width: 135px !important;
  }

  /* YouTube：スマホでは埋め込みを表示せず、軽量な外部再生ボタンにする */
  #page-tejime .youtubelist {
    width: 100%;
    margin: 8px 0 12px !important;
  }

  #page-tejime .youtubelist .box_inner {
    width: 100% !important;
    margin: 0 0 7px !important;
    padding: 0 !important;
  }

  #page-tejime .youtube {
    width: 100%;
    margin: 0;
    padding: 8px 9px;
    border: 1px solid #d5d5d5;
    background: #fafafa;
  }

  #page-tejime .youtube_wrap {
    display: none !important;
  }

  #page-tejime .youtube-caption {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.4;
    text-align: center;
  }

  #page-tejime .youtube-fallback {
    margin: 0;
    text-align: center;
  }

  #page-tejime .youtube-fallback a {
    display: inline-block;
    min-width: 180px;
    padding: 8px 14px;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    border: 1px solid #204db7;
    border-radius: 3px;
    background: #315ecb;
  }

  #page-tejime .youtube-fallback a::before {
    content: "▶ ";
  }
}

/* 320px級では写真を少しだけ縮小し、余白を確保 */
@media only screen and (max-width: 359px) {
  #page-tejime .product_table tbody td:nth-of-type(1) img {
    width: min(58vw, 175px) !important;
    height: 112px !important;
    max-width: 175px !important;
    max-height: 112px !important;
  }

  #page-tejime .product_table tbody td:nth-of-type(2) {
    padding-left: 7px;
    padding-right: 7px;
  }
}

/* ================================================================
 * v4: スマートフォン操作ボタンの最適化
 * カタログと動画が両方ある場合は左右配置にし、縦スクロール量を抑える。
 * タップ領域は画像そのものより大きく取り、操作性を維持する。
 * ================================================================ */
@media only screen and (max-width: 639px) {
  #page-tejime .product_table tbody td:nth-of-type(3) {
    padding: 6px 8px 5px;
  }

  #page-tejime .product-action-buttons {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0 auto;
  }

  #page-tejime .product-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    min-height: 44px;
    padding: 3px 9px;
    box-sizing: border-box;
    border: 1px solid #d2d2d2;
    border-radius: 4px;
    background: #fff;
    text-decoration: none;
    touch-action: manipulation;
  }

  #page-tejime .product-action-buttons.has-two-actions .product-action {
    flex: 1 1 0;
    max-width: 145px;
  }

  #page-tejime .product-action img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 92px !important;
    max-height: 38px !important;
    margin: 0 !important;
  }

  #page-tejime .video-sound-note {
    margin: 3px 0 0;
    font-size: 10px;
    line-height: 1.25;
    color: #555;
    text-align: center;
  }

  /* スマホ用YouTubeリンクは題名をボタン内に含め、captionとの重複をなくす */
  #page-tejime .youtubelist .youtube-caption {
    display: none;
  }

  #page-tejime .youtube-fallback a {
    box-sizing: border-box;
    width: min(100%, 260px);
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
  }

  /* 商品カード間の余白を少しだけ詰める。読みやすさは維持。 */
  #page-tejime .product_table tr {
    margin-bottom: 11px;
  }
}

@media only screen and (max-width: 359px) {
  #page-tejime .product-action {
    min-width: 0;
    padding-left: 5px;
    padding-right: 5px;
  }

  #page-tejime .product-action-buttons {
    gap: 6px;
  }
}


/* ================================================================
 * v5: スマートフォンの商品写真領域の余白最適化
 * v3/v4では写真の表示箱を125px固定としていたため、封緘機のような
 * 横長画像で上下に不要な空白が生じていた。画像の縦横比に応じて
 * 実寸表示領域を変え、写真直下から説明が始まるようにする。
 * PC表示には影響しない。
 * ================================================================ */
@media only screen and (max-width: 639px) {
  /* 写真セル自体の上下余白も少し詰める */
  #page-tejime .product_table tbody td:nth-of-type(1) {
    padding: 7px 8px 3px;
  }

  /* v3/v4の固定高さを解除。共通設定は自然な縦横比を維持 */
  #page-tejime .product_table tbody td:nth-of-type(1) img {
    height: auto !important;
    max-height: none !important;
    margin: 0 auto 2px;
    object-fit: contain;
  }

  /* 封緘機など横長写真：横幅を広く使い、画像のすぐ下に説明を置く */
  #page-tejime .product_table tbody td:nth-of-type(1) img.tejime-photo-wide {
    width: min(72vw, 220px) !important;
    max-width: 220px !important;
    height: auto !important;
  }

  /* 標準比率：大きさを確保しつつ縦スクロールを増やしすぎない */
  #page-tejime .product_table tbody td:nth-of-type(1) img.tejime-photo-standard {
    width: min(54vw, 172px) !important;
    max-width: 172px !important;
    height: auto !important;
  }

  /* 縦長写真：高さ基準で表示し、過度に縦長にならないようにする */
  #page-tejime .product_table tbody td:nth-of-type(1) img.tejime-photo-tall {
    width: auto !important;
    height: min(42vw, 150px) !important;
    max-width: min(54vw, 172px) !important;
    max-height: 150px !important;
  }

  /* 写真の直後から説明が始まるよう説明欄上余白も少し縮小 */
  #page-tejime .product_table tbody td:nth-of-type(2) {
    padding-top: 5px;
  }
}

@media only screen and (max-width: 359px) {
  #page-tejime .product_table tbody td:nth-of-type(1) img.tejime-photo-wide {
    width: min(76vw, 205px) !important;
    max-width: 205px !important;
  }

  #page-tejime .product_table tbody td:nth-of-type(1) img.tejime-photo-standard {
    width: min(55vw, 158px) !important;
    max-width: 158px !important;
  }

  #page-tejime .product_table tbody td:nth-of-type(1) img.tejime-photo-tall {
    height: min(44vw, 142px) !important;
    max-height: 142px !important;
  }
}


/* ================================================================
 * v6: SEO / 可読性 / 問い合わせ導線の最終調整
 * PCの基本商品表レイアウトは変更しない。
 * ================================================================ */

/* 現在ページをナビ上でわかりやすく */
#gnav a[aria-current="page"] {
  color: #c00;
  background: #ffff99;
}

/* 選び方の目安：既存説明を短く整理した補助ブロック */
#contents .tejime-selection-guide {
  margin: 10px 0 12px;
  padding: 8px 10px;
  border: 1px solid #9bb7d8;
  background: #f7fbff;
}
#contents .tejime-selection-guide h3 {
  margin: -8px -10px 8px;
  padding: 4px 8px;
  font-size: 15px;
}
#contents .selection-guide-items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
#contents .selection-guide-items p {
  margin: 0;
  padding: 6px;
  border: 1px solid #cbd8e6;
  background: #fff;
  line-height: 1.45;
}
#contents .selection-guide-items strong {
  display: block;
  margin-bottom: 2px;
  color: #003399;
}
#contents .selection-guide-items span {
  display: block;
}
#contents .selection-seal-note {
  margin: 7px 0 0;
  padding-top: 6px;
  border-top: 1px dotted #9bb7d8;
  line-height: 1.5;
}

/* 見出しに混在していた補足文を分離 */
#contents .section-help {
  margin: 2px 3px 7px;
  line-height: 1.5;
}
#contents .section-help-link a {
  font-weight: bold;
}

/* 選定相談：押し付け感を抑えたコンパクトCTA */
#contents .tejime-consultation {
  margin: 7px 0 10px;
  padding: 7px 9px;
  border: 1px solid #d9a3d8;
  background: #fff1ff;
  line-height: 1.5;
}
#contents .consultation-btn {
  display: inline-block;
  margin-left: 8px;
  padding: 5px 10px;
  color: #fff;
  font-weight: bold;
  text-decoration: none;
  border: 1px solid #2449aa;
  background: #315fd1;
}
#contents .consultation-btn:hover {
  color: #fff;
  background: #2449aa;
}

/* 販売終了・廃番表示 */
#contents .product-status {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: bold;
  line-height: 1.35;
  border-radius: 2px;
}
#contents .product-status-ended {
  color: #a40000 !important;
  border: 1px solid #d58b8b;
  background: #fff1f1;
}
footer .page-maintenance-note {
  font-size: 11px;
  color: #555;
}

@media only screen and (max-width: 639px) {
  #contents .tejime-selection-guide {
    margin: 8px 0 10px;
    padding: 6px;
  }
  #contents .tejime-selection-guide h3 {
    margin: -6px -6px 6px;
    font-size: 14px;
  }
  #contents .selection-guide-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  #contents .selection-guide-items p {
    padding: 5px;
    font-size: 12px;
  }
  #contents .selection-seal-note {
    font-size: 12px;
  }
  #contents .section-help {
    margin: 2px 3px 5px;
    font-size: 12px;
  }
  #contents .tejime-consultation {
    padding: 6px;
    font-size: 12px;
  }
  #contents .consultation-btn {
    display: block;
    margin: 6px 0 0;
    padding: 8px 6px;
    text-align: center;
    font-size: 13px;
  }
  #contents .product-status {
    margin-top: 3px;
  }
}
