
@media (min-width: 1716px) {
  .case-prev, .case-next { display: none; }
}

/* 背景スクロール抑止用 */
.body-no-scroll { overflow: hidden; }

@media (max-width: 1715px) {
    .caseSlides {
        min-width: 33.33%; /* 3枚表示するために33.33% */
    }
}

@media (min-width: 1001px) {
    .close-menu {
        display: none;
    }
}

@media (max-width: 1280px) {
    .navbar ul li a {
        font-size: 16px;
    }
}

@media (max-width: 1200px) {
    #webCatalogLink img {
        width: 75px;
        height: 120px;
        padding-bottom: 10px;
    }
    #webCatalogLink p {
        font-size: small;
    }
    .overlay-text {
        font-size: 24px; /* テキストのサイズを縮小 */
    }
    .news-header .brackets {
        display: none;
    }
    .read-article-btn {
        width: 75%;
    }
    .aboutjp {
        width: 75%;
        margin:auto;
        text-align: left;
    }

    header {
        justify-content: space-between; /* ロゴとハンバーガーメニューを両端に配置 */
        height: 50px !important;
    }

    header,
    header.shrink {
        padding: 10px 5px !important;  /* ← 好きな薄さに調整OK */
    }
    header .logo img {
        max-height: 30px !important;
        height: auto;
        width: auto;
        margin-left: 5px;
    }
    /* 余計なアニメでチラつくなら切る */
    header { transition: none !important; }

    .navbar ul {
        flex-direction: column; /* 縦並び表示 */
        width: 100%;
        display: none; /* 初期状態では非表示 */
    }

    .hamburger {
        display: block; /* モバイルビューでハンバーガーメニューを表示 */
        margin-right: 10px; /* 右にマージンを追加 */
    }

    .navbar.active ul {
        display: flex; /* アクティブ時にメニューを表示 */
    }

    .navbar {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%; /* または必要な幅、例えば300px */
        height: 100vh; /* 画面の高さ全体をカバー */
        background-color: #333;
        display: none; /* 初期状態では非表示 */
        flex-direction: column;
        align-items: center; /* 中央揃えでアイテムを配置 */
        justify-content: space-around; /* アイテム間に均等なスペースを配置 */
        z-index: 1000; /* 他の要素より前面に表示 */
    }

    .navbar.active {
        display: flex; /* アクティブ時にメニューを表示 */
    }

    .close-menu {
        display: block;
        color: white;
        font-size: 30px;
        position: absolute;
        top: 10px;
        right: 20px;
        cursor: pointer;
    }

    .slideshow-container {
        margin: 70px 0 0 0; /* ヘッダーの高さ分の余白を追加し、水平中央揃え */
        max-width: 100%;
    }


    /* 既存のモバイル用ルールを打ち消し */
    .footer-left,
    .footer-center,
    .footer-external-links,
    .exterior {
        padding-left: 0 !important;
        max-width: none !important;
    }

    .footer-container{
        display: grid;
        grid-template-columns: repeat(3, minmax(240px, 1fr));
        grid-auto-rows: auto;
        gap: 24px;
        align-items: start;
        padding: 0 16px;
    }

    /* 1段目：画像を全幅で1行占有 */
    .footer-container .exterior{
        grid-column: 1 / -1;   /* 全カラムをまたぐ */
        margin: 0;
    }
    /* thanks.css の img{height:100%} を上書きして重なりを防止 */
    .footer-container .exterior img{
        width: 60%;
        height: auto !important;   /* ここが重要 */
        max-height: 200px;
        display: block;
        margin: 0 auto;
    }
    .footer-container > div {
        margin: 10px ; /* 各セクションの左右パディング */
    }

    /* 2段目：3カラム */
    .footer-left,
    .footer-center,
    .footer-external-links{
        margin: 0;
        text-align: left;
    }

    .footer-center ul,
    .footer-external-links ul{
        text-align: left;
    }

    .section-title.active::after {
        width: 50%; /* ラインの幅を指定 */
        left: 25%;
    }

    #mobile-summary-bar.visible { 
        display: flex; 
    }
    /* 既存の右サイドリストは隠す */
    #estimate-blocks-list { 
        display: none !important; 
    }
}


