/* ルームエクスプローラーのスタイル
   移植元: shoppable-room/prototypes/shared/room-ui.css ＋ 04-editorial-hotspot/index.html の<style>
   サイト側との共存のための変更点:
   - デザイントークンは :root ではなく .room-explorer / .item-dock に定義する
     （.item-dock は body 直下に生成されるため両方に置く。--muted はウィジェット内でだけ上書きされる）
   - body / * へのリセットと .shell（ページ幅）は削除（サイトの base.css が担当） */
.room-explorer,
.item-dock {
  --paper: #f7f5f1;
  --surface: #fffdf9;
  --ink: #282925;
  --muted: #6b6b62;
  --line: #d8d5ce;
  --oak: #a87849;
  --olive: #687565;
  --olive-soft: #e5e9e1;
  --warm: #e8b86d;
  --shadow: 0 18px 48px rgb(36 34 29 / 16%);
  color: var(--ink);
}

.room-explorer button, .item-dock button, .room-explorer a, .item-dock a { font: inherit; }
.room-explorer button, .item-dock button { cursor: pointer; }

/* PR表記：タイトル直前・静かな罫線・常時表示（隠さない） */
.pr { display: inline-flex; margin-bottom: 12px; border-bottom: 1px solid var(--ink);
  padding-bottom: 4px; color: var(--ink); font-size: 12px; }
.room-title { margin: 0 0 16px; font-size: clamp(18px, 3vw, 24px); font-weight: 500;
  border: 0; padding: 0; }

/* ステージ（イラストの外枠） */
.stage { position: relative; overflow: hidden;
  min-height: clamp(360px, 58svh, 620px); background: #dfd8cc; }
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 5%); }
.stage-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.stage-bar button { border: 0; border-bottom: 1px solid var(--ink); padding: 0 0 3px;
  color: var(--ink); background: transparent; }

/* ホットスポット＝小さな付箋タグ（RoomClip参考・2026-08-01）。
   丸番号をやめてアイテムの短縮名をそのまま見せる。featured（.lg）は大きめにして
   大小の差で目線を誘導する。昼シーンは白い半透明の付箋でイラストの雰囲気を守り、
   暗いシーン（[data-tone="dark"]）だけ暗色タグに切り替える（Codexレビュー P3） */
.room-explorer .hotspot { position: absolute; z-index: 2; border-radius: 3px;
  min-height: 32px; padding: 4px 9px 4px 17px; color: var(--ink);
  background: rgb(255 253 249 / 88%); border: 1px solid rgb(40 41 37 / 18%);
  backdrop-filter: blur(3px);
  font-size: 10.5px; font-weight: 500; letter-spacing: .02em; white-space: nowrap;
  box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
  /* --tx はステージ端で見切れるタグを内側へ、--ty は重なったタグを縦に逃がすためのJS補正 */
  transform: translate(var(--tx, -50%), var(--ty, -50%)); }
/* 浮遊は featured（.lg）だけ・初回2ループで止める（全タグ常時だとツール感が勝つ） */
.room-explorer .hotspot.lg { padding: 6px 12px 6px 20px; font-size: 12px;
  animation: tag-bob 4.2s ease-in-out 2; }
/* 左端の小さな点＝アイテムの位置を指す目印 */
.room-explorer .hotspot::before { content: ""; position: absolute; left: 7px; top: 50%; width: 5px; height: 5px;
  border-radius: 50%; background: var(--warm); transform: translateY(-50%); }
.room-explorer .hotspot.lg::before { left: 9px; }
/* 暗いシーンでは白付箋が浮きすぎるため暗色タグに切り替える */
.room-explorer .stage[data-tone="dark"] .hotspot { color: #fffdf9;
  background: rgb(40 41 37 / 78%); border-color: rgb(255 253 249 / 22%);
  box-shadow: 0 3px 12px rgb(0 0 0 / 18%); }
/* hover/選択はどちらの配色でもオリーブ（暗シーン側の指定より後勝ちになるよう明示する） */
.room-explorer .hotspot:hover, .room-explorer .hotspot:focus-visible, .room-explorer .hotspot.selected,
.room-explorer .stage[data-tone="dark"] .hotspot:hover,
.room-explorer .stage[data-tone="dark"] .hotspot:focus-visible,
.room-explorer .stage[data-tone="dark"] .hotspot.selected {
  color: #fff; background: var(--olive); border-color: var(--olive);
  outline: none; animation-play-state: paused; }
