:root {
  /* Paleta Genshin Impact (Celestia & Teyvat) */
  --bg-page: #0d121f;
  --bg-surface: #161e31;
  --bg-subtle: #1e2942;
  --text-main: #f4efe6;
  --text-muted: #9aa4b8;
  --accent: #d3bc8e;
  --accent-hover: #e8d5a7;
  --border: rgba(211, 188, 142, 0.22);

  /* Skeletons */
  --skeleton-base: #1e2942;
  --skeleton-highlight: #2a3859;

  /* Espaciado (grilla 8px) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;

  /* Radios y sombras en capas */
  --radius-sm: 8px;
  --radius-md: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.06);

  /* Motion Identity */
  --ease-reveal: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-ui: cubic-bezier(0.25, 1, 0.5, 1);
  --dur-fast: 180ms;
  --dur-reveal: 500ms;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(74, 144, 226, 0.14), transparent 40%),
    radial-gradient(circle at 80% 35%, rgba(211, 188, 142, 0.1), transparent 45%);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .logo {
  font-family: "Cinzel", Georgia, serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: var(--space-2);
  background: var(--text-main);
  color: #ffffff;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  z-index: 200;
  text-decoration: none;
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease-ui);
}

.skip-link:focus {
  top: var(--space-2);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(13, 18, 31, 0.85);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text-main);
}

.logo span {
  color: var(--accent);
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-4);
}

.main-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease-ui);
}

.main-nav a:hover {
  color: var(--text-main);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.icon-btn {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast) var(--ease-ui), border-color var(--dur-fast) var(--ease-ui);
}

.icon-btn:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.96);
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background-color: var(--accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.cart-badge.pop {
  animation: badgePop 260ms var(--ease-reveal);
}

@keyframes badgePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Hero */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-3) var(--space-6);
}

.hero-content {
  max-width: 68ch;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-2);
}

.hero-subtitle {
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  color: var(--text-muted);
  max-width: 56ch;
  margin-bottom: var(--space-4);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.primary-cta {
  display: inline-flex;
  align-items: center;
  background-color: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 999px;
  transition: background-color var(--dur-fast) var(--ease-ui), transform var(--dur-fast) var(--ease-ui);
}

.primary-cta:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
}

.trust-signal {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Catálogo */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) var(--space-10);
}

.catalog-header {
  margin-bottom: var(--space-4);
}

.catalog-header h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.catalog-header p {
  color: var(--text-muted);
  max-width: 60ch;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
  gap: var(--space-3);
}

/* Tarjeta de producto */
.product-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-ui), box-shadow var(--dur-fast) var(--ease-ui);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background-color: var(--bg-subtle);
  display: block;
}

.product-body {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-1);
}

.product-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.product-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  flex: 1;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--bg-subtle);
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.add-btn {
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-ui), transform var(--dur-fast) var(--ease-ui);
}

.add-btn:hover {
  background-color: var(--accent-hover);
}

.add-btn:active {
  transform: scale(0.96);
}

/* Animación fade-in con propósito */
.fade-in {
  opacity: 0;
  animation: fadeIn var(--dur-reveal) var(--ease-reveal) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skeleton Loader */
.skeleton-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.skeleton-box {
  background: linear-gradient(
    90deg,
    var(--skeleton-base) 25%,
    var(--skeleton-highlight) 50%,
    var(--skeleton-base) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite ease-in-out;
}

.skeleton-image {
  width: 100%;
  height: 200px;
}

.skeleton-body {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-title {
  height: 18px;
  width: 68%;
  border-radius: 6px;
}

.skeleton-text {
  height: 13px;
  width: 100%;
  border-radius: 6px;
}

.skeleton-text.short {
  width: 78%;
}

.skeleton-price {
  height: 22px;
  width: 36%;
  border-radius: 6px;
  margin-top: var(--space-1);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.scroll-sentinel {
  height: 24px;
  margin-top: var(--space-2);
}

.end-message {
  text-align: center;
  color: var(--text-muted);
  margin-top: var(--space-3);
  font-size: 0.95rem;
}

@media (max-width: 680px) {
  .main-nav {
    display: none;
  }

  .hero {
    padding: var(--space-6) var(--space-2) var(--space-4);
  }

  .main-content {
    padding: var(--space-3) var(--space-2) var(--space-8);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .fade-in,
  .skeleton-box,
  .cart-badge.pop {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .product-card,
  .icon-btn,
  .add-btn,
  .primary-cta {
    transition: none;
  }
}


/* Paimon cursor follower */
#paimon-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 76px;
  height: auto;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
  user-select: none;
}

.product-visual {
  position: relative;
  width: 100%;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(211, 188, 142, 0.16), rgba(13, 18, 31, 0.85));
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.element-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(13, 18, 31, 0.8);
  border: 1px solid var(--border);
  color: var(--accent);
}


.product-img {
  max-width: 78%;
  max-height: 78%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
  transition: transform var(--dur-fast) var(--ease-ui);
}

.product-card:hover .product-img {
  transform: scale(1.06);
}


/* Cart Drawer & Checkout */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 18, 0.7);
  backdrop-filter: blur(4px);
  z-index: 300;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 310;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.5);
}

.cart-drawer[hidden],
.cart-overlay[hidden],
.cart-status[hidden] {
  display: none;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.cart-header h2 {
  font-size: 1.25rem;
  color: var(--accent);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-empty {
  color: var(--text-muted);
  text-align: center;
  margin-top: 40px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.cart-item img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.cart-item-price {
  font-size: 0.85rem;
  color: var(--accent);
}

.cart-remove-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8rem;
}

.cart-remove-btn:hover {
  color: var(--text-main);
  border-color: var(--accent);
}

.cart-status {
  margin: 0 24px 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--accent);
  text-align: center;
  font-size: 0.92rem;
}

.cart-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(211, 188, 142, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
}

.cart-total-row strong {
  color: var(--accent);
  font-size: 1.25rem;
}

.checkout-btn {
  width: 100%;
  text-align: center;
  border: none;
  cursor: pointer;
}

.checkout-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.product-card.sold-out {
  opacity: 0.65;
}

.add-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}


/* Cart Dropdown & Centered Checkout Modal */
.cart-wrapper {
  position: relative;
}

.cart-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(360px, 90vw);
  max-height: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 250;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-dropdown[hidden],
.checkout-overlay[hidden],
#close-modal-btn[hidden] {
  display: none;
}

.checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 18, 0.72);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.checkout-modal {
  width: min(380px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.checkout-modal .cart-status {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 0.98rem;
  color: var(--text-main);
}


/* Profile Dropdown */
.profile-wrapper {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(280px, 88vw);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 250;
  overflow: hidden;
}

.profile-dropdown[hidden] {
  display: none;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--bg-subtle);
}

.profile-name {
  display: block;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.05rem;
  color: var(--accent);
}

.profile-rank {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.profile-menu {
  list-style: none;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-ui), color var(--dur-fast) var(--ease-ui);
}

.profile-menu-item:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

.profile-logout {
  color: #f08a8a;
}
