/* ==========================================================================
   KANG YUMIN PORTFOLIO (No Hover Effect on Image Boxes & Optimized WebP Images)
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: #ffffff;
  color: #000000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 500; /* Medium Font Weight */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  font-weight: inherit;
}

/* Top Left Fixed Brand Title */
.top-left-brand {
  position: fixed;
  top: 2rem;
  left: 2.5rem;
  z-index: 300;
}

.brand-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #000000;
  text-transform: uppercase;
  transition: text-decoration 0.15s ease;
}

/* Underline Only on Hover */
.brand-title:hover {
  text-decoration: underline;
}

/* Bottom Left Navigation Container (Fixed Stationary Anchor) */
.bottom-left-nav {
  position: fixed;
  bottom: 2rem;
  left: 2.5rem;
  z-index: 300;
}

/* Bottom Control Buttons (Pinned - Category & Info Never Shift) */
.bottom-controls {
  display: flex;
  align-items: center;
  gap: 3.5rem; /* Gap between Category and Info */
}

.bottom-nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: #000000;
  line-height: 1.35;
  transition: text-decoration 0.15s ease;
  display: inline-block;
  min-width: 60px; /* Pinned width */
  text-align: left;
}

/* Underline Only on Hover */
.bottom-nav-link:hover {
  text-decoration: underline;
}

/* Absolute Upward Drawers (Floating Above Specific Buttons) */
.nav-drawer {
  position: absolute;
  bottom: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: drawerFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
  white-space: nowrap;
}

/* Category Drawer: Directly above Category / Close (Left) */
.category-drawer-pos {
  left: 0;
}

/* Info Drawer: Directly above Info / Close (Right - Exact Image 1 Match) */
.info-drawer-pos {
  left: calc(60px + 3.5rem); /* Positioned exactly above the Info button */
}

@keyframes drawerFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.drawer-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: #000000;
  line-height: 1.35;
  transition: text-decoration 0.15s ease;
  display: block;
}

/* Underline Only on Hover & Active */
.drawer-link:hover,
.drawer-link.active {
  text-decoration: underline;
}

/* Clickable Contact Links (Email, Phone, Instagram) */
.info-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: #000000;
  line-height: 1.45;
  display: block;
  transition: text-decoration 0.15s ease;
}

/* Underline Only on Hover */
.info-link:hover {
  text-decoration: underline;
}

/* Main Content Wrapper (Centered across ENTIRE Viewport) */
.content-wrapper {
  width: 100%;
  padding: 2.5rem 1.5rem 6rem 1.5rem;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.main-content {
  margin-left: 0; /* Perfectly Centered relative to screen width */
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Viewport-Centered Masonry Grid Cluster */
.portfolio-masonry {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  column-count: 5;
  column-gap: 0.5rem;
  padding-top: 0.5rem;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1), transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth Fade-Out State on Category Switch */
.portfolio-masonry.filtering-out {
  opacity: 0;
  transform: translateY(8px);
}

/* Pure Solid Grey Box / Image Box Elements (Fixed 4:5 Aspect Ratio) */
.grey-box {
  width: var(--w, 100%);
  aspect-ratio: 4 / 5;
  background-color: #d8d8d8;
  margin-bottom: 0.35rem;
  margin-top: var(--mt, 0px);
  break-inside: avoid;
  display: block;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  z-index: var(--z, 1);
  transform: rotate(var(--rot, 0deg)) translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--s, 1));
  transform-origin: center center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Embedded Real Image inside Grid Box */
.grey-box .box-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Staggered Wave Entrance Animation */
@keyframes fadeInGreyBox {
  from {
    opacity: 0;
    transform: rotate(var(--rot, 0deg)) translate(var(--tx, 0px), calc(var(--ty, 0px) + 16px)) scale(calc(var(--s, 1) * 0.95));
  }
  to {
    opacity: 1;
    transform: rotate(var(--rot, 0deg)) translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--s, 1));
  }
}

.grey-box.animate-in {
  animation: fadeInGreyBox 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--delay, 0) * 10ms);
}

/* Alignments inside masonry columns */
.align-left { margin-left: 0; margin-right: auto; }
.align-right { margin-left: auto; margin-right: 0; }
.align-center { margin-left: auto; margin-right: auto; }

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.96);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: modalFade 0.2s ease-out;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-modal.hidden,
.nav-drawer.hidden {
  display: none !important;
}

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.5rem;
  font-weight: 500;
  color: #000;
  z-index: 1010;
  width: 40px;
  height: 40px;
}

.modal-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  font-weight: 500;
  color: #000;
  z-index: 1010;
  width: 40px;
  height: 40px;
}

.prev-btn { left: 1.5rem; }
.next-btn { right: 1.5rem; }

.modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 750px;
  width: 100%;
}

.modal-media-container {
  width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.modal-media-container .grey-box-large {
  width: 360px;
  aspect-ratio: 4 / 5;
  background-color: #d8d8d8;
}

.modal-media-container .modal-img {
  max-height: 65vh;
  width: auto;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.modal-info {
  text-align: center;
}

.modal-title-text {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.modal-meta-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: #666;
}

/* Responsiveness for Masonry Columns & Controls */
@media (max-width: 1200px) {
  .top-left-brand { top: 1.5rem; left: 1.5rem; }
  .bottom-left-nav { bottom: 1.5rem; left: 1.5rem; }
  
  .portfolio-masonry {
    max-width: 720px;
    column-count: 4;
  }
}

@media (max-width: 960px) {
  .portfolio-masonry {
    max-width: 540px;
    column-count: 3;
  }
}

@media (max-width: 720px) {
  .portfolio-masonry {
    max-width: 380px;
    column-count: 2;
  }
}

@media (max-width: 550px) {
  .top-left-brand { top: 1rem; left: 1rem; }
  .bottom-left-nav { bottom: 1rem; left: 1rem; }
  .info-drawer-pos { left: calc(50px + 1.5rem); }

  .content-wrapper {
    padding-top: 4rem;
    padding-bottom: 5rem;
  }

  .portfolio-masonry {
    max-width: 100%;
    column-count: 1;
  }
}