@media (max-width: 1000px) {

  #features .features-list{
    grid-template-columns: 1fr;   /* 1カラム */
    justify-items: center;        /* 子要素を中央寄せ */
  }
  #features .features-list li{
    width: 70%;                   /* 要望どおり */
    margin: 0 auto;
  }

  .product-list .product-item{
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    gap: 12px;
  }

  /* 左右カラムの共通リセット */
  .product-item .left-content,
  .product-item .right-content{
    width: 100% !important;
    float: none !important;
    order: initial;               /* 既存の order 指定を無効化 */
    position: static !important;  /* sticky/fixed/absolute を無効化 */
    top: auto !important;
    transform: none !important;
    z-index: auto !important;
    margin: 0;                    /* 余白は gap で管理 */
    background-attachment: scroll !important; /* 背景固定の保険 */
  }

  /* 画像ははみ出さず全幅 */
  .product-item .left-content img{
    display: block;
    width: 80%;
    height: auto;
    margin: auto;
  }

  /* テキスト側の微調整（必要なら） */
  .product-item .right-content{
    margin-top: 0;
  }

  .color-circle-container{
    display: none;
  }

    .color-list{
        padding-top: 40px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

    .caseSlides {
        min-width: 50%; /* 3枚表示するために33.33% */
    }  
  
}

/* デフォ：PCではナビ内カタログは出さない（サイドバー版を使う） */

@media (max-width: 800px) {
  .caseSlides {
    min-width: 0 !important;   /* 20% を打ち消す。flexで縮められるように0に */
    flex: 0 0 100% !important;
  }
}

#nav-catalog { 
    display: none; 
}

@media (max-width: 768px) {

    #nav-catalog { 
        display: block; 
    }

    section{
        padding: 60px 0;
    }

    /* サイド固定のカタログUIはスマホでは非表示 */
    #webCatalogLink,
    #verticalCatalogLink {
        display: none !important;
    }

    .overlay-text {
        font-size: 20px; /* テキストサイズをさらに縮小 */
        line-height: 1.4; /* 行間を調整 */
        text-align: right; /* テキストを右揃え */
    }
    .overlay-text br {
        display: inline; /* <br> を表示する */
    }

    .slideshow-container {
        height: 60vh; /* 高さを固定 */
    }



    .product-item-container{
        width: 90%;
    }


    .read-article-btn {
        width: 100%;
    }
    .specification {
        flex-direction: column; /* 縦並びにする */
        align-items: center; /* 中央揃えにする */
        gap: 10px; /* 画像間のスペースを設定 */
    }

    .section-title{
        font-size: 1.4rem;
    }

    .title-rt .second { 
        display: block; 
    }

    .specification img{
        width: 200px;
        height: auto;
    }

    .spec-desc {
        width: 200px;
    }

    .slideshow-info {
        display: none !important;
    }

    .section-title.active::after {
        width: 90%; /* ラインの幅を指定 */
        left: 5%;
    }

    #features .features-list li{
        width: 80%;
    }


    .optional-example-image img{
        width: 80%;
        padding: 0 5px;
        height: auto;
    }

    #modalDetail {
        width: 90%; /* モーダルの幅を広げる */
    }
    #caption {
        width: 90%;
    }

    #caseCaption {
        width: 90%;
    }
    /*フッター*/

    .footer-container{
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .exterior{
        width: 92%;
        margin: 0;
        padding-left: 0 !important;
    }
    .exterior img{
        width: 100%;
        height: auto !important; /* グローバルの height:100% を上書き */
        display: block;
    }

    .footer-left,
    .footer-center,
    .footer-external-links{
        padding-left: 0 !important;
        width: 100%;
        text-align: left;
    }

    /* 要望どおり footer-left の本文だけ少しインデント */
    .footer-left > :not(:first-child){ padding-left: 1rem; }

    .table-wrap{
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin; /* Firefox */
    }
    .table-wrap .swipe-hint{
        position: absolute;
        right: 10px;
        bottom: 8px;
        display: none;           /* .show-swipe の時だけ表示 */
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 16px;
        font-size: 12px;
        line-height: 1;
        color: #fff;
        background: rgba(0,0,0,.55);
        pointer-events: none;
        z-index: 5;
    }
    .table-wrap.show-swipe .swipe-hint{ display: inline-flex; }
    .swipe-hint .arr{ opacity: .6; animation: arrBlink 1.2s ease-in-out infinite; }
    .swipe-hint .hand{ display:inline-block; animation: swipeX 1.2s ease-in-out infinite; }
    @keyframes swipeX{ 0%{transform:translateX(0)} 50%{transform:translateX(-8px)} 100%{transform:translateX(0)} }
    @keyframes arrBlink{ 0%,100%{opacity:.4} 50%{opacity:1} }
    @media (prefers-reduced-motion: reduce){
        .swipe-hint .arr, .swipe-hint .hand{ animation: none; }
    }
}

