/* =========================================
   UPGRADE v2.0 — Visual Design Enhancements
   Import this after style.css
   ========================================= */

/* ── Custom Cursor ─────────────────────── */
*, *::before, *::after { cursor: none !important; }

#ue-cursor {
  position: fixed;
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: width .15s, height .15s, background .15s, opacity .15s;
  mix-blend-mode: screen;
  box-shadow: 0 0 10px var(--accent), 0 0 30px var(--accent-glow);
}

#ue-cursor-ring {
  position: fixed;
  width: 36px; height: 36px;
  border: 1px solid rgba(0, 212, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  transition: transform .08s ease, width .2s, height .2s, border-color .2s;
}

body:has(a:hover) #ue-cursor,
body:has(button:hover) #ue-cursor { width: 6px; height: 6px; background: #fff; }

body:has(a:hover) #ue-cursor-ring,
body:has(button:hover) #ue-cursor-ring { width: 52px; height: 52px; border-color: var(--accent); }

@media (hover: none) {
  #ue-cursor, #ue-cursor-ring { display: none; }
  *, *::before, *::after { cursor: auto !important; }
}

/* ── Particle Canvas ───────────────────── */
#ue-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── Glitch Text Effect ────────────────── */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
}

.glitch::before {
  color: #ff003c;
  transform: translateX(-3px);
  animation: glitch-1 3s infinite linear;
  opacity: 0;
}

.glitch::after {
  color: var(--accent);
  transform: translateX(3px);
  animation: glitch-2 3s infinite linear;
  opacity: 0;
}

.glitch:hover::before,
.glitch:hover::after { opacity: 1; }

@keyframes glitch-1 {
  0%, 90%, 100% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); transform: translateX(0); }
  92% { clip-path: polygon(0 20%, 100% 20%, 100% 35%, 0 35%); transform: translateX(-4px); }
  94% { clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); transform: translateX(2px); }
  96% { clip-path: polygon(0 45%, 100% 45%, 100% 55%, 0 55%); transform: translateX(-2px); }
}

@keyframes glitch-2 {
  0%, 90%, 100% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); transform: translateX(0); }
  91% { clip-path: polygon(0 55%, 100% 55%, 100% 70%, 0 70%); transform: translateX(4px); }
  93% { clip-path: polygon(0 15%, 100% 15%, 100% 30%, 0 30%); transform: translateX(-2px); }
  95% { clip-path: polygon(0 75%, 100% 75%, 100% 90%, 0 90%); transform: translateX(3px); }
}

/* ── Scanline Overlay ──────────────────── */
.hero-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 212, 255, 0.012) 2px,
    rgba(0, 212, 255, 0.012) 4px
  );
  pointer-events: none;
  animation: scanline-move 8s linear infinite;
}

@keyframes scanline-move {
  0% { background-position: 0 0; }
  100% { background-position: 0 100px; }
}

/* ── Hexagon Grid Background ───────────── */
.hex-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.06;
}

.hex-bg svg {
  width: 100%;
  height: 100%;
  position: absolute;
}

/* ── Card Holographic Effect ───────────── */
.game-card, .template-card {
  position: relative;
  isolation: isolate;
}

.game-card::before, .template-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    125deg,
    transparent 40%,
    rgba(0, 212, 255, 0.05) 50%,
    transparent 60%
  );
  background-size: 300% 300%;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 1;
}

.game-card:hover::before { opacity: 1; animation: holo-shift 1.5s ease infinite; }
.template-card:hover::before { opacity: 1; animation: holo-shift-warm 1.5s ease infinite; }

@keyframes holo-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes holo-shift-warm {
  0%, 100% { background-position: 0% 50%; }
  50% {
    background-position: 100% 50%;
    background-image: linear-gradient(125deg, transparent 40%, rgba(255,107,53,0.07) 50%, transparent 60%);
  }
}

/* ── Typewriter Effect ─────────────────── */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation: typing 3s steps(40, end), blink-caret .7s step-end infinite;
}

@keyframes typing { from { width: 0 } to { width: 100% } }
@keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: var(--accent) } }

/* ── Loading Screen ────────────────────── */
#ue-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  transition: opacity .6s ease, visibility .6s ease;
}

#ue-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-logo {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow);
  animation: pulse-glow 1.5s ease infinite;
}

.loader-bar-wrap {
  width: 240px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #fff);
  border-radius: 2px;
  animation: loader-fill 1.2s cubic-bezier(0.4,0,0.2,1) forwards;
  box-shadow: 0 0 12px var(--accent);
}

