/* REDSKY public Gallery: compact featured preview + deferred full archive. */
html.redsky-gallery-instant-scroll {
  scroll-behavior: auto !important;
}

body #gallery.gallery-section {
  min-height: auto;
  padding-top: clamp(76px, 8vw, 112px);
  padding-bottom: clamp(76px, 8vw, 112px);
  background:
    radial-gradient(circle at 50% 16%, rgba(151, 17, 34, .12), transparent 34%),
    linear-gradient(180deg, #060709, #0a0c10);
}

body #gallery.gallery-section > .container {
  min-height: 0;
}

#gallery .center-head {
  margin-bottom: 34px;
}

#galleryFeaturedGrid.gallery-featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 18px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

#galleryFeaturedGrid.gallery-featured-grid:has(> :only-child) {
  grid-template-columns: minmax(0, 720px);
  justify-content: center;
}

#galleryFeaturedGrid.gallery-featured-grid:has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 860px;
}

#galleryFeaturedGrid .redsky-gallery-image-card {
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 10;
  padding: 0;
  text-align: left;
  grid-column: auto;
  grid-row: auto;
  appearance: none;
}

#galleryFeaturedGrid .gallery-overlay {
  width: 100%;
  padding: 22px;
}

#galleryFeaturedGrid .gallery-overlay p {
  margin: 0;
  color: rgba(232, 235, 241, .76);
  font-size: .84rem;
  line-height: 1.45;
}

.gallery-preview-state {
  grid-column: 1 / -1;
  min-height: 230px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 26px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(194, 28, 47, .13), transparent 45%),
    rgba(255, 255, 255, .025);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .3);
}

.gallery-preview-state > span {
  color: #ff7783;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .17em;
}

.gallery-preview-state h3 {
  margin: 12px 0 10px;
  color: #fff;
  font: 800 clamp(1.15rem, 2.2vw, 1.65rem) / 1.2 Orbitron, Inter, sans-serif;
}

.gallery-preview-state p {
  max-width: 560px;
  margin: 0;
  color: #9ba3af;
  line-height: 1.65;
}

.gallery-preview-actions {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.gallery-preview-actions .btn {
  min-width: 220px;
}

.redsky-gallery-image-card:focus-visible,
.redsky-gallery-full-card:focus-visible,
.redsky-gallery-album:focus-visible,
.redsky-gallery-icon-button:focus-visible,
.redsky-gallery-lightbox-nav:focus-visible {
  outline: 2px solid #ff7581;
  outline-offset: 3px;
}

.redsky-gallery-browser,
.redsky-gallery-lightbox {
  position: fixed;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.redsky-gallery-browser {
  z-index: 650;
  padding: 18px;
  background: rgba(2, 4, 7, .88);
  backdrop-filter: blur(16px);
  transition: opacity .24s ease, visibility .24s ease;
}

.redsky-gallery-browser.is-open,
.redsky-gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.redsky-gallery-browser-shell {
  width: min(1500px, 100%);
  height: calc(100vh - 36px);
  height: calc(100dvh - 36px);
  margin: 0 auto;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 28px;
  background:
    radial-gradient(circle at 85% 0%, rgba(155, 18, 36, .13), transparent 30%),
    #080a0e;
  box-shadow: 0 34px 110px rgba(0, 0, 0, .65);
  transform: translateY(16px) scale(.99);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}

.redsky-gallery-browser.is-open .redsky-gallery-browser-shell {
  transform: none;
}

.redsky-gallery-browser-head {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 104px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(8, 10, 14, .9);
  backdrop-filter: blur(18px);
}

.redsky-gallery-browser-head span {
  color: #ff7783;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.redsky-gallery-browser-head h2 {
  margin: 7px 0 0;
  font: 800 clamp(1.55rem, 3vw, 2.5rem) / 1 Orbitron, Inter, sans-serif;
}

.redsky-gallery-icon-button,
.redsky-gallery-lightbox-nav {
  appearance: none;
  min-width: 46px;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .055);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.redsky-gallery-icon-button {
  font-size: 1.8rem;
}

.redsky-gallery-icon-button:hover,
.redsky-gallery-lightbox-nav:hover {
  transform: scale(1.05);
  border-color: rgba(255, 93, 106, .5);
  background: rgba(153, 18, 36, .28);
}

.redsky-gallery-albums {
  display: flex;
  gap: 10px;
  padding: 22px 28px 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.redsky-gallery-album {
  appearance: none;
  min-height: 44px;
  padding: 0 15px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #c8cdd6;
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
  font-weight: 800;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.redsky-gallery-album small {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #aeb5c0;
  background: rgba(255, 255, 255, .07);
}

.redsky-gallery-album[aria-pressed="true"] {
  color: #fff;
  border-color: rgba(255, 91, 104, .42);
  background: linear-gradient(135deg, rgba(122, 18, 37, .75), rgba(53, 7, 15, .82));
  box-shadow: 0 8px 26px rgba(0, 0, 0, .24);
}

.redsky-gallery-notice {
  margin: 8px 28px 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  color: #aeb5c0;
  background: rgba(255, 255, 255, .025);
  font-size: .84rem;
}

.redsky-gallery-notice[hidden] {
  display: none;
}

.redsky-gallery-full-grid {
  padding: 20px 28px 34px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.redsky-gallery-full-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 10;
  padding: 0;
  overflow: hidden;
  appearance: none;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, .085);
  border-radius: 20px;
  color: #fff;
  background: #0d1116;
  box-shadow: 0 18px 52px rgba(0, 0, 0, .3);
  cursor: pointer;
  isolation: isolate;
}

.redsky-gallery-full-card > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .5s ease, filter .3s ease;
}

.redsky-gallery-full-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 28%, rgba(2, 4, 7, .88));
}

