/* Лаборатория карты «Пробуждение» — 10 вариантов интерактивности.
   Наследует токены site.css (та же палитра «экспедиционная картография»). */
.page-lab { overflow: hidden; }
.lab { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column; }

/* ---- Верхний бар ---- */
.lab-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(12px, 2.5vw, 22px);
  background: rgba(16, 12, 10, 0.96);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.lab-back { display: grid; place-items: center; width: 40px; height: 40px; color: var(--dim); background: var(--bg3); flex: none;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); transition: color 140ms, background 140ms; }
.lab-back:hover { color: var(--ink); background: var(--bg4, #2C221C); }
.lab-title { min-width: 0; flex: 1; }
.lab-title-main { margin: 0; font: 700 clamp(15px, 2.4vw, 19px)/1.1 var(--disp); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-title-sub { margin: 3px 0 0; font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-info-btn { display: grid; place-items: center; width: 40px; height: 40px; color: var(--rose-deep); flex: none; transition: color 140ms; }
.lab-info-btn:hover { color: var(--rose); }

/* ---- Переключатель вариантов ---- */
.lab-switch {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 12px clamp(12px, 2.5vw, 22px);
  background: rgba(20, 16, 13, 0.92);
  border-bottom: 1px solid var(--line);
  z-index: 35;
}
.lab-switch::-webkit-scrollbar { display: none; }
.lab-chip {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  padding: 9px 15px 9px 12px; color: var(--dim);
  background: var(--bg2); font: 500 13.5px/1 var(--body);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: color 140ms, background 140ms;
}
.lab-chip:hover { color: var(--ink); background: var(--bg3); }
.lab-chip.is-on { color: #241512; background: var(--rose); font-weight: 600; }
.lab-chip.is-on .lab-chip-n { color: rgba(36, 21, 18, 0.6); }
.lab-chip-n { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* ---- Сцена ---- */
.lab-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--bg); }
.leaflet-container { background: var(--bg) !important; font-family: var(--body); outline: none; }
.lab-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px;
  color: var(--dim); font-size: 14px; background: var(--bg); z-index: 60; pointer-events: none; transition: opacity 300ms; }
.lab-loading.is-hidden { opacity: 0; }
.lab-spin { width: 30px; height: 30px; border: 2px solid var(--line); border-top-color: var(--rose); border-radius: 50%; animation: labspin 0.8s linear infinite; }
@keyframes labspin { to { transform: rotate(360deg); } }

/* ---- Подсказка ---- */
.lab-hint {
  position: absolute; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 50; max-width: min(92vw, 560px);
  background: rgba(22, 17, 14, 0.96); color: var(--ink-soft);
  padding: 12px 44px 12px 16px; font-size: 13.5px; line-height: 1.45;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.lab-hint b { color: var(--rose-strong); font-weight: 600; }
.lab-hint-close { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; color: var(--faint); }
.lab-hint-close:hover { color: var(--ink); }

/* ---- Зум-кнопки (общие) ---- */
.lab-zoom { position: absolute; right: 14px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 45; display: flex; flex-direction: column; gap: 7px; }
.lab-zoom button { width: 44px; height: 44px; display: grid; place-items: center; background: rgba(17, 13, 11, 0.94); color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); transition: background 140ms, color 140ms; }
.lab-zoom button:hover { background: var(--bg3); color: var(--rose-strong); }
/* в туре нижнюю панель не перекрываем — колонка зума поднимается выше */
.lab-zoom--above-tour { bottom: calc(190px + env(safe-area-inset-bottom)); }

/* ---- Кликабельные подписи на растре (deepzoom/filter/tour/spotlight) ---- */
.hot { position: absolute; box-sizing: border-box; cursor: pointer; border: 1.5px solid transparent; border-radius: 3px;
  transition: border-color 120ms, background 120ms; }
.hot:hover, .hot.is-hot { border-color: var(--rose); background: rgba(228, 178, 181, 0.16); }
.hot.is-linked { border-color: rgba(217, 164, 65, 0.5); }
.hot.is-linked:hover { border-color: var(--gold); background: rgba(217, 164, 65, 0.18); }
.hot.is-dim { opacity: 0.12; }
.hot.is-match { border-color: var(--rose); background: rgba(228, 178, 181, 0.22); box-shadow: 0 0 0 3px rgba(228,178,181,0.12); }

/* маркеры-точки (constellation/lod/filter) через divIcon */
.lab-node { transform: translate(-50%, -50%); }

/* ---- Детальная панель (переиспользуем .mv-panel из site.css, добавим лаб-контент) ---- */
.lp-cat { display: inline-flex; align-items: center; gap: 8px; font: 500 13px/1 var(--body); margin-bottom: 12px; }
.lp-cat::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.lp-actions--gap { margin-top: 8px; }
.lp-cat.c-soznanie { color: var(--rose); }
.lp-cat.c-chastoty { color: var(--gold); }
.lp-cat.c-istoriya { color: var(--clay); }
.lp-cat.c-prostranstva { color: var(--bone); }
.lp-cat.c-none { color: var(--dim); }
.lp-title { margin: 0 26px 12px 0; font: 500 20px/1.3 var(--disp); }
.lp-teaser { margin: 0 0 16px; font-size: 14.5px; line-height: 1.6; color: var(--dim); }
.lp-meta { margin: 0 0 18px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.lp-note { margin: 0 0 8px; color: var(--faint); font-size: 13.5px; line-height: 1.5; }
.lp-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---- v06 split ---- */
.lab-split { position: absolute; inset: 0; display: grid; grid-template-columns: 340px 1fr; }
.lab-index { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg2); min-height: 0; }
.lab-index-search { margin: 14px; background: var(--bg); border: 0; outline: 0; padding: 11px 14px; color: var(--ink); font-size: 14px; }
.lab-index-search::placeholder { color: var(--faint); }
.lab-index-list { list-style: none; margin: 0; padding: 0 6px 16px; overflow-y: auto; min-height: 0; }
.lab-index-group { padding: 14px 10px 6px; font: 600 11.5px/1 var(--body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--rose-deep); }
.lab-index-item { display: block; width: 100%; text-align: left; padding: 9px 12px; color: var(--ink-soft); font-size: 14px; transition: background 120ms, color 120ms; cursor: pointer; border: 0; background: none; }
.lab-index-item:hover, .lab-index-item.is-on { background: var(--bg3); color: var(--rose-strong); }
.lab-index-item.is-linked::after { content: '↗'; color: var(--gold); margin-left: 6px; font-size: 12px; }
.lab-split-map { position: relative; min-height: 0; }
@media (max-width: 780px) {
  .lab-split { grid-template-columns: 1fr; grid-template-rows: 42% 58%; }
  .lab-index { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---- v07 filter toggles ---- */
.lab-filters { position: absolute; left: 14px; top: 14px; z-index: 45; display: flex; flex-direction: column; gap: 7px; }
.lab-filter { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; background: rgba(17,13,11,0.94); color: var(--dim); font: 500 13px/1 var(--body);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); transition: color 140ms, background 140ms; cursor: pointer; }
.lab-filter:hover { color: var(--ink); }
.lab-filter .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.lab-filter.c-soznanie { --c: var(--rose); } .lab-filter.c-chastoty { --c: var(--gold); }
.lab-filter.c-istoriya { --c: var(--clay); } .lab-filter.c-prostranstva { --c: var(--bone); }
.lab-filter .dot { color: var(--c); }
.lab-filter.is-on { color: var(--ink); background: var(--bg3); }
.lab-filter.is-off .dot { opacity: 0.3; }

/* ---- v08 tour ---- */
.lab-tour { position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 46;
  width: min(94vw, 620px); background: rgba(22,17,14,0.97); padding: 18px 20px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%); }
.lab-tour-step { font-family: var(--mono); font-size: 11px; color: var(--rose-deep); margin: 0 0 6px; }
.lab-tour-title { margin: 0 0 6px; font: 500 18px/1.25 var(--disp); }
.lab-tour-text { margin: 0 0 14px; font-size: 13.5px; line-height: 1.5; color: var(--dim); }
.lab-tour-nav { display: flex; align-items: center; gap: 10px; }
.lab-tour-nav .btn { flex: none; }
.lab-tour-nav .grow { flex: 1; }
.lab-tour-btn { padding: 11px 16px; background: var(--bg3); color: var(--ink); font: 500 13.5px/1 var(--body); cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); transition: background 140ms; }
.lab-tour-btn:hover { background: var(--bg4, #2C221C); }
.lab-tour-btn:disabled { opacity: 0.4; cursor: default; }
.lab-tour-play { color: var(--rose-strong); }

/* ---- v05 constellation / v02 lod / v09 radial / v10 tilt: canvas ---- */
.lab-canvas { position: absolute; inset: 0; display: block; cursor: grab; touch-action: none; }
.lab-canvas.dragging { cursor: grabbing; }
.lab-floatlabel { position: absolute; z-index: 20; pointer-events: none; transform: translate(-50%, -140%);
  font: 600 12.5px/1.2 var(--body); color: #241413; background: rgba(255,250,246,0.92); padding: 4px 8px; white-space: nowrap; max-width: 240px; }

/* ---- v04 lens ---- */
.lab-lens { position: absolute; z-index: 30; width: 260px; height: 260px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(255,250,246,0.5); box-shadow: 0 8px 30px rgba(0,0,0,0.5); overflow: hidden; display: none; }
.lab-lens canvas { display: block; }
.lab-lens-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(42,22,24,0.4); pointer-events: none; }

/* ---- v03 spotlight search ---- */
.lab-search { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 46; width: min(92vw, 520px); }
.lab-search-box { display: flex; align-items: center; gap: 10px; background: rgba(22,17,14,0.97); padding: 6px 6px 6px 16px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); }
.lab-search-box input { flex: 1; background: none; border: 0; outline: 0; color: var(--ink); font-size: 15.5px; padding: 9px 0; }
.lab-search-box input::placeholder { color: var(--faint); }
.lab-search-count { font-family: var(--mono); font-size: 11px; color: var(--rose-deep); padding-right: 8px; white-space: nowrap; }
.lab-search-results { margin-top: 8px; background: rgba(28,22,19,0.97); max-height: 40vh; overflow-y: auto;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.lab-search-results:empty { display: none; }
.lab-sr { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; cursor: pointer; transition: background 120ms; }
.lab-sr:hover, .lab-sr.is-hot { background: var(--bg3); }
.lab-sr-t { color: var(--ink-soft); font-size: 14px; }
.lab-sr-c { margin-left: auto; font-size: 11px; color: var(--faint); white-space: nowrap; }

/* ---- overlay-хинт (модалка «как это работает») ---- */
.lab-modal { position: fixed; inset: 0; z-index: 200; background: rgba(10,8,6,0.86); display: grid; place-items: center; padding: 18px; }
.lab-modal-panel { width: min(520px, 94vw); background: var(--bg2); padding: 26px 28px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%); }
.lab-modal-panel h3 { margin: 0 0 6px; font: 500 20px/1.25 var(--disp); }
.lab-modal-panel .tag { margin: 0 0 16px; font-family: var(--mono); font-size: 11.5px; color: var(--rose-deep); }
.lab-modal-panel p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.6; color: var(--dim); }
.lab-modal-panel .btn { margin-top: 4px; }

@media (max-width: 640px) {
  .lab-zoom { bottom: auto; top: 12px; }
  .lab-search { top: 12px; }
  .lab-filters { top: auto; bottom: calc(20px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .lab-spin { animation: none; }
}

/* Пульс фокусной точки — переход «Показать на карте» с страницы статьи */
.lab-pulse-wrap { pointer-events: none; }
.lab-pulse-wrap .lab-pulse {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid #E4B2B5; opacity: 0;
  animation: labPulse 2s ease-out infinite;
}
.lab-pulse-wrap .lab-pulse-2 { animation-delay: 1s; }
.lab-pulse-wrap .lab-pulse-core {
  position: absolute; left: 5px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%; background: #E4B2B5;
  box-shadow: 0 0 14px 3px rgba(228, 178, 181, 0.85);
}
@keyframes labPulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  70% { transform: scale(3.4); opacity: 0; }
  100% { transform: scale(3.4); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .lab-pulse-wrap .lab-pulse { animation: none; opacity: 0.6; transform: scale(1.8); }
}
