/* 竣工写真（js/photos.js）。index.html（app.css の後）と project_detail.html（propertydetail.css の後）で読む
 * 物件詳細のタブの幅は組み合わせで決まるので、後から足した「地質調査」タブ（mockui.js）の分もここに置く */

/* ---- 物件詳細のタブ: 写真がある物件だけ 3 つ目「竣工写真」を出す ---- */
#propertyDetail .pd-hero-actions .pd-tabs.has-photos{width:314px;grid-template-columns:74px 126px 108px;}
#propertyDetail .pd-hero-actions .pd-tabs.photos-active::before{width:102px;transform:translateX(203px);}
#propertyDetail .pd-hero-actions .pd-tab#pdTabPhotos{width:108px;gap:6px;}
/* app.css は「関連ファイル」の幅を :last-child で付けているので、3 つ目のタブを足しても崩れないよう ID で付け直す */
#propertyDetail .pd-hero-actions .pd-tab#pdTabFiles{width:126px;gap:6px;}
.pd-tab[hidden]{display:none !important;}

/* ---- 物件詳細のタブ: 地質調査（07_地質調査報告書 のある物件だけ。mockui.js）。竣工写真の後ろに並ぶ ---- */
#propertyDetail .pd-hero-actions .pd-tab#pdTabGeotech{width:108px;gap:6px;}
#propertyDetail .pd-hero-actions .pd-tabs.has-geotech{width:314px;grid-template-columns:74px 126px 108px;}
#propertyDetail .pd-hero-actions .pd-tabs.geotech-active::before{width:102px;transform:translateX(203px);}
#propertyDetail .pd-hero-actions .pd-tabs.has-photos.has-geotech{width:422px;grid-template-columns:74px 126px 108px 108px;}
#propertyDetail .pd-hero-actions .pd-tabs.has-photos.geotech-active::before{transform:translateX(311px);}
.pd-geotech-group{
  margin:18px 0 8px;padding-bottom:6px;border-bottom:1px solid #E4EAEA;
  font-size:12px;font-weight:700;color:#4E5A5A;overflow-wrap:anywhere;
}
.pd-geotech-group:first-child{margin-top:0;}
.pd-geotech-list .pd-file-desc.is-muted{color:#9AA6A6;}

/* ---- 物件詳細の上部: 代表写真（左） ---- */
.pd-hero-photo{display:none;}
.pd-hero.has-photo .pd-hero-inner{display:grid;grid-template-columns:172px minmax(0,1fr);column-gap:24px;align-items:center;}
.pd-hero.has-photo .pd-hero-photo{
  display:block;width:172px;height:128px;padding:0;border:0;border-radius:6px;overflow:hidden;
  background:#E8ECEC;cursor:zoom-in;position:relative;
}
.pd-hero.has-photo .pd-hero-photo[hidden]{display:none;}
.pd-hero-photo img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .25s ease;}
.pd-hero-photo:hover img{transform:scale(1.04);}
.pd-hero-photo:focus-visible{outline:2px solid var(--teal);outline-offset:2px;}
/* 右下のタブと題名が重ならないよう、写真があるときは題名の右側を空ける */
.pd-hero.has-photo .pd-hero-text{padding-right:0;}

