/* Visite — interface de présentation */

body { overflow: hidden; }

.stage { position: fixed; inset: 0; }

.scrim {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(8, 52, 39, 0.5), rgba(8, 52, 39, 0) 22%),
    linear-gradient(to top, rgba(8, 52, 39, 0.42), rgba(8, 52, 39, 0) 26%);
  transition: opacity 0.4s;
}

.chrome { transition: opacity 0.35s; }
body.ui-hidden .chrome { opacity: 0; pointer-events: none; }
body.ui-hidden .chrome * { pointer-events: none; }

/* ---------- titre ---------- */
.head {
  position: fixed;
  top: 26px;
  left: 30px;
  max-width: min(560px, calc(100vw - 160px));
  pointer-events: none;
  text-shadow: 0 1px 14px rgba(6, 42, 31, 0.6);
}
.head-logo {
  display: block;
  height: 64px;
  width: auto;
  margin: 0 0 16px;
  filter: drop-shadow(0 1px 10px rgba(6, 42, 31, 0.5));
}
.head-title {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 450;
  letter-spacing: 0.03em;
  color: var(--stone-2);
}
.head-scene {
  margin: 0;
  font-size: clamp(26px, 3.1vw, 38px);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.01em;
  transition: opacity 0.25s, transform 0.25s;
}
.head-scene.is-swapping { opacity: 0; transform: translateY(4px); }

/* ---------- outils ---------- */
.tools {
  position: fixed;
  top: 22px;
  right: 22px;
  display: flex;
  gap: 8px;
}

/* ---------- barre du bas ---------- */
.dock {
  position: fixed;
  left: 22px;
  bottom: 22px;
  max-width: calc(100vw - 44px);
  display: flex;
  align-items: stretch;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.floors {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  padding-right: 8px;
  margin-right: 8px;
  border-right: 1px solid var(--line);
}
.floor-btn {
  min-width: 58px;
  height: 27px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--stone-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.floor-btn:hover { color: var(--stone); background: rgba(238, 247, 240, 0.08); }
.floor-btn[aria-current='true'] { background: var(--stone); color: var(--walnut); }

.strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.strip::-webkit-scrollbar { display: none; }
.dock.is-collapsed .strip { display: none; }

.strip-item {
  flex: 0 0 auto;
  width: 128px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--stone-2);
  font-size: 12.5px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}
.strip-item .thumb {
  outline: 2px solid transparent;
  outline-offset: -2px;
  filter: saturate(0.8) brightness(0.86);
  transition: outline-color 0.2s, filter 0.2s;
}
.strip-item .label {
  display: block;
  padding: 6px 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip-item:hover .thumb { filter: none; }
.strip-item:hover .label { color: var(--stone); }
.strip-item[aria-current='true'] .thumb { outline-color: var(--brass); filter: none; }
.strip-item[aria-current='true'] .label { color: var(--stone); }
.strip.is-scrollable { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.strip.is-scrollable.at-end { mask-image: none; -webkit-mask-image: none; }

.dock-toggle {
  align-self: flex-end;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--stone-2);
  cursor: pointer;
}
.dock-toggle:hover { color: var(--stone); background: rgba(238, 247, 240, 0.08); }
.dock-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s; }
.dock.is-collapsed .dock-toggle svg { transform: rotate(180deg); }

/* ---------- aide de départ ---------- */
.hint {
  position: fixed;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  font-size: 14.5px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.5s;
}
.hint svg { width: 22px; height: 22px; fill: none; stroke: var(--brass-hi); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hint.is-gone { opacity: 0; }

/* ---------- chargement haute définition ---------- */
.progress {
  position: fixed;
  left: 0;
  top: 0;
  height: 2px;
  width: calc(var(--p, 0) * 100%);
  background: var(--brass);
  opacity: 0;
  transition: width 0.2s, opacity 0.5s;
}
.progress.is-on { opacity: 1; }

/* ---------- ouverture ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--walnut);
  transition: opacity 1s ease 0.15s, visibility 1s ease 0.15s;
}
.intro > div { max-width: calc(100vw - 32px); }
.intro.is-done { opacity: 0; visibility: hidden; }
.intro-logo {
  display: block;
  height: clamp(120px, 18vh, 180px);
  width: auto;
  margin: 0 auto 36px;
}
.intro-title {
  margin: 0 0 22px;
  font-size: clamp(32px, 5.4vw, 64px);
  font-weight: 300;
  letter-spacing: 0.05em;
  text-align: center;
}
.intro-line {
  position: relative;
  width: 160px;
  height: 1px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--line);
}
.intro-line::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--brass);
  animation: slide 1.3s ease-in-out infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.notice {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--walnut);
}
.notice div { max-width: 460px; }
.notice h2 { margin: 0 0 10px; font-size: 24px; font-weight: 400; }
.notice p { margin: 0 0 10px; color: var(--stone-2); line-height: 1.55; }
.notice code { color: var(--brass-hi); font-size: 0.95em; }

/* ---------- commentaires ---------- */
.tools .icon-btn { position: relative; }
.tools .icon-btn[hidden] { display: none; }
.count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--walnut);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(11, 67, 50, 0.6);
}

