.mod-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mod-card {
  display: block;
  padding: 10px;
  min-height: 214px;
  background: white;
  box-shadow: 6px 6px 0 #33517e14;
  color: inherit;
  text-decoration: none;
  align-self: stretch;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease;
}

.mod-card:hover,
.mod-card:focus-visible {
  background: white;
  color: inherit;
  box-shadow: 6px 9px 0 #e776ba45;
  transform: translateY(-4px);
}

.mod-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 240/135;
  object-fit: cover;
}

.mod-image-wrap {
  display: block;
  position: relative;
}

.mod-image-wrap::after,
.media-gallery button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--lightblue);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.mod-card:hover .mod-image-wrap::after,
.media-gallery button:hover::after,
.media-gallery button:focus-visible::after {
  opacity: 0.3;
}

.modcardname {
  text-transform: uppercase;
  font:
    700 17px/18px Astroneer,
    sans-serif;
  color: var(--blue);
  margin: 7px 0 6px;
}

.modcardstar {
  display: inline-block;
  font-family: 'Segoe UI Symbol', sans-serif;
  color: var(--navy);
  font-size: 16px;
  font-weight: 400;
  padding-right: 5px;
  margin-right: 2px;
}

.modcarddesc {
  font:
    300 12px/13px Roboto,
    sans-serif;
  color: #8d8d8d;
  max-height: 26px;
  overflow: hidden;
  margin: 0;
}

.mod-card:hover .modcardname,
.mod-card:focus-visible .modcardname {
  color: var(--purple);
}

.mod-card:hover .modcardstar,
.mod-card:focus-visible .modcardstar {
  color: var(--yellow);
  animation: star-sparkle 0.55s ease-out both;
}

.mod-section + .mod-section {
  margin-top: 40px;
}

.mod-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 240 / 135;
  background: linear-gradient(135deg, var(--lightblue), #e6dff5);
  color: var(--blue);
  font:
    40px 'Segoe UI Symbol',
    sans-serif;
}

.mod-diary {
  font-size: 14px;
}

.mod-diary p {
  margin: 0 0 10px;
}

.paper .mod-notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-left: 3px solid var(--pink);
  background: #fff3f8;
  color: var(--navy);
  font-size: 14px;
  line-height: 22px;
}

.mod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 24px;
}

.paper .mod-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 20px;
  background: var(--blue);
  color: white;
  font:
    700 18px/22px Astroneer,
    sans-serif;
  text-align: center;
  text-decoration: none;
}

.paper .mod-button:hover {
  background: var(--purple);
  color: white;
}

.paper .mod-button:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}

.mod-meta {
  margin: 0 0 18px 20px;
  padding: 12px 18px;
  border-left: 8px solid var(--blue);
  background: #f2f4f9;
  font-size: 14px;
  line-height: 120%;
  width: 300px;
}

.back-link {
  margin: 26px 0 0;
}

.media-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.media-gallery button {
  position: relative;
  width: 160px;
  height: 90px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--lightblue);
  cursor: zoom-in;
}

.media-gallery button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
}

.media-gallery button:hover,
.media-gallery button:focus-visible {
  outline: 1px solid var(--purple);
  outline-offset: 3px;
}

.mod-readme-header p {
  margin-top: 30px;
}

.media-popup {
  max-width: 92vw;
  max-height: 92vh;
  padding: 36px 12px 12px;
  border: 0;
  background: white;
}

.media-popup::backdrop {
  background: rgba(26, 32, 55, 0.75);
}

.media-popup > img {
  display: block;
  max-width: 85vw;
  max-height: 80vh;
  object-fit: contain;
}

.media-popup > button {
  position: absolute;
  top: 2px;
  right: 8px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 28px;
  cursor: pointer;
}

@media (max-width: 1050px) {
  .mod-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .mod-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mod-card:hover .modcardstar,
  .mod-card:focus-visible .modcardstar {
    animation: none;
  }
  .mod-card,
  .mod-image-wrap::after,
  .media-gallery button::after {
    transition: none;
  }
}