@media (max-width: 660px) {
    section h2 {
        font-size: 1.5rem; /* セクションタイトルのフォントサイズを小さく */
    }
    
    #features .features-list li{
        width: 70%;
    }

    .feature-title {
        font-size: 1rem; /* タイトルのフォントサイズを小さく */
    }

    .feature-icon img {
        width: 60%;
        height: auto;
    }
    .product-item h3 {
        font-size: 1.3rem; /* フォントサイズを小さく */
    }

    .left-content p{
        font-size: 0.8rem;
    }

    .icon-container img {
        width: 35px;
        height: auto;
        transition: transform .3s ease;
    }

    .product-description table {
        font-size: 0.6rem; /* フォントサイズを小さく */
    }

    .product-description p {
        font-size: 0.8rem; /* フォントサイズを小さく */
    }
    .product-description strong {
        font-size: 1rem; /* 強調テキストのフォントサイズを小さく */
    }

    .detail-image strong{
        font-size: 0.6rem;
    }

    #bona p{
        font-size: 0.8rem; /* フォントサイズを小さく */
    }

    #bona table{
        font-size: 1rem; /* フォントサイズを小さく */
    }

    .color-list{
        grid-template-columns: 1fr;
        width: 60%;
    }
    .color-list img {
        width: 80%; /* サイズを割合で指定 */
        height: auto; /* 高さは自動調整 */
    }

    .coating-table-wrap{
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .coating-table{
        width: max-content;     /* 内容幅に合わせる */
        table-layout: auto;
        font-size: 0.8rem; /* フォントサイズを小さく */
    }
    .coating-table caption{
        font-size: 0.8rem;
    }

    .coating-table thead th{
        font-size: 0.8rem;
    }

    .coating-table tbody th,
    .coating-table tbody td{
        font-size: 0.8rem;
    }
    .coating-table td.bona, .coating-table thead .col-bona{
        font-size: 0.85rem;
    }

    .radio-list label{
        font-size: 0.9rem;
    }


    .limit-note{ font-size:.9rem; }


    /* 内側（button と small が入ってる列）を横並びに変更
        ※ inlineの flex-direction:column を打ち消すので !important 付き */
    #estimate-file-area .estimate-attachment > div > div:first-child {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 12px;
        flex: 1 1 100%;
    }

    /* 他でも .radio-list を使ってるなら #sample-block などでスコープ推奨 */
    .radio-list{
        display: grid !important;
        grid-template-columns: 1fr !important;  /* ← 1カラム */
        gap: 10px;
    }
    .radio-list label{
        display: flex;               /* クリック範囲を横並びに整える */
        align-items: center;
        gap: 8px;
        width: 100%;
    }
    .radio-list input[type="radio"]{
        flex: 0 0 auto;
    }
    #image-group.product-preview{
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    /* ✅ 画像だけ隠す（JSがdisplayを付けても勝てるように!important） */
    #selected-image,
    /* 画像を包む要素があるなら一緒に */
    #image-group.product-preview img{ display:none !important; }
    #image-group.product-preview{ gap: 8px; }
    .meta-list li {
        padding: 0;
    }

    

    /* 注意書きは横書き・折り返しOKで、横幅が狭くても潰れないように */
    #estimate-file-area .estimate-attachment > div > div:first-child small {
        writing-mode: horizontal-tb;   /* 念のため横書きを強制 */
        white-space: normal;           /* 折り返し可 */
        overflow-wrap: anywhere;       /* 英数字や記号も折り返せる */
        line-height: 1.4;
        margin: 0;                     /* 上の margin-top を打ち消し */
        flex: 1 1 auto;                /* 余り幅を使って自然に折り返す */
        min-width: 0;                  /* Flex 収まり改善 */
    }

    /* ボタンと少し間隔 */
    #estimate-file-area #estimate-add-btn {
        flex: 0 0 auto;
    }

    /* プレビューは下段フル幅 */
    #estimate-preview {
        flex: 1 1 100%;
        margin-top: 4px;
    }
    
}

