/* Work Stage — 3D Spiral Gallery & Dual-View Styles (Light Theme) */
/* Seamlessly integrated with portfolio white stage & minimalist typography */

:root {
  --work-bg: var(--stage);
  --work-glass: var(--glass);
  --work-glass-border: var(--line);
  --work-text: var(--ink);
  --work-muted: var(--muted-2);
}

body.work-body {
  background-color: var(--stage);
  background-image: none;
  color: var(--ink);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  margin: 0;
  user-select: none;
  -webkit-user-select: none;
}

/* Viewport Stage */
.work-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* 3D WebGL Canvas */
.webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
  z-index: 1;
}

/* Top View Switch & Audio Controls */
.top-view-toggle {
  position: fixed;
  top: 29px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  background-color: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px;
  box-shadow: var(--shadow-nav);
}

.view-switch-cluster {
  display: inline-grid;
  grid-template-columns: repeat(2, 68px);
  position: relative;
  border-radius: var(--radius-pill);
}

.view-pill-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 68px;
  border-radius: var(--radius-pill);
  background-color: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.view-pill-indicator.is-spiral {
  transform: translateX(0);
}

.view-pill-indicator.is-list {
  transform: translateX(68px);
}

.view-link {
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  padding: 0;
}

.view-link:hover {
  color: var(--ink);
}

.view-link.is-active {
  color: var(--ink);
  font-weight: 600;
}

/* Floating Hover Tag / Badge (Cursor Follower in 3D Mode) */
.spiral-hover-tag {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.spiral-hover-tag.is-active {
  opacity: 1;
  visibility: visible;
}

.hover-tag-thumb-wrap {
  width: 44px;
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f2;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.hover-tag-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hover-tag-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spiral-hover-tag__title {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.badge-loop-track-wrapper {
  overflow: hidden;
  width: 140px;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

.badge-loop-track {
  display: flex;
  width: max-content;
  animation: badgeLoopTrack 12s linear infinite;
  will-change: transform;
}

.badge-loop-segment {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted-2);
  letter-spacing: 0.1em;
  white-space: nowrap;
  padding-right: 12px;
}

@keyframes badgeLoopTrack {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Typographic List View Container */
.list-container {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 100px 24px 70px;
  background: transparent;
  pointer-events: none;
}

.list-centered-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 960px;
  margin: auto;
}

.list-project-item {
  width: 100%;
  text-align: center;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  pointer-events: auto;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.list-title-mask {
  display: inline-flex;
  align-items: baseline;
  gap: 18px;
  overflow: hidden;
}

.list-project-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.list-project-title {
  font-family: var(--font-body);
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  transition: color 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-block;
}

.list-project-series {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted-2);
  letter-spacing: 0.1em;
}

.list-project-item:hover .list-project-title {
  color: var(--ink);
  transform: scale(1.03);
}

.list-project-item:hover .list-project-num,
.list-project-item:hover .list-project-series {
  color: var(--ink);
}

/* Preview Follower Card (List Mode Cursor Follower) */
.preview-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(280px, 30vw, 420px);
  aspect-ratio: 16 / 10;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.32s;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--line);
  will-change: transform;
}

.preview-follower.is-visible {
  opacity: 1;
  visibility: visible;
}

.preview-follower__inner {
  width: 100%;
  height: 100%;
  background-color: #f4f4f6;
}

.preview-follower img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Overlay Dialog (Native) */
.work-overlay {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 90vw;
  width: 660px;
  margin: auto;
  z-index: 999;
}

.work-overlay::backdrop {
  background-color: rgba(20, 19, 14, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.work-overlay-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.16), 0 4px 16px rgba(0, 0, 0, 0.05);
  padding: 32px;
  border-radius: 20px;
  color: var(--ink);
  animation: overlayFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.work-overlay-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  z-index: 10;
  border-radius: 50%;
  border: 1px solid var(--line);
  background-color: var(--white);
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
}

.work-overlay-close:hover {
  background-color: #f5f5f5;
  border-color: var(--ink);
  transform: scale(1.08);
}

.work-overlay-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: #f4f4f6;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.work-overlay-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.work-overlay-title {
  font-family: var(--font-body);
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px 0;
}

.work-overlay-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 16px 0;
}

.work-overlay-desc {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 24px;
  color: var(--muted-2);
  margin: 0 0 24px 0;
}

.work-overlay-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  background-color: var(--ink);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.work-overlay-link:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* Responsive Media Queries */
@media (max-width: 820px) {
  .top-view-toggle {
    top: 18px;
  }
  .list-project-title {
    font-size: clamp(1.8rem, 7vw, 3rem);
  }
}

@media (max-width: 480px) {
  .view-switch-cluster {
    grid-template-columns: repeat(2, 60px);
  }
  .view-pill-indicator {
    width: 60px;
  }
  .view-pill-indicator.is-list {
    transform: translateX(60px);
  }
  .view-link {
    font-size: 10px;
  }
  .work-overlay-card {
    padding: 22px 18px;
  }
  .work-overlay-title {
    font-size: 22px;
  }
}
