/* =========================================================
   ПРОЕКТСТРОЙ — Базата (интерактивна карта)
   Design reference: Figma "Base map" / "Base map selected"
   (1440×900 и 1920×1080) + 12-те „… window" рамки
   ========================================================= */

.page-map {
  height: 100%;
  overflow: hidden;
  background: #1c1917;
  overscroll-behavior: none;
}
html:has(.page-map) { height: 100%; }

/* ---------------------------------------------------------
   Сцена
   --------------------------------------------------------- */
.map {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: #1c1917;
}

/* Когато снимката не запълва екрана (висок и тесен телефон, широк
   монитор), отстрани не остава черно, а размазано продължение на
   същия кадър — иначе базата плува в празно поле. */
.map::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("images/base-map-blur.jpg") center / cover no-repeat;
  transform: scale(1.08);
  filter: blur(18px) brightness(0.55) saturate(0.85);
  pointer-events: none;
}
.map__stage { z-index: 1; }
.map.is-panning { cursor: grabbing; }

.map__stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map__photo {
  width: 100%;
  height: 100%;
  display: block;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.map__pins {
  position: absolute;
  inset: 0;
}

/* ---------------------------------------------------------
   Точки
   --------------------------------------------------------- */
.pin {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  /* Точката стои закотвена, докато картата се мащабира:
     контра-мащабът я държи в постоянен екранен размер. */
  transform: translate(-9px, -50%) scale(var(--inv, 1));
  transform-origin: 9px 50%;
}

.pin__dot {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-red);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
/* червен пръстен → бял пръстен → червено ядро */
.pin__dot::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #fff;
}
.pin__dot::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--c-red);
}

.pin__label {
  padding: 0 13px;
  height: 30px;
  display: flex;
  align-items: center;
  border-radius: 15px;
  background: rgba(28, 25, 23, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: background-color 0.18s ease;
}

.pin:hover .pin__dot,
.pin:focus-visible .pin__dot { transform: scale(1.18); }
.pin:hover .pin__label,
.pin:focus-visible .pin__label { background: rgba(28, 25, 23, 0.95); }

.pin.is-active .pin__dot {
  transform: scale(1.25);
  box-shadow: 0 0 0 6px rgba(241, 17, 18, 0.28), 0 1px 6px rgba(0, 0, 0, 0.45);
}
.pin.is-active .pin__label { background: var(--c-red); }

/* Точките вляво от центъра държат етикета отдясно, а тези
   вдясно — отляво, за да не излиза извън кадъра. */
.pin.is-flipped { flex-direction: row-reverse; transform-origin: calc(100% - 9px) 50%; }
.pin.is-flipped { transform: translate(calc(-100% + 9px), -50%) scale(var(--inv, 1)); }

/* ---------------------------------------------------------
   Контроли
   --------------------------------------------------------- */
.map__back,
.map__zoom-btn {
  background: rgba(28, 25, 23, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.map__back {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}
.map__back:hover { background: rgba(28, 25, 23, 0.95); }

.map__zoom {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map__zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.map__zoom-btn:hover { background: rgba(28, 25, 23, 0.95); }
.map__zoom-btn:disabled { opacity: 0.4; cursor: default; }

.map__hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 10;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  white-space: nowrap;
  transition: opacity 0.4s ease;
}
.map__hint.is-gone { opacity: 0; pointer-events: none; }


/* ---------------------------------------------------------
   Опорен екран  (Figma: Base Opening Screen, 1440×900)
   Размитата снимка и червеният филтър се вдигат при
   „Разгледай" — все едно излизаш от облаците.
   --------------------------------------------------------- */
.opening {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.opening__blur,
.opening__tint {
  position: absolute;
  inset: 0;
  transition: opacity 1.15s cubic-bezier(0.22, 0.61, 0.25, 1);
}

.opening__blur img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);   /* скрива меките ръбове на размазването */
}

.opening__tint {
  background: rgba(241, 17, 18, 0.63);
  /* лека винетка, както в кадъра */
  box-shadow: inset 0 0 220px 60px rgba(90, 8, 8, 0.55);
}

.opening__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.22, 0.61, 0.25, 1);
}

.opening__kicker {
  font-weight: 700;
  font-size: clamp(20px, 3.33vw, 48px);
  letter-spacing: 0.083em;
  text-indent: 0.083em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
}

