/* Homepage section 3 — short Cosmos logo wall (not pinned).
   Trademark: logos are placeholders owned by their trademark holders;
   Joe must get approval / production artwork before launch. */

.certs {
  padding: 72px 0 64px;
  background: var(--bg);
  color: var(--ink);
  overflow: visible;
  scroll-margin-top: 104px;
}

.certs-heading {
  font-size: 33px;
  font-weight: 350;
  letter-spacing: -1.32px;
  line-height: 1.1;
  text-align: center;
  margin: 0 auto 40px;
  max-width: 18em;
}

.certs-wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  padding: 8px 0 4px;
  overflow: visible;
}

.certs-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 5 / 4;
  min-height: 112px;
  padding: 16px;
  margin: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  overflow: visible;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.certs-tile.is-in,
.certs.is-static .certs-tile {
  opacity: 1;
  transform: none;
}

.certs-tile:focus {
  outline: none;
}

.certs-tile:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  z-index: 2;
}

.certs-mark {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 168px);
  max-height: 56px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.62;
  transform: scale(1);
  transform-origin: center center;
  transition:
    filter 0.85s ease,
    opacity 0.85s ease,
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.certs-mark[data-fit='en'] {
  max-width: 168px;
  max-height: 52px;
}

.certs-mark[data-fit='astm'] {
  max-width: 176px;
  max-height: 44px;
}

.certs-mark[data-fit='salford'] {
  max-width: 72px;
  max-height: 80px;
}

.certs-mark[data-fit='badge'] {
  max-width: 72px;
  max-height: 88px;
}

.certs-mark[data-fit='grs'] {
  max-width: 132px;
  max-height: 56px;
}

.certs-mark[data-fit='scs'] {
  max-width: 100px;
  max-height: 82px;
}

.certs-mark[data-fit='epd'] {
  max-width: 148px;
  max-height: 40px;
}

.certs-tile:hover,
.certs-tile:focus-visible {
  z-index: 2;
}

.certs-tile:hover .certs-mark,
.certs-tile:focus-visible .certs-mark {
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1.2);
}

@media (hover: none) and (pointer: coarse) {
  .certs-tile:hover .certs-mark {
    filter: grayscale(1);
    opacity: 0.62;
    transform: none;
  }
}

.certs-dialog {
  width: min(100% - 40px, 28rem);
  max-width: 28rem;
  max-height: min(80vh, 640px);
  overflow: auto;
  margin: auto;
  padding: 28px 24px 24px;
  border: 1px solid rgba(13, 13, 13, 0.12);
  border-radius: 16px;
  background: #ffffff;
  color: #0d0d0d;
  box-shadow: none;
}

.certs-dialog::backdrop {
  background: rgba(13, 13, 13, 0.28);
}

.certs-panel {
  position: relative;
}

.certs-dialog[open] {
  animation: certs-panel-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes certs-panel-in {
  from {
    transform: translateY(10px);
  }
  to {
    transform: none;
  }
}

.certs-close {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--secondary);
  font-family: inherit;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
}

.certs-close:hover,
.certs-close:focus-visible {
  color: var(--ink);
}

.certs-close:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.certs-dialog-title {
  font-size: 24px;
  font-weight: 350;
  letter-spacing: -0.48px;
  line-height: 1.2;
  margin: 0 48px 16px 0;
}

.certs-dialog-body p {
  font-size: 16px;
  letter-spacing: -0.18px;
  line-height: 1.5;
  color: var(--secondary);
  margin: 0 0 12px;
}

.certs-dialog-body p:last-child {
  margin-bottom: 0;
}

.certs-request {
  margin: 16px 0 0;
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.5;
  color: var(--muted);
}

.certs-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.5;
  color: var(--ink);
}

.certs-ask a {
  color: var(--secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.certs-ask a:hover,
.certs-ask a:focus-visible {
  color: var(--ink);
}

@media (max-width: 768px) {
  .certs {
    padding: 56px 0 48px;
  }

  .certs-heading {
    font-size: 24px;
    letter-spacing: -0.48px;
    line-height: 1.2;
    margin-bottom: 28px;
  }

  .certs-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .certs-tile {
    aspect-ratio: 4 / 3;
    min-height: 96px;
    padding: 12px;
  }

  .certs-mark[data-fit='scs'] {
    max-width: 100px;
  }

  .certs-dialog {
    width: min(100% - 32px, 28rem);
    max-height: min(78vh, 640px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .certs-tile,
  .certs-mark,
  .certs-dialog[open] {
    animation: none;
    transition: none;
  }

  .certs-tile {
    opacity: 1;
    transform: none;
  }

  .certs-tile:hover .certs-mark,
  .certs-tile:focus-visible .certs-mark {
    transform: none;
  }
}
