/* Square tiles for Projects, Supporting and Branding.
   Same tile pattern as the Spectrum Patronum Projects page. */

.projects-page {
  max-width: 76rem;
  margin: 0 auto;
  padding: calc(var(--header-h) + env(safe-area-inset-top) + 1.5rem) 1.25rem 1.5rem;
}

.projects-page h1 {
  margin: 0 0 1.35rem;
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  line-height: 1.3;
}

.projects-page h2.section-heading {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  color: var(--muted);
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-grid > li {
  min-width: 0;
}

.project-tile {
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0.7rem 0.75rem 0.8rem;
  background: #000;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(243, 238, 230, 0.28);
  border-radius: 2px;
}

a.project-tile:hover,
a.project-tile:focus-visible {
  border-color: rgba(243, 238, 230, 0.62);
  background: #070707;
}

.project-tile.is-pending {
  border-style: dashed;
}

.project-logo {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.project-logo picture {
  position: absolute;
  inset: 0;
  display: block;
}

.project-logo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: auto;
  object-fit: contain;
}

.project-logo img.project-mark {
  width: 42%;
  height: 42%;
}

.project-copy {
  flex: 0 0 auto;
  display: block;
  padding-top: 0.45rem;
  text-align: center;
}

.project-name {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: clamp(0.78rem, 1.5vw, 0.98rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.project-tile.is-pending .project-name {
  color: var(--muted);
}

/* La Caverne only: copper seal on a turquoise disc.
   The square tile stays the same black card as the others.
   The seal artwork is a transparent centre, so the disc shows through. */
.project-tile.is-caverne .project-logo::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  height: 100%;
  aspect-ratio: 1;
  max-width: 100%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #30D5C8;
}

.project-tile.is-caverne .project-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(168deg, #E8B07A 0%, #B87333 22%, #7A441C 55%, #A8602A 100%);
  -webkit-mask: url("/assets/logos/la-caverne.png") center / contain no-repeat;
  mask: url("/assets/logos/la-caverne.png") center / contain no-repeat;
}

.project-tile.is-caverne .project-logo img {
  opacity: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.project-fallback {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

/* Phones: three small squares. Tablets: two columns. Desktop: three, then four. */
@media (max-width: 539px) {
  .projects-page {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .project-grid {
    grid-template-columns: repeat(3, 4.5rem);
    justify-content: center;
    gap: 0.45rem;
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
  }

  .project-tile {
    padding: 0.28rem 0.22rem 0.32rem;
  }

  .project-logo img.project-mark {
    width: 58%;
    height: 58%;
  }

  .project-copy {
    padding-top: 0.16rem;
  }

  .project-name {
    font-size: 0.58rem;
    letter-spacing: 0.02em;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }
}

@media (min-width: 540px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1240px) {
  .project-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
