/* COMPONENTES COMPARTILHADOS DA HOME E DA V-DEX: botões, cards de monstro, chips e emblemas de tipo.
   Cores vêm dos tokens --vm-* e --type-* de base.css. */

.wrap {
  width: min(var(--vm-max), 100% - 40px);
  margin-inline: auto;
}

.display {
  font-family: "Redonda", system-ui, sans-serif;
  font-weight: normal;
  letter-spacing: 0.01em;
}

/* BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: 2px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid var(--vm-orange);
  outline-offset: 3px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--vm-orange), var(--vm-orange-deep));
  box-shadow: 0 6px 0 var(--vm-plum);
  color: var(--vm-on-accent);
}

.btn-secondary {
  background: var(--vm-crimson);
  box-shadow: 0 6px 0 var(--vm-plum);
  color: #fff;
}

.btn-ghost {
  background: var(--vm-surface);
  border-color: var(--vm-line);
  color: var(--vm-text);
}

.btn-sm {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
}

.btn-primary.btn-sm,
.btn-secondary.btn-sm {
  box-shadow: 0 4px 0 var(--vm-plum);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* CHIPS E BADGES */
.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--tc, var(--type-NEUTRAL));
  color: #1a0610;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--vm-line);
  border-radius: 999px;
  color: var(--vm-text-soft);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Cor de cada tipo exposta como --tc para cards, chips e emblemas */
.type-WILD { --tc: var(--type-WILD); }
.type-GHOST { --tc: var(--type-GHOST); }
.type-DIVINE { --tc: var(--type-DIVINE); }
.type-ELECTRIC { --tc: var(--type-ELECTRIC); }
.type-AQUATIC { --tc: var(--type-AQUATIC); }
.type-DARK { --tc: var(--type-DARK); }
.type-NEUTRAL { --tc: var(--type-NEUTRAL); }
.type-MINERAL { --tc: var(--type-MINERAL); }
.type-FIRE { --tc: var(--type-FIRE); }
.type-ICE { --tc: var(--type-ICE); }
.type-MECHANIC { --tc: var(--type-MECHANIC); }
.type-PLANT { --tc: var(--type-PLANT); }
.type-VIRUS { --tc: var(--type-VIRUS); }
.type-ARCANO { --tc: var(--type-ARCANO); }

/* EMBLEMA DO TIPO: o PNG oficial (branco sobre transparente) vira máscara e recebe a cor pelo CSS */
.type-emblem {
  display: inline-grid;
  place-items: center;
  color: var(--tc, var(--type-NEUTRAL));
}

.type-emblem-glyph {
  width: 100%;
  height: 100%;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* CARDS DE MONSTRO: cor chapada do tipo + camadas de textura */
.monster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 16px;
}

.monster-card {
  --tc-edge: color-mix(in srgb, var(--tc, var(--type-NEUTRAL)) 55%, #1a0610);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  padding: 10px 10px 12px;
  border: 2px solid var(--tc-edge);
  border-radius: 14px;
  background: var(--tc, var(--type-NEUTRAL));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.28),
    0 5px 0 var(--tc-edge),
    0 12px 22px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Brilho, disco atrás do sprite, scanlines e faixa diagonal */
.monster-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.55) 0 27%, rgba(255, 255, 255, 0.18) 28% 33%, transparent 34%),
    radial-gradient(circle at 85% 8%, rgba(255, 255, 255, 0.45) 0%, transparent 40%),
    radial-gradient(circle at 10% 100%, rgba(0, 0, 0, 0.18) 0%, transparent 45%),
    linear-gradient(115deg, transparent 0 62%, rgba(255, 255, 255, 0.16) 62% 70%, transparent 70% 74%, rgba(255, 255, 255, 0.1) 74% 77%, transparent 77%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.045) 0 2px, transparent 2px 4px);
}

/* Mosaico de pixels da identidade */
.monster-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("/images/ui/card-texture.webp") center / cover no-repeat;
  mix-blend-mode: multiply;
  opacity: 0.9;
}

.monster-card:hover {
  transform: translateY(-4px);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.4),
    0 9px 0 var(--tc-edge),
    0 18px 28px rgba(0, 0, 0, 0.3);
}

.monster-card:focus-visible {
  outline: 3px solid var(--vm-orange);
  outline-offset: 3px;
}

.monster-card .num {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(26, 6, 16, 0.55);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.monster-card img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 6px 4px rgba(26, 6, 16, 0.35));
  transition: transform 0.15s ease;
}

.monster-card:hover img {
  transform: scale(1.08);
}

.monster-card .name {
  color: #1a0610;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.55), 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Dentro do card o fundo já é a cor do tipo: o chip inverte */
.monster-card .type-chip {
  background: rgba(26, 6, 16, 0.78);
  color: #fff;
  font-size: 11px;
}

.monster-card .type-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tc, var(--type-NEUTRAL));
}

/* SELO DE FORMA GLITCH */
.glitch-mark {
  display: inline-grid;
  place-items: center;
}

.glitch-mark svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.monster-card .glitch-mark {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(26, 6, 16, 0.7);
  box-shadow: 1px 0 0 #2ee6ff inset, -1px 0 0 #ff4fd8 inset;
  color: #ff4fd8;
}

/* Na visão glitch da V-Dex: separação RGB no sprite */
.monster-card.is-glitch img {
  filter:
    drop-shadow(2px 0 0 rgba(255, 79, 216, 0.75))
    drop-shadow(-2px 0 0 rgba(46, 230, 255, 0.75))
    drop-shadow(0 6px 4px rgba(26, 6, 16, 0.35));
}

.monster-card.is-glitch::before {
  background-color: rgba(26, 6, 16, 0.12);
}

/* LOGOS DE REDES (SVG oficial da marca usado como máscara branca) */
.brand-logo {
  --brand: #444;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 12px;
  background: var(--brand);
}

.brand-logo::before {
  content: "";
  width: 55%;
  height: 55%;
  background: #fff;
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
}

.brand-logo[data-brand="discord"] { --brand: #5865f2; --logo: url("/images/social/discord.svg"); }
.brand-logo[data-brand="youtube"] { --brand: #ff0000; --logo: url("/images/social/youtube.svg"); }
.brand-logo[data-brand="instagram"] { --logo: url("/images/social/instagram.svg"); background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.brand-logo[data-brand="x"] { --brand: #000; --logo: url("/images/social/x.svg"); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset; }
.brand-logo[data-brand="tiktok"] { --brand: #000; --logo: url("/images/social/tiktok.svg"); box-shadow: 2px 0 0 #25f4ee inset, -2px 0 0 #fe2c55 inset; }
.brand-logo[data-brand="bluesky"] { --brand: #1185fe; --logo: url("/images/social/bluesky.svg"); }
.brand-logo[data-brand="threads"] { --brand: #000; --logo: url("/images/social/threads.svg"); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset; }
.brand-logo[data-brand="facebook"] { --brand: #0866ff; --logo: url("/images/social/facebook.svg"); }
.brand-logo[data-brand="twitch"] { --brand: #9146ff; --logo: url("/images/social/twitch.svg"); }
.brand-logo[data-brand="reddit"] { --brand: #ff4500; --logo: url("/images/social/reddit.svg"); }
.brand-logo[data-brand="steam"] { --logo: url("/images/social/steam.svg"); background: linear-gradient(135deg, #111d2e, #1b4a7a); }

@media (prefers-reduced-motion: reduce) {
  .btn,
  .monster-card,
  .monster-card img {
    transition: none;
  }
}