.loader-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

@keyframes loader-fill { from { width: 0 } to { width: 100% } }
@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px var(--accent-glow); }
  50% { text-shadow: 0 0 60px var(--accent-glow), 0 0 100px rgba(0,212,255,0.3); }
}

/* ── Hero v2 Enhancements ──────────────── */
.hero-title-line {
  display: block;
  overflow: hidden;
}

.hero-title-line span {
  display: inline-block;
  animation: slideUp .8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-title-line:nth-child(1) span { animation-delay: .4s; }
.hero-title-line:nth-child(2) span { animation-delay: .55s; }

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Filter Bar ────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.filter-bar-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.filter-btn {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.45em 1em;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-secondary);
  cursor: none;
  transition: all .2s;
}

.filter-btn:hover, .filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,212,255,0.06);
  box-shadow: 0 0 12px var(--accent-glow);
}

.filter-btn.active { cursor: none; }

.search-wrap {
  margin-left: auto;
  position: relative;
}

.search-wrap::before {
  content: '⌕';
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.filter-search {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5em 1em 0.5em 2.2em;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 220px;
  outline: none;
  transition: border-color .2s;
}

.filter-search:focus { border-color: var(--accent); }
.filter-search::placeholder { color: var(--text-muted); }

/* Filter animation */
.game-card, .template-card {
  transition: opacity .3s ease, transform .3s ease, border-color .25s, box-shadow .25s;
}

.game-card.hidden-by-filter, .template-card.hidden-by-filter {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  position: absolute;
  visibility: hidden;
}

/* ── Section Dividers ──────────────────── */
.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
  margin: 0;
}

/* ── Stats Counter Animation ───────────── */
.stat-number {
  display: inline-block;
  transition: transform .1s;
}

/* ── Enhanced Cards – 3D Tilt ──────────── */
.tilt-card {
  transform-style: preserve-3d;
  will-change: transform;
}

.tilt-card .game-card-body,
.tilt-card .template-card-body {
  transform: translateZ(20px);
}

/* ── Neon Border Pulse on CTA ──────────── */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: none;
}

.btn-primary:hover::after {
  animation: btn-shine .5s ease forwards;
}

@keyframes btn-shine {
  to { transform: translateX(100%); }
}

/* ── WooCommerce Overrides ─────────────── */
.woocommerce-page .woocommerce {
  color: var(--text-primary);
}

.woocommerce ul.products li.product {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  transition: all var(--transition);
}

.woocommerce ul.products li.product:hover {
  border-color: var(--accent-secondary);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 30px var(--accent-secondary-glow);
}

.woocommerce ul.products li.product a img {
  margin-bottom: 0;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  padding: 1rem 1rem 0.3rem;
}

.woocommerce ul.products li.product .price {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent-secondary);
  padding: 0 1rem;
}

.woocommerce ul.products li.product .button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
  border-radius: var(--radius);
  padding: 0.6em 1.2em;
  transition: all var(--transition);
  cursor: none;
  margin: 1rem;
  width: calc(100% - 2rem);
}

.woocommerce ul.products li.product .button:hover,
.woocommerce a.button:hover,
.woocommerce button.button.alt:hover {
  background: var(--accent-secondary);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-secondary-glow);
}

.woocommerce button.button.alt {
  background: var(--accent-secondary);
  color: #fff;
  border-color: var(--accent-secondary);
}

.woocommerce-cart .cart-collaterals,
.woocommerce-checkout #order_review,
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-primary);
  border-radius: var(--radius);
}

.woocommerce form .form-row label { color: var(--text-secondary); font-family: var(--font-display); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }

.woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-notices-wrapper .woocommerce-error {
  background: var(--bg-card);
  border-top-color: var(--accent);
  color: var(--text-primary);
}

/* ── Admin Bar Fix ─────────────────────── */
@media screen and (min-width: 601px) {
  #ue-loader, #ue-cursor, #ue-cursor-ring { top: var(--wp-admin--admin-bar--height, 0); }
}

/* ── Scroll Progress Bar ───────────────── */
#ue-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  z-index: 99999;
  transition: width .1s linear;
  box-shadow: 0 0 8px var(--accent);
}

/* ── Grid transition container ─────────── */
.games-grid, .templates-grid {
  position: relative;
  transition: min-height .3s;
}

.no-results-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}
