/* TALS — Panorama (scoped to #panorama) • Footer SSOT (—app-hf) */

/* Pano güvenli yüksekliği: merkezi değişkene bağla */
#panorama,
.tals-pano {
  --pano-safe-h: var(--app-hf);
}

.tals-pano {
  position: relative;
  background: var(--pano-info-bg-d, var(--pano-info-bg, var(--section-bg, #000)));
  color: var(--c-text, #fff);
  min-height: var(--pano-safe-h);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Inter,
    Helvetica,
    Arial;
}

.tals-pano__viewport {
  position: relative;
  height: var(--pano-safe-h);
  overflow: hidden;
}

#tals-pano-view {
  position: absolute;
  inset: 0;
}

/* Dots (sahne seçimi) — footer alanı zaten düşüldüğü için yalnız safe-area */
.tals-pano__dots {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  grid-auto-flow: column;
  gap: 10px;
}
.tals-pano__dots button {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  cursor: pointer;
  opacity: 0.8;
}
.tals-pano__dots button[aria-current='true'] {
  background: #fff;
  opacity: 1;
}

/* Alt slayt barı — yalnız safe-area */
.tals-pano__bar {
  position: absolute;
  left: 50%;
  bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 22px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  font-size: 14px;
  color: #fff;
  z-index: 6;
}
.tals-pano__bar .pano-nav {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  cursor: pointer;
}
.tals-pano__bar .pano-count {
  min-width: 64px;
  text-align: center;
  opacity: 0.9;
}

/* Tarayıcı jestlerinin dışarı taşmasını engelle (yumuşak) */
#tals-pano-root,
#tals-pano-view {
  overscroll-behavior: contain;
}

/* Gerçek overlay elemanı */
.tals-pano__viewport > .tals-pano__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;

  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.9));
  color: #fff;
  z-index: 30;
  pointer-events: auto;
}

.tals-pano__loading-spinner {
  width: 34px;
  height: 34px;
  margin-top: 14px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: panoSpin 0.9s linear infinite;
}

@keyframes panoSpin {
  to {
    transform: rotate(360deg);
  }
}

.tals-pano__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.96));
  color: rgba(255, 255, 255, 0.88);
}

