/* The portfolio page (portfolio.html): the cases in a grid, with a filter per solution. Each picture
   is a still of the case, with its live page over it (portfolio.js). The base and the texture are in
   page.css; portfolio.js does the filter and the live pages, motion.js brings the cases in. */

/* ------------------------------------------------------------ the yellow card */

.pf-hero {
  position: relative;
  padding: 16px 16px 0;
}

.pf-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: clamp(460px, 66svh, 760px);
  border-radius: 40px;
  overflow: hidden;
  background: #feeb8d;
  color: #252324;
}

.pf-body {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px 40px;
  padding: 140px 32px 36px 40px;
}

.pf-title {
  margin: 0;
  font-size: clamp(64px, 9vw, 168px);
  font-size: min(clamp(64px, 9vw, 168px), 17svh);
  font-weight: 550;
  line-height: 0.86;
  letter-spacing: -0.06em;
}

.pf-title > span {
  display: block;
}

.pf-title > span + span {
  color: rgba(37, 35, 36, 0.5);
}

/* ------------------------------------------------------------ the filter */

.pf-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 640px;
}

.pf-chip {
  height: 46px;
  margin: 0;
  padding: 0 8px 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(37, 35, 36, 0.45);
  color: #252324;
  font: inherit;
  font-size: 18px;
  font-weight: 450;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

.pf-chip:hover {
  box-shadow: inset 0 0 0 1.5px #252324;
}

.pf-chip[aria-pressed='true'] {
  background: #252324;
  box-shadow: none;
  color: #fffce1;
}

.pf-chip:focus-visible {
  outline: 2px solid #252324;
  outline-offset: 3px;
}

.pf-chip__n {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(37, 35, 36, 0.1);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.pf-chip[aria-pressed='true'] .pf-chip__n {
  background: #feeb8d;
  color: #252324;
}

/* ------------------------------------------------------------ the cases */

.pf-work {
  position: relative;
  padding: 16px 16px 140px;
}

/* two columns, the right one a little lower, as a pile of work rather than a table */
.pf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 56px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pf-grid:not(.is-filtered) .pf-case:nth-child(2n) {
  margin-top: 120px;
}

.pf-case.is-in > .pf-case__in {
  animation: pf-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pf-in {
  from {
    opacity: 0;
    translate: 0 28px;
  }
}

/* a case that is live: the whole card goes to the site */
a.pf-case__in {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.pf-case__in:focus-visible {
  outline: 2px solid #feeb8d;
  outline-offset: 8px;
  border-radius: 32px;
}

.pf-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pf-shot {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 32px;
  container-type: inline-size;
}

.pf-shot > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.pf-case:hover .pf-shot > img {
  scale: 1.03;
}

.pf-shot > img {
  transition: scale 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* the live page over the still (portfolio.js): 1440 by 900, scaled down to the picture, out of reach
   of the pointer (the whole card is the link) */
.pf-play {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, scale 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.pf-play.is-ready {
  opacity: 1;
}

.pf-play > iframe {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

.pf-case:hover .pf-play {
  scale: 1.03;
}

.pf-cap {
  display: flex;
  gap: 18px;
  padding: 24px 8px 0;
}

.pf-no {
  flex: none;
  padding-top: 0.45em;
  font-size: 16.5px;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: rgba(255, 252, 225, 0.5);
}

.pf-name {
  margin: 0;
  font-size: clamp(30px, 2.9vw, 52px);
  font-weight: 550;
  line-height: 1;
  letter-spacing: -0.045em;
}

.pf-kind {
  margin: 10px 0 0;
  font-size: 19px;
  font-weight: 450;
  line-height: 1.3;
  letter-spacing: -0.012em;
}

.pf-kind > span {
  color: rgba(255, 252, 225, 0.5);
}

.pf-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------ smaller screens */

@media (max-width: 900px) {
  .pf-body {
    flex-direction: column;
    align-items: flex-start;
  }

  .pf-filters {
    justify-content: flex-start;
  }

  .pf-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .pf-grid:not(.is-filtered) .pf-case:nth-child(2n) {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .pf-body {
    padding: 112px 24px 28px;
  }

  .pf-chip {
    height: 42px;
    padding-left: 16px;
    font-size: 16px;
  }

  .pf-chip__n {
    min-width: 26px;
    height: 26px;
    font-size: 13px;
  }

  .pf-work {
    padding-bottom: 96px;
  }

  .pf-shot {
    border-radius: 24px;
  }

  .pf-cap {
    padding: 18px 4px 0;
  }

  .pf-kind {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pf-case.is-in > .pf-case__in {
    animation: none;
  }

  .pf-shot > img {
    transition: none;
  }

  .pf-case:hover .pf-shot > img {
    scale: none;
  }
}
