/* =========================================================
   VITRINA GAMER — styles.css
   Paleta, tipografía, layout, cards, modal, responsive.
   ========================================================= */

/* ---------- Variables de diseño ---------- */
:root {
  --bg: #14161C;
  --surface: #1E2129;
  --surface-2: #262A35;
  --border: #2E3340;

  --accent: #5B8DEF;
  --accent-2: #7C6FF0;
  --available: #3BB273;
  --sold: #6B7280;
  --danger: #E5484D;

  --text: #E5E7EB;
  --text-dim: #9CA3AF;
  --text-muted: #6B7280;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  --font-title: "Space Grotesk", "Sora", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --container: 1160px;
  --header-h: 68px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent-2); }
button { font-family: inherit; cursor: pointer; }
ul, ol { padding-left: 0; margin: 0; list-style: none; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
.section {
  padding: 80px 0;
}
.section-title {
  font-family: var(--font-title);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.section-lead {
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 0 32px;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #0B1020;
}
.btn-primary:hover { background: #7AA0F3; color: #0B1020; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-small { padding: 8px 14px; font-size: 0.85rem; }
.btn-icon { font-size: 1rem; }

.btn-ig {
  background: linear-gradient(135deg, #F58529, #DD2A7B, #8134AF);
  color: white;
}
.btn-fb { background: #1877F2; color: white; }
.btn-msg { background: #0084FF; color: white; }
.btn-ig:hover, .btn-fb:hover, .btn-msg:hover { filter: brightness(1.08); color: white; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 22, 28, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 20px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.logo-mark {
  color: var(--accent);
  font-size: 0.9em;
}
.main-nav {
  display: flex;
  gap: 22px;
}
.main-nav a {
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 500;
}
.main-nav a:hover { color: var(--text); }
.header-cta { padding: 9px 16px; font-size: 0.88rem; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: 0;
  padding: 8px;
}
.menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}

/* ---------- Hero ---------- */
.hero {
  padding: 90px 0 60px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 80% 10%, rgba(91, 141, 239, 0.15), transparent 60%),
    radial-gradient(500px 260px at 10% 80%, rgba(124, 111, 240, 0.10), transparent 60%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 780px; }
.hero-eyebrow {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 16px;
}
.hero-title {
  font-family: var(--font-title);
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  font-weight: 700;
}
.hero-subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  margin: 0 0 32px;
  max-width: 620px;
}
.hero-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Trust strip ---------- */
.trust-strip {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(30, 33, 41, 0.4);
}
.trust-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 20px;
}
.trust-list li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--text-dim);
}
.trust-icon { font-size: 1rem; }

/* ---------- Cómo comprar ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  counter-reset: none;
}
.steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .2s ease, transform .2s ease;
}
.steps li:hover { border-color: var(--accent); transform: translateY(-2px); }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(91, 141, 239, 0.15);
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-title);
  margin-bottom: 12px;
}
.steps h3 {
  margin: 0 0 6px;
  font-family: var(--font-title);
  font-size: 1.05rem;
}
.steps p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* ---------- Catálogo ---------- */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.tab {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all .2s ease;
}
.tab:hover { color: var(--text); border-color: var(--text-muted); }
.tab.active {
  background: var(--accent);
  color: #0B1020;
  border-color: var(--accent);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- Product card ---------- */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  position: relative;
}
.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.product-card.is-sold {
  opacity: 0.65;
}
.product-card.is-sold .product-image img {
  filter: grayscale(1);
}

.product-image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #0E1016;
  overflow: hidden;
}
.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .product-image img { transform: scale(1.03); }

/* ---------- BADGES CORREGIDOS ---------- */
.product-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  max-width: max-content;
  min-height: 0;
  line-height: 1;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 6px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(20, 22, 28, 0.88);
  color: var(--text);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.08);
  flex: 0 0 auto;
  align-self: flex-start;
}

.badge-platform { color: var(--accent); }
.badge-available { background: var(--available); color: #062212; border-color: transparent; }
.badge-sold { background: var(--sold); color: white; border-color: transparent; }

/* ---------- Rotación de imagen (Zelda) ---------- */
.product-image img.img-rotate-180 {
  transform: rotate(180deg);
}

.product-card:hover .product-image img.img-rotate-180 {
  transform: rotate(180deg) scale(1.03);
}

.product-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.product-name {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.product-price {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}
.product-price.is-consult {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}
.product-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.product-meta strong { color: var(--text); font-weight: 600; }
.product-note {
  font-size: 0.85rem;
  color: #C9B46A;
  background: rgba(201, 180, 106, 0.08);
  border-left: 3px solid #C9B46A;
  padding: 8px 10px;
  border-radius: 4px;
  line-height: 1.45;
}
.product-cta {
  margin-top: auto;
  padding-top: 10px;
}
.product-cta .btn {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.9rem;
}
.product-card.is-sold .product-cta .btn {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
  border-color: var(--border);
}

/* ---------- Avisos ---------- */
.notice-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.notice-box p { margin: 0 0 12px; }
.notice-box p:last-child { margin-bottom: 0; }

/* ---------- Contacto ---------- */
.contact-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.contact-buttons .btn {
  min-width: 180px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 30px;
  background: #101218;
}
.footer-inner { text-align: center; }
.footer-tagline {
  max-width: 560px;
  margin: 0 auto 16px;
  color: var(--text-dim);
}
.footer-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
}
.footer-update, .footer-credit {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 4px 0;
}

/* ---------- Modal ---------- */
/* Asegura que el modal NO aparezca al cargar */
.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 460px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow);
  animation: popIn .25s ease;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 1.6rem;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background .2s ease, color .2s ease;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-title {
  font-family: var(--font-title);
  margin: 0 0 6px;
  font-size: 1.2rem;
}
.modal-product {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 18px;
  font-size: 0.95rem;
}
.modal-message {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 18px;
}
.modal-message label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.modal-message textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  resize: none;
  margin-bottom: 8px;
}
.modal-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.modal-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

/* ---------- Animaciones ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Fade-in al scroll */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .main-nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: 75%;
    max-width: 300px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    transform: translateX(100%);
    transition: transform .25s ease;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav a { font-size: 1rem; color: var(--text); }
  .header-cta { display: none; }
  .menu-toggle { display: flex; }
  .menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle.open span:nth-child(2) { opacity: 0; }
  .menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .hero { padding: 60px 0 40px; }
  .section { padding: 60px 0; }
}

@media (max-width: 520px) {
  .hero-title { font-size: 2rem; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { width: 100%; }
  .products-grid { grid-template-columns: 1fr; }
  .contact-buttons { flex-direction: column; }
  .contact-buttons .btn { width: 100%; min-width: 0; }
}

/* ---------- Accesibilidad ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}


/* ---------- FIX ROBUSTO CLOUDFARE/CACHÉ ---------- */
/* Mantiene el contenido visible aunque falle IntersectionObserver o quede cacheado un CSS anterior. */
.hero,
.trust-strip,
.section,
.site-footer {
  display: block;
  opacity: 1;
  visibility: visible;
}
.hero-inner,
.trust-list,
.section > .container,
.footer-inner {
  opacity: 1;
  visibility: visible;
}
.reveal {
  opacity: 1;
  transform: none;
}
.product-badges {
  align-items: flex-start !important;
  bottom: auto !important;
  height: auto !important;
}
.product-badges .badge,
.badge {
  flex: 0 0 auto !important;
  align-self: flex-start !important;
  width: auto !important;
  height: auto !important;
  max-height: 28px !important;
}
