/* ==========================================================================
   works.css — the wall, filters, the grid, and the lightbox
   ========================================================================== */

/* ============================================================ the wall === */
.wallviewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 340px;
  overflow: hidden;
  background: var(--paper);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.wallviewport.is-dragging { cursor: grabbing; }
.wallviewport::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 90px;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg, rgba(246,246,242,0) 0%, var(--paper) 100%);
}

.wall {
  position: absolute;
  inset: -22% -12%;
  transform-origin: 50% 42%;
  transform: perspective(1150px) rotateX(15deg) scale(1.04);
}
.wall-stage {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.1vw, 18px);
  will-change: transform;
}
.wrow {
  display: flex;
  gap: clamp(10px, 1.1vw, 18px);
  height: clamp(200px, 33vh, 360px);
  flex: 0 0 auto;
  will-change: transform;
}
.wrow:nth-child(1) { margin-left: -220px; }
.wrow:nth-child(2) { margin-left: -70px; }
.wrow:nth-child(3) { margin-left: -330px; }

.wtile {
  position: relative;
  height: 100%;
  aspect-ratio: var(--ar, 3 / 2);
  flex: 0 0 auto;
  overflow: hidden;
  background: #E8E7DF;
  transition: opacity .5s var(--ease), transform .8s var(--ease-out);
}
.wtile img,
.wtile video {
  height: 100%;
  width: 100%;
  object-fit: cover;
  object-position: var(--f, 50% 34%);
  filter: saturate(.96) contrast(1.03) brightness(.99);
  transition: transform 1s var(--ease-out), filter .5s var(--ease);
}
.wtile video {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.wtile video.is-on { opacity: 1; }

.wall:hover .wtile { opacity: .48; }
.wall .wtile:hover { opacity: 1; z-index: 3; }
.wall .wtile:hover img { transform: scale(1.045); filter: saturate(1) contrast(1.03) brightness(1); }

.wtile .label {
  position: absolute;
  left: 0; bottom: 0;
  right: 0;
  padding: 26px 14px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, rgba(10,10,9,0) 0%, rgba(10,10,9,.78) 100%);
  color: #F7F6F1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
  pointer-events: none;
}
.wtile:hover .label { opacity: 1; transform: none; }
.wtile .label b {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: .04em;
}
.wtile .label span {
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .78;
  white-space: nowrap;
}
.wtile .tickdot {
  position: absolute;
  left: 10px; top: 10px;
  width: 5px; height: 5px;
  background: var(--lime);
  opacity: 0;
  transition: opacity .35s var(--ease);
}
.wtile:hover .tickdot { opacity: 1; }

.wallviewport.is-static .wall { transform: none; }
.wallviewport.is-static .wall-stage { transform: none !important; }

/* small screens: the 3D wall becomes a horizontally scrolling film strip */
@media (max-width: 720px) {
  .wallpage { min-height: 0; }
  .wallviewport {
    flex: 0 0 auto;
    height: min(64svh, 470px);
    overflow-x: auto;
    overflow-y: hidden;
    cursor: default;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .wrow:nth-child(3) { display: none; }
  .wallviewport::-webkit-scrollbar { display: none; }
  .wallviewport::after { display: none; }
  .wall { position: relative; inset: auto; transform: none; }
  .wall-stage {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 14px var(--pad) 18px;
    transform: none !important;
    width: max-content;
  }
  .wrow {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    gap: 10px;
    margin-left: 0 !important;
  }
  .wrow:nth-child(even) { margin-top: 26px; }
  .wtile {
    height: auto;
    aspect-ratio: auto;
    width: auto;
  }
  .wtile img,
  .wtile video {
    height: clamp(88px, 24vw, 132px);
    width: auto;
    max-width: none;
  }
}

/* ============================================================= filters === */
.filters {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 30px);
}
.filters button {
  position: relative;
  font-size: 12.5px;
  letter-spacing: .08em;
  color: var(--ink-2);
  padding: 2px 0 6px;
  transition: color .3s var(--ease);
}
.filters button span {
  font-family: var(--latin);
  font-size: 10px;
  letter-spacing: .06em;
  margin-left: 5px;
  opacity: .55;
}
.filters button::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s var(--ease);
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ink); }
.filters button[aria-pressed="true"]::after { transform: scaleX(1); }

.count {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.count s { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); display: block; }

/* ================================================================ grid === */
.worksgrid-section { padding-top: clamp(44px, 6vw, 84px); }

.wgrid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(28px, 3.6vw, 54px) clamp(14px, 1.8vw, 26px);
  align-items: start;
}
.card {
  display: block;
  grid-column: span 4;
  opacity: 1;
  transition: opacity .45s var(--ease);
}
.card[hidden] { display: none; }

.card .media {
  position: relative;
  overflow: hidden;
  background: #EDECE4;
  aspect-ratio: var(--ar, 4 / 3);
}
.card .media img,
.card .media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--f, 50% 50%);
  filter: saturate(.92) contrast(1.02);
  transition: transform .95s var(--ease-out), filter .5s var(--ease);
}
.card .media video { opacity: 0; transition: opacity .5s var(--ease); }
.card .media video.is-on { opacity: 1; }
.card:hover .media img { transform: scale(1.035); filter: saturate(1) contrast(1.02); }

