/* Слой «Фото»: тумблер в ряду слоёв, круглые миниатюры на карте и карточка
   просмотра (site/js/photos-view.js, photos-layer.js, photos-viewer.js).
   Цвета и радиусы только из токенов base.css. */

/* Тумблер «Фото» это включатель, а не набор слоёв (Семён 17.11.2026: «в меню
   фото кнопка указана как-то невзрачно»): первым в ряду, значок и слово на
   любом экране, выключенный белый с акцентным значком, рамкой и текстом,
   включённый залит акцентом. Отступ справа отделяет его от наборов. */
.layer-chip-photos {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-end: 4px;
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}
.layer-chip-photos svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}
/* У тумблера своя иконка, галочка набора ему не нужна. */
.layer-chip-photos[aria-pressed="true"]::before { content: none; }

.photo-marker-wrap { background: none; border: 0; }
.photo-marker {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--tint-strong);
  box-shadow: var(--shadow-button);
  cursor: pointer;
}
.photo-marker img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}
/* Лицензия без права изменений: картинка целиком, без обрезки кругом. */
.photo-marker-whole img { object-fit: contain; }
.photo-marker-group { width: 46px; height: 46px; border-color: var(--brand); }
.photo-count {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 20px;
  padding: 1px 5px;
  border: 1.5px solid var(--surface);
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--action-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
/* Место только с видео: метка без картинки, знак воспроизведения. */
.photo-marker-video {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--action-ink);
}
.photo-marker-play svg { display: block; width: 18px; height: 18px; fill: currentColor; }
/* Знак «есть видео» у метки с фото. */
.photo-video-badge {
  position: absolute;
  bottom: -4px;
  left: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  background: var(--brand);
  color: var(--action-ink);
}
.photo-video-badge svg { width: 10px; height: 10px; fill: currentColor; }
.leaflet-marker-icon:focus-visible .photo-marker { outline: 3px solid var(--focus); outline-offset: 2px; }

.photo-viewer {
  position: fixed;
  z-index: 1120;
  /* Под плашкой NOTAM на всю страну, пока она видна (--nationwide-bottom). */
  top: max(calc(124px + env(safe-area-inset-top)), calc(var(--nationwide-bottom, 0px) + 12px));
  right: 12px;
  display: flex;
  width: 380px;
  max-width: calc(100% - 24px);
  /* Низ над колонкой кнопок карты справа («Маршрут» bottom 160 px + 40 px
     и зазор 12 px): просмотр не закрывает «Маршрут», «центр карты» и масштаб. */
  max-height: calc(100% - max(calc(124px + env(safe-area-inset-top)), calc(var(--nationwide-bottom, 0px) + 12px)) - 212px);
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  color: var(--ink);
}
.photo-viewer[hidden] { display: none; }
.pv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
}
.pv-counter { color: var(--muted); font-size: 13px; font-weight: 650; }
.pv-close,
.pv-nav {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.pv-close svg,
.pv-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pv-close:hover,
.pv-nav:hover { border-color: var(--brand); color: var(--brand); }
.pv-frame {
  position: relative;
  display: grid;
  place-items: center;
  height: 260px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--tint);
}
/* Без обрезки: фото целиком в рамке, поля фоном. */
.pv-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.pv-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  box-shadow: var(--shadow-button);
}
.pv-prev { left: 8px; }
.pv-next { right: 8px; }
.pv-nav[hidden],
.pv-frame[hidden],
.pv-title[hidden],
.pv-credit[hidden] { display: none; }
.pv-title {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.pv-credit {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.pv-credit a { color: var(--brand); }
.pv-status { margin: 8px 0; color: var(--ink-soft); }

/* Видео места после фото: плашки без картинок YouTube, плеер по нажатию. */
.pv-videos { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.pv-videos[hidden] { display: none; }
.pv-videos-title { margin: 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.pv-video-list { display: flex; flex-direction: column; gap: 6px; }
.pv-video {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.pv-video:hover { border-color: var(--brand); }
.pv-video-play {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--action-bg);
  color: var(--action-ink);
}
.pv-video-play svg { width: 18px; height: 18px; fill: currentColor; }
.pv-video-text { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.pv-video-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}
.pv-video-meta { color: var(--ink-soft); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
/* Плеер: окно не меньше 200 × 200 px (требование YouTube), поверх ничего. */
.pv-player { display: flex; flex-direction: column; gap: 4px; }
.pv-player-box {
  position: relative;
  width: 100%;
  min-width: 200px;
  min-height: 200px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--ink);
}
.pv-player-frame { display: block; width: 100%; height: 100%; min-height: 200px; border: 0; }
.pv-player-note { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.4; }
.pv-player-note a { color: var(--brand); }
.pv-player-close {
  align-self: flex-start;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

@media (max-width: 760px) {
  /* Метки на телефоне мельче: 32 px место, 38 px группа (photos-layer.js MARKER_PX). */
  .photo-marker { width: 32px; height: 32px; }
  .photo-marker-group { width: 38px; height: 38px; }
  .photo-count { top: -5px; right: -7px; min-width: 18px; padding: 0 4px; font-size: 10.5px; line-height: 15px; }
  /* На телефоне тоже значок и слово; ряд, если не помещается, листается вбок
     (mobile.css), «Фото» первым и виден без прокрутки. */
  .layer-chip-photos { padding-inline: 11px; }
  /* Нижний лист поверх меню: карта над ним остаётся видна. */
  .photo-viewer {
    z-index: 1600;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-width: none;
    max-height: 60vh;
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-sheet);
  }
  .pv-frame { height: min(34vh, 260px); }
}

/* Правка маршрута (класс на <body> ставит route-bar.js): метки фото не
   нажимаются, нажатие ставит вершину маршрута; бледнее, чтобы не спорить с
   линией маршрута. */
.route-editing .leaflet-photo-pane .leaflet-marker-icon {
  pointer-events: none;
  opacity: .5;
}
