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


@media (max-width: 1715px) {
    .species-images {
        width: 60%;
        margin: 0 auto; /* 中央揃え */
    }
    .caseSlides {
        min-width: 33.33%; /* 3枚表示するために33.33% */
    }
}

@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 {
        color: white;
        font-size: 30px;
        position: absolute;
        top: 10px;
        right: 20px;
        cursor: pointer;
    }

    .slideshow-container {
        margin-top: 70px; /* ヘッダーの高さ分のマージンを追加 */
    }

    /* 既存のモバイル用ルールを打ち消し */
    .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,
    #sample-blocks-list { 
        display: none !important; 
    }
}

/* ===== モバイル用サマリー（#contact 内でスクロール追従） ===== */
#mobile-summary-bar {
  position: sticky;          /* セクション内で追従 */
  top: 60px;                 /* ヘッダーに被らないよう余白 */
  margin-left: 12px;         /* 左に少し寄せる */
  width: fit-content;
  display: none;             /* 初期は非表示（JSで .visible 付与） */
  gap: 8px;
  z-index: 1100;
}

#mobile-summary-bar .pill {
  display: inline-flex; 
  align-items: center; 
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0,0,0,.7);
  color: #fff; 
  border: 0; 
  border-radius: 999px;
  font-size: 14px; 
  line-height: 1; 
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

#mobile-summary-bar .pill .count-badge {
  min-width: 1.8em; 
  padding: 3px 6px; 
  text-align: center;
  background: #ffcc00; 
  color: #222; 
  border-radius: 999px; 
  font-weight: 700;
}

/* ===== モーダル ===== */
#blocks-modal {
  position: fixed; 
  inset: 0; 
  display: none;
  align-items: center; 
  justify-content: center;
  background: rgba(0,0,0,.45); z-index: 1200;
  color: #333;
}

#blocks-modal.open { 
    display: flex; 
}

#blocks-modal .modal-dialog {
  position: relative;
  width: min(92vw, 720px);
  max-height: 80vh; 
  overflow: auto;
  background: #fff; 
  border-radius: 14px; 
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}

#blocks-modal .modal-close {
  position: absolute; 
  top: 10px; 
  right: 12px;
  font-size: 26px; 
  background: transparent; 
  border: none; 
  cursor: pointer;
  color: #333;
}

#blocks-modal h4 { 
    margin: 0 0 10px; 
    font-size: 18px; 
}

/* モバイル用モーダルの中のカード */
#blocks-modal .modal-card{
  background:#fff;
  border-radius:12px;
  margin:16px 0;
  padding:16px;
  box-shadow:0 1px 6px rgba(0,0,0,.08);
}

#blocks-modal .modal-card__title{
  background:#555;
  color:#fff;
  font-weight:700;
  margin:-16px -16px 12px;
  padding:10px 12px;
  border-radius:12px 12px 0 0;
}

#blocks-modal .modal-dl{
    display:grid;
    grid-template-columns:8em 1fr;
    row-gap:.4rem;
    column-gap:1rem;
}

#blocks-modal .modal-dl dt{
    color:#666;
}

#blocks-modal .modal-ctrls{
    display:flex;
    gap:8px;
    justify-content:flex-end;
    margin-top:12px;
}

#blocks-modal .modal-ctrls .modal-edit,
#blocks-modal .modal-ctrls .modal-del{
  border:1px solid #999;
  background:#f7f7f7;
  border-radius:6px;
  padding:6px 10px;
  cursor:pointer;
}

#blocks-modal .modal-ctrls .modal-del{
    border-color:#b00020;
    color:#b00020;
    background:#fff;
}

.modal-block {
  background: #fafafa; 
  border: 1px solid #eee; 
  border-radius: 10px;
  padding: 12px; 
  margin: 10px 0;
}

.modal-block dl { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 4px 10px; 
}

.modal-block dt { 
    font-weight: 700; 
    width: 7em; 
}

.modal-block dd { 
    margin: 0; 
}

@media (max-width: 1140px) {
    .species-images {
        width: 80%;
        margin: 0 auto; /* 中央揃え */
    }
}


@media (max-width: 1000px) {




    .example-image {
        max-width: 300px;
        display: flex;
    }

    .optional-example-image{
        display: flex;
        justify-content: center;
        max-width: 250px;
        height: 200px;
        margin: 0 auto 50px auto;
    }

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

/* デフォ：PCではナビ内カタログは出さない（サイドバー版を使う） */
.nav-catalog { 
    display: none; 
}

@media (max-width: 768px) {

    .nav-catalog { 
        display: block; 
    }

    
    .design-modal-content {
        width: 100%;
    }

    .design-modal .product-card h3 {
        width: 100%;
    }

    /* サイド固定のカタログ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; /* 高さを固定 */
        max-width: 100%;
    }


    .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;
    }
    .product-card{
        width: 80%;
        height: auto;
        margin: 0 auto;
    }
    .product-card img{
        width: 80%;
        height: auto;
    }
    .product-card[data-target="straight"] picture img,
    .product-card[data-target="slant"]   picture img,
    .product-card[data-target="rough-tone"] picture img{
    height: auto;
    }
    .design-modal__dialog{ padding: 16px; }
    .design-open-btn{ width: fit-content; }
    .species-card h3{
        font-size: 1.5rem;
    }

    .spec-desc {
        width: 200px;
    }

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

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

    #backToTopBtn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        line-height: 56px;
    }

    .arrow-icon {
        width: 16px;
        height: 16px;
        margin-bottom: 20px;
    }

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

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

    #caseCaption {
        width: 90%;
    }

    .coating-note{ flex-direction:column; }
    .coating-note__img{
        height:auto;
        width:100%;
        margin: 0 auto;
        max-width:360px;       /* 大きくなりすぎ防止（任意） */
    }


    /*フッター*/

    .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; }
}

@media (max-width: 660px) {
    
    .species-images {
        width: 100%;
        margin: 0 auto; /* 中央揃え */
    }

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

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

    /* 外側：プレビューを次の行へ回すため wrap */
    #estimate-file-area .estimate-attachment > div {
        display: flex;          /* 念のため */
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
    }

    /* 内側（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%;
    }

    /* 注意書きは横書き・折り返し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;
    }
    .notice-text {
        text-align: left;   /* 660px以下は左寄せ */
        font-size: 12px;    /* 文字を少し小さく */
    } 
}

/* 添付ファイル行のはみ出し対策（スマホ対応） */
#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; }


/* まずPCではセレクトを非表示 */
#species-sample-select { display:none; }

/* 480px以下で：ラジオを隠してセレクトを出す */
@media (max-width: 480px) {
  #species-checkbox-list { display:none; }
  #species-sample-select { display:block; width:100%; }
    .footer-container .exterior img {
        width: 90%;
        height: auto !important; /* グローバルの height:100% を上書き */
        display: block;
    }  
}


/* スマホ用の「thanks」ページのスタイル */
/* 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;
  }
}
