.gallery-layout {
  --gallery-section-gap: 3.5rem;
  display: grid;
  gap: var(--gallery-section-gap);
  padding-top: var(--gallery-section-gap);
  padding-bottom: 6rem;
}

.gallery-ads {
  padding: 0;
}

.pr-ads__box {
  height: 200px;
  background: #434343;
  overflow: hidden;
  position: relative;
}

.pr-ads__box picture,
.pr-ads__box img {
  display: block;
  width: 100%;
  height: 100%;
}

.pr-ads__box img {
  object-fit: cover;
}

.hero-banner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.hero-slide picture {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-pagination {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  z-index: 4;
}

.hero-dot-btn {
  position: relative;
  width: 24px;
  height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  display: block;
}

.hero-dot-btn.is-active .hero-dot {
  background: #1f2937;
}

.hero-dot__timer {
  position: absolute;
  inset: 1px;
  width: 22px;
  height: 22px;
  display: none;
}

.hero-dot-btn.is-active .hero-dot__timer {
  display: block;
}

.hero-dot__bg {
  fill: none;
  stroke: #111827;
  stroke-width: 2;
}

.hero-dot__progress {
  fill: none;
  stroke: #ef4444;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 50.27;
  stroke-dashoffset: 50.27;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  animation: heroDotProgress var(--slide-duration, 3500ms) linear forwards;
}

@keyframes heroDotProgress {
  to {
    stroke-dashoffset: 0;
  }
}

.pr-ads__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
  font-size: 14px;
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.gallery-head-copy {
  display: grid;
  gap: 2rem;
  flex: 1 1 520px;
  min-width: 0;
}

.gallery-head-intro {
  display: grid;
  gap: 1rem;
}

.gallery-title {
  margin: 0;
  color: #f6f6f9;
  font-size: clamp(1.8rem, 2.4vw, 2rem);
  line-height: 1;
}

.gallery-description {
  margin: 0;
  color: #6b6d76;
  font-size: 1.125rem;
  line-height: 1.4;
}

#galleryMeta {
  margin: 0;
  display: grid;
  gap: 1rem;
}

.gallery-meta-fact {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
  font-weight: 500;
  color: #6b6d76;
  text-box: trim-both cap alphabetic;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  -webkit-font-smoothing: antialiased;
}

.gallery-meta-fact-text {
  text-box: trim-both cap alphabetic;
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  -webkit-font-smoothing: antialiased;
}

.gallery-meta-fact::before {
  content: '';
  width: 11.132px;
  height: 11.132px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
}

.gallery-meta-fact-date::before {
  background-image: url('/wp-content/plugins/photorace/assets/figma-home/icon-calendar.svg');
}

.gallery-meta-fact-location::before {
  background-image: url('/wp-content/plugins/photorace/assets/figma-home/icon-marker.svg');
}

.gallery-buy-all {
  border: 0;
  border-radius: 0;
  background: #d52b31;
  color: #fcfcfc;
  min-height: 3.25rem;
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: nowrap;
  font-family: var(--font-display);
  text-transform: uppercase;
}

.gallery-buy-all:hover {
  filter: brightness(.92);
}

.gallery-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.625rem;
}

.photo-card {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  overflow: hidden;
  border: 0;
  background: #242424;
}

.photo-preview-btn {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  cursor: zoom-in;
  background: transparent;
}

.photo-preview-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-select-btn {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  width: 1.52rem;
  height: 1.52rem;
  border: 1.5px solid #f6f6f9;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: transparent;
  opacity: 0.5;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background-color .12s ease, border-color .12s ease;
  overflow: hidden;
}

.photo-select-btn:hover {
  transform: scale(1.04);
  opacity: 1;
}

.photo-card.selected .photo-select-btn,
.photo-select-btn.is-selected {
  background: #d52b31;
  border-color: #d52b31;
  opacity: 1;
}

.photo-select-icon {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.gallery-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  gap: 8px;
  margin: 0 auto;
}

.gallery-pager-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-page-btn {
  width: 40px;
  height: 40px;
  border-radius: 0;
  border: 0;
  padding: 8px;
  background: #d52b31;
  color: #fcfcfc;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(13, 13, 13, 0.04);
}

.gallery-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.gallery-page-arrow {
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.gallery-page-number {
  background: transparent;
  color: #d52b31;
  box-shadow: none;
}

.gallery-page-number.is-active {
  background: #d52b31;
  color: #fcfcfc;
  box-shadow: 0 1px 2px rgba(13, 13, 13, 0.04);
}

.selection-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  width: min(380px, calc(100vw - 1.4rem));
  max-height: min(72vh, 560px);
  display: grid;
  gap: 0.7rem;
  padding: 0.8rem;
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.35);
  border-radius: 0;
}

.selection-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.selection-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: pre-line;
}