.opening__title {
  margin-top: clamp(2px, 0.7vw, 10px);
  font-family: var(--f-cond);
  font-weight: 800;
  font-size: clamp(52px, 10.28vw, 148px);
  line-height: 0.9;
  text-transform: uppercase;
  color: #fff;
}

.opening__btn {
  margin-top: clamp(14px, 1.25vw, 18px);
  width: clamp(190px, 18.54vw, 267px);
  height: clamp(54px, 5.2vw, 75px);
  border: 0;
  border-radius: clamp(16px, 1.53vw, 22px);
  background: #000;
  color: #f1f1f1;
  font-weight: 600;
  font-size: clamp(20px, 2.22vw, 32px);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.opening__btn:hover { background: #241e1e; transform: translateY(-2px); }

.opening__note {
  margin-top: clamp(16px, 2.08vw, 30px);
  font-weight: 800;
  font-size: clamp(11px, 1.11vw, 16px);
  letter-spacing: 0.106em;
  text-indent: 0.106em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

/* --- напускане --- */
.opening.is-leaving { pointer-events: none; }
.opening.is-leaving .opening__blur,
.opening.is-leaving .opening__tint { opacity: 0; }
.opening.is-leaving .opening__inner {
  opacity: 0;
  transform: translateY(-14px) scale(1.04);
  transition-duration: 0.4s, 0.5s;
}
.opening[hidden] { display: none; }

/* --- появата на точките --- */
.map__pins .pin {
  opacity: 0;
  visibility: hidden;
}
.map__pins.is-in .pin {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease, visibility 0s;
}

/* Докато опорният екран е горе, контролите не се виждат */
.map__back,
.map__zoom,
.map__hint { transition: opacity 0.5s ease 0.15s; }
.is-opening .map__back,
.is-opening .map__zoom,
.is-opening .map__hint { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .opening__blur,
  .opening__tint,
  .opening__inner,
  .map__pins .pin { transition-duration: 0.001ms !important; }
}

/* ---------------------------------------------------------
   Карта на обект  (Figma: „… window", 400px)
   --------------------------------------------------------- */
.window {
  position: absolute;
  z-index: 20;
  width: 400px;
  max-width: calc(100vw - 32px);
  padding: 24px;
  border-radius: 18px;
  background: var(--c-cream);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: window-in 0.22s ease both;
}
.window[hidden] { display: none; }

@keyframes window-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.window__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.window__titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-transform: uppercase;
}

.window__eyebrow {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2.4px;
  color: var(--c-eyebrow);
}

.window__title {
  font-family: var(--f-cond);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.1;
  color: var(--c-ink);
}

.window__close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 99px;
  background: #fff;
  border: 1px solid var(--c-field-border);
  color: var(--c-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.window__close:hover { background: var(--c-ink); color: #fff; }

.window__media {
  height: 110px;
  border-radius: 10px;
  overflow: hidden;
}
.window__media img { width: 100%; height: 100%; object-fit: cover; }
.window__media[hidden] { display: none; }

.window__text {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--c-muted);
}

.window__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  border-radius: 10px;
  background: var(--c-red);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  transition: background-color 0.2s ease;
}
.window__cta:hover { background: #d80e0f; }

/* ---------------------------------------------------------
   Малки екрани
   --------------------------------------------------------- */
@media (max-width: 720px) {
  /* На телефон етикетите не се събират в кадъра — остават само точките,
     а името се вижда в панела при докосване. */
  .pin__label { display: none; }
  .pin.is-active .pin__label {
    display: flex;
    font-size: 10.5px; height: 26px; padding: 0 10px; letter-spacing: 0.4px;
  }
  .pin__dot { width: 20px; height: 20px; }
  .pin__dot::before { inset: 3.5px; }
  .pin__dot::after { inset: 7px; }

  .map__hint { font-size: 11px; bottom: 16px; padding: 7px 12px; }
  .map__back { top: 14px; left: 14px; height: 36px; font-size: 13px; }
  .map__zoom { top: 14px; right: 14px; }
  .map__zoom-btn { width: 36px; height: 36px; }

  /* Панелът минава в долен лист — иначе няма къде да застане */
  .window {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 8px;
    width: auto;
    max-width: none;
    max-height: 72vh;
    overflow-y: auto;
    animation-name: sheet-in;
  }
  .window__title { font-size: 26px; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .window { animation: none; }
  .map__stage { transition: none !important; }
}
