/* Sidebar merch callout — a larger cousin of the site's animated 88x31 button */
.merch-promo-window h2 {
  background: linear-gradient(90deg, #9a235d, #df558e 62%, #ffc47a);
}

.merch-promo-body {
  display: grid;
  place-items: center;
  padding: 8px;
  background:
    repeating-conic-gradient(rgba(217,236,248,.78) 0 25%, rgba(255,255,255,.92) 0 50%) 0 0 / 10px 10px;
}

.merch-promo {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 76px auto;
  width: 100%;
  max-width: 320px;
  min-height: 116px;
  overflow: hidden;
  color: #fff;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(#bdeaff 0, #75bde8 46%, #3f81c4 48%, #17458d 100%);
  border: 2px solid #17204f;
  outline: 1px solid #fff;
  outline-offset: -3px;
  box-shadow: 3px 3px 0 #7b3157, inset 0 0 0 3px rgba(217,239,255,.48);
  text-shadow: 1px 1px #0b2c63;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.merch-promo:visited { color: #fff; }

.merch-promo:hover {
  color: #fff;
  background: linear-gradient(#d6f4ff 0, #88caf0 46%, #4b91d2 48%, #1b4f99 100%);
  box-shadow: 5px 6px 0 #b83d72, inset 0 0 0 3px rgba(255,255,255,.62);
  filter: saturate(1.08);
  transform: translate(-1px, -2px);
}

.merch-promo:focus-visible {
  outline: 3px dashed #ffe461;
  outline-offset: -7px;
}

.merch-promo:active {
  border-style: inset;
  box-shadow: 1px 1px 0 #7b3157;
  transform: translate(1px, 1px);
}

.merch-promo::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: -28px;
  left: -54px;
  width: 22px;
  height: 180px;
  pointer-events: none;
  background: rgba(255,255,255,.22);
  transform: rotate(24deg);
  animation: merch-button-scan 3.4s linear infinite;
}

.merch-promo::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 4px;
  pointer-events: none;
  border: 1px dashed rgba(230,247,255,.75);
}

.merch-promo__cast {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: center;
  min-width: 0;
  height: 76px;
  padding: 3px 3px 0;
  overflow: hidden;
  filter: drop-shadow(1px 2px 0 rgba(23,32,79,.35));
}

.merch-promo__cast img {
  flex: 0 0 auto;
  width: 38px;
  height: 73px;
  margin-inline: -5px;
  object-fit: contain;
  object-position: center bottom;
  transform-origin: 50% 90%;
  animation: merch-chibi-bob 2.8s steps(2, end) infinite;
}

.merch-promo__cast img:nth-child(2) { animation-delay: -.4s; }
.merch-promo__cast img:nth-child(3) { animation-delay: -.8s; }
.merch-promo__cast img:nth-child(4) { animation-delay: -1.2s; }
.merch-promo__cast img:nth-child(5) { animation-delay: -1.6s; }
.merch-promo__cast img:nth-child(6) { animation-delay: -2s; }
.merch-promo__cast img:nth-child(7) { animation-delay: -2.4s; }

.merch-promo:hover .merch-promo__cast img {
  animation-duration: 1.7s;
}

.merch-promo__copy {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 5px;
  min-height: 40px;
  padding: 4px 9px 5px;
  color: #fff;
  background: linear-gradient(#ff9fc4, #d84d85 52%, #a92260 54%, #ca3a76);
  border-top: 1px solid #ffe4ef;
}

.merch-promo__brand {
  grid-column: 1;
  justify-self: start;
  font: 900 14px/1 Verdana, Arial, sans-serif;
  letter-spacing: -.06em;
  text-shadow: 1px 1px #6f1842, -1px -1px rgba(255,255,255,.42);
}

.merch-promo__label {
  grid-column: 1;
  justify-self: start;
  font: bold 6px/1.2 "Courier New", monospace;
  letter-spacing: .13em;
}

.merch-promo__copy strong {
  grid-column: 2;
  grid-row: 1 / 3;
  min-width: 52px;
  padding: 5px 4px;
  color: #17204f;
  font: bold 9px Verdana, sans-serif;
  background: linear-gradient(#fff8ad, #ffd648);
  border: 2px outset #fff7c7;
  box-shadow: 1px 1px 0 #732044;
  text-shadow: none;
}

.merch-promo__spark {
  position: absolute;
  z-index: 4;
  color: #ffe461;
  font: bold 11px Georgia, serif;
  text-shadow: 1px 1px #824b00;
  animation: merch-spark-blink 1.2s steps(2, end) infinite;
}

.merch-promo__spark--a { top: 7px; right: 8px; }
.merch-promo__spark--b { top: 44px; left: 7px; animation-delay: -.6s; }

@keyframes merch-chibi-bob {
  0%, 100% { transform: translateY(2px) rotate(-1deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

@keyframes merch-button-scan {
  to { transform: translateX(390px) rotate(24deg); }
}

@keyframes merch-spark-blink {
  50% { opacity: .18; transform: scale(.72); }
}

/* Merch catalog page */
.merch-main {
  padding: 12px;
  background: #d9eff8;
}

.merch-window {
  overflow: hidden;
  background: var(--paper);
  border: 2px outset #b8d4e7;
  box-shadow: 3px 3px 0 rgba(31,76,127,.28);
}

.merch-intro {
  padding: 11px;
  color: #6c2346;
  text-align: center;
  background: linear-gradient(90deg, #fff7c7, #ffe7f1, #dff4ff);
  border-bottom: 1px dashed #ad6685;
}

.merch-intro p { margin: 0 0 4px; }
.merch-intro small { color: #596779; font: 9px/1.45 "Courier New", monospace; }

.merch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  background:
    linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.72)),
    repeating-conic-gradient(#ddecf6 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}

.merch-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(190px, 1fr) auto auto;
  overflow: hidden;
  color: #17204f;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(#fff, #e5f3ff);
  border: 2px outset #d5ecfa;
  box-shadow: 3px 3px 0 #9cb9d1;
  transition: transform .15s ease, box-shadow .15s ease;
}

.merch-card:visited { color: #17204f; }
.merch-card:hover {
  z-index: 1;
  color: #17204f;
  background: linear-gradient(#fffef0, #ffe9f3);
  transform: translate(-2px, -3px) rotate(-.35deg);
  box-shadow: 6px 7px 0 #e6a6c2;
}

.merch-card:focus-visible {
  outline: 3px dashed #b92d68;
  outline-offset: 3px;
}

.merch-card__portrait {
  display: grid;
  place-items: end center;
  min-width: 0;
  padding: 10px 8px 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 25%, #fff 0 4px, transparent 5px) 0 0 / 28px 28px,
    linear-gradient(150deg, #ccefff, #ffe2ef);
  border-bottom: 1px dashed #8ca8be;
}

.merch-card__portrait img {
  display: block;
  width: min(100%, 170px);
  height: 190px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(2px 3px 0 rgba(42,59,103,.2));
  transform-origin: 50% 90%;
  transition: transform .18s ease;
}

.merch-card:hover .merch-card__portrait img {
  transform: translateY(-3px) rotate(2deg) scale(1.04);
}

.merch-card__name {
  padding: 7px 6px 5px;
  color: #b22965;
  font: bold 20px Georgia, serif;
  text-shadow: 1px 1px #fff;
}

.merch-card__cta {
  margin: 0 8px 9px;
  padding: 7px 6px;
  color: #fff;
  font: bold 9px Verdana, sans-serif;
  letter-spacing: .04em;
  background: linear-gradient(#397fc7, #184686);
  border: 2px outset #a9d7ff;
  text-shadow: 1px 1px #0f2e61;
}

.merch-card:active .merch-card__cta { border-style: inset; }

html[data-theme="strawberry"] .merch-main { background: #f8d6e5; }
html[data-theme="strawberry"] .merch-grid { background-color: #fff0f6; }
html[data-theme="strawberry"] .merch-card__cta { background: linear-gradient(#e36a9e, #8f2e67); border-color: #ffc8df; }

html[data-theme="midnight"] .merch-main { background: #ccd0ee; }
html[data-theme="midnight"] .merch-grid { background-color: #e4e3f5; }
html[data-theme="midnight"] .merch-card__cta { background: linear-gradient(#7165bd, #282565); border-color: #cbc7ff; }

html[data-theme="frutiger"] .merch-window {
  border: 1px solid rgba(255,255,255,.94);
  outline: 1px solid rgba(27,113,158,.58);
  border-radius: 7px;
  box-shadow: 0 7px 14px rgba(0,72,110,.23), inset 0 1px 0 #fff;
}

html[data-theme="frutiger"] .merch-card {
  border: 1px solid #86b9d0;
  border-radius: 6px;
  box-shadow: 0 3px 7px rgba(14,89,122,.17), inset 0 1px 0 #fff;
}

html[data-theme="xp"] .merch-main { background: #ece9d8; }
html[data-theme="xp"] .merch-window {
  border: 2px solid #0054e3;
  border-radius: 7px 7px 2px 2px;
  box-shadow: 2px 2px 0 rgba(0,43,135,.22);
}
html[data-theme="xp"] .merch-grid { background-color: #fff; }
html[data-theme="xp"] .merch-card {
  border: 1px solid #7f9db9;
  border-radius: 2px;
  box-shadow: 1px 1px 0 #d5e4f4;
}
html[data-theme="xp"] .merch-card__cta {
  color: #fff;
  background: linear-gradient(#3b8cf5, #0054d9);
  border-color: #9bc7ff;
}

@media (max-width: 760px) {
  .merch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 9px; }
  .merch-card { grid-template-rows: minmax(170px, 1fr) auto auto; }
  .merch-card__portrait img { height: 170px; }
}

@media (max-width: 600px) {
  .merch-promo-window { grid-column: 1 / -1; }
  .merch-promo { width: min(100%, 320px); }
}

@media (max-width: 430px) {
  .merch-main { padding: 7px; }
  .merch-grid { grid-template-columns: 1fr; }
  .merch-card {
    grid-template-columns: minmax(118px, 42%) 1fr;
    grid-template-rows: auto auto;
    min-height: 160px;
    text-align: left;
  }
  .merch-card__portrait { grid-row: 1 / 3; }
  .merch-card__portrait img { width: 128px; height: 158px; }
  .merch-card__name { align-self: end; padding: 14px 10px 5px; font-size: 22px; }
  .merch-card__cta { align-self: start; margin: 3px 9px 12px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .merch-promo,
  .merch-promo__cast img { transition: none; }
  .merch-promo::before,
  .merch-promo__cast img,
  .merch-promo__spark { animation: none; }
  .merch-promo:hover { transform: none; }
  .merch-card,
  .merch-card__portrait img { transition: none; }
  .merch-card:hover,
  .merch-card:hover .merch-card__portrait img { transform: none; }
}