.selection-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  max-height: 320px;
  overflow: auto;
}

.selection-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem;
  border-radius: 0;
  border: 1px solid var(--line);
  background: #0f1012;
}

.selection-open {
  border: 0;
  background: transparent;
  padding: 0;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.5rem;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.selection-thumb {
  width: 52px;
  height: 52px;
  border-radius: 0;
  background: #e5e7eb;
  object-fit: cover;
}

.selection-name {
  color: var(--text);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-remove {
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 0;
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  background: rgba(213, 43, 49, 0.15);
  color: #ff9ea2;
  cursor: pointer;
}

.selection-panel .pr-btn,
.selection-panel button {
  border-radius: 0;
}

#finishOrderBtn {
  font-family: var(--font-display);
  text-transform: uppercase;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.gallery-empty,
.gallery-error {
  padding: 1rem;
  text-align: center;
}

.gallery-skeleton {
  height: 150px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #17181c, #232428, #17181c);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

.gallery-lightbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  padding: 0;
}

.gallery-lightbox-nav {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 2px solid #a11217;
  background: #d52b31;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
  transition: filter .15s ease, transform .15s ease;
}

.gallery-lightbox-nav:hover:not(:disabled) {
  filter: brightness(.95);
  transform: translateY(-1px);
}

.gallery-lightbox-nav:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gallery-lightbox-frame {
  position: relative;
  display: grid;
  place-items: center;
  background: rgba(16, 17, 20, 0.96);
  border-radius: 0;
  box-shadow: 0 16px 40px rgba(18, 24, 38, 0.28);
  padding: 0.5rem;
}

.gallery-lightbox-frame img {
  display: block;
  width: auto;
  max-width: min(90vw, 1200px);
  max-height: min(78vh, 900px);
  object-fit: contain;
  border-radius: 0;
  background: #111318;
}

.gallery-lightbox-select {
  right: 0.9rem;
  top: 0.9rem;
  width: 36px;
  height: 36px;
  z-index: 3;
}

.pr-modal-panel.gallery-lightbox-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  max-width: 96vw;
  max-height: 94vh;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pr-modal-panel.gallery-lightbox-panel .pr-modal-close {
  position: absolute;
  right: -42px;
  top: 0;
  z-index: 4;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(18, 24, 38, 0.72);
  color: #fff;
  line-height: 1;
}

.pr-upsell-modal {
  display: grid;
  gap: 1rem;
  background: #f6f6f9;
  color: #202224;
  border: 1px solid #e4e5ea;
  box-shadow: 0 28px 60px rgba(0, 0, 0, .26);
  padding: 1.35rem;
}

.pr-upsell-brand {
  display: inline-flex;
  width: max-content;
  padding: .38rem .58rem;
  background: #d52b31;
  color: #fff;
  font-family: var(--font-display);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1;
}

.pr-upsell-title {
  margin: 0;
  color: #202224;
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.02;
}

.pr-upsell-copy {
  margin: 0;
  color: #5c5f66;
  font-size: .86rem;
  line-height: 1.45;
}

.pr-upsell-copy strong {
  color: #202224;
}

.pr-upsell-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  flex-wrap: nowrap;
  margin-top: .8rem;
}

.pr-upsell-actions .pr-btn {
  flex: 1 1 0;
  border-radius: 0;
  min-height: 3rem;
  font-size: .72rem;
  letter-spacing: .02em;
  font-family: var(--font-display);
  text-transform: uppercase;
}

.pr-modal-panel.pr-upsell-panel {
  width: min(520px, calc(100% - 1.2rem));
  margin-top: 6vh;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.pr-modal-panel.pr-upsell-panel .pr-modal-close {
  color: #ffffff;
  background: rgba(0, 0, 0, .55);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  position: absolute;
  top: -14px;
  right: -14px;
  margin: 0;
  z-index: 2;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 1100px) {
  .gallery-layout {
    padding-top: 2.5rem;
    gap: 2.25rem;
  }

  .gallery-head {
    align-items: flex-start;
  }

  .gallery-buy-all {
    width: 100%;
    white-space: normal;
  }

  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.1333vw;
  }

  .photo-card {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .selection-panel {
    right: 2.56vw;
    left: 2.56vw;
    width: auto;
    max-height: 52vh;
  }

  .selection-list {
    max-height: 53.3333vw;
  }

  .pr-modal-panel.gallery-lightbox-panel .pr-modal-close {
    right: 0;
    top: -10.6667vw;
  }

  .pr-upsell-actions .pr-btn { min-width: 0; }

  .pr-modal-panel.pr-upsell-panel {
    width: calc(100% - 4.2667vw);
    margin-top: 8vh;
  }

  .pr-modal-panel.pr-upsell-panel .pr-modal-close {
    top: -3.2vw;
    right: 0;
  }
}
