/* Art Space 2015 GALLERY detail loading v0.96 */
/* Gallery detail loading states: keep the page usable while images arrive. */
.gallery-detail-page .gallery-stage-figure {
  position: relative;
}

.gallery-detail-page .gallery-stage-figure::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: linear-gradient(100deg, #f6f5f4 25%, #ecebea 42%, #f6f5f4 59%);
  background-size: 240% 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}

.gallery-detail-page .gallery-stage-figure.is-initializing::before {
  opacity: 1;
  animation: gallery-skeleton-shift 1.3s ease-in-out infinite;
}

.gallery-detail-page .gallery-stage-image {
  position: relative;
  z-index: 1;
  display: block;
}

.gallery-detail-page .gallery-stage-figure.is-loading.has-loaded-image .gallery-stage-image {
  opacity: .9;
}

.gallery-detail-page .gallery-stage-image.is-revealing {
  animation: gallery-image-reveal .18s ease-out;
}

.gallery-stage-loader {
  position: absolute;
  z-index: 3;
  top: min(46%, 270px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: calc(100% - 40px);
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid rgba(216, 212, 211, .72);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #7f7b7e;
  box-shadow: 0 3px 14px rgba(72, 67, 69, .08);
  font-family: "Yu Gothic", "YuGothic", Meiryo, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  transform: translate(-50%, -50%);
}

.gallery-stage-loader[hidden] {
  display: none;
}

.gallery-stage-loader-text[hidden],
.gallery-stage-loader-compact[hidden] {
  display: none;
}

.gallery-stage-loader-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
}

.gallery-stage-loader-spinner {
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(127, 123, 126, .28);
  border-top-color: #7f7b7e;
  border-radius: 50%;
  animation: gallery-loader-spin .72s linear infinite;
}

.gallery-stage-loader-dots {
  position: relative;
  top: -1px;
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  line-height: 1;
}

.gallery-stage-loader.is-error {
  border-color: rgba(213, 139, 126, .58);
  background: rgba(255, 250, 249, .96);
}

.gallery-stage-retry,
.gallery-thumb-retry {
  border: 1px solid #d2a59e;
  border-radius: 999px;
  background: #fff;
  color: #806661;
  font: inherit;
  cursor: pointer;
}

.gallery-stage-retry {
  flex: 0 0 auto;
  padding: 3px 9px;
}

.gallery-stage-retry:hover,
.gallery-stage-retry:focus-visible,
.gallery-thumb-retry:hover,
.gallery-thumb-retry:focus-visible {
  border-color: var(--nav-coral);
  color: #6e514c;
}

.gallery-stage-arrow:disabled {
  color: #d5d5d5;
  cursor: wait;
  opacity: .56;
}

.gallery-stage-arrow:disabled:hover {
  color: #d5d5d5;
}

.gallery-loading-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 9px;
  min-height: 22px;
  margin: 9px auto 0;
  color: #8d898c;
  font-family: "Yu Gothic", "YuGothic", Meiryo, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.gallery-loading-status.is-complete {
  visibility: hidden;
}

.gallery-main-status,
.gallery-thumb-status {
  margin: 0;
}

.gallery-main-status + .gallery-thumb-status:not([hidden])::before {
  content: "・";
  margin-right: 9px;
  color: #c7c4c5;
}

.gallery-thumb-retry {
  padding: 2px 9px;
}

.gallery-detail-page .gallery-thumbnails {
  margin-top: 8px;
}

.gallery-thumb-button {
  position: relative;
  overflow: hidden;
}

.gallery-thumb-button::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 2px;
  background: linear-gradient(100deg, #f4f3f2 25%, #e7e5e4 42%, #f4f3f2 59%);
  background-size: 240% 100%;
  opacity: 0;
  pointer-events: none;
}

.gallery-thumb-button.is-loading::before {
  opacity: 1;
  animation: gallery-skeleton-shift 1.25s ease-in-out infinite;
}

.gallery-thumb-button img {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity .16s ease;
}

.gallery-thumb-button.is-ready img {
  opacity: 1;
}

.gallery-thumb-button.is-error::after {
  content: "↻";
  position: absolute;
  z-index: 2;
  inset: 2px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background: #faf5f4;
  color: #b57f76;
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1;
}

@keyframes gallery-loader-spin {
  to { transform: rotate(360deg); }
}

@keyframes gallery-skeleton-shift {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes gallery-image-reveal {
  from { opacity: .45; }
  to { opacity: 1; }
}

@media (max-width: 760px) {
  .gallery-loading-status {
    padding: 0 10px;
    font-size: 10.5px;
  }

  .gallery-stage-loader {
    max-width: calc(100% - 24px);
    padding: 6px 10px;
    font-size: 10.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-detail-page .gallery-stage-figure.is-initializing::before,
  .gallery-thumb-button.is-loading::before,
  .gallery-detail-page .gallery-stage-image.is-revealing,
  .gallery-stage-loader-spinner {
    animation: none;
  }

  .gallery-detail-page .gallery-stage-image,
  .gallery-thumb-button img,
  .gallery-detail-page .gallery-stage-figure::before {
    transition: none;
  }
}

/* v0.95: thumbnail sheets + staged, non-blocking progress display */
.gallery-stage-loader {
  flex-wrap: wrap;
}

.gallery-stage-loader-slow {
  flex: 1 0 100%;
  color: #999497;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
}

.gallery-stage-loader-slow[hidden],
.gallery-slow-status[hidden] {
  display: none;
}

.gallery-slow-status {
  flex: 1 0 100%;
  margin: 1px 0 0;
  color: #999497;
  font-size: 10px;
}

.gallery-thumb-sprite {
  position: relative;
  z-index: 1;
  display: block;
  width: 40px;
  height: 40px;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity .16s ease;
}

.gallery-thumb-fallback {
  display: none;
}

.gallery-thumb-button.uses-sheet.is-ready .gallery-thumb-sprite {
  opacity: 1;
}

.gallery-thumb-button.uses-fallback.is-ready .gallery-thumb-sprite {
  display: none;
}

.gallery-thumb-button.uses-fallback.is-ready .gallery-thumb-fallback {
  display: block;
}

@media (max-width: 390px) {
  .gallery-thumb-sprite {
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-thumb-sprite {
    transition: none;
  }
}
