/* Redeem codes (dist/codes.html, built by tools/build-codes.mjs). Loaded after site.css. */

.codes-page { --page-w: 1100px; }

.code-group + .code-group { margin-top: 36px; }
.code-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-bottom: 16px;
  color: #fff;
}
.code-group + .code-group .code-group-head { color: var(--navy); }
.code-group-head h2 { color: inherit; font-size: clamp(22px, 3vw, 28px); }
.code-group-head p { margin: 0; opacity: .85; font-size: 15px; font-weight: 700; }
.code-group + .code-group .code-group-head p { color: var(--gray); opacity: 1; }

.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.code-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 0 var(--line), 0 24px 50px -30px rgba(15, 31, 58, .4);
}
.code-card--limited { background: linear-gradient(180deg, #fffaf0 0%, #fff 70px); }

.code-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code-name { margin: 0; min-width: 0; }
.code-name code {
  display: inline-block;
  padding: 6px 12px;
  border: 1px dashed #9fb6d2;
  border-radius: 10px;
  background: #f3f8ff;
  color: var(--navy);
  font: 800 19px/1.3 var(--font);
  letter-spacing: .02em;
  user-select: all;
  overflow-wrap: anywhere;
}
.code-copy {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--yellow);
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12);
}
.code-copy:hover { filter: brightness(1.04); }
.code-copy:active { transform: translateY(1px); }
.code-copy.is-done { background: #e5f5e8; color: #1d6b2b; }

.code-requires {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  margin: 0;
  padding: 3px 12px 3px 5px;
  border-radius: 999px;
  background: #e4f0fb;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}
.code-requires img { width: 28px; height: 28px; }
.code-requires:not(:has(img)) { padding-left: 12px; }
.code-requires--champion { background: #fff1c2; color: #6f5300; }

.code-rewards {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
.code-rewards li { display: flex; align-items: center; gap: 10px; padding: 3px 0; }

/* Reward icons: the same sheets as the Pokédex. Positions come from codes-icons.css. */
.code-icon { flex: none; display: block; }
.code-icon--item { position: relative; width: 32px; height: 32px; }
.code-icon-sprite {
  position: absolute;
  background: url("./assets/pokerogue/items.png") no-repeat;
  image-rendering: pixelated;
}
.code-icon--mon {
  width: 60px;
  height: 45px;
  margin: -8px -10px;
  background: url("./assets/showdown/pokemonicons-sheet.png") no-repeat;
  background-size: 720px auto;
  image-rendering: pixelated;
}
.code-reward--mon { font-weight: 800; color: var(--navy); }
.code-icon--bp {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff1c2;
  color: #6f5300;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}
.code-icon--none { width: 32px; height: 32px; }
.code-icon--none::before { display: block; width: 7px; height: 7px; margin: 12px auto; border-radius: 50%; background: var(--green); content: ""; }

.code-limit,
.code-expires { margin: auto 0 0; padding-top: 8px; border-top: 1px solid var(--line); color: var(--gray); font-size: 13.5px; font-weight: 700; }
.code-limit + .code-expires { margin-top: 0; padding-top: 0; border-top: 0; }
.code-expires time { color: #a35e00; }

/* Set by assets/js/codes.js once the expiry day has passed. */
.code-card.is-expired { opacity: .62; }
.code-card.is-expired .code-name code { text-decoration: line-through; text-decoration-thickness: 2px; }
.code-card.is-expired .code-expires time { color: #a3230a; }
.code-card.is-expired .code-copy { display: none; }

.code-empty {
  margin: 0;
  padding: 28px;
  border-radius: 18px;
  background: #fff;
  color: var(--gray);
  text-align: center;
  box-shadow: 0 1px 0 var(--line);
}

@media (max-width: 600px) {
  .code-grid { grid-template-columns: 1fr; }
  .code-card { padding: 18px 18px 16px; }
}
