/*=====================================
 Panorama cards
========================================*/
.panorama-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.panorama-card {
  position: relative;
  width: 100%;
  min-height: 300px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background-color: var(--black);
  color: var(--white);
  text-align: left;
  cursor: pointer;
}

.panorama-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.78) 100%);
}

.panorama-card img {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
  transition: transform 600ms ease;
}

.panorama-card:hover img {
  transform: scale(1.035);
}

.panorama-card__content {
  position: absolute;
  right: 24px;
  bottom: 22px;
  left: 24px;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.panorama-card__title {
  font-family: var(--font-1);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.panorama-card__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background-color: var(--main);
  font-family: var(--font-2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 991px) {
  .panorama-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .panorama-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .panorama-card {
    min-height: 240px;
  }
}

/*=====================================
 Panorama viewer
========================================*/
body.panorama-is-open {
  overflow: hidden;
}

.panorama-modal[hidden] {
  display: none;
}

.panorama-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 240ms ease, visibility 240ms ease;
}

.panorama-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.panorama-modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.96);
}

.panorama-modal__dialog {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background-color: #000;
}

.panorama-modal__header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 4;
  min-height: 72px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--white);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent);
  pointer-events: none;
}

.panorama-modal__heading h2,
.panorama-modal__heading p {
  margin: 0;
  color: inherit;
}

.panorama-modal__heading h2 {
  font-family: var(--font-2);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
}

.panorama-modal__heading p {
  margin-top: 4px;
  font-family: var(--font-2);
  font-size: 14px;
  line-height: 1.3;
  opacity: 0.78;
}

.panorama-modal__close {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 200ms ease;
}

.panorama-modal__close:hover {
  background-color: var(--main);
}

.panorama-modal__close .ui-icon {
  width: 28px;
  height: 28px;
}

.panorama-modal__viewer {
  width: 100%;
  height: 100%;
}

.panorama-modal__viewer .pnlm-controls-container {
  top: 76px;
}

.panorama-modal__controls {
  position: absolute;
  top: 176px;
  left: 4px;
  z-index: 5;
  display: grid;
  gap: 4px;
}

.panorama-modal__controls button {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 3px;
  color: #333;
  background-color: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.panorama-modal__controls button:hover,
.panorama-modal__controls button:focus,
.panorama-modal__controls button.is-active {
  color: var(--white);
  background-color: var(--main);
}

.panorama-modal__controls button:disabled {
  cursor: default;
  opacity: 0.45;
}

.panorama-modal__controls .ui-icon {
  width: 18px;
  height: 18px;
}

.panorama-modal__controls button.is-active .ui-icon--eye {
  --ui-icon-mask: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS13aWR0aD0iMS44IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgYXJpYS1oaWRkZW49InRydWUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIuNSAxMnMzLjUtNiA5LjUtNiA5LjUgNiA5LjUgNi0zLjUgNi05LjUgNi05LjUtNi05LjUtNloiIC8+PGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMi43NSIgLz48cGF0aCBjbGFzcz0icGFub3JhbWEtbW9kYWxfX2V5ZS1zbGFzaCIgZD0iTTQgNCAyMCAyMCIgLz48L3N2Zz4=");
}

.panorama-modal__message {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: min(90%, 520px);
  margin: 0;
  padding: 18px 22px;
  color: var(--white);
  background-color: rgba(0, 0, 0, 0.82);
  font-family: var(--font-2);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  transform: translate(-50%, -50%);
}

.panorama-modal__debug {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  width: min(320px, calc(100% - 48px));
  padding: 16px;
  display: grid;
  gap: 8px;
  color: var(--white);
  background-color: rgba(0, 0, 0, 0.82);
  border-left: 3px solid var(--main);
  font-family: var(--font-2);
  font-size: 14px;
  line-height: 1.4;
  backdrop-filter: blur(8px);
}

.panorama-modal__debug-label {
  color: var(--main);
  font-weight: 700;
}

.panorama-modal__debug code {
  color: var(--white);
  font-family: monospace;
  font-size: 13px;
}

.panorama-modal__debug button {
  justify-self: start;
  padding: 8px 12px;
  border: 0;
  color: var(--white);
  background-color: var(--main);
  font-family: var(--font-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.panorama-modal__debug button:disabled {
  cursor: default;
  opacity: 0.5;
}

/* Znacznik dokładnego punktu w trybie ustawiania hotspotów */
.kalisz-panorama-debug-marker {
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid var(--white);
  border-radius: 50%;
  background-color: var(--main);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.62), 0 3px 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* Hotspoty panoramy: informacja i przejście do innej perspektywy */
.kalisz-hotspot {
  --hotspot-marker-size: 30px;
  --hotspot-panel-bg: rgba(23, 23, 23, 0.92);
  --hotspot-panel-header-bg: rgba(255, 255, 255, 0.1);
  --hotspot-panel-text: #fff;
  --hotspot-panel-muted: rgba(255, 255, 255, 0.78);
  --hotspot-panel-radius: 14px;
  width: var(--hotspot-marker-size);
  height: var(--hotspot-marker-size);
  border-radius: 50%;
  color: var(--white);
  background-color: rgba(var(--panorama-hotspot-rgb), 0.72);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.kalisz-hotspot--info {
  transition: opacity 220ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.kalisz-hotspot--info::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  height: 18px;
}

.kalisz-hotspot--info::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -4px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  animation: kalisz-panorama-marker-pulse 2s ease-out infinite;
}

.panorama-modal.are-info-hotspots-hidden .kalisz-hotspot--info {
  opacity: 0;
  visibility: hidden !important;
  pointer-events: none;
}

.kalisz-hotspot--info:hover,
.kalisz-hotspot--info:focus,
.kalisz-hotspot--info.is-tooltip-open {
  background-color: rgba(var(--panorama-hotspot-rgb), 0.72);
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.38);
}

.kalisz-hotspot__icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.kalisz-hotspot__icon svg,
.kalisz-hotspot__header-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kalisz-hotspot--panorama {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background-color: rgba(23, 23, 23, 0.58);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.34);
}

.kalisz-hotspot__panorama-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.kalisz-hotspot__panorama-icon span {
  position: absolute;
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--white);
  border-left: 2px solid var(--white);
  animation: kalisz-panorama-arrow-bounce 1.5s ease-in-out infinite;
}