@media (max-width: 1023.98px) {
  /* Mobilde sayfa yukarı-aşağı doğal kayabilsin, panorama içi jestler kilitlemesin */
  #tals-pano-root,
  #tals-pano-view {
    touch-action: pan-y pinch-zoom;
    overscroll-behavior: contain;
  }

  /* [ROLLBACK: pano-mobile-full-overlay] Mobilde pano tam ekran + overlay bilgi karti */
  .tals-pano--split .tals-pano__layout {
    height: var(--pano-safe-h);
    display: block !important;
    grid-template-columns: none !important;
    position: relative;
    gap: 0;
    overflow: hidden;
  }

  .tals-pano--split .tals-pano__viewport {
    position: absolute;
    inset: 0;
    height: 100%;
    width: 100%;
    grid-column: auto !important;
    border-radius: 0;
  }

  .tals-pano--split .tals-pano__info {
    display: none;
    position: absolute;
    left: calc(16px + env(safe-area-inset-left, 0px));
    right: 16px;
    top: var(--pano-info-top-pos-m, auto);
    bottom: var(
      --pano-info-bottom-pos-m,
      calc(var(--pano-info-bottom-m, 18px) + env(safe-area-inset-bottom, 0px))
    );
    z-index: 12;
    grid-column: auto !important;
    min-height: 0;
    max-width: min(var(--pano-info-maxw-m, 92%), 520px);
    width: auto;
    margin: 0;
    border-radius: var(--pano-info-radius-m, 0);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: var(--pano-info-pad-m, var(--pano-info-pad));
    background: color-mix(
      in oklab,
      var(--pano-info-bg-m, var(--pano-info-bg-d, var(--pano-info-bg, rgba(8, 10, 14, 0.92))))
        var(--pano-info-bg-opacity-m, 84%),
      transparent
    );
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    justify-content: var(--pano-info-valign-m, var(--pano-info-valign, flex-start));
    text-align: var(--pano-text-align-m, var(--pano-text-align, left));
    transform: translate(
      var(--pano-info-shift-x-m, 0px),
      calc(var(--pano-info-shift-m, 0%) + var(--pano-info-shift-y-m, 0px))
    );
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: min(72%, calc(100% - clamp(96px, 16vh, 180px) - var(--pano-info-bottom-m, 18px)));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.24s ease,
      transform 0.24s ease,
      visibility 0.24s ease;
  }

  .tals-pano--split .tals-pano__layout::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(2, 4, 8, 0.52);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.24s ease,
      visibility 0.24s ease;
    z-index: 11;
  }

  .tals-pano.is-info-open .tals-pano__layout::after {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .tals-pano.is-info-open .tals-pano__info {
    display: flex;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(
      var(--pano-info-shift-x-m, 0px),
      calc(var(--pano-info-shift-m, 0%) + var(--pano-info-shift-y-m, 0px) - 4px)
    );
  }

  .tals-pano__info .tpi__title {
    font-size: var(--pano-title-fs-m, var(--pano-title-fs-d, 22px)) !important;
    font-weight: var(--pano-title-fw-m, var(--pano-title-fw-d, 700)) !important;
    color: var(
      --pano-title-color-m,
      var(--pano-title-color-d, var(--pano-title-color, inherit))
    ) !important;
  }

  .tals-pano__info .tpi__kicker {
    color: var(
      --pano-kicker-color-m,
      var(--pano-kicker-color-d, var(--pano-kicker-color, inherit))
    ) !important;
  }

  .tals-pano__info .tpi__desc {
    font-size: var(--pano-desc-fs-m, var(--pano-desc-fs-d, 13px)) !important;
    font-weight: var(--pano-desc-fw-m, var(--pano-desc-fw-d, 400)) !important;
    color: var(
      --pano-desc-color-m,
      var(--pano-desc-color-d, var(--pano-desc-color, inherit))
    ) !important;
  }

  .tals-pano__info .tpi__close {
    display: grid;
  }

  .tals-pano__info .tpi__actions {
    position: sticky !important;
    top: 0;
    align-self: stretch;
    display: flex !important;
    justify-content: flex-end;
    gap: 8px;
    margin: 0 0 8px;
    padding: 0 0 6px;
    width: 100%;
    z-index: 2;
    background: linear-gradient(
      180deg,
      color-mix(
        in oklab,
        var(--pano-info-bg-m, var(--pano-info-bg-d, var(--pano-info-bg, rgba(8, 10, 14, 0.92))))
          var(--pano-info-bg-opacity-m, 84%),
        transparent
      ),
      transparent
    );
  }

  .tals-pano__info .tpi__scroll {
    display: none !important;
  }

  .tals-pano__info .tpi__close > span {
    transform: translateY(-1px);
  }

  .tals-pano__info .tpi__kicker,
  .tals-pano__info .tpi__title,
  .tals-pano__info .tpi__desc {
    padding-right: 0 !important;
    width: 100%;
    max-width: 100%;
  }
}

.tals-pano__hint {
  position: absolute;
  left: 50%;
  bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 64px);
  transform: translateX(-50%);
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  opacity: 0.9;
  pointer-events: none;
}

