* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background-color: #f8f8f8;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background-color: #fff;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.logo h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.logo p {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 1px;
  color: #666;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 30px;
}

.nav-link {
  text-decoration: none;
  color: #666;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  transition: color 0.3s ease;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  color: #333;
}

.contact-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  color: #666;
  letter-spacing: 0.5px;
}

/* Gallery */
.main {
  padding: 40px 0;
}

.gallery {
  columns: 4;
  column-gap: 20px;
  margin-top: 20px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  break-inside: avoid;
  display: inline-block;
  width: 100%;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
  will-change: transform;
  display: block;
  background-color: #fff;
}

.gallery-item img:not([src]),
.gallery-item img[src=""] {
  background-color: #fff;
  border: none;
  outline: none;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.gallery-item:hover .overlay {
  transform: translateY(0);
}

.overlay h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 5px;
}

.overlay p {
  font-size: 12px;
  opacity: 0.9;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
  position: relative;
  margin: auto;
  padding: 50px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.close:hover {
  opacity: 0.7;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}

.modal-prev,
.modal-next {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 30px;
  padding: 15px 25px;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.3s ease;
}

.modal-prev:hover,
.modal-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .gallery {
    columns: 3;
    column-gap: 15px;
  }

  .header .container {
    flex-direction: column;
    gap: 20px;
    padding: 15px 20px;
  }

  .logo p {
    text-align: center;
  }

  .nav-list {
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .contact-info {
    align-items: center;
    text-align: center;
  }

  .gallery {
    columns: 2;
    column-gap: 15px;
  }

  .modal-content {
    padding: 10px;
    width: 95%;
    height: 95%;
  }

  .close {
    top: 10px;
    right: 20px;
    font-size: 30px;
  }

  .modal-nav {
    padding: 0 10px;
  }

  .modal-prev,
  .modal-next {
    font-size: 24px;
    padding: 10px 15px;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 20px;
  }

  .nav-link {
    font-size: 12px;
  }

  .gallery {
    columns: 1;
    column-gap: 10px;
  }
}

/* 이미지 비율 유지를 위한 스타일 제거 */

/* 애니메이션 */
.gallery-item {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.gallery-item:nth-child(1) {
  animation-delay: 0.05s;
}
.gallery-item:nth-child(2) {
  animation-delay: 0.1s;
}
.gallery-item:nth-child(3) {
  animation-delay: 0.15s;
}
.gallery-item:nth-child(4) {
  animation-delay: 0.2s;
}
.gallery-item:nth-child(5) {
  animation-delay: 0.25s;
}
.gallery-item:nth-child(6) {
  animation-delay: 0.3s;
}

/* 이미지 로딩 상태 */
.gallery-item img.lazy {
  filter: blur(2px);
  transition: filter 0.3s ease;
}

.gallery-item img.loaded {
  filter: none;
}

/* 썸네일 이미지 스타일 */
.gallery-item img[data-thumbnail] {
  transition: all 0.3s ease;
}

/* 원본 이미지 스타일 (모달용) */
.modal-image {
  transition: opacity 0.3s ease;
}

/* 로딩 스켈레톤 */
.gallery-item img[src*="data:image/svg"] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 성능 최적화 */
.gallery {
  contain: layout style paint;
}

.gallery-item {
  contain: layout style paint;
  transform: translateZ(0); /* GPU 가속 */
}

/* 모달 이미지 최적화 */
.modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.modal-image[src*="data:image/svg"] {
  opacity: 0.7;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 필터 전환 애니메이션 */
.gallery-item.hidden {
  display: none;
}

.gallery-item.visible {
  display: block;
}