body.comments-on .pano { cursor: crosshair; }
body.comments-on .pano.is-dragging { cursor: grabbing; }
body.comments-on .dock { max-width: calc(100vw - 44px - 352px); }

.comments {
  position: fixed;
  top: 74px;
  right: 22px;
  z-index: 10;
  width: 340px;
  max-height: calc(100vh - 96px);
  max-height: calc(100dvh - 96px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  box-shadow: 0 18px 50px rgba(3, 24, 18, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateX(16px);
  transition: opacity 0.25s, transform 0.25s, visibility 0s 0.25s;
}
body.comments-on .comments { opacity: 1; visibility: visible; transform: none; transition: opacity 0.25s, transform 0.25s; }
body.ui-hidden .comments, body.ui-hidden .cm-card { opacity: 0; visibility: hidden; }

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 2px 18px;
}
.comments-head h2 { margin: 0; font-size: 19px; font-weight: 400; }
.comments-total { margin-left: 4px; color: var(--stone-3); font-size: 15px; }
.comments-head .icon-btn { width: 32px; height: 32px; background: none; border-color: transparent; backdrop-filter: none; }
.comments-head .icon-btn:hover { background: rgba(238, 247, 240, 0.08); }
.comments-help { margin: 0 18px 12px; color: var(--stone-2); font-size: 13px; line-height: 1.45; }

.comments-filter {
  display: flex;
  gap: 2px;
  margin: 0 14px 6px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 24, 18, 0.28);
}
.comments-filter button {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--stone-2);
  font-size: 13px;
  cursor: pointer;
}
.comments-filter button:hover { color: var(--stone); }
.comments-filter button[aria-pressed='true'] { background: var(--walnut-2); color: var(--stone); box-shadow: 0 0 0 1px var(--line-strong); }
.comments-filter .n { margin-left: 2px; color: var(--stone-3); font-size: 12px; }

.comment-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 4px 8px 8px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.comment-list li + li { margin-top: 2px; }
.cm-item {
  display: flex;
  gap: 11px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--stone);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s;
}
.cm-item:hover:not(:disabled) { background: rgba(238, 247, 240, 0.06); }
.cm-item[aria-current='true'] { background: rgba(188, 255, 187, 0.14); }
.cm-item:disabled { opacity: 0.5; cursor: default; }
.cm-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cm-item .cm-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.cm-where { color: var(--stone-3); font-size: 12px; }
.cm-item.is-here .cm-where { color: var(--brass-hi); }
.cm-empty { padding: 16px 10px 12px; color: var(--stone-3); font-size: 13.5px; text-align: center; }

