/*
 Theme Name: GENSEN Child
 Description: Child theme for TCD GENSEN. Adds CPT "property", taxonomy "deal", auto templates, badges & search boxes, loan simulator, map embed, and ACF test tools.
 Template: gensen_tcd050
 Version: 1.6.0
*/

/* 共通：2列表示テーブル */
.sale-detail-table.two-col-table,
.rent-detail-table.two-col-table {
  width:100%;
  border-collapse:collapse;
  margin-top:16px;
  border:1px solid #ddd;
}

.sale-detail-table.two-col-table th,
.sale-detail-table.two-col-table td,
.rent-detail-table.two-col-table th,
.rent-detail-table.two-col-table td {
  border:1px solid #ddd;
  padding:8px 10px;
  font-size:14px;
  vertical-align:top;
}

.sale-detail-table.two-col-table th,
.rent-detail-table.two-col-table th {
  background:#f7f7f7;
  width:120px;
  white-space:nowrap;
  font-weight:600;
}

.sale-detail-table.two-col-table {
  width:100%;
  border-collapse:collapse;
  margin-top:16px;
  border:1px solid #ddd;
}

.sale-detail-table.two-col-table th,
.sale-detail-table.two-col-table td {
  border:1px solid #ddd;
  padding:8px 10px;
  font-size:14px;
}

.sale-detail-table.two-col-table th {
  background:#f7f7f7;
  width:120px;
  white-space:nowrap;
  font-weight:600;
}

/* ========== 物件詳細：横3カラムグリッド ========== */
.sale-detail-facts .facts-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px 16px;
}

.sale-detail-facts .fact-item{
  display:flex;
  flex-direction:column;
  background:#fff;
  border:1px solid #e5e5e5;
  border-radius:6px;
  padding:12px 14px;
  min-height:64px;
}

.sale-detail-facts .fact-title{
  font-size:12px;
  line-height:1.2;
  color:#666;
  font-weight:600;
  margin-bottom:6px;
}

.sale-detail-facts .fact-data{
  font-size:14px;
  line-height:1.6;
  color:#111;
  word-break:break-word;
}

/* 住所や備考など横幅を取りやすい項目 */
.sale-detail-facts .fact-item--wide{
  grid-column:1/-1;
}
@media (min-width:640px){
  .sale-detail-facts .facts-grid{
    grid-template-columns:repeat(2,1fr);
  }
  .sale-detail-facts .fact-item--wide-sm{
    grid-column:1/-1; /* タブレットでも横幅確保 */
  }
}
@media (min-width:960px){
  .sale-detail-facts .facts-grid{
    grid-template-columns:repeat(3,1fr);
  }
  .sale-detail-facts .fact-item--wide-sm{
    grid-column:auto; /* PCでは通常の1マスに戻す（必要に応じて外してOK） */
  }
}


/* 最優先で折り返す＆幅を親にフィットさせる（上書き） */
.rent-detail-facts{ overflow-x:auto; -webkit-overflow-scrolling:touch; }

.rent-detail-table{
  width:100% !important;
  max-width:100% !important;
  table-layout:fixed !important;
  border-collapse:collapse;
}

/* セル内の非改行指定を解除して折り返しを強制 */
.rent-detail-table th,
.rent-detail-table td{
  white-space:normal !important;     /* ← nowrapを打ち消す本丸 */
  word-break:break-word;             /* 日本語/英数字どちらもOK */
  overflow-wrap:anywhere;
  box-sizing:border-box;
  padding:10px;
}

/* 住所・設備・備考などの横伸び対策（長い英数・URLがある場合） */
.rent-detail-table a{ word-break:break-all; overflow-wrap:anywhere; }

/* もしテーマでテーブルに固定幅がある場合の保険 */
.rent-detail-facts table{ min-width:0 !important; }

/* 包む要素で横スクロールを許可（最終保険） */
.rent-detail-facts{
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}

/* テーブルは親幅にフィット＋自動改行 */
.rent-detail-table{
  width:100%;
  table-layout: fixed;           /* 列幅を均等に計算してはみ出しにくく */
  border-collapse: collapse;
}
.rent-detail-table th,
.rent-detail-table td{
  padding:10px;
  box-sizing: border-box;
  word-break: break-word;        /* 日本語・英数字どちらも折り返す */
  overflow-wrap: anywhere;       /* 長いURLや駅名の連結も折り返す */
}

/* 任意：4列テーブルの基本幅（PC） */
.rent-detail-table colgroup col{ width:25%; }

/* 住所や設備などは1行フル幅を維持（あなたのHTMLのままOK） */
.rent-detail-table td[colspan="3"]{ grid-column: 1 / -1; }

/* スマホ：行ごとに2カラム風レイアウトにして横幅節約 */
@media (max-width: 640px){
  .rent-detail-table{ display:block; }
  .rent-detail-table tr{
    display:grid;
    grid-template-columns: 7.5em 1fr;  /* 左＝見出し、右＝値 */
    border-top:1px solid #eee;
  }
  .rent-detail-table th{ 
    border-right:none;
  }
  .rent-detail-table td[colspan="3"]{
    grid-column: 1 / -1; /* 住所・設備・備考などは行フルで表示 */
  }
  /* 4セル行（th,td,th,td）も1セットずつ縦積みに */
  .rent-detail-table tr > th:nth-of-type(1),
  .rent-detail-table tr > td:nth-of-type(1){ grid-column: 1; }
  .rent-detail-table tr > th:nth-of-type(2),
  .rent-detail-table tr > td:nth-of-type(2){ grid-column: 1; }
  .rent-detail-table tr > th:nth-of-type(2){ margin-top:8px; } /* 2組目の見出しに少し余白 */

.hb-latest-properties { margin: 40px 0; }
.hb-latest-properties__title { font-size: 1.4rem; margin: 0 0 16px; }
.hb-latest-properties__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0; margin: 0;
}
.hb-latest-properties__item { background:#fff; border:1px solid #eee; border-radius:12px; overflow:hidden; }
.hb-latest-properties__link { display:block; text-decoration:none; color:inherit; }
.hb-latest-properties__thumb img, .hb-latest-properties__noimg { width:100%; height:180px; object-fit:cover; background:#f3f5f7; display:block; }
.hb-latest-properties__noimg { display:flex; align-items:center; justify-content:center; }
.hb-latest-properties__meta { padding:12px; }
.hb-latest-properties__name { font-size:1.05rem; margin:0 0 6px; line-height:1.4; }
.hb-latest-properties__row { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:6px; }
.hb-latest-properties__price { font-weight:700; }
.hb-latest-properties__addr { font-size:.9rem; color:#666; }
.hb-latest-properties__date { font-size:.8rem; color:#999; margin-top:6px; }
}