@keyframes tag-bob {
  0%, 100% { transform: translate(var(--tx, -50%), var(--ty, -50%)); }
  50% { transform: translate(var(--tx, -50%), calc(var(--ty, -50%) - 5px)); }
}

/* 商品カード（デスクトップ：右下フローティング／モバイル：ボトムシート） */
.item-dock { position: fixed; right: max(16px, calc((100vw - 1080px) / 2)); bottom: 16px;
  z-index: 4; width: min(384px, calc(100vw - 32px)); padding: 20px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  line-height: 1.6; }
.item-dock[hidden] { display: none; }
.dock-top { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.dock-kicker { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.dock-title { margin: 0; font-size: 19px; font-weight: 500; }
.dock-close { display: grid; width: 32px; height: 32px; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent; }
.dock-price { margin: 14px 0 2px; font-size: 17px; font-weight: 600; }
.cta-primary.disabled { border-color: var(--line); color: var(--muted);
  background: var(--paper); cursor: not-allowed; pointer-events: none; }
.similar-item .pending { color: var(--muted); font-size: 12px; white-space: nowrap; }
.dock-confirmed { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.dock-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
/* 該当カテゴリの記事があるときだけ出す導線（Codexレビュー コンテンツ優先度1） */
.dock-article-link { margin: 10px 0 0; font-size: 12.5px; }
.dock-article-link a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.dock-article-link a:hover { color: var(--olive); }
/* 画像は参考イラストである旨の免責（常設・隠さない） */
.dock-disclaimer { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11px; line-height: 1.6; }
.dock-actions { display: grid; gap: 10px; margin-top: 20px; }
.cta-primary { display: flex; align-items: center; justify-content: center; min-height: 46px;
  border: 1px solid var(--ink); border-radius: 3px; color: #fff; background: var(--ink);
  text-decoration: none; font-size: 14px; }
.cta-primary:hover { color: #fff; }
.ad-note { margin: -4px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.cta-secondary { min-height: 42px; border: 1px solid var(--line); border-radius: 3px;
  color: var(--ink); background: transparent; font-size: 14px; }

/* 類似条件パネル */
.similar { display: none; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.similar.open { display: block; }
.similar h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { border: 1px solid #b9c1b3; border-radius: 100px; padding: 4px 8px;
  color: #4f5b4a; background: var(--olive-soft); font-size: 11px; }
.similar-list { display: grid; gap: 8px; }
.similar-item { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.similar-item:last-child { border-bottom: 0; }
.similar-item .labels { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.similar-item a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
  white-space: nowrap; }
.similar-empty { margin: 0; color: var(--muted); font-size: 12px; }

/* アイテム一覧（フォールバック・番号リスト） */
.fallback-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  margin-top: 32px; background: var(--line); border: 1px solid var(--line); }
.fallback-list button { min-height: 72px; border: 0; color: var(--ink);
  background: var(--surface); font-size: 13px; text-align: left; padding: 12px 14px;
  line-height: 1.6; }
.fallback-list button strong { display: block; margin-bottom: 4px; font-size: 11px;
  color: var(--muted); font-weight: 500; }

/* ---- 04-editorial 固有（部屋タブ・時間帯トグル・シーン画像） ---- */
.room-switch { display: flex; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.room-switch a { font-size: 12px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; background: var(--surface); }
.room-switch a:hover { color: var(--ink); }
.room-switch a[aria-current="true"] { background: #687565; border-color: #687565; color: #fff; }

/* 画像は全シーン 3:2（1536x1024）。%座標を安定させるためステージも 3:2 固定 */
.room-explorer .stage { min-height: 0; aspect-ratio: 3 / 2; background: #efe9df; }
/* 画像とピンを同じラッパーに入れ、パララックスはラッパーごと動かす（ピンずれ防止） */
.scene-wrap { position: absolute; inset: 0; will-change: transform; }
.scene-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .45s ease; }
.scene-img.active { opacity: 1; }

/* 時間帯トグル（画像上部右・部屋タブとは分ける） */
.scene-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 0 0 8px; }
.time-toggle { display: inline-flex; flex-shrink: 0; border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; background: var(--surface); }
.time-toggle button { border: 0; padding: 6px 14px; background: transparent;
  color: var(--muted); font-size: 12px; white-space: nowrap; }
.time-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---- 2ペイン（2026-08-01 オーナー要望）----
   デスクトップは左＝イラスト・右＝商品カードの2面にして、カードがイラストに
   被らないようにする。900px 未満は従来のフローティング／ボトムシートのまま */
.dock-placeholder { display: none; }
/* 2ペインの開始を 760px まで下げる。900px 開始だと 721〜899px でカードが
   position: fixed のままイラストに重なり、タグを覆っていた（オーナー報告 2026-08-01）。
   右カラムは clamp で可変にし、1280px 以上では従来どおり 336px に収まる */
@media (min-width: 760px) {
  .explorer-grid { display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(280px, 32%, 336px);
    gap: 20px; align-items: start; }
  .dock-col { position: sticky; top: 16px; }
  .dock-placeholder { display: block; min-height: 240px; padding: 20px;
    border: 1px dashed var(--line); background: var(--paper);
    color: var(--muted); font-size: 13px; line-height: 1.8; }
  .dock-placeholder p { margin: 0; }
  .placeholder-kicker { margin: 0 0 8px !important; font-size: 11px; font-weight: 700;
    letter-spacing: .12em; color: var(--muted); }
  /* 初期状態でも「このシーンのアイテム」を選べるようにする（Codexレビュー P3）。
     行頭はタグと同じ短縮名にして、イラスト上のタグと対応づけて読めるようにする */
  .placeholder-list { margin-top: 14px; border-top: 1px solid var(--line); }
  .placeholder-list button { display: flex; align-items: baseline; gap: 8px; width: 100%;
    min-height: 40px; border: 0; border-bottom: 1px solid var(--line); padding: 8px 2px;
    background: transparent; color: var(--muted); font-size: 11.5px; text-align: left; }
  .placeholder-list button:hover strong { color: var(--olive); }
  .placeholder-list button strong { color: var(--ink); font-size: 13px; font-weight: 600;
    white-space: nowrap; }
  /* カードは fixed をやめて右カラムに収める。低い画面で「似た条件」を開いても
     右ペイン内でスクロールして完結させる（Codexレビュー P2） */
  .dock-col .item-dock { position: static; width: auto; box-shadow: none;
    max-height: calc(100svh - 32px); overflow: auto; overscroll-behavior: contain; }
  /* カードが開いている間はプレースホルダを引っ込める */
  .dock-col:has(.item-dock:not([hidden])) .dock-placeholder { display: none; }
}

/* ほかの間取りへのカード導線（RoomClipの「おすすめの写真」参考・2026-08-01） */
.other-rooms-wrap { margin-top: 44px; }
.other-rooms-title { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.other-rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.other-room-card { display: block; color: var(--ink); text-decoration: none; }
.other-room-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.other-room-card .card-title { display: inline-block; margin-top: 8px; padding-bottom: 2px;
  border-bottom: 1px solid var(--ink); font-size: 13px; }
.other-room-card .card-audience { display: block; margin-top: 5px; color: var(--muted);
  font-size: 11px; }
.other-room-card:hover .card-title { color: var(--olive); border-color: var(--olive); }

/* タグの縮小はステージが狭くなる範囲すべてに効かせる。2ペインでも 900px 未満では
   イラストが 500px を切るため、レイアウトの分岐（760px）より広めに取る */
@media (max-width: 899.98px) {
  /* 小さいステージでは文字を少し落としつつ、指で押せる高さは確保する
     （Codexレビュー P2：タップ成功率を優先） */
  .room-explorer .hotspot { min-height: 30px; padding: 5px 9px 5px 16px; font-size: 10px; }
  .room-explorer .hotspot::before { left: 6px; width: 4px; height: 4px; }
  .room-explorer .hotspot.lg { min-height: 34px; padding: 5px 10px 5px 18px; font-size: 11px; }
  .room-explorer .hotspot.lg::before { left: 7px; }
}
/* 1カラムに戻る範囲。2ペインの開始（760px）と隙間なく繋げる */
@media (max-width: 759.98px) {
  .room-explorer .stage { min-height: 0; }
  /* 100vw はスクロールバー幅を含むため left/right 指定にする */
  .item-dock { left: 12px; right: 12px; bottom: 0; width: auto;
    border-radius: 8px 8px 0 0; max-height: 72svh; overflow: auto; }
  .fallback-list { grid-template-columns: 1fr; }
  .fallback-list button { min-height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-img { transition: none; }
  /* .lg のアニメ指定（詳細度 0,3,0）に勝つよう .lg も明示する */
  .room-explorer .hotspot, .room-explorer .hotspot.lg { animation: none; }
}
