/**
 * Deep Zoom ビューア（OpenSeadragon）
 *
 * レイアウト:
 * - PC: 説明文 +（ビューア | サムネイル）
 * - SP: 説明文 + ビューア + サムネイル
 * 全体は admin バーを除いた画面高さに収める。
 */

body {
  background: #fff;
}

.deep-zoom-wrap {
  --deep-zoom-admin-offset: var(--wp-admin--admin-bar--height, var(--admin-bar-height, 0px));
  position: fixed;
  inset: var(--deep-zoom-admin-offset) 0 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100dvh - var(--deep-zoom-admin-offset));
  max-width: 100%;
  margin: 0;
  background: #fff;
  overflow: hidden;
  box-sizing: border-box;
}

.deep-zoom__note {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.75em 1em;
  font-size: 0.875rem;
  line-height: 1.5;
}

.deep-zoom {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.deep-zoom__viewer {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 1em;
  background: #fff;
  box-sizing: border-box;
}

.deep-zoom__viewer .openseadragon-canvas {
  outline: none;
}

.deep-zoom__loading {
  position: absolute;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: rgba(255, 255, 255, 0.72);
  /* 画面全体（説明文・サムネ含む）を覆い、操作をブロックする */
  pointer-events: auto;
}

.deep-zoom__loading[hidden] {
  display: none !important;
}

.deep-zoom__loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  min-width: 8.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.deep-zoom__spinner {
  display: block;
  width: 2rem;
  height: 2rem;
  border: 3px solid #e5e5e5;
  border-top-color: #333;
  border-radius: 50%;
  animation: deep-zoom-spin 0.8s linear infinite;
}

.deep-zoom__loading-text {
  color: #333;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

@keyframes deep-zoom-spin {
  to {
    transform: rotate(360deg);
  }
}

.deep-zoom__thumbs {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: start;
  padding: 1em;
  margin: 0;
  list-style: none;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.deep-zoom__thumbs-item {
  margin: 0;
}

.deep-zoom__thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 5.5rem;
  padding: 0.4rem;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.deep-zoom__thumb:hover,
.deep-zoom__thumb:focus-visible {
  border-color: #999;
  outline: none;
}

.deep-zoom__thumb.is-active {
  border-color: #333;
  box-shadow: 0 0 0 1px #333;
}

.deep-zoom__thumb-img,
.deep-zoom__thumb-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eee;
}

.deep-zoom__viewer--error,
.deep-zoom__error {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 120px;
  padding: 1.5rem;
  margin: 0;
  color: #333;
  background: #f5f5f5;
  font-size: 0.875rem;
  text-align: center;
}

.deep-zoom__viewer--error {
  height: 100%;
}

@media (width < 768px) {
  .deep-zoom {
    flex-direction: column;
  }

  .deep-zoom__viewer {
    flex: 1 1 auto;
    min-height: 0;
  }

  .deep-zoom__thumbs {
    flex-direction: row;
    flex: 0 0 5em;
    height: 5em;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .deep-zoom__thumb {
    width: 3.5rem;
  }
}
