/* ── Work Canvas (All Projects) ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080808;
  --white: #ffffff;
  --white-10: rgba(255, 255, 255, 0.10);
  --white-06: rgba(255, 255, 255, 0.06);
  --white-40: rgba(255, 255, 255, 0.40);
  --white-20: rgba(255, 255, 255, 0.20);
  --white-60: rgba(255, 255, 255, 0.60);

  /* z-index scale — every stacking layer on this page picks from here
     rather than an arbitrary number, so new layers can't accidentally
     collide with an existing one. */
  --z-topbar: 20;
  --z-dropdown: 30;
  --z-lightbox: 50;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
}

/* ── TOP BAR ── */
#canvas-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  pointer-events: none;
}

#canvas-topbar > * { pointer-events: auto; }

.canvas-back {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  background: rgba(18, 18, 18, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--white-10);
  border-radius: 14px;
  color: var(--white);
  text-decoration: none;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.canvas-back:hover {
  border-color: var(--white-40);
  background: rgba(28, 28, 28, 0.9);
}

.canvas-back svg { flex-shrink: 0; }

/* ── CATEGORY FILTERS (dropdowns under the All Projects chip) ──
   Two independent, combinable filters sit side by side: platform, and
   effect type. */
.canvas-filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.canvas-filter {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.canvas-filter-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  background: rgba(18, 18, 18, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--white-10);
  border-radius: 14px;
  color: var(--white);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.canvas-filter-btn:hover { border-color: var(--white-40); }

.canvas-filter-btn svg { transition: transform 0.25s ease; }
.canvas-filter.open .canvas-filter-btn svg { transform: rotate(180deg); }

.canvas-filter-menu {
  position: absolute;
  top: 52px;
  left: 0;
  z-index: var(--z-dropdown);
  min-width: 250px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: rgba(14, 14, 14, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--white-10);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top left;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.canvas-filter.open .canvas-filter-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.canvas-filter-menu button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px 11px 18px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--white-60);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, padding-left 0.2s ease;
}

.canvas-filter-menu button::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  border-radius: 3px;
  background: #fff;
  transition: height 0.2s ease;
}

.canvas-filter-menu button:hover {
  background: var(--white-06);
  color: #fff;
  padding-left: 20px;
}

.canvas-filter-menu button.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  font-weight: 500;
}

.canvas-filter-menu button.is-active::before { height: 16px; }

.canvas-filter-menu button .count {
  flex-shrink: 0;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--white-40);
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 8px;
  border-radius: 100px;
}

.canvas-filter-menu button.is-active .count {
  color: var(--white-60);
  background: rgba(255, 255, 255, 0.12);
}

/* ── GRID ── */
#canvas-grid-wrap {
  max-width: 1600px;
  margin: 0 auto;
  padding: 130px 24px 80px;
}

/* Pinterest-style masonry: distributed into JS-built column tracks
   (see work-canvas.js) rather than CSS `columns` — with 100+ tall,
   break-inside:avoid items, Chromium's column-balancing degrades to a
   single column instead of distributing across the width. Explicit
   flex column tracks sidestep that entirely and let each tile keep its
   source video's real aspect ratio instead of a forced crop. */
#canvas-grid {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.masonry-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── EMPTY CATEGORY STATE ── */
#canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 120px 24px;
}

#canvas-empty[hidden] { display: none; }

.canvas-empty-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 5vw, 48px);
  color: var(--white);
}

.canvas-empty-sub {
  font-size: 14px;
  color: var(--white-40);
}

/* ── TILE ── */
.pt {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0d0d0d;
  border: 1px solid var(--white-10);
  cursor: pointer;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  /* transform is deliberately left out of this base transition — GSAP
     drives it directly during the entrance stagger, and a CSS transition
     on the same property fights that frame-by-frame tween. It's added
     back in :hover below, where nothing else is touching transform. */
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.pt:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-8px) rotate(var(--tilt, -0.6deg)) scale(1.015);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 2;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.pt-media {
  display: block;
  width: 100%;
  height: auto;
  /* Placeholder tint while the poster decodes, so a tile isn't a hole
     in the masonry column before its image paints. */
  background: rgba(255, 255, 255, 0.03);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.6s ease;
  -webkit-user-drag: none;
}

.pt-media.loaded { opacity: 1; }
.pt:hover .pt-media { transform: scale(1.05); }

/* Hover preview: the real clip, muted and looping, laid directly over the
   still poster underneath — same box, so no layout shift when it mounts. */
.pt-video-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.pt:hover .pt-play {
  opacity: 0;
  transform: scale(0.7);
}

.pt-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,0.78) 100%);
  pointer-events: none;
}

.pt-play {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(8, 8, 8, 0.65);
  backdrop-filter: blur(4px);
  border: 1px solid var(--white-20);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.pt-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 14px;
  pointer-events: none;
}

.pt-tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white-60);
  background: rgba(8, 8, 8, 0.6);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border: 1px solid var(--white-10);
  border-radius: 100px;
  margin-bottom: 7px;
}

.pt-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  line-height: 1.3;
}

/* ── LIGHTBOX PLAYER ── */
.canvas-lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.canvas-lightbox-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
}

.canvas-lightbox video {
  max-width: min(92vw, 1100px);
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  background: #000;
  transform: scale(0.97);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.canvas-lightbox.is-open video { transform: scale(1); }

.canvas-lightbox figcaption {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--white-60);
  text-align: center;
}

.canvas-lightbox-counter {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--white-40);
  border: 1px solid var(--white-10);
  padding: 3px 10px;
  border-radius: 100px;
}

.canvas-lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--white-20);
  background: rgba(20, 20, 20, 0.85);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: calc(var(--z-lightbox) + 1);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.canvas-lightbox-prev { left: 18px; }
.canvas-lightbox-next { right: 18px; }

.canvas-lightbox-nav:hover {
  border-color: var(--white-40);
  background: rgba(35, 35, 35, 0.95);
}

.canvas-lightbox-nav:active { transform: translateY(-50%) scale(0.92); }

@media (max-width: 640px) {
  .canvas-lightbox-nav { width: 40px; height: 40px; }
  .canvas-lightbox-prev { left: 8px; }
  .canvas-lightbox-next { right: 8px; }
  .canvas-lightbox video { max-height: 72vh; }
}

.canvas-lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--white-20);
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.canvas-lightbox-close:hover {
  border-color: var(--white-40);
  background: rgba(30, 30, 30, 0.95);
}

@media (max-width: 640px) {
  #canvas-topbar { padding: 14px 14px; flex-wrap: wrap; gap: 10px; }
  .canvas-back { padding: 0 14px; font-size: 12px; }
  .canvas-filter-btn { padding: 0 14px; font-size: 11px; }
  .canvas-filter-group { gap: 8px; }
  #canvas-grid-wrap { padding: 170px 14px 60px; }
  #canvas-grid { gap: 12px; }
  .masonry-col { gap: 12px; }
}