.card .tag {
  position: absolute;
  left: 14px; top: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  background: var(--surface);
  font-size: 9.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink);
}
.card .tag s { width: 4px; height: 4px; background: var(--lime); display: block; }
.card .hint {
  position: absolute;
  left: 0; top: 0;
  z-index: 2;
  padding: 10px 13px;
  background: var(--lime);
  color: var(--ink);
  font-size: 9.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
  font-weight: 500;
  transform: translateY(-101%);
  transition: transform .45s var(--ease);
}
.card:hover .hint { transform: translateY(0); }

.card .cap {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 13px;
  padding-top: 11px;
}
.card .cap .idx {
  font-family: var(--latin);
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: lining-nums;
  min-width: 20px;
}
.card .cap h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: .035em;
}
.card .cap .meta {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}

/* spans come from data.js */
.span-4  { grid-column: span 4; }
.span-5  { grid-column: span 5; }
.span-7  { grid-column: span 7; }
.span-8  { grid-column: span 8; }
.span-12 { grid-column: span 12; }

/* when a filter is active the asymmetric rhythm can't sum to 12 any more,
   so fall back to an even 3-up grid */
.wgrid.is-filtered .card { grid-column: span 4; }
.wgrid.is-filtered .card .media { aspect-ratio: 4 / 3; }

@media (max-width: 900px) {
  .card, .span-4, .span-5, .span-7, .span-8, .span-12 { grid-column: span 6; }
  .wgrid.is-filtered .card { grid-column: span 6; }
}
@media (max-width: 560px) {
  .card, .span-4, .span-5, .span-7, .span-8, .span-12 { grid-column: span 12; }
  .wgrid.is-filtered .card { grid-column: span 12; }
}

.empty-note {
  padding: 60px 0;
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: .06em;
}

/* ============================================================= lightbox == */
.lb {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: #0B0B0A;
  color: #F4F3ED;
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s var(--ease), visibility .4s;
}
.lb.is-open { opacity: 1; visibility: visible; }

.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid rgba(244,243,237,.12);
  flex: 0 0 auto;
}
.lb-brand { display: flex; align-items: center; gap: 10px; }
.lb-brand img { height: 26px; width: auto; filter: brightness(0) invert(1); opacity: .82; }
.lb-brand span { font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; opacity: .6; }
.lb-tools { display: flex; align-items: center; gap: 8px; }
.lb-btn {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244,243,237,.2);
  transition: background .3s var(--ease), border-color .3s var(--ease), color .3s;
}
.lb-btn:hover { background: rgba(244,243,237,.1); border-color: rgba(244,243,237,.45); }
.lb-btn svg { width: 15px; height: 15px; }
.lb-btn:disabled { opacity: .3; pointer-events: none; }

.lb-stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 2.4vw, 34px) clamp(16px, 5vw, 90px);
  min-height: 0;
  overflow: hidden;
}
.lb-stage img,
.lb-stage video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.7);
}
.lb-stage video { background: #000; }

.lb-bottom {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 3vw, 40px) 22px;
  border-top: 1px solid rgba(244,243,237,.12);
  flex-wrap: wrap;
}
.lb-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.lb-title h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(20px, 2.4vw, 30px);
  letter-spacing: .03em;
}
.lb-title em {
  font-family: var(--latin);
  font-style: italic;
  font-size: 12px;
  letter-spacing: .12em;
  opacity: .58;
}
.lb-meta { display: flex; gap: clamp(14px, 2vw, 28px); flex-wrap: wrap; }
.lb-meta div { display: flex; flex-direction: column; gap: 3px; }
.lb-meta dt {
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .45;
  line-height: 1.4;
}
.lb-meta dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .88;
}
.lb-count {
  font-family: var(--latin);
  font-style: normal;
  font-variant-numeric: lining-nums;
  font-size: 13px;
  letter-spacing: .1em;
  opacity: .6;
  white-space: nowrap;
}
.lb-count b { font-weight: 400; color: var(--lime); font-style: normal; }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244,243,237,.22);
  background: rgba(11,11,10,.5);
  backdrop-filter: blur(6px);
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.lb-nav:hover { background: rgba(200,243,29,.14); border-color: var(--lime); }
.lb-nav.prev { left: clamp(8px, 2vw, 26px); }
.lb-nav.next { right: clamp(8px, 2vw, 26px); }
.lb-nav svg { width: 16px; height: 16px; }

@media (max-width: 720px) {
  .lb-nav { display: none; }
  .lb-bottom { gap: 14px; }
  .lb-meta { display: none; }
}

/* ============================================================ filterbar == */
.filterbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(14px, 2vw, 28px);
  padding: 13px var(--pad);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.filterbar .fb-label {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--ink);
  white-space: nowrap;
}
.filterbar .fb-label em {
  font-family: var(--latin);
  font-style: italic;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.filterbar .filters { margin-left: auto; }

@media (max-width: 720px) {
  .filterbar { gap: 10px; padding: 11px var(--pad); }
  .filterbar .fb-label { display: none; }
  .filterbar .filters { margin-left: 0; gap: 14px; }
  .filterbar .filters button { font-size: 12px; }
  .filterbar .count { display: none; }
}

/* anchor targets shouldn't hide under the sticky chrome */
#grid { scroll-margin-top: calc(var(--nav-h) + 60px); }
