/* Gallery */

.gallery-section {
  width: 100%;
}

.gallery-header {
  margin-bottom: 35px;
}

.gallery-header h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -1.5px;
}

.gallery-header p {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 16px;
}

/* Empty gallery */

.gallery-empty {
  width: 100%;
  min-height: 360px;
  padding: 60px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.035),
    rgba(124, 140, 255, 0.025)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.gallery-empty-icon {
  margin-bottom: 20px;
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 8px 15px rgba(124, 140, 255, 0.18));
}

.gallery-empty h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.5px;
}

.gallery-empty p {
  width: min(520px, 100%);
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.gallery-empty .button {
  margin-top: 25px;
}

/* Masonry gallery */

.gallery {
  columns: 4 220px;
  column-gap: 14px;
}

.gallery:has(.gallery-empty) {
  columns: unset;
}

.gallery-item {
  position: relative;
  width: 100%;
  margin: 0 0 14px;
  break-inside: avoid;
  overflow: hidden;
  background: rgba(24, 27, 37, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.18),
    0 2px 8px rgba(255, 255, 255, 0.025);
  transform: translateY(0);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.015) 45%,
    rgba(124, 140, 255, 0.035)
  );
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  transform: scale(1);
  transition:
    transform 0.4s ease,
    filter 0.4s ease;
}

.gallery-item:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.3),
    0 5px 15px rgba(124, 140, 255, 0.08);
}

.gallery-item:hover::after {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.018);
  filter: brightness(1.055) saturate(1.02);
}

/* Gallery modal */

.gallery-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
  visibility: hidden;
  opacity: 0;
  z-index: 1000;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.gallery-modal.open {
  visibility: visible;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(10px) saturate(115%);
  -webkit-backdrop-filter: blur(10px) saturate(115%);
  cursor: pointer;
}

/* Modal content */

.modal-content {
  position: relative;
  width: min(1100px, 100%);
  max-height: 90vh;
  display: grid;
  grid-template-columns:
    minmax(0, 1.5fr)
    minmax(260px, 0.7fr);
  overflow: hidden;
  background: rgba(24, 27, 37, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.02);
  transform: scale(0.96);
  transition: transform 0.25s ease;
  z-index: 1;
}

.gallery-modal.open .modal-content {
  transform: scale(1);
}

/* Modal image */

.modal-image-container {
  position: relative;
  min-width: 0;
  min-height: 400px;
  height: 90vh;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #090b10;
}

.modal-image-container img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Modal information */

.modal-info {
  position: relative;
  padding: 35px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(
    145deg,
    rgba(28, 31, 43, 0.96),
    rgba(20, 23, 32, 0.94)
  );
  backdrop-filter: blur(28px) saturate(130%);
  -webkit-backdrop-filter: blur(28px) saturate(130%);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-info::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(
      circle at 15% 20%,
      rgba(124, 140, 255, 0.12),
      transparent 45%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0));
}

/* Author */

.author-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.author-avatar {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(124, 140, 255, 0.18);
}

.modal-author {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.modal-fursona {
  margin-top: 3px;
  color: #d1d5e0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

/* Creation date */

.modal-created {
  margin-top: 30px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.modal-created-label {
  display: block;
  margin-bottom: 5px;
  color: #8991a8;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.modal-created-value {
  color: #c5cad7;
}

/* Modal close button */

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(17, 19, 26, 0.78);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  font-family: inherit;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.modal-close:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  transform: rotate(90deg);
}

/* Gallery responsive layout */

@media (max-width: 900px) {
  .gallery {
    columns: 3 180px;
    column-gap: 12px;
  }

  .gallery-item {
    margin-bottom: 12px;
  }

  .modal-content {
    grid-template-columns: 1fr;
    max-height: 92vh;
  }

  .modal-image-container {
    height: 60vh;
    max-height: 60vh;
    min-height: 250px;
  }

  .modal-info {
    padding: 25px;
    gap: 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .modal-created {
    margin-top: 20px;
  }
}

@media (max-width: 700px) {
  .gallery-header {
    margin-bottom: 25px;
  }

  .gallery {
    columns: 2 140px;
    column-gap: 10px;
  }

  .gallery-item {
    margin-bottom: 10px;
    border-radius: 10px;
  }

  .gallery-item img {
    border-radius: 10px;
  }

  .gallery-item:hover {
    transform: translateY(-3px);
  }

  .gallery-empty {
    min-height: 300px;
    padding: 45px 20px;
  }

  .gallery-empty h2 {
    font-size: 21px;
  }

  .gallery-empty p {
    font-size: 14px;
  }

  .gallery-modal {
    padding: 15px;
  }

  .modal-content {
    border-radius: 12px;
  }

  .modal-image-container {
    height: 55vh;
    max-height: 55vh;
  }

  .modal-info {
    padding: 22px;
  }

  .author-avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
}

@media (max-width: 450px) {
  .gallery {
    columns: 1;
  }

  .gallery-header h1 {
    font-size: 32px;
  }

  .gallery-header p {
    font-size: 14px;
  }

  .modal-image-container {
    height: 50vh;
    max-height: 50vh;
  }
}
