/* ─── VRealm Games ────────────────────────────────────────────────────────────
 * Main stylesheet for the games grid component.
 * All tokens from DESIGN.md — no hardcoded values.
 * ──────────────────────────────────────────────────────────────────────────── */

/* ─── Custom Properties ────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --vrealm-color-primary: #74D7CE;
  --vrealm-color-accent: #e43063;

  /* Surfaces */
  --vrealm-color-bg: #0A0A0C;
  --vrealm-color-surface: #131316;
  --vrealm-color-surface-hover: #1B1B1F;
  --vrealm-color-border: rgba(255, 255, 255, 0.08);
  --vrealm-color-border-accent: rgba(211, 49, 95, 0.35);

  /* Text */
  --vrealm-color-text-primary: #FFFFFF;
  --vrealm-color-text-secondary: #C9C9CE;
  --vrealm-color-text-muted: #8A8A90;

  /* Typography */
  --vrealm-font-heading: 'Audiowide', system-ui, sans-serif;
  --vrealm-font-body: 'Nunito Sans', system-ui, sans-serif;

  /* Spacing */
  --vrealm-space-xs: 4px;
  --vrealm-space-sm: 8px;
  --vrealm-space-md: 16px;
  --vrealm-space-lg: 24px;
  --vrealm-space-xl: 32px;
  --vrealm-space-2xl: 48px;

  /* Radii */
  --vrealm-radius-sm: 8px;
  --vrealm-radius-md: 12px;
  --vrealm-radius-lg: 16px;
  --vrealm-radius-pill: 999px;
  --vrealm-border-width: 1px;
}

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
.vrealm-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--vrealm-space-sm);
  margin-bottom: var(--vrealm-space-xl);
}

.vrealm-tab {
  position: relative;
  isolation: isolate;
  font-family: var(--vrealm-font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--vrealm-color-text-muted);
  background: transparent;
  border: var(--vrealm-border-width) solid rgba(255, 255, 255, 0.15);
  border-radius: var(--vrealm-radius-pill);
  padding: var(--vrealm-space-sm) var(--vrealm-space-lg);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  outline: none;
  overflow: hidden;
}

/* Glow effect behind the tab (hidden by default) */
.vrealm-tab::before {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: -1;
  background: radial-gradient(
    circle at center,
    rgba(96, 239, 255, 0.35),
    rgba(211, 49, 95, 0.15),
    transparent 50%
  );
  opacity: 0;
  transform: scale(0.1);
  transition: opacity 0.6s ease, transform 0.6s ease;
  filter: blur(20px);
  border-radius: inherit;
}

.vrealm-tab:hover {
  color: var(--vrealm-color-text-primary);
  border-color: transparent;
  background-image: linear-gradient(135deg, #39C2D2 0%, #D3315F 100%);
  background-size: 200% 200%;
  background-position: 0% 50%;
  animation: vream-tab-gradient 0.6s ease forwards;
}

/* Glow appears on hover */
.vrealm-tab:hover::before {
  opacity: 1;
  transform: scale(1);
}

@keyframes vream-tab-gradient {
  to {
    background-position: 100% 50%;
  }
}

.vrealm-tab:focus-visible {
  border-color: var(--vrealm-color-primary);
  box-shadow: 0 0 0 2px var(--vrealm-color-primary);
}

.vrealm-tab.is-active {
  color: var(--vrealm-color-text-primary);
  border-color: transparent;
  background-image: linear-gradient(135deg, #39C2D2 0%, #D3315F 100%);
}

/* ─── Grid ─────────────────────────────────────────────────────────────────── */
.vrealm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--vrealm-space-lg);
  margin-bottom: var(--vrealm-space-xl);
  opacity: 1;
  transition: opacity 0.35s ease-in-out;
}

.vrealm-grid.is-hidden {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  pointer-events: none;
}

