/* ========== SHARED OVERLAY / LIGHTBOX / MOBILE PROJECT LIST STYLES ==========
   Used by both grid.html and index.html. Loaded via <link> from overlay.css
   AFTER each page's own stylesheet so it can reference tokens but win on
   specificity ties. */

/* Prevent background scroll while overlay/lightbox is open — home also needs
   this now, so it lives in the shared overlay stylesheet. */
html:has(body.scroll-locked) {
  overflow: hidden !important;
}

/* ========== MOBILE PROJECT LIST ========== */
.mobile-proj-list {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #ffffff;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
  display: none;
}

.mobile-proj-list.open {
  transform: translateY(0);
}

.mobile-proj-bg {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 150px;
  height: 150px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
  pointer-events: none;
}

.mobile-proj-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mobile-proj-bg.visible {
  opacity: 1;
}

.mobile-proj-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 210;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.1);
  color: #111;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-proj-scroll {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  padding: 0 24px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 35%, black 65%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 35%, black 65%, transparent 100%);
}

.mobile-proj-spacer {
  height: 42vh;
}

.mobile-proj-item {
  height: 5vh;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  cursor: pointer;
}

.mobile-proj-item-inner {
  text-align: center;
}

.mobile-proj-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: rgba(0,0,0,0.2);
  transition: color 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.mobile-proj-item.center .mobile-proj-name,
.mobile-proj-item.active .mobile-proj-name {
  color: #111 !important;
  font-weight: 600;
}


.mobile-proj-year {
  display: none;
}

@media (min-width: 769px) {
  .mobile-proj-list { display: none !important; }
}

@media (max-width: 768px) {
  .mobile-proj-list { display: block; }
}

/* ========== OVERLAY / PROJECT DETAIL ========== */
.overlay {
  position: fixed;
  top: 100%;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100dvh;
  z-index: 200;
  background: #111;
  color: #f0f0f0;
  pointer-events: none;
  transition: top 0.5s cubic-bezier(0.16,1,0.3,1);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.overlay.open {
  top: 0;
  pointer-events: auto;
}

/* Floating project title pill */
.proj-floating-pill {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 8px;
  background: rgba(20,20,20,0.7);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  z-index: 240;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}

.proj-floating-pill.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.proj-pill-icon {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.proj-pill-progress {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.proj-pill-ring {
  transition: stroke-dashoffset 0.1s linear;
}

.proj-pill-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.proj-pill-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.overlay-close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 250;
  background: rgba(20,20,20,0.6);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  line-height: 1;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s, background 0.2s;
  pointer-events: none;
}

.overlay.open ~ .overlay-close,
.overlay-close.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.overlay-close:hover {
  background: rgba(20,20,20,0.8);
}

.overlay-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.4s ease 0.3s, transform 0.4s cubic-bezier(0.19,1,0.22,1) 0.3s;
}

.overlay.open .overlay-inner {
  opacity: 1;
  transform: translateY(0);
}

/* ========== PROJECT HERO (FULLSCREEN BG) ========== */
.proj-hero-bg {
  position: relative;
  width: 100%;
  height: 90vh;
  overflow: hidden;
  z-index: 0;
}

.proj-hero-bg-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

@media (max-width: 768px) {
  .proj-hero-bg {
    height: 70vh;
  }
}

/* keep old dark hero for lab */
.proj-hero-dark {
  background: #0a0a0a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 60px;
  position: relative;
}


.proj-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 200;
  line-height: 1.05;
  margin-bottom: 24px;
  letter-spacing: -0.03em;
  color: #fff;
}

.proj-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
}

.proj-meta strong {
  display: block;
  color: rgba(255,255,255,0.7);
  font-weight: 700;
  margin-bottom: 2px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.proj-desc {
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.45);
  margin-bottom: 12px;
}

.proj-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.proj-tag {
  padding: 4px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
}

/* ========== WHITE SHEET ========== */
.proj-white-sheet {
  background: #fff;
  color: #111;
  border-radius: 32px 32px 0 0;
  margin-top: -32px;
  position: relative;
  z-index: 2;
  padding: 80px 16px 120px;
}

.proj-header {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 32px;
}
.proj-header-thumb {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-xl);
  object-fit: cover;
  flex-shrink: 0;
}
.proj-header-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.proj-title-white {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 200;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #111;
  margin-bottom: 12px;
}

.proj-meta-white {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.proj-meta-white span {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: 4px 12px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-pill);
}

.proj-brief {
  margin-bottom: 24px;
}

.proj-brief-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #555;
  display: block;
  margin-bottom: 8px;
}

.proj-brief p {
  font-size: 1.1rem;
  font-weight: 500;
  color: #222;
  line-height: 1.6;
  font-style: italic;
}

/* intro text */
.proj-intro {
  max-width: 640px;
  margin: 0 0 16px;
  padding: 0;
  text-align: left;
}

.proj-intro p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #555;
  margin-bottom: 16px;
}

.proj-intro a {
  color: var(--accent);
  text-decoration: none;
}



/* 2-column media grid with white space */
.proj-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.media-cell.full {
  grid-column: 1 / -1;
}

.media-cell.left {
  grid-column: 1;
}

.media-cell.right {
  grid-column: 2;
}

.media-cell {
  min-height: 0;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  border-radius: var(--radius-lg);
  position: relative;
}

.media-cell img,
.media-cell video {
  width: 100%;
  height: auto;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 0;
  cursor: pointer;
  transition: opacity 0.2s;
  will-change: transform;
  transform: scale(1.15);
}

