/* Portfolio home: one line about SALUT, then the works as big 16:9 frames (Gevirtz wall) whose
   silent loops play on hover, or while on screen on phones. Captions stay short: work and client. */

.intro {
  padding: clamp(16px, 3vw, 40px) var(--gutter) clamp(28px, 3.6vw, 52px);
}

.intro__text {
  max-width: 40ch;
  font-size: clamp(19px, 1.9vw, 27px);
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

/* Who first, on its own line; what we shoot under it, quieter. */
.intro__text span {
  display: block;
  color: var(--fg-dim);
  text-wrap: balance;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px 16px;
  margin: 0;
  padding: 0 var(--gutter);
  list-style: none;
}

.grid[aria-busy="true"] {
  min-height: 60vh;
}

/* Without JavaScript the grid stays «busy» for good: no empty block above the note about it. */
@media (scripting: none) {
  .grid[aria-busy="true"] {
    min-height: 0;
  }
}

@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(36px, 4vw, 56px) clamp(16px, 1.6vw, 24px);
  }
}

/* Three in a row on a laptop and wider, the Gevirtz wall. */
@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* A count that would leave a short last row: the strongest go first and larger, two in a row, and every row
     is full. Two left over (5, 8 works): 2 + 3 + 3. One left over (7 works now): 2 + 2 + 3. home.js gives those
     cards wider image sizes (WIDE_CARDS). */
  .grid:has(> .card:last-child:nth-child(3n + 2)),
  .grid:has(> .card:last-child:nth-child(3n + 1)) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .grid:has(> .card:last-child:nth-child(3n + 2)) > .card,
  .grid:has(> .card:last-child:nth-child(3n + 1)) > .card {
    grid-column: span 2;
  }

  .grid:has(> .card:last-child:nth-child(3n + 2)) > .card:nth-child(-n + 2),
  .grid:has(> .card:last-child:nth-child(3n + 1)) > .card:nth-child(-n + 4) {
    grid-column: span 3;
  }
}

.card {
  scroll-margin: 24px;
}

.card__link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
}

.card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius);
  background: var(--surface);
}

.card__media img,
.card__loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__media img {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.card__media.is-loaded img {
  opacity: 1;
}

/* Keep the fade in step with FADE_MS in home.js. */
.card__loop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.card__loop.is-on {
  opacity: 1;
}

.card__cap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 10px;
  margin-top: 14px;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.card__title {
  font-weight: 500;
}

.card__kind {
  color: var(--fg-dim);
}

@media (hover: hover) {
  .card__link:hover .card__title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.24em;
  }
}

.card__link:focus-visible {
  outline: none;
}

.card__link:focus-visible .card__media {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- under the wall: the vertical films, 9:16 tiles, four in a row (two on phones) ---------- */
.verticals {
  padding: clamp(56px, 7vw, 104px) var(--gutter) 0;
}

.verticals__title {
  margin: 0 0 clamp(18px, 2vw, 28px);
  font-size: clamp(19px, 1.9vw, 27px);
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.vgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 700px) {
  .vgrid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(36px, 4vw, 56px) clamp(16px, 1.6vw, 24px);
  }
}

.card__media--tall {
  aspect-ratio: 9 / 16;
}

/* Without JavaScript the row would be a heading over nothing: the works are listed in the wall's <noscript>. */
@media (scripting: none) {
  .verticals {
    display: none;
  }
}