.kalisz-hotspot__tooltip {
  position: absolute;
  bottom: calc(100% + 18px);
  left: 50%;
  width: min(360px, calc(100vw - 40px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--hotspot-panel-radius);
  color: var(--hotspot-panel-text);
  background-color: var(--hotspot-panel-bg);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.38), 0 6px 20px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 24px) scale(0.82);
  transform-origin: 50% 100%;
  transition: opacity 220ms ease, transform 420ms cubic-bezier(0.16, 1, 0.3, 1), visibility 220ms ease;
}

.kalisz-hotspot__header {
  min-height: 58px;
  padding: 9px 56px 9px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  background-color: var(--hotspot-panel-header-bg);
}

.kalisz-hotspot__header-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background-color: rgba(var(--panorama-hotspot-rgb), 0.72);
}

.kalisz-hotspot__header-icon svg {
  width: 24px;
  height: 24px;
}

.kalisz-hotspot__body {
  padding: 18px 20px 19px;
}

.kalisz-hotspot--panorama .kalisz-hotspot__tooltip {
  bottom: calc(100% + 17px);
  left: 50%;
  width: max-content;
  max-width: min(320px, calc(100vw - 40px));
  padding: 14px 19px;
  overflow: visible;
  border-color: rgba(255, 255, 255, 0.32);
  border-radius: 11px;
  color: var(--black);
  background-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
  text-align: left;
  transform: translate(-24px, 18px) rotate(-5deg) scale(0.82);
  transform-origin: 24px 100%;
}

.kalisz-hotspot__tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  border: 8px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.9);
  transform: translateX(-50%);
}

.kalisz-hotspot--panorama .kalisz-hotspot__tooltip::after {
  top: calc(100% - 1px);
  left: 24px;
  border-width: 10px 9px 0;
  border-color: rgba(255, 255, 255, 0.92) transparent transparent;
  transform: translateX(-50%);
}

.kalisz-hotspot:not(.is-tooltip-closed):hover .kalisz-hotspot__tooltip,
.kalisz-hotspot:not(.is-tooltip-closed):focus .kalisz-hotspot__tooltip,
.kalisz-hotspot.is-tooltip-open .kalisz-hotspot__tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.kalisz-hotspot.kalisz-hotspot--panorama:hover .kalisz-hotspot__tooltip,
.kalisz-hotspot.kalisz-hotspot--panorama:focus .kalisz-hotspot__tooltip {
  pointer-events: none;
  transform: translate(-24px, 0) rotate(0) scale(1);
}

.kalisz-hotspot__close {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background-color: rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.kalisz-hotspot__close:hover {
  color: var(--white);
  background-color: var(--main);
  transform: rotate(8deg);
}

.kalisz-hotspot__close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.kalisz-hotspot__title,
.kalisz-hotspot__description {
  display: block;
  margin: 0;
  font-family: var(--font-2);
}

.kalisz-hotspot__title {
  color: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.kalisz-hotspot__description {
  color: var(--hotspot-panel-muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}

.kalisz-hotspot__link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--main);
  font-family: var(--font-2);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.kalisz-hotspot__link::after {
  content: "→";
  margin-left: 16px;
  font-size: 18px;
  transition: transform 180ms ease;
}

.kalisz-hotspot__link:hover {
  color: var(--main);
  text-decoration: none;
}

.kalisz-hotspot__link:hover::after {
  transform: translateX(4px);
}

@keyframes kalisz-panorama-marker-pulse {
  0% {
    opacity: 0.44;
    transform: scale(0.82);
  }
  70% {
    opacity: 0;
    transform: scale(1.45);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes kalisz-panorama-arrow-bounce {
  0%,
  100% {
    transform: translateY(-4px) rotate(225deg);
  }
  50% {
    transform: translateY(0) rotate(225deg);
  }
}

@media (max-width: 576px) {
  .panorama-modal__header {
    min-height: 64px;
    padding: 10px 12px 10px 16px;
  }

  .panorama-modal__heading h2 {
    font-size: 17px;
  }

  .panorama-modal__close {
    width: 44px;
    height: 44px;
  }

  .panorama-modal__viewer .pnlm-controls-container {
    top: 68px;
  }

  .panorama-modal__controls {
    top: 168px;
  }

  .panorama-modal__debug {
    right: 12px;
    bottom: 12px;
    width: min(300px, calc(100% - 24px));
  }

  .kalisz-hotspot__tooltip {
    width: min(260px, calc(100vw - 40px));
  }

  .kalisz-hotspot--panorama .kalisz-hotspot__tooltip {
    max-width: min(240px, calc(100vw - 40px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .panorama-modal,
  .panorama-card img,
  .kalisz-hotspot,
  .kalisz-hotspot__tooltip,
  .kalisz-hotspot--info::after,
  .kalisz-hotspot__panorama-icon span {
    transition: none;
    animation: none;
  }
}