/* === Panorama — Sol Bilgi + Sağ Viewport (split) ===================== */
.tals-pano--split {
  /* Varsayılan tema değişkenleri (Customizer’dan override edilebilir) */
  --pano-info-w: 36%;
  --pano-info-w-d: var(--pano-info-w, 36%);
  --pano-info-track-d: minmax(280px, var(--pano-info-w-d, var(--pano-info-w, 36%)));
  --pano-info-pad: clamp(24px, 4vw, 42px);
  --pano-info-bg: color-mix(in oklab, var(--c-bg, #0b0c0f) 88%, transparent);
  --pano-info-fg: var(--c-text, #eaeaea);
  --pano-gap: clamp(16px, 3.4vw, 28px);

  /* kart stil değişkenleri */
  --pano-info-radius: 0px;
  --pano-info-valign: center; /* flex-start/center/flex-end */
  --pano-text-align: left; /* left/center/right */
  --pano-title-fs: clamp(20px, 3.2vw, 34px);
  --pano-title-fw: 800;
  --pano-desc-fs: 14px;
  --pano-desc-fw: 400;
  --pano-title-color: var(--pano-info-fg, #eaeaea);
  --pano-kicker-color: var(--pano-title-color, var(--pano-info-fg, #eaeaea));
  --pano-desc-color: var(--pano-info-fg, #eaeaea);
  --pano-title-font:
    ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
  --pano-desc-font:
    ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;

  /* min height değişkeni */
  --pano-info-min-h: auto;
}

.tals-pano__layout {
  position: relative;
  height: var(--pano-safe-h);
  display: block;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.tals-pano__info {
  position: absolute;
  z-index: 12;
  top: var(--pano-info-y-d, 50%);
  transform: translate(
    var(--pano-info-shift-x-d, 0px),
    calc(var(--pano-info-shift-d, -50%) + var(--pano-info-shift-y-d, 0px))
  );
  background: color-mix(
    in oklab,
    var(--pano-info-bg-d, var(--pano-info-bg, rgba(8, 10, 14, 0.84))) 84%,
    transparent
  );
  color: var(--pano-info-fg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--pano-info-radius-d, var(--pano-info-radius));
  width: min(100%, var(--pano-info-w-d, var(--pano-info-w, 36%)));
  max-width: calc(100% - clamp(40px, 10vw, 160px));
  max-height: calc(100% - clamp(48px, 10vh, 120px));
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  text-align: var(--pano-text-align-d, var(--pano-text-align));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-height: var(--pano-info-min-h);
  padding: var(--pano-info-pad-d, var(--pano-info-pad));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  scrollbar-width: none;
}

.tals-pano--split .tals-pano__info {
  left: clamp(32px, 6vw, 80px);
}

.tals-pano--split[data-info-side-d='right'] .tals-pano__info {
  left: auto;
  right: clamp(32px, 6vw, 80px);
}

.tals-pano__info::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.tals-pano__info .tpi__title {
  margin: 0 0 0.6em 0;
  font-family: var(--pano-title-font, inherit);
  font-weight: var(--pano-title-fw-d, var(--pano-title-fw, 700));
  font-size: var(--pano-title-fs-d, var(--pano-title-fs, clamp(20px, 3.2vw, 34px)));
  color: var(--pano-title-color-d, var(--pano-title-color, var(--pano-info-fg, inherit)));
  line-height: 1.05;
}

.tals-pano__info .tpi__kicker {
  color: var(--pano-kicker-color-d, var(--pano-kicker-color, var(--pano-title-color, inherit)));
}

.tals-pano__info .tpi__desc {
  font-family: var(--pano-desc-font, inherit);
  font-weight: var(--pano-desc-fw-d, var(--pano-desc-fw, 400));
  font-size: var(--pano-desc-fs-d, var(--pano-desc-fs, 14px));
  color: var(--pano-desc-color-d, var(--pano-desc-color, var(--pano-info-fg, inherit)));
  line-height: 1.6;
}

.tals-pano__info .tpi__kicker,
.tals-pano__info .tpi__title,
.tals-pano__info .tpi__desc {
  padding-right: 120px;
}

.tals-pano__info .tpi__close {
  display: none;
}

.tals-pano__info .tpi__actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 3;
}

.tals-pano__info .tpi__scroll,
.tals-pano__info .tpi__close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.tals-pano__info .tpi__scroll:hover,
.tals-pano__info .tpi__close:hover {
  opacity: 0.9;
}

.tals-pano__info .tpi__scroll:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Sağ viewport */
.tals-pano--split .tals-pano__viewport {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--c-border);
}

/* Pannellum'un kendi siyah hata kutusunu gizle; kendi fallback'imizi kullanıyoruz */
#tals-pano-view .pnlm-error-msg {
  display: none !important;
}

/* PANO — Header/Footer aware viewport (masaüstü) */
@media (min-width: 1024px) {
  :is(#panorama, section[data-section='panorama']) .tals-pano__layout {
    box-sizing: border-box;
    min-height: var(--pano-safe-h);
    padding-top: 0;
  }
}

/* === Desktop split layout: solda panel, sağda pano full === */
@media (min-width: 1024px) {
  .tals-pano--split .tals-pano__layout {
    height: var(--pano-safe-h);
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: var(--pano-info-track-d) minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    max-width: none;
    margin: 0;
    position: relative !important;
    overflow: hidden !important;
  }

  .tals-pano--split .tals-pano__info {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 2;
    width: auto !important;
    min-width: 0;
    max-width: 100% !important;
    max-height: none !important;
    height: 100%;
    margin: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    -webkit-backdrop-filter: blur(8px) !important;
    backdrop-filter: blur(8px) !important;
    box-sizing: border-box;
    justify-content: var(--pano-info-valign-d, var(--pano-info-valign, center));
    gap: 12px;
    background: color-mix(
      in oklab,
      var(--pano-info-bg-d, var(--pano-info-bg, rgba(8, 10, 14, 0.84))) 84%,
      transparent
    );
    color: var(--pano-info-fg);
    border-radius: var(--pano-info-radius-d, var(--pano-info-radius));
    border: 0;
    box-shadow: none;
    padding: var(--pano-info-pad-d, var(--pano-info-pad));
    text-align: var(--pano-text-align-d, var(--pano-text-align));
    transform: translate(var(--pano-info-shift-x-d, 0px), var(--pano-info-shift-y-d, 0px));
    overflow: auto;
    overflow-x: hidden;
    min-height: var(--pano-info-min-h);
    justify-self: stretch;
    align-self: stretch;
  }

  .tals-pano--split[data-info-side-d='right'] .tals-pano__info {
    grid-column: 2;
    text-align: var(--pano-text-align-d, right);
  }

  .tals-pano--split[data-info-side-d='right'] .tals-pano__layout {
    grid-template-columns: minmax(0, 1fr) var(--pano-info-track-d);
  }

  .tals-pano--split .tals-pano__viewport {
    position: relative;
    inset: auto;
    grid-column: 2;
    height: 100%;
    min-width: 0;
    border-radius: 0;
    border: 0;
  }

  .tals-pano--split[data-info-side-d='right'] .tals-pano__viewport {
    grid-column: 1;
  }

  .tals-pano--split[data-info-side-d='right'] .tals-pano__info .tpi__kicker,
  .tals-pano--split[data-info-side-d='right'] .tals-pano__info .tpi__title,
  .tals-pano--split[data-info-side-d='right'] .tals-pano__info .tpi__desc {
    margin-left: auto;
  }

  .tals-pano--split .tals-pano__layout::after {
    display: none !important;
  }

  .tals-pano__info .tpi__close {
    display: none !important;
  }

  .tals-pano__info .tpi__scroll,
  .tals-pano__info .tpi__actions {
    display: none !important;
  }

  .tals-pano__info .tpi__kicker,
  .tals-pano__info .tpi__title,
  .tals-pano__info .tpi__desc {
    padding-right: 0 !important;
  }
}

/* Panorama section'da köşeleri yuvarlama kapalı */
#panorama {
  border-radius: 0 !important;
  overflow: visible;
}

#panorama .tals-pano__viewport {
  border-radius: 0 !important;
}