.cm-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px 12px 12px 3px;
  background: var(--stone);
  color: var(--walnut);
  font-size: 12px;
  font-weight: 600;
}
.cm-item[aria-current='true'] .cm-num { background: var(--brass); }
.cm-meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--stone-3); font-size: 12px; }
.cm-meta b { overflow: hidden; color: var(--stone); font-size: 13.5px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.cm-meta time { white-space: nowrap; }

/* épingles posées dans l'image : la pointe en bas à gauche marque l'endroit */
.cm-pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  cursor: pointer;
}
.cm-pin:focus-visible { outline: none; }
.cm-pin-dot {
  position: absolute;
  left: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border-radius: 15px 15px 15px 3px;
  background: var(--stone);
  color: var(--walnut);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(11, 67, 50, 0.45), 0 8px 22px rgba(3, 24, 18, 0.45);
  transform-origin: 0 100%;
  transition: transform 0.15s, background-color 0.15s;
}
.cm-pin:hover .cm-pin-dot,
.cm-pin:focus-visible .cm-pin-dot,
.cm-pin[aria-current='true'] .cm-pin-dot { transform: scale(1.12); }
.cm-pin[aria-current='true'] .cm-pin-dot,
.cm-pin--draft .cm-pin-dot { background: var(--brass); }
.cm-pin--draft { cursor: default; }
.cm-pin--draft .cm-pin-dot { font-size: 19px; font-weight: 400; animation: cm-pop 0.2s ease-out; }
@keyframes cm-pop { from { opacity: 0; transform: scale(0.4); } }

/* bulle : lecture ou écriture d'un commentaire */
.cm-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 12;
  width: 300px;
  max-width: calc(100vw - 24px);
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 44px rgba(3, 24, 18, 0.5);
  transition: opacity 0.15s;
}
.cm-card.is-away { opacity: 0; pointer-events: none; }
.cm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cm-head .cm-meta { flex: 1; }
.cm-x {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin: -4px -4px -4px 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--stone-2);
  cursor: pointer;
}
.cm-x:hover { background: rgba(238, 247, 240, 0.08); color: var(--stone); }
.cm-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.cm-card .cm-text { max-height: 40vh; margin: 0; overflow-y: auto; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.cm-link { margin: -4px -6px; padding: 4px 6px; border: 0; border-radius: 5px; background: none; color: var(--stone-3); font-size: 12.5px; cursor: pointer; }
.cm-link.danger:hover, .cm-link.is-confirm { color: var(--alert); }
.cm-link.is-confirm { background: rgba(224, 154, 134, 0.12); }

.cm-form { display: flex; flex-direction: column; gap: 8px; }
.cm-row { display: flex; align-items: center; gap: 6px; }
.cm-input, .cm-name {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(3, 24, 18, 0.32);
  color: var(--stone);
  font: 400 14.5px/1.45 var(--font);
}
.cm-input { min-height: 78px; max-height: 40vh; padding: 8px 10px; resize: none; field-sizing: content; }
.cm-name { flex: 1; min-width: 0; height: 32px; padding: 0 9px; font-size: 13.5px; }
.cm-input:focus, .cm-name:focus { outline: none; border-color: var(--brass); }
.cm-input::placeholder, .cm-name::placeholder { color: var(--stone-3); }
.cm-btn {
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: none;
  color: var(--stone);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.cm-btn:hover:not(:disabled) { background: rgba(238, 247, 240, 0.08); }
.cm-btn.primary { border-color: var(--brass); background: var(--brass); color: var(--walnut); }
.cm-btn.primary:hover:not(:disabled) { border-color: var(--brass-hi); background: var(--brass-hi); }
.cm-btn:disabled { opacity: 0.5; cursor: default; }
.cm-error { margin: 0; color: var(--alert); font-size: 13px; }
.cm-tip { margin: 0; color: var(--stone-3); font-size: 12px; }

/* ---------- petits écrans ---------- */
@media (max-width: 640px) {
  .head { top: 16px; left: 16px; max-width: calc(100vw - 120px); }
  .head-logo { height: 44px; margin-bottom: 10px; }
  .head-title { font-size: 12.5px; margin-bottom: 3px; }
  .tools { top: 14px; right: 16px; gap: 6px; }
  .dock { left: 12px; right: 12px; bottom: 12px; max-width: none; padding: 6px; }
  .floors { padding-right: 6px; margin-right: 6px; }
  .floor-btn { min-width: 46px; height: 24px; padding: 0 8px; font-size: 12.5px; }
  .strip-item { width: 96px; font-size: 12px; }
  .comments {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 46vh;
    max-height: 46dvh;
    transform: translateY(16px);
  }
  body.comments-on .dock { display: none; }
  .comments-help { margin-bottom: 8px; }
}
