/* Expoline: project grid (home, /projekty/, categories). A masonry of cards whose height follows each photo. */

.stage {
  display: block;
  column-count: 3;
  column-gap: var(--gap);
  padding-top: var(--bar);
  padding-bottom: var(--m);
  padding-left: max(var(--m), env(safe-area-inset-left, 0px));
  padding-right: max(var(--m), env(safe-area-inset-right, 0px));
}
.stage.page { column-count: auto; }

/* Reading-order masonry built by the inline script in project-grid.php */
.stage.masonry {
  column-count: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
}
.stage.masonry > .col { flex: 1 1 0; min-width: 0; }

.tile {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin-bottom: var(--gap);
  overflow: hidden;
  background: var(--ph);
  break-inside: avoid;
  cursor: pointer;
  text-decoration: none;
}
.tile.empty {
  background: linear-gradient(145deg, var(--ph), var(--ph2));
  aspect-ratio: 3 / 2;
}
.tile img,
.tile video {
  width: 100%;
  max-width: none;
  display: block;
  transition: transform 1.4s var(--ease);
}
.tile img {
  position: relative;
  height: auto;
}
.tile video {
  position: absolute;
  inset: 0;
  z-index: 0;
  height: 100%;
  object-fit: cover;
}
.tile.has-video.empty video { position: static; height: auto; }
.tile:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* Project name, always visible */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, .4), rgba(0, 0, 0, 0) 40%);
}
.name {
  position: absolute;
  left: clamp(16px, 2vw, 36px);
  right: clamp(16px, 2vw, 36px);
  bottom: clamp(14px, 1.8vw, 32px);
  z-index: 2;
  margin: 0;
  pointer-events: none;
  font-family: var(--font);
  font-weight: 300;
  font-size: clamp(11px, 1vw, 16px);
  line-height: 1.8;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .84);
}
.name .loc { display: flex; align-items: center; gap: .9em; color: rgba(255, 255, 255, .56); }
.tile.empty:not(.has-video)::after { display: none; }
.tile.empty:not(.has-video) .name { color: var(--ink); }
.tile.empty:not(.has-video) .name .loc { color: var(--mute); }

/* Cards fade in when they reach the screen (site.js adds .in, 160ms apart) and the photo settles from a slight zoom */
.js .tile[data-reveal] {
  opacity: 0;
  transition: opacity 1.8s var(--ease);
}
.js .tile[data-reveal].in { opacity: 1; }
.js .tile[data-reveal] img,
.js .tile[data-reveal] video { transform: scale(1.06); transition: transform 2.6s var(--ease); }
.js .tile[data-reveal].in img,
.js .tile[data-reveal].in video { transform: scale(1); }

/* Zoom on hover: only with a mouse, never on touch screens. Cards with a video do not zoom. */
@media (hover: hover) and (pointer: fine) {
  .tile:not(.has-video):hover img,
  .js .tile[data-reveal].in:not(.has-video):hover img { transform: scale(1.07); transition-duration: 1.4s; }
}

.grid-empty {
  column-span: all;
  margin: clamp(24px, 6vh, 72px) 0 0;
  font-size: 12px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--mute);
}

/* Tablets: two columns */
@media (max-width: 1024px) {
  .stage { column-count: 2; }
}

/* Narrow phones: the same masonry, one column */
@media (max-width: 560px) {
  .stage { column-count: 1; }
}
