/* library.css: the look of the catalog's home page, a grid of game box
   covers. Only index.html uses it; it comes after style.css, so the other
   pages keep their look.

   Covers look like the "black box" covers of the first NES games: black,
   with a fine grid, the title in big letters, and a window of game art.
   To change a color, change it in :root. */

:root {
  --wall: #1c1230;        /* The page. */
  --sign: #ffd23f;        /* The sign, and the titles on the covers. */
  --sign-glow: #ff8a1f;
  --box: #000;
  --box-grid: #1f1f1f;    /* The fine grid on a black box. */
  --box-red: #d82800;     /* NES red: the label in the cover's corner. */
}

body.library { background: var(--wall); }

/* ------------------------------------------------------------------
   The sign
   ------------------------------------------------------------------ */

.sign-wall {
  position: relative;
  width: min(100% - 2rem, 64rem);
  margin-inline: auto;
  padding-block: 4rem 2.5rem;
  text-align: center;
}
.sign-wall .corner { top: 1.25rem; right: 0; }

.sign {
  display: inline-block;
  font-size: clamp(2.25rem, 7vw, 4.75rem);
  color: #fff6d0;
  padding: 0.35em 0.6em 0.4em;
  border: 4px solid var(--sign);
  border-radius: 6px;
  /* The letters and the frame glow, as a lit sign does. */
  text-shadow: 0 0 6px var(--sign), 0 0 22px var(--sign-glow);
  box-shadow: 0 0 18px rgba(255, 138, 31, 0.45), inset 0 0 18px rgba(255, 138, 31, 0.3);
  background: rgba(0, 0, 0, 0.35);
}

.sign-wall p {
  max-width: 34rem;
  margin: 1.25rem auto 0;
  font-size: 1.125rem;
  color: #e8dcff;
}

/* ------------------------------------------------------------------
   The grid: as many columns as fit, each cover 15rem wide.
   ------------------------------------------------------------------ */

.library-grid {
  width: min(100% - 2rem, 64rem);
  margin-inline: auto;
  padding-bottom: 5rem;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 15rem));
  justify-content: center;
  gap: 2.5rem 2rem;
}

/* ------------------------------------------------------------------
   A cover. The whole cover is a link that starts the game.
   ------------------------------------------------------------------ */

.box {
  display: block;
  aspect-ratio: 9 / 12.6;
  color: inherit;
  text-decoration: none;
  transition: transform 150ms ease-out;
}
.box:hover { transform: translateY(-4px); }
.box:focus-visible {
  outline: 3px solid var(--sign);
  outline-offset: 4px;
}

.box-front {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.85rem 0.85rem 0.75rem;
  background-color: var(--box);
  /* The fine grid of a black box. */
  background-image:
    linear-gradient(var(--box-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--box-grid) 1px, transparent 1px);
  background-size: 10px 10px;
  border: 1px solid #3a3a3a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* The label in the top corner. */
.box-label {
  align-self: flex-start;
  font-family: "Pixelify Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  background: var(--box-red);
  padding: 0.05rem 0.45rem 0.1rem;
  margin-bottom: 0.55rem;
}

.box-title {
  font-family: "Pixelify Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 0.95;
  color: var(--sign);
  /* A hard red shadow, as printed titles of the time had. */
  text-shadow: 3px 3px 0 var(--box-red);
  text-transform: uppercase;
}

.box-tagline {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: #d8d8d8;
}

/* The window of game art. */
.box-art {
  flex: 1;
  min-height: 0;
  margin-top: 0.7rem;
  border: 3px solid #fff;
  outline: 2px solid var(--box-red);
  background: #000;
  overflow: hidden;
}
.box-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated; /* Keep the game's pixels sharp. */
}

.box-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.65rem;
}
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid #fff;
  padding: 0 0.35rem;
}

/* ------------------------------------------------------------------
   Under the cover: the name and the links.
   ------------------------------------------------------------------ */

.caption { margin-top: 0.9rem; }
.caption h2 { font-size: 1.4rem; }
.caption .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 0.6rem;
}
.caption .play { font-size: 1.05rem; padding: 0.35rem 1rem; }
/* "Online" is a button like "Play", in the sign's yellow, so the two
   stand apart. */
.caption .online-button { background: var(--sign); }
.caption .online-button:hover { background: #fff; }

.library .note { color: var(--sign); }

/* No lift for people who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  .box { transition: none; }
  .box:hover { transform: none; }
}
