.gallery-item:not(.is-hidden) {
  cursor: zoom-in;
}

button.gallery-item {
  display: block;
  border: none;
  padding: 0;
  margin: 0;
  background: none;
  font: inherit;
  text-align: inherit;
  color: inherit;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

.lightbox.is-open {
  display: block;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.lightbox-main {
  pointer-events: auto;
  display: flex;
  gap: 24px;
  max-width: min(1400px, calc(100vw - 48px));
  max-height: 92vh;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.lightbox-image-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  margin: 0;
}

.lightbox-image-stage {
  position: relative;
  flex-shrink: 0;
  max-width: 100%;
  max-height: 80vh;
  overflow: hidden;
}

.lightbox-image-stage img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-image-stage .lightbox-image--thumb-layer {
  opacity: 0;
  z-index: 0;
  transition: none;
  box-shadow: none;
  visibility: hidden;
}

.lightbox-image-stage .lightbox-image--thumb-layer.is-active {
  opacity: 1;
  z-index: 1;
  visibility: visible;
}

.lightbox-image-stage .lightbox-image--full.is-loaded {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.lightbox-image-stage .lightbox-image--full {
  opacity: 0;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.lightbox-image-stage .lightbox-image--full.is-loaded {
  opacity: 1;
}

.lightbox-image-stage.is-build-grid .lightbox-nav-btn,
.lightbox-image-stage.is-build-grid .lightbox-image--thumb-layer,
.lightbox-image-stage.is-build-grid .lightbox-image--full {
  visibility: hidden;
  pointer-events: none;
}

.lightbox-image-stage.is-build-focus {
  max-height: calc(80vh - 72px);
}

.lightbox-build-grid {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
  align-content: start;
}

.lightbox-build-grid[hidden] {
  display: none !important;
}

.lightbox-build-grid button {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  cursor: zoom-in;
  aspect-ratio: 16 / 9;
}

.lightbox-build-grid button:hover,
.lightbox-build-grid button:focus-visible {
  border-color: #5865F2;
  outline: none;
}

.lightbox-build-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox-build-filmstrip {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  padding: 8px 2px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.lightbox-build-filmstrip[hidden] {
  display: none !important;
}

.lightbox-build-filmstrip-item {
  flex: 0 0 auto;
  width: 88px;
  height: 56px;
  padding: 0;
  margin: 0;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.lightbox-build-filmstrip-item:hover,
.lightbox-build-filmstrip-item:focus-visible {
  opacity: 1;
  border-color: rgba(88, 101, 242, 0.65);
  outline: none;
}

.lightbox-build-filmstrip-item.is-active {
  opacity: 1;
  border-color: #5865F2;
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.35);
}

.lightbox-build-filmstrip-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox-build-back {
  align-self: flex-start;
  margin-top: 2px;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lightbox-build-back:hover {
  color: #fff;
}

.lightbox-build-back[hidden] {
  display: none !important;
}

.lightbox-open-tab {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  text-decoration: none;
}

.lightbox-open-tab:hover {
  color: #fff;
}

.lightbox-panel {
  flex: 0 0 320px;
  flex-shrink: 0;
  width: 320px;
  min-width: 320px;
  margin: 0;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(18, 19, 23, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 18px;
  color: #e8e8e8;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  pointer-events: auto;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  color: #fff;
}

.lightbox-owner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.lightbox-owner img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.lightbox-owner-name {
  font-weight: 600;
  font-size: 15px;
}

.lightbox-meta-row {
  margin-bottom: 12px;
  font-size: 14px;
}

.lightbox-meta-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.lightbox-rating {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.lightbox-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.lightbox-votes {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.lightbox-vote-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.lightbox-vote-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.lightbox-vote-btn.is-active-up {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
}

.lightbox-vote-btn.is-active-down {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.lightbox-vote-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lightbox-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
}

.lightbox-similar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.lightbox-similar-grid button {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
}

.lightbox-similar-grid img {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: cover;
}

.lightbox-comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  max-height: 220px;
  overflow-y: auto;
}

.lightbox-comment {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.lightbox-comment img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lightbox-comment-body {
  min-width: 0;
}

.lightbox-comment-author {
  font-weight: 600;
  margin-bottom: 2px;
}

.lightbox-comment time {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  margin-left: 6px;
  font-weight: 400;
}

.lightbox-comment-form textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
}

.lightbox-comment-form button {
  margin-top: 8px;
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.lightbox-comment-form button:hover {
  background: #4752c4;
}

.lightbox-login-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.lightbox-login-hint a {
  color: #5865f2;
}

@media (max-width: 900px) {
  .lightbox-dialog {
    padding: 12px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .lightbox-main {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-height: none;
    overflow: visible;
  }

  .lightbox-image-wrap {
    flex: none;
    width: auto;
    max-width: 100%;
    align-items: center;
  }

  .lightbox-image-stage {
    max-width: 100%;
    max-height: 50vh;
  }

  .lightbox-panel {
    flex: none;
    width: 100%;
    min-width: 0;
    max-height: none;
  }
}