.redsky-gallery-full-card:hover > img {
  transform: scale(1.04);
  filter: saturate(1.08);
}

.redsky-gallery-full-copy {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  padding: 18px;
  display: grid;
  gap: 6px;
}

.redsky-gallery-full-copy > span {
  color: #ff7a86;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .14em;
}

.redsky-gallery-full-copy h3 {
  margin: 0;
  color: #fff;
  font: 800 1rem / 1.2 Orbitron, Inter, sans-serif;
}

.redsky-gallery-full-copy p {
  margin: 0;
  overflow: hidden;
  color: rgba(228, 232, 239, .7);
  font-size: .76rem;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.redsky-gallery-full-grid > .gallery-preview-state {
  min-height: 360px;
}

.redsky-gallery-lightbox {
  z-index: 720;
  padding: 34px 94px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 22px;
  background: rgba(1, 3, 6, .94);
  backdrop-filter: blur(18px);
  transition: opacity .22s ease, visibility .22s ease;
}

.redsky-gallery-lightbox-close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  right: max(22px, env(safe-area-inset-right));
  z-index: 2;
}

.redsky-gallery-lightbox-nav {
  width: 54px;
  height: 54px;
  font-size: 2.1rem;
}

.redsky-gallery-lightbox-panel {
  min-width: 0;
  max-width: min(1180px, 100%);
  max-height: calc(100vh - 70px);
  max-height: calc(100dvh - 70px);
  margin: 0 auto;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.redsky-gallery-lightbox-panel img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  max-height: calc(100dvh - 190px);
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  background: #05070a;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .65);
}

.redsky-gallery-lightbox-panel figcaption {
  max-width: 760px;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.redsky-gallery-lightbox-panel figcaption > span {
  color: #ff7b87;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .17em;
}

.redsky-gallery-lightbox-panel figcaption > strong {
  color: #fff;
  font: 800 clamp(1rem, 2vw, 1.4rem) / 1.2 Orbitron, Inter, sans-serif;
}

.redsky-gallery-lightbox-panel figcaption > p {
  margin: 0;
  color: #aeb5c0;
  line-height: 1.5;
}

@media (max-width: 1120px) {
  .redsky-gallery-full-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  #galleryFeaturedGrid.gallery-featured-grid,
  #galleryFeaturedGrid.gallery-featured-grid:has(> :nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .redsky-gallery-lightbox {
    padding: 76px 18px 22px;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 10px;
  }
}

@media (max-width: 620px) {
  body #gallery.gallery-section {
    padding-top: 72px;
    padding-bottom: 72px;
  }

  #gallery .center-head {
    margin-bottom: 26px;
  }

  #galleryFeaturedGrid.gallery-featured-grid,
  #galleryFeaturedGrid.gallery-featured-grid:has(> :nth-child(2):last-child) {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  #galleryFeaturedGrid .redsky-gallery-image-card {
    aspect-ratio: 16 / 10;
    border-radius: 20px;
  }

  #galleryFeaturedGrid .gallery-overlay {
    padding: 18px;
  }

  #galleryFeaturedGrid .gallery-overlay h3 {
    font-size: 1.05rem;
  }

  #galleryFeaturedGrid .gallery-overlay p {
    display: none;
  }

  .gallery-preview-state {
    min-height: 190px;
    padding: 24px 18px;
    border-radius: 20px;
  }

  .gallery-preview-actions {
    margin-top: 20px;
  }

  .gallery-preview-actions .btn {
    width: 100%;
    min-height: 50px;
  }

  .redsky-gallery-browser {
    padding: 0;
  }

  .redsky-gallery-browser-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .redsky-gallery-browser-head {
    min-height: 86px;
    padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  }

  .redsky-gallery-browser-head h2 {
    font-size: 1.42rem;
  }

  .redsky-gallery-albums {
    padding: 16px 16px 8px;
    scrollbar-width: none;
  }

  .redsky-gallery-albums::-webkit-scrollbar {
    display: none;
  }

  .redsky-gallery-notice {
    margin: 8px 16px 0;
  }

  .redsky-gallery-full-grid {
    grid-template-columns: 1fr;
    gap: 13px;
    padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  }

  .redsky-gallery-full-card {
    aspect-ratio: 16 / 10;
    border-radius: 18px;
  }

  .redsky-gallery-lightbox {
    padding: 72px 14px 84px;
    display: block;
  }

  .redsky-gallery-lightbox-panel {
    width: 100%;
    height: 100%;
    align-content: center;
  }

  .redsky-gallery-lightbox-panel img {
    max-height: calc(100vh - 230px);
    max-height: calc(100dvh - 230px);
    border-radius: 16px;
  }

  .redsky-gallery-lightbox-nav {
    position: absolute;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 2;
  }

  .redsky-gallery-lightbox-nav.is-prev {
    left: calc(50% - 62px);
  }

  .redsky-gallery-lightbox-nav.is-next {
    right: calc(50% - 62px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .redsky-gallery-browser,
  .redsky-gallery-browser-shell,
  .redsky-gallery-lightbox,
  .redsky-gallery-full-card > img,
  .redsky-gallery-icon-button,
  .redsky-gallery-lightbox-nav {
    transition: none !important;
  }
}