@media (max-width: 1024px) {
  .vrealm-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .vrealm-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Card ─────────────────────────────────────────────────────────────────── */
.vrealm-card {
  position: relative;
  border-radius: var(--vrealm-radius-md);
  overflow: visible;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  outline: none;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.4s ease, transform 0.3s ease;
}

.vrealm-card:focus-visible {
  box-shadow: 0 0 0 3px var(--vrealm-color-primary);
}

.vrealm-card:hover {
  box-shadow:
    0 0 12px 2px rgba(116, 215, 206, 0.9),
    0 0 30px 6px rgba(228, 48, 99, 0.7),
    0 0 60px 12px rgba(116, 215, 206, 0.3),
    0 0 90px 10px rgba(228, 48, 99, 0.15);
  transform: translateY(-4px);
}

/* ─── Card Cover ───────────────────────────────────────────────────────────── */
.vrealm-card__cover {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

.vrealm-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vrealm-card__no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--vrealm-color-surface);
  color: var(--vrealm-color-text-muted);
}

.vrealm-card__gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.97) 0%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease-in-out;
}

.vrealm-card:hover .vrealm-card__gradient,
.vrealm-card:focus-within .vrealm-card__gradient {
  opacity: 1;
}

/* ─── Card Info (hover reveal) ─────────────────────────────────────────────── */
.vrealm-card__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--vrealm-space-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.vrealm-card:hover .vrealm-card__info,
.vrealm-card:focus-within .vrealm-card__info {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Card: Temática tag ──────────────────────────────────────────────────── */
.vrealm-card__tematica {
  display: block;
  font-family: var(--vrealm-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--vrealm-color-primary);
  margin-bottom: var(--vrealm-space-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ─── Card: Modalidad tag ─────────────────────────────────────────────────── */
.vrealm-card__modalidad {
  display: block;
  font-family: var(--vrealm-font-body);
  font-size: 16px;
  font-weight: 600;
  color: white !important;
  margin-bottom: var(--vrealm-space-xs);
  letter-spacing: 0.03em;
}

/* ─── Card: Title ──────────────────────────────────────────────────────────── */
.vrealm-card__title {
  font-family: var(--vrealm-font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--vrealm-color-text-primary);
  margin: 0 0 var(--vrealm-space-sm) 0;
  text-transform: uppercase;
}

/* ─── Card: Flags ──────────────────────────────────────────────────────────── */
.vrealm-card__flags {
  display: flex;
  gap: var(--vrealm-space-xs);
  margin-bottom: var(--vrealm-space-sm);
}

.vrealm-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
}

.vrealm-flag--globe {
  fill: none;
  stroke: var(--vrealm-color-text-secondary);
  stroke-width: 1.5;
}

/* ─── Card: Meta (players + duration) ──────────────────────────────────────── */
.vrealm-card__meta {
  display: flex;
  flex-direction: column;
  gap: var(--vrealm-space-xs);
}

.vrealm-card__players,
.vrealm-card__duration {
  display: inline-flex;
  align-items: center;
  gap: var(--vrealm-space-xs);
  font-family: var(--vrealm-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--vrealm-color-text-primary);
}

.vrealm-card__meta .vrealm-icon {
  width: 14px;
  height: 14px;
  color: var(--vrealm-color-accent);
  flex-shrink: 0;
}

/* ─── Modal ────────────────────────────────────────────────────────────────── */
.vrealm-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.vrealm-modal.is-active {
  display: flex;
}

.vrealm-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.vrealm-modal__content {
  position: relative;
  width: 90%;
  height: 85%;
  max-width: 1200px;
  z-index: 1;
}

.vrealm-modal__close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--vrealm-color-primary);
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  outline: none;
}

.vrealm-modal__close:hover {
  color: var(--vrealm-color-text-primary);
}

.vrealm-modal__close:focus-visible {
  box-shadow: 0 0 0 2px var(--vrealm-color-primary);
  border-radius: 4px;
}

.vrealm-modal__iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--vrealm-radius-md);
  background: var(--vrealm-color-bg);
}

/* ─── Icon sprite (hidden) ─────────────────────────────────────────────────── */
.vrealm-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.vrealm-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
