/* CraftAttack.me - Community Gallery */

.gallery-intro {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 28px;
  background: var(--color-bg-card);
  border: 2px solid var(--mc-border-light);
  border-top-color: var(--mc-highlight);
  border-left-color: var(--mc-highlight);
  border-bottom-color: var(--mc-border-dark);
  border-right-color: var(--mc-border-dark);
}
.gallery-intro-icon {
  font-size: 1.6rem;
  color: var(--color-primary);
  line-height: 1;
  flex-shrink: 0;
}
.gallery-intro p {
  font-size: 0.9rem;
  margin-bottom: 2px;
  color: var(--color-text);
  font-weight: 600;
}
.gallery-intro span {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.gallery-count {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}
.gallery-count strong {
  color: var(--color-primary);
  font-weight: 700;
}

/* Gallery sections (e.g. Shopping District vs all images) */
.gallery-section { margin-bottom: 48px; }
.gallery-section-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--mc-border-dark);
  position: relative;
}
.gallery-section-head::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 80px;
  height: 2px;
  background: var(--color-primary);
}
.gallery-section-tag {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--color-primary);
  background: rgba(255,152,0,0.1);
  border: 1px solid rgba(255,152,0,0.3);
  padding: 3px 10px;
  margin-bottom: 8px;
}
.gallery-section-head h2 {
  font-size: 1.4rem;
  margin-bottom: 4px;
  color: var(--color-text);
}
.gallery-section-head p {
  font-size: 0.86rem;
  color: var(--color-text-muted);
}

/* Shopping District grid - fewer columns, bigger tiles */
.gallery-grid-shop { column-count: 2; }
@media (max-width: 640px) { .gallery-grid-shop { column-count: 1; } }

/* Masonry-like CSS columns layout */
.gallery-grid {
  column-count: 4;
  column-gap: 12px;
  margin-bottom: 40px;
}
@media (max-width: 900px) { .gallery-grid { column-count: 3; } }
@media (max-width: 640px) { .gallery-grid { column-count: 2; } }
@media (max-width: 420px) { .gallery-grid { column-count: 1; } }

.gallery-item {
  break-inside: avoid;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--mc-border-dark);
  border-top-color: var(--mc-border-light);
  border-left-color: var(--mc-border-light);
  background: var(--color-bg-card);
  cursor: pointer;
  display: block;
  transition: transform var(--transition), border-color var(--transition);
}
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
  image-rendering: auto;
}
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.7) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.gallery-item:hover {
  border-top-color: var(--color-primary);
  border-left-color: var(--color-primary);
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item:hover::after { opacity: 1; }
.gallery-item-label {
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
  font-size: 0.72rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 2;
  font-family: monospace;
  letter-spacing: 0.5px;
}
.gallery-item:hover .gallery-item-label { opacity: 1; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 7, 4, 0.94);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: lbFade 0.2s ease;
}
.lightbox.open { display: flex; }
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  cursor: zoom-out;
}
.lightbox-content {
  position: relative;
  max-width: min(1400px, 95vw);
  max-height: 90vh;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  border: 2px solid var(--mc-border-dark);
  border-top-color: var(--mc-border-light);
  border-left-color: var(--mc-border-light);
  background: var(--color-bg);
  padding: 6px;
  max-height: 82vh;
}
.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}
.lightbox-caption {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-family: monospace;
  text-align: center;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: var(--color-bg-card);
  border: 2px solid var(--mc-border-dark);
  border-top-color: var(--mc-border-light);
  border-left-color: var(--mc-border-light);
  color: var(--color-text);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  z-index: 3;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--color-primary);
  color: #1a1410;
}
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
  .lightbox { padding: 12px; }
  .lightbox-close { top: 8px; right: 8px; width: 38px; height: 38px; }
  .lightbox-prev { left: 6px; width: 38px; height: 38px; }
  .lightbox-next { right: 6px; width: 38px; height: 38px; }
}

/* Compact gallery strip (used on server.html + sub-tabs) */
.gallery-strip-section {
  margin: 40px 0 48px;
}
.gallery-strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.gallery-strip-head h3 {
  font-size: 1rem;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.gallery-strip-head a {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}
.gallery-strip-head a:hover { color: var(--color-primary); }

.gallery-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.gallery-strip a {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 2px solid var(--mc-border-dark);
  border-top-color: var(--mc-border-light);
  border-left-color: var(--mc-border-light);
  background: var(--color-bg-card);
}
.gallery-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery-strip a:hover img { transform: scale(1.08); }
.gallery-strip a::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,152,0,0) 60%, rgba(255,152,0,0.25));
  opacity: 0;
  transition: opacity var(--transition);
}
.gallery-strip a:hover::after { opacity: 1; }

@media (max-width: 900px) { .gallery-strip { grid-template-columns: repeat(3, 1fr); } .gallery-strip a:nth-child(n+7) { display: none; } }
@media (max-width: 480px) { .gallery-strip { grid-template-columns: repeat(2, 1fr); } .gallery-strip a:nth-child(n+5) { display: none; } }

/* Inline single image (accent image in sub-tabs) */
.inline-shot {
  margin: 28px 0;
  border: 2px solid var(--mc-border-dark);
  border-top-color: var(--mc-border-light);
  border-left-color: var(--mc-border-light);
  background: var(--color-bg-card);
  padding: 6px;
  position: relative;
}
.inline-shot img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 380px;
  object-fit: cover;
}
.inline-shot figcaption {
  position: absolute;
  bottom: 10px;
  left: 14px;
  background: rgba(10,7,4,0.75);
  padding: 4px 10px;
  font-size: 0.72rem;
  color: var(--color-text);
  font-family: monospace;
  letter-spacing: 0.5px;
  border-left: 2px solid var(--color-primary);
}

/* Community server link card variant with image */
.server-link.with-img {
  padding: 0;
  overflow: hidden;
}
.server-link.with-img .server-link-img {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-bg);
}
.server-link.with-img .server-link-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.server-link.with-img:hover .server-link-img img { transform: scale(1.06); }
.server-link.with-img .server-link-body { padding: 16px 18px 20px; }
