/* ==========================================================================
   TJ Mauck Films — Work page
   Left-rail category filters + thumbnail grid (FLIP filtering),
   project view: film center, still grabs collaged around.
   ========================================================================== */

:root {
  --bg: #0e0e0e;
  --text: #f2f2f2;
  --grey: rgba(242, 242, 242, .4);
  --nav-pad: 44px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

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

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  line-height: 20px;
  min-height: 100svh;
}

img { display: block; max-width: 100%; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Nav (same skeleton as the homepage, static page background)
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--nav-pad) - 6px) var(--nav-pad);
  background: linear-gradient(to bottom, rgba(14, 14, 14, .9), rgba(14, 14, 14, 0));
}

.nav a {
  pointer-events: auto;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .2px;
}

.nav a:hover { opacity: .7; }

.nav-title {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .4px;
  line-height: 1.15;
}

.nav-sub {
  display: block;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: .6px;
  margin-top: 2px;
}

body.film-open .nav-links {
  opacity: 0;
  pointer-events: none;
}

.nav-links { transition: opacity .3s ease; }

.nav-links a {
  margin-left: 28px;
  font-weight: 300;
}

.nav-links a.active { font-weight: 700; }

/* --------------------------------------------------------------------------
   Layout: left rail + grid
   -------------------------------------------------------------------------- */

.work {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 140px var(--nav-pad) 60px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 140px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.filter {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .5px;
  text-transform: uppercase;
  opacity: .4;
  transition: opacity .4s;
}

.filter:hover,
.filter.active { opacity: 1; }

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 28px;
}

.work-item {
  display: block;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  will-change: transform, opacity;
}

.work-item.hiding {
  transition: opacity .35s ease, transform .35s ease;
  opacity: 0;
  transform: scale(.94);
  pointer-events: none;
}

.work-item.hidden { display: none; }

.work-item h2 {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-item h2 .num {
  color: var(--grey);
  margin-right: 14px;
}

.work-item figure {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #161616;
}

.work-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease-out), opacity .4s;
}

.work-item:hover img { transform: scale(1.04); }

/* --------------------------------------------------------------------------
   Project view — film center, grabs collaged around
   -------------------------------------------------------------------------- */

.project-view {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  overflow: hidden;
}

.project-view[hidden] { display: none; }

.pv-close {
  position: absolute;
  top: 18px;
  right: 26px;
  z-index: 520;
  font-size: 40px;
  line-height: 1;
  opacity: .8;
}

.pv-close:hover { opacity: 1; }

.pv-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(62vw, calc(72svh * 16 / 9));
  z-index: 510;
}

.pv-media {
  aspect-ratio: 16 / 9;
  background: #000;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .6);
}

.pv-media iframe,
.pv-media img {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  display: block;
}

.pv-title {
  margin-top: 12px;
  font-size: 13px;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.pv-title .num { color: var(--grey); margin-right: 14px; }

/* Grab wall: full-bleed tile grid behind the stage — 16:9 tiles, no gaps.
   Rows overflow-crop at the bottom edge; JS fills enough tiles to cover. */
.pv-collage {
  position: absolute;
  inset: 0;
  z-index: 505;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: calc(33.34vw * 9 / 16);
  overflow: hidden;
}

.pv-collage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: brightness(.55);
}

.project-view.open .pv-collage img {
  opacity: 1;
  transition: opacity .7s ease var(--d, 0s);
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .nav { padding: 18px 24px; }
  .nav-title { font-size: 18px; }
  .nav-sub { font-size: 11px; }

  .work {
    grid-template-columns: 1fr;
    padding: 110px 20px 40px;
    gap: 18px;
  }

  .filters {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 16px;
  }

  .filter { font-size: 12px; }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 10px;
    row-gap: 18px;
  }

  .work-item h2 { font-size: 10px; letter-spacing: .5px; }
  .work-item h2 .num { margin-right: 8px; }

  .pv-stage { width: 92vw; }

  .pv-collage {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
    grid-template-rows: repeat(6, 1fr);
  }
}