.media-cell img:hover,
.media-cell video:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .proj-media-grid {
    grid-template-columns: 1fr;
  }
  .media-cell.left,
  .media-cell.right,
  .media-cell.full {
    grid-column: 1;
  }
}

/* Lab splash */
.lab-splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  font-family: var(--font-display);
  font-size: clamp(5rem, 20vw, 15rem);
  font-weight: 200;
  font-style: italic;
  color: #fff;
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: labSplashIn 0.6s cubic-bezier(0.16,1,0.3,1) both;
}

.lab-splash span {
  font-weight: 300;
}

.lab-splash.fade-out {
  animation: labSplashOut 0.8s cubic-bezier(0.32,0.72,0,1) forwards;
}

@keyframes labSplashIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes labSplashOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}

/* tools inline (after description) */
.proj-tools-inline {
  padding: 32px 0;
  border-top: 1px solid rgba(0,0,0,0.06);
  margin: 0;
}

.proj-tools-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.proj-tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.proj-tools-list span {
  padding: 8px 18px;
  background: #f2f2f2;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tool-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.proj-copyright {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: #aaa;
  padding: 40px 20px 32px;
  letter-spacing: 0.02em;
}

/* Lab gallery (kept simple) */
.proj-gallery {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  padding: 0 24px;
}

.proj-gallery .row-1 { grid-template-columns: 1fr; }
.proj-gallery .row-2 { grid-template-columns: 1fr 1fr; }
.proj-gallery .row-3 { grid-template-columns: 1fr 1fr 1fr; }

.proj-gallery .gallery-row {
  display: grid;
  gap: 16px;
}

.proj-gallery img,
.proj-gallery video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: opacity 0.2s;
}

.proj-gallery img:hover,
.proj-gallery video:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .proj-hero-media { width: 92vw; }
  .proj-hero-dark { padding: 60px 16px 40px; }
  .proj-hero-content { padding: 0; }
  .proj-white-sheet { padding: 40px 16px 80px; border-radius: 20px 20px 0 0; }
  .proj-header { gap: 16px; }
  .proj-header-thumb { width: 80px; height: 80px; border-radius: var(--radius-lg); }
  .proj-intro { padding: 0; margin-bottom: 40px; }
  .proj-gallery { padding: 0; }
  .overlay-inner { padding: 0; }
  .proj-gallery .row-2, .proj-gallery .row-3 {
    grid-template-columns: 1fr;
  }
}


/* ========== LIGHTBOX ========== */
.lb-swipe-hint {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.lb-swipe-hint span {
  font-size: 1.4rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(30px) saturate(1.2);
  -webkit-backdrop-filter: blur(30px) saturate(1.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 120px;
  touch-action: pan-x;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 92vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
}

@keyframes lbSlideInRight {
  0% { transform: translateX(80px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes lbSlideInLeft {
  0% { transform: translateX(-80px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes lbSlideOutLeft {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-80px); opacity: 0; }
}

@keyframes lbSlideOutRight {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(80px); opacity: 0; }
}

.lightbox-content.slide-right img,
.lightbox-content.slide-right video {
  animation: lbSlideInRight 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.lightbox-content.slide-left img,
.lightbox-content.slide-left video {
  animation: lbSlideInLeft 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.lightbox-content.slide-init img,
.lightbox-content.slide-init video {
  animation: lbSlideInRight 0.3s cubic-bezier(0.16,1,0.3,1) both;
}

.lightbox.open .lightbox-content img,
.lightbox.open .lightbox-content video {
  transform: translateX(0);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 310;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.2);
}

.lightbox-bottom {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 310;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(16px);
  border-radius: 999px;
  padding: 4px;
}

.lb-ctrl-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.lb-ctrl-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.lightbox-info {
  position: absolute;
  top: 20px;
  left: 24px;
  z-index: 310;
  font-family: 'Inter', monospace;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.35);
  line-height: 1.6;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.lightbox-histogram {
  position: absolute;
  top: 90px;
  left: 24px;
  z-index: 310;
  width: 160px;
  height: 60px;
  border-radius: 6px;
  background: rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0.6;
}

.lightbox-strip {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: transparent;
  border-radius: 0;
  max-width: 80vw;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
  z-index: 310;
}

.lightbox-strip::-webkit-scrollbar {
  display: none;
}

.lightbox-strip-item {
  height: 48px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  opacity: 1;
  transition: transform 0.2s;
  border: 2px solid transparent;
}

.lightbox-strip-item:hover {
  transform: scale(1.05);
}

.lightbox-strip-item.active {
  opacity: 1;
  border-color: #fff;
  transform: scale(1.1);
}

.lightbox-strip-item.is-film::before,
.lightbox-strip-item.is-film::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.5) 0px,
    rgba(255,255,255,0.5) 3px,
    transparent 3px,
    transparent 5px
  );
  z-index: 1;
}

.lightbox-strip-item.is-film::before { left: 2px; }
.lightbox-strip-item.is-film::after { right: 2px; }

.lightbox-strip-item.is-film {
  position: relative;
}

.lightbox-strip-item img {
  height: 100%;
  width: auto;
  display: block;
}

.lightbox-counter {
  color: rgba(255,255,255,0.4);
  font-size: 0.75rem;
}

/* Lightbox strip mobile */
@media (max-width: 768px) {
  .lightbox-bottom {
    left: 0;
    right: 0;
    transform: none;
    padding: 0 8px;
  }
  .lightbox-strip {
    max-width: 100%;
    border-radius: 0;
    padding: 4px;
  }
  .lightbox-strip-item {
    height: 56px;
  }
}
