/*
 * 360度画像（[gkk_panorama]）の表示。
 * 色と余白はテーマの値（--color-* / --space-* / --focus-ring-*）があれば使い、無ければ下の値で出す。
 * figure に alignwide を付けてあるので、記事の列より広げるかはテーマが決める（gkkyoto は記事の列いっぱいに広げる）。
 */

.gkk-panorama {
  margin: var(--topics-image-space, 2rem) 0 0;
  padding: 0;
}

.gkk-panorama__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 80svh;
  overflow: hidden;
  background: var(--color-bg-subtle, #ececec);
}

.gkk-panorama__viewer {
  position: absolute;
  inset: 0;
}

.gkk-panorama__viewer:focus-visible {
  outline: var(--focus-ring-width, 2px) solid var(--focus-ring-color, #4c4948);
  outline-offset: calc(-1 * var(--focus-ring-width, 2px));
}

/* ビューアが画像を読み終えるまで（読めないときも）出す静止画 */
.gkk-panorama .gkk-panorama__still {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  object-fit: cover;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.gkk-panorama.is-loaded .gkk-panorama__still {
  opacity: 0;
}

/* Pannellum はビューアの要素そのものに pnlm-container を付ける。位置は上の指定のまま、地は静止画を見せるため透かす */
.gkk-panorama__viewer.pnlm-container {
  position: absolute;
  inset: 0;
  background: transparent;
}

.gkk-panorama__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  font-family: var(--font-latin, "Helvetica Neue", Arial, sans-serif);
  font-size: 15px;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgb(0 0 0 / 0.45));
  pointer-events: none;
}

.gkk-panorama__badge-text {
  order: -1;
  margin-bottom: -2px;
  letter-spacing: 0.04em;
}

.gkk-panorama__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.gkk-panorama__thumb {
  position: relative;
  width: calc((100% - 3 * 8px) / 4);
  max-width: 200px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  aspect-ratio: 2 / 1;
  outline-offset: 2px;
}

.gkk-panorama .gkk-panorama__thumb img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  object-fit: cover;
  transition: opacity var(--dur-fast, 0.15s) ease;
}

.gkk-panorama__thumb[aria-pressed="true"] {
  outline: 2px solid var(--color-heading, #4c4948);
}

.gkk-panorama__thumb:focus-visible {
  outline: var(--focus-ring-width, 2px) solid var(--focus-ring-color, #4c4948);
}

@media (hover: hover) {
  .gkk-panorama__thumb[aria-pressed="false"]:hover img {
    opacity: 0.7;
  }
}

@media (max-width: 768px) {
  .gkk-panorama__thumb {
    width: calc((100% - 2 * 8px) / 3);
  }

  .gkk-panorama__badge {
    top: 8px;
    right: 8px;
    font-size: 13px;
  }

  .gkk-panorama__badge-arrow {
    width: 40px;
    height: 12px;
  }
}

.gkk-panorama__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
