* {
  margin: 0;
  padding: 0;
}

body {
  overflow: hidden;
  background: #0a0a0a;
}

#viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: grab;
}

#viewport.grabbing {
  cursor: grabbing;
}

#container {
  position: absolute;
  inset: -10vmin;
  width: 100%;
  height: 100%;
}

#grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.grid-item {
  position: absolute;
  overflow: hidden;
  will-change: transform;
  user-select: none;
  backface-visibility: hidden;
  border-radius: 24px;
}

.grid-item img:not(.play-pill-icon) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: 24px;
  transition: filter 0.3s ease;
}

.grid-item:hover:not(.lightbox-active) img {
  filter: brightness(1.08);
}

.video-tag {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 100px;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.multi-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  gap: 2px;
  overflow: hidden;
}

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

/* 2 images: side by side */
.multi-grid-2 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

/* 3 images: 1 tall left, 2 stacked right */
.multi-grid-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.multi-grid-3 img:first-child {
  grid-row: 1 / 3;
}

/* 4 images: 2x2 */
.multi-grid-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

/* --- Gallery --- */

.lightbox-gallery {
  scrollbar-width: none;
}

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

.gallery-slide-img,
.gallery-slide-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 24px;
}

.lightbox-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 24px;
  pointer-events: auto;
}

.gallery-slide-video {
  pointer-events: auto;
}

.gallery-dots {
  position: fixed;
  z-index: 102;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 100px;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.2s ease;
}

.gallery-dot.active {
  background: #fff;
}

.gallery-arrow {
  position: fixed;
  transform: translateY(-50%);
  z-index: 102;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease;
  filter: invert(1);
}

.gallery-arrow:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gallery-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

/* --- Lightbox --- */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

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

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 102;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
  backdrop-filter: blur(8px);
}

.lightbox-overlay.active .lightbox-close {
  opacity: 1;
  transform: scale(1);
  transition-delay: 0.2s;
}

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

.lightbox-copy {
  position: absolute;
  top: 84px;
  right: 24px;
  z-index: 102;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
  backdrop-filter: blur(8px);
}

.lightbox-overlay.active .lightbox-copy {
  opacity: 1;
  transform: scale(1);
  transition-delay: 0.25s;
}

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

.lightbox-copy .lightbox-check-icon {
  position: absolute;
  opacity: 0;
  transform: scale(0.5);
}

.lightbox-info {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transition-delay: 0s;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 640px;
}

.lightbox-overlay.active .lightbox-info {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0.25s;
}

.lightbox-title {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  max-width: 640px;
  line-height: 1.4;
}

.lightbox-link {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s ease;
}

.lightbox-link:hover {
  color: rgba(255, 255, 255, 0.8);
}

.grid-item.lightbox-active {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 101;
  pointer-events: none;
  overflow: hidden;
  will-change: transform, width, height;
}

.grid-item.lightbox-active img {
  pointer-events: none;
}

.grid-item.lightbox-active video {
  pointer-events: auto;
}

.play-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 12px 16px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.9);
}

.play-pill.visible {
  opacity: 1;
  transform: scale(1);
}

.play-pill-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  filter: invert(1);
}

.lightbox-play-btn:hover .play-pill {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.25);
}

/* --- Folder Pill --- */

.nav-bar {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 5px;
  background: linear-gradient(
    135deg,
    rgba(30, 30, 30, 0.65) 0%,
    rgba(20, 20, 20, 0.55) 50%,
    rgba(30, 30, 30, 0.6) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.2);
  border-left-color: rgba(255, 255, 255, 0.15);
  border-radius: 100px;
  backdrop-filter: blur(16px) saturate(1.4) url(#glass-refract);
  -webkit-backdrop-filter: blur(16px) saturate(1.4) url(#glass-refract);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset,
    0 1px 0 0 rgba(255, 255, 255, 0.1) inset;
}

.folder-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: rgba(255, 255, 255, 0.8);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  user-select: none;
}

.folder-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
  flex-shrink: 0;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease;
  filter: invert(1);
  opacity: 0.5;
}

.view-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 0.8;
}

.view-toggle-btn.active {
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

.folder-dropdown {
  position: fixed;
  top: 64px;
  right: 24px;
  z-index: 50;
  min-width: 160px;
  padding: 6px;
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.folder-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.folder-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.folder-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.folder-dropdown-item.active {
  color: #fff;
  font-weight: 600;
}

/* --- Timeline View --- */

.timeline-view {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #0a0a0a;
  overflow-y: auto;
  padding: 80px 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.timeline-view.visible {
  opacity: 1;
}

.timeline-card {
  width: 100%;
  max-width: 720px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.timeline-card:hover {
  transform: scale(1.01);
}

.timeline-media {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  gap: 2px;
}

.timeline-media img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.timeline-media-1 {
  grid-template-columns: 1fr;
}

.timeline-media-1 img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.timeline-media-2 {
  grid-template-columns: 1fr 1fr;
  height: 360px;
}

.timeline-media-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 480px;
}

.timeline-media-3 img:first-child {
  grid-row: 1 / 3;
}

.timeline-media-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 480px;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
}

.timeline-author {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.timeline-date {
  color: rgba(255, 255, 255, 0.35);
}

.timeline-text {
  padding: 0 4px 8px;
  color: rgba(255, 255, 255, 0.5);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}