/* ---- 竣工写真タブの中身 ---- */
.pd-photo-set + .pd-photo-set{margin-top:30px;}
.pd-photo-set-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin-bottom:16px;}
.pd-photo-set-title{font-size:15px;font-weight:600;color:#242424;}
.pd-photo-set-count{font-size:12px;color:#5E6767;}
.pd-photo-badge{
  display:inline-block;padding:1px 8px;border-radius:9px;font-size:11px;font-weight:600;line-height:17px;
  background:#E0F4F4;color:#007F85;
}
.pd-photo-badge.is-check{background:#FFF3D6;color:#8A5A00;}
.pd-photo-badge.is-ng{background:#FDE4E2;color:#B3261E;}

/* 同じ建物の別物件の写真（物件詳細）・写真フォルダの物件（建物 DB）。物件 ID を押すとその物件詳細を開く */
.pd-photo-set-from{font-size:12px;color:#5E6767;margin:-8px 0 14px;}
.pd-photo-prop-link{
  border:0;background:none;padding:0;font:inherit;color:#1A73E8;cursor:pointer;text-align:left;
}
.pd-photo-prop-link:hover{text-decoration:underline;}
.pd-photo-loading{padding:12px 0;font-size:13px;color:#7A8585;}

/* デヂエの登録内容（物件情報タブの .pd-row と同じ見た目で 2 列） */
.pd-photo-info-title{font-size:14px;font-weight:600;color:var(--teal);margin-bottom:10px;}
.pd-photo-info{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:40px;margin-bottom:24px;
  border-bottom:1px solid #D3E1E0;
}
.pd-photo-info-row{
  min-height:38px;padding:7px 0;border-top:1px solid #D3E1E0;display:grid;grid-template-columns:118px minmax(0,1fr);
  align-items:center;font-size:13px;line-height:1.45;color:#242424;
}
.pd-photo-info-label{font-weight:600;}
.pd-photo-info-value{min-width:0;overflow-wrap:anywhere;}
.pd-photo-info-note{display:block;font-size:11px;color:#7A8585;margin-top:2px;}
.pd-photo-info-link{color:#1A73E8;text-decoration:none;}
.pd-photo-info-link:hover{text-decoration:underline;}
.pd-photo-info-empty{grid-column:1/-1;padding:12px 0;border-top:1px solid #D3E1E0;font-size:13px;color:#7A8585;}

.pd-photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(176px,1fr));gap:10px;}
.pd-photo-item{
  position:relative;aspect-ratio:4/3;padding:0;border:0;border-radius:4px;overflow:hidden;background:#E8ECEC;cursor:zoom-in;
}
.pd-photo-item img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .25s ease,opacity .2s ease;}
.pd-photo-item:hover img{transform:scale(1.04);}
.pd-photo-item:focus-visible{outline:2px solid var(--teal);outline-offset:2px;}
.pd-photo-item.is-broken img{display:none;}
.pd-photo-item.is-broken::after{content:"表示できません";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:11px;color:#8A9494;}
.pd-photo-cover{
  position:absolute;left:6px;top:6px;padding:1px 6px;border-radius:3px;font-size:10px;font-weight:700;
  background:rgba(0,0,0,.55);color:#fff;
}

/* ---- カタログ一覧（建物名の左）・マップのポップアップの代表写真 ---- */
.cat-photo-thumb{
  width:36px;height:27px;object-fit:cover;border-radius:3px;vertical-align:middle;margin-right:8px;background:#E8ECEC;
}
.map-popup-thumb{
  width:48px;height:36px;object-fit:cover;border-radius:3px;flex-shrink:0;background:#E8ECEC;cursor:pointer;
}

/* ---- 拡大表示 ---- */
html.photo-lb-open{overflow:hidden;}
.photo-lightbox{
  position:fixed;inset:0;z-index:400;background:rgba(10,14,14,.92);
  display:flex;align-items:center;justify-content:center;gap:12px;padding:64px 16px 24px;
  font-family:'Hiragino Sans','Hiragino Kaku Gothic ProN','Noto Sans JP',sans-serif;
}
.photo-lightbox[hidden]{display:none;}
.photo-lb-figure{margin:0;display:flex;flex-direction:column;align-items:center;min-width:0;flex:1;height:100%;}
.photo-lb-stage{position:relative;flex:1;min-height:0;width:100%;display:flex;align-items:center;justify-content:center;}
.photo-lb-img{max-width:100%;max-height:100%;object-fit:contain;display:block;box-shadow:0 8px 30px rgba(0,0,0,.45);}
.photo-lightbox.is-loading .photo-lb-img{opacity:.35;}
.photo-lightbox.is-error .photo-lb-img{display:none;}
.photo-lb-loading{position:absolute;color:#C9D2D2;font-size:13px;display:none;}
.photo-lightbox.is-loading .photo-lb-loading,.photo-lightbox.is-error .photo-lb-loading{display:block;}
/* 右の情報欄（ファイル名・番号・原寸リンク・デヂエの登録内容） */
.photo-lb-info{
  flex:0 0 320px;align-self:stretch;overflow-y:auto;overscroll-behavior:contain;
  background:rgba(255,255,255,.06);border-radius:8px;padding:18px 18px 22px;color:#E6ECEC;font-size:12px;line-height:1.5;
}
.photo-lb-info-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:8px;}
.photo-lb-name{font-size:14px;font-weight:600;color:#fff;overflow-wrap:anywhere;}
.photo-lb-count{font-variant-numeric:tabular-nums;color:#AEB9B9;white-space:nowrap;}
.photo-lb-original{display:inline-block;color:#7FE0E4;text-decoration:none;border-bottom:1px solid rgba(127,224,228,.4);margin-bottom:18px;}
.photo-lb-original:hover{color:#B4F0F2;}
.photo-lb-info-title{font-size:12px;font-weight:600;color:#7FE0E4;margin-bottom:4px;}
.photo-lb-folder{font-size:12px;color:#AEB9B9;margin-bottom:4px;overflow-wrap:anywhere;}
.photo-lb-prop{font-size:12px;color:#AEB9B9;margin-bottom:8px;}
.photo-lb-prop .pd-photo-prop-link{color:#7FE0E4;}
.photo-lb-field-row{display:grid;grid-template-columns:96px minmax(0,1fr);gap:8px;padding:7px 0;border-top:1px solid rgba(255,255,255,.1);}
.photo-lb-field-label{color:#AEB9B9;font-weight:600;}
.photo-lb-field-value{min-width:0;overflow-wrap:anywhere;}
.photo-lb-field-value .pd-photo-info-note{color:#8C9898;}
.photo-lb-field-value .pd-photo-info-link{color:#7FE0E4;}
.photo-lb-field-empty{padding:8px 0;color:#AEB9B9;}
.photo-lb-close{
  position:absolute;top:14px;right:16px;width:40px;height:40px;border:0;border-radius:50%;background:transparent;color:#fff;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
}
.photo-lb-close svg{width:24px;height:24px;}
.photo-lb-nav{
  flex-shrink:0;width:48px;height:48px;border:0;border-radius:50%;background:rgba(255,255,255,.08);color:#fff;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
}
.photo-lb-nav[hidden]{visibility:hidden;}
.photo-lb-nav svg{width:26px;height:26px;}
.photo-lb-close:hover,.photo-lb-nav:hover{background:rgba(255,255,255,.18);}
.photo-lb-close:focus-visible,.photo-lb-nav:focus-visible{outline:2px solid #7FE0E4;outline-offset:2px;}

@media (max-width:820px){
  /* 上部は高さ固定で題名が長いとタブに重なるので、狭い画面では代表写真を出さない（写真はタブで見る） */
  .pd-hero.has-photo .pd-hero-inner{display:block;}
  .pd-hero.has-photo .pd-hero-photo{display:none;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos{width:290px;grid-template-columns:70px 114px 100px;}
  #propertyDetail .pd-hero-actions .pd-tab#pdTabPhotos{width:100px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos .pd-tab:first-child{width:70px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos .pd-tab:nth-child(2){width:114px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos::before{width:65px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos.files-active::before{width:108px;transform:translateX(69px);}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos.photos-active::before{width:94px;transform:translateX(185px);}
  #propertyDetail .pd-hero-actions .pd-tabs.has-geotech{width:290px;grid-template-columns:70px 114px 100px;}
  #propertyDetail .pd-hero-actions .pd-tab#pdTabGeotech{width:100px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-geotech .pd-tab:first-child{width:70px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-geotech .pd-tab:nth-child(2){width:114px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-geotech::before{width:65px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-geotech.files-active::before{width:108px;transform:translateX(69px);}
  #propertyDetail .pd-hero-actions .pd-tabs.geotech-active::before{width:94px;transform:translateX(185px);}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos.has-geotech{width:390px;grid-template-columns:70px 114px 100px 100px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos.geotech-active::before{transform:translateX(285px);}
  /* 上の :first-child / :nth-child(2) は、広い画面の ID 指定（#pdTabFiles 126px）に負けるので ID で付け直す */
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos .pd-tab#pdTabInfo,
  #propertyDetail .pd-hero-actions .pd-tabs.has-geotech .pd-tab#pdTabInfo{width:70px;}
  #propertyDetail .pd-hero-actions .pd-tabs.has-photos .pd-tab#pdTabFiles,
  #propertyDetail .pd-hero-actions .pd-tabs.has-geotech .pd-tab#pdTabFiles{width:114px;}
  .pd-photo-grid{grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:8px;}
  .pd-photo-info{grid-template-columns:1fr;}
  .pd-photo-info-row{grid-template-columns:104px minmax(0,1fr);}
  /* 狭い画面では写真の下に情報欄を置き、情報欄だけスクロールさせる */
  .photo-lightbox{flex-wrap:wrap;align-content:flex-start;padding:56px 6px 10px;gap:4px;}
  .photo-lb-figure{flex:1 1 calc(100% - 80px);height:50vh;}
  .photo-lb-nav{width:36px;height:36px;align-self:center;}
  .photo-lb-info{flex:1 1 100%;max-height:calc(50vh - 76px);padding:12px 14px 16px;}
}

/* ---- チャットの回答: 回答に出てきた物件の竣工写真（回答の文章の下。js/photos.js renderAnswerPhotos） ---- */
.answer-photos{margin-top:12px;border-top:1px solid #eee;padding-top:8px;}
.answer-photos-title{font-size:12px;color:#888;font-weight:600;margin-bottom:6px;}
.answer-photo-item{display:flex;gap:12px;align-items:flex-start;padding:6px 0;}
.answer-photo-item + .answer-photo-item{border-top:1px dashed #EEF1F1;}
.answer-photo-thumb{
  flex:0 0 auto;width:112px;height:84px;padding:0;border:0;border-radius:6px;overflow:hidden;
  background:#E8ECEC;cursor:pointer;position:relative;
}
.answer-photo-thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.answer-photo-thumb.is-broken img{display:none;}
.answer-photo-thumb.is-broken::after{content:"表示できません";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:11px;color:#8A9494;}
.answer-photo-body{min-width:0;display:flex;flex-direction:column;gap:3px;font-size:12px;color:#555;}
.answer-photo-name{font-size:13px;font-weight:600;color:#242424;overflow-wrap:anywhere;}
.answer-photo-from{color:#5E6767;}
.answer-photo-open{
  align-self:flex-start;margin-top:2px;padding:2px 10px;border:1px solid #BFD9DA;border-radius:12px;
  background:#fff;color:#007F85;font-size:12px;cursor:pointer;
}
.answer-photo-open:hover{background:#E0F4F4;}
.answer-photos-more{font-size:12px;color:#888;padding-top:4px;}