/* 既存はそのまま。スマホだけ切り替え */
@media (max-width: 480px){
  .sample-img{
    display: grid;                 /* 2カラムのグリッドに */
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .sample-img > div{
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .sample-img img{
    width: 100%;                   /* セル幅いっぱい */
    max-width: 160px;              /* 少し小さめに（お好みで調整） */
    height: auto;
    display: block;
  }
  .sample-img p{
    margin-top: 6px;
    margin-bottom: 0;
    font-size: 0.65rem;               /* 文字も少しだけ小さく */
    text-align: center;

  }
    label:has(> input[name="specification_sample"]) br,
    label:has(> input[name="coating_sample"]) br{
        display:inline;  /* ← <br> を効かせる */
    }


    .meta-list li {
        font-size: 0.7rem; /* フォントサイズを小さく */
    }

    .meta-list li strong {
        font-weight: 600;
        font-size: 0.7rem; /* 強調テキストのフォントサイズを小さく */
    }

    .preview-meta h4 {
        font-size: 0.8rem; /* フォントサイズを小さく */
    }
}


/* 添付ファイル行のはみ出し対策（スマホ対応） */
#estimate-file-area { width: 100%; }

#estimate-file-area .estimate-attachment > div {
  /* ここが「＋ファイル追加」列 + プレビュー列の横並び */
  display: flex;          /* 既に inline で指定されててもOK（上書き） */
  flex-wrap: wrap;        /* 狭いときは下に折り返す！ */
  gap: 12px 16px;
  width: 100%;
  box-sizing: border-box;
}

/* 右側：プレビューリスト */
#estimate-preview {
  flex: 1 1 320px;        /* 余った分で伸びる/縮む */
  min-width: 0;           /* ← これが超重要：はみ出し防止 */
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;       /* 念のため */
}

/* プレビュー1件の並び */
#estimate-preview .preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;        /* ボタンが収まらない時は折り返し */
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.05); /* お好みで */
}

/* ファイル名：はみ出さず省略表示 */
#estimate-preview .preview-name {
  flex: 1 1 auto;
  min-width: 0;           /* ← これも超重要 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 変更/削除ボタンの並び */
#estimate-preview .preview-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
#estimate-preview .preview-btn { flex: 0 0 auto; }


/* ── 送信完了ページのスタイル ── */
/* 768px以下のスマホ想定 */
@media (max-width: 768px) {
    .thanks-header h1 {
        font-size: 1.5em; /* ヘッダーのフォントサイズを小さく */
        text-align: center; /* 中央揃え */
    }

    .related-products h2{
        font-size: 1.35em;
    }

    .thanks-header{
        padding-top: 64px;
        padding-bottom: 80px;
    }

    .btn-group a{
        width: 90%;
        max-width: 480px;
    }

    .related-products{
        padding: 16px 12px 80px;
    }

    /* ← ここが重要：コンテナの幅と並びを上書き */
    .related-item{
        display: flex;
        flex-direction: column;   /* 縦積み */
        align-items: stretch;     /* 子を全幅に */
        gap: 12px;
        width: 100%;              /* 960px を打ち消す */
        max-width: none;          /* 念のため */
        margin: 0;                /* 親にパディングあるので中央寄せ不要 */
    }

    .related-item p {
        font-size: 0.75em;         /* フォントサイズを小さく */
    }
    /* グローバル img{height:100%} を上書き */
    .related-item img{
        order: 1;
        width: 100%;
        height: auto;             /* ここで縦横比維持 */
        max-height: 260px;        /* 任意 */
        object-fit: cover;
        display: block;
    }

    .related-item .related-info{
        order: 2;
        padding-top: 12px;
    }

    .site-link{
        font-size: 1.4em;
        margin-bottom: 12px;
    }

    .desc{
        font-size: 0.95em;
    }

}

