/* ==========================================================================
   3D Portfolio Standing Panels & Coverflow Deck
   ========================================================================== */

:root {
  --bg-color: #08090c;
  --panel-border: rgba(255, 255, 255, 0.16);
  --panel-active-border: rgba(129, 140, 248, 0.8);
  --panel-active-glow: 0 0 35px rgba(99, 102, 241, 0.5), 0 30px 60px rgba(0, 0, 0, 0.8);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #c084fc 100%);
  --font-main: 'Montserrat', sans-serif;
  --font-body: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  --panel-width: 360px;
  --panel-height: 360px;
}

@media (max-width: 1024px) {
  :root {
    --panel-width: 300px;
    --panel-height: 300px;
  }
}

@media (max-width: 640px) {
  :root {
    --panel-width: 250px;
    --panel-height: 250px;
  }
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Ambient Dynamic Background & Grid
   ========================================================================== */
.ambient-background {
  position: fixed;
  inset: -20%;
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.18) 0%, rgba(13, 15, 22, 0.95) 60%);
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
  transition: background 0.8s ease, filter 0.8s ease;
}

.background-grid-overlay {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  z-index: 1;
  pointer-events: none;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px 32px 20px 32px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}

.logo-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge {
  font-family: var(--font-main);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  font-weight: 700;
  color: #818cf8;
  text-transform: uppercase;
}

.site-title {
  font-family: var(--font-main);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.slide-counter {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-main);
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  backdrop-filter: blur(10px);
}

.current-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
}

.counter-sep {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.total-num {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Main 3D Scene Viewport
   ========================================================================== */
.scene-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  cursor: grab;
}

.scene-container:active {
  cursor: grabbing;
}

.stage-instructions {
  position: absolute;
  top: 10px;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: rgba(15, 18, 25, 0.6);
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  pointer-events: none;
  z-index: 5;
}

.viewport-3d {
  width: 100%;
  height: 100%;
  max-height: 580px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  transform-style: preserve-3d;
  position: relative;
}

.deck-3d {
  position: relative;
  width: var(--panel-width);
  height: var(--panel-height);
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Individual 3D Standing Panel
   ========================================================================== */
.panel-3d {
  position: absolute;
  width: var(--panel-width);
  height: var(--panel-height);
  left: 0;
  top: 0;
  border-radius: 18px;
  background-color: rgba(22, 26, 35, 0.8);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  transform-style: preserve-3d;
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.15),
              opacity 0.4s ease,
              filter 0.4s ease,
              border-color 0.4s ease,
              box-shadow 0.4s ease;
  will-change: transform, opacity, filter;
  overflow: visible;
}

/* The inner card containing the image and frame */
.panel-card {
  width: 100%;
  height: 100%;
  border-radius: 17px;
  overflow: hidden;
  position: relative;
  background: #0d1017;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  transition: transform 0.4s ease;
}

/* Floor reflection shadow simulation */
.panel-reflection {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 70px;
  margin-top: 12px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), transparent 85%);
  border-radius: 14px;
  filter: blur(10px);
  opacity: 0.3;
  transform: scaleY(-1);
  pointer-events: none;
  mask-image: linear-gradient(to bottom, black, transparent);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
}

/* Active Highlight Styling */
.panel-3d.active {
  border-color: var(--panel-active-border);
  box-shadow: var(--panel-active-glow);
  cursor: zoom-in;
}

.panel-3d.active .panel-card img {
  transform: scale(1.02);
}

/* Enlarge Badge on Hover for the Center Panel */
.panel-zoom-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.panel-3d.active:hover .panel-zoom-overlay {
  opacity: 1;
}

.zoom-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #0b0d14;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.85);
  transition: transform 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.panel-3d.active:hover .zoom-icon-badge {
  transform: scale(1);
}

.zoom-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   Navigation Floating Arrows
   ========================================================================== */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(20, 24, 34, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.25s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.nav-arrow:hover {
  background: rgba(255, 255, 255, 0.95);
  color: #08090c;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.4);
}

.nav-prev { left: 16px; }
.nav-next { right: 16px; }

/* ==========================================================================
   Active Item Info Bar
   ========================================================================== */
.active-item-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(520px, 90%);
  padding: 14px 22px;
  background: rgba(20, 24, 34, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  z-index: 15;
  margin-top: 16px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.info-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.item-title {
  font-family: var(--font-main);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.item-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.detail-zoom-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.detail-zoom-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

/* ==========================================================================
   Footer Controls & Dots
   ========================================================================== */
.footer-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  flex-shrink: 0;
  z-index: 10;
}

.dot-indicators {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.dot:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.2);
}

.dot.active {
  width: 28px;
  border-radius: 9999px;
  background: var(--accent-gradient);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.keyboard-guide {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-badge {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #e2e8f0;
  font-family: monospace;
  font-size: 0.75rem;
}

.guide-divider {
  color: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

/* ==========================================================================
   Fullscreen Lightbox Modal
   ========================================================================== */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s ease;
}

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

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 9, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.lightbox-wrapper {
  position: relative;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 40px;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1010;
}

.lightbox-close:hover {
  background: #ffffff;
  color: #000000;
  transform: rotate(90deg) scale(1.08);
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1010;
  transition: all 0.2s ease;
}

.lightbox-nav-btn:hover {
  background: #ffffff;
  color: #000000;
  transform: translateY(-50%) scale(1.1);
}

.lb-prev { left: 28px; }
.lb-next { right: 28px; }

.lightbox-image-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 86vw;
  max-height: 84vh;
}

.lightbox-image-box img {
  max-width: 80vw;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.2);
  animation: modalScaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-details {
  margin-top: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.lb-tag {
  font-family: var(--font-main);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: #818cf8;
}

.lb-title {
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
}

.lb-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .app-container {
    padding: 16px;
  }

  .site-title {
    font-size: 1.4rem;
  }

  .stage-instructions {
    font-size: 0.72rem;
    padding: 4px 12px;
  }

  .nav-arrow {
    width: 42px;
    height: 42px;
  }

  .nav-prev { left: 8px; }
  .nav-next { right: 8px; }

  .active-item-info {
    width: 96%;
    padding: 12px 16px;
  }

  .item-title {
    font-size: 1rem;
  }

  .keyboard-guide {
    display: none;
  }

  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
}
