/*
 * Archetype pop-up (js/archetype-popup.js). Moved from meet-the-archetypes.html;
 * classes renamed .popup-* → .ap-* and scoped under .ap-overlay.
 */
.ap-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
}
.ap-overlay.show { display: flex; }
.ap-overlay [hidden] { display: none !important; }

.ap-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 90vh;
}

.ap-close, .ap-nav {
  position: absolute;
  border: none;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10001;
  backdrop-filter: blur(10px);
}
.ap-close svg, .ap-nav svg { pointer-events: none; }
.ap-close {
  top: -15px;
  right: -15px;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
}
.ap-close:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); }
.ap-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.15);
  user-select: none;
}
.ap-nav:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-50%) scale(1.1); }
.ap-nav-left { left: -80px; }
.ap-nav-right { right: -80px; }

.ap-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  overflow: hidden;
}
.ap-media { display: flex; align-items: center; justify-content: center; }
.ap-image, .ap-video {
  max-width: 50vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.ap-description {
  display: flex;
  flex-direction: column;
  max-width: 40vw;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  background: rgba(42, 42, 42, 0.95);
  border-radius: 8px;
  border: 1px solid #505050;
  text-align: left;
}
.ap-description > *:not(.ap-counter) { align-self: flex-start; }
.ap-name { margin: 0 0 10px 0; font-size: 2.16rem; color: #e0e0e0; }
.ap-name-main { font-size: 1.44rem; font-weight: bold; margin-bottom: 4px; }
.ap-name-title { font-size: 1.2rem; font-style: italic; color: #666; }
.ap-subtitle { font-size: 1.32rem; color: #4CAF50; margin-bottom: 15px; font-weight: 600; }

.ap-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 15px; }
.ap-meta:empty { display: none; }
.ap-appears-after { font-size: 0.95rem; color: #aaa; }
.ap-overlay .element-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.ap-overlay .element-badge.element-fire { color: #ff8a65; background: rgba(255, 138, 101, 0.12); }
.ap-overlay .element-badge.element-water { color: #4fc3f7; background: rgba(79, 195, 247, 0.12); }
.ap-overlay .element-badge.element-earth { color: #9ccc65; background: rgba(156, 204, 101, 0.12); }
.ap-overlay .element-badge.element-air { color: #cfd8dc; background: rgba(207, 216, 220, 0.12); }
.ap-overlay .element-badge.element-guardian { color: #e9c46a; background: rgba(233, 196, 106, 0.12); }
.ap-overlay .element-badge.element-trickster { color: #ce93d8; background: rgba(206, 147, 216, 0.12); }

.ap-tags { margin-bottom: 20px; }
.ap-tag {
  display: inline-block;
  margin: 2px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(96, 125, 139, 0.15);
  color: #b0bec5;
  border: 1px solid #607d8b;
}
.ap-motto {
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-style: italic;
  border-left: 3px solid #e9c46a;
  padding: 4px 0 4px 12px;
  color: #f3ead2;
}
.ap-motto:empty { display: none; }
.ap-full { color: #e0e0e0; line-height: 1.6; font-size: 1.14rem; }

.ap-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #505050;
  align-self: stretch !important;
}
.ap-action-btn {
  flex: 1;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: white;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ap-action-btn:hover { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.3); transform: translateY(-1px); }
.ap-action-btn svg { flex-shrink: 0; pointer-events: none; }

.ap-counter {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: fit-content;
  align-self: center;
}
.ap-counter:empty { display: none; }

@media (max-width: 768px) {
  .ap-content { flex-direction: column; gap: 20px; }
  .ap-image, .ap-video { max-width: 80vw; max-height: 40vh; }
  .ap-description { max-width: 80vw; max-height: 40vh; }
  /* Arrows centered on the image area (40vh max), not the whole pop-up */
  .ap-nav { width: 50px; height: 50px; top: 20vh; }
  .ap-nav svg { width: 24px; height: 24px; }
  .ap-nav-left { left: -60px; }
  .ap-nav-right { right: -60px; }
  .ap-counter { font-size: 0.8rem; padding: 5px 10px; margin-top: 12px; }
  .ap-close { top: -10px; right: -10px; width: 40px; height: 40px; }
  .ap-close svg { width: 20px; height: 20px; }
  .ap-wrapper { max-width: 95vw; max-height: 95vh; margin: 20px; }
  .ap-actions { flex-direction: column; gap: 8px; }
  .ap-action-btn { width: 100%; padding: 10px 16px; }
}
@media (max-width: 480px) {
  .ap-nav-left { left: 10px; }
  .ap-nav-right { right: 10px; }
  .ap-nav { background: rgba(0, 0, 0, 0.6); width: 45px; height: 45px; }
  .ap-nav svg { width: 20px; height: 20px; }
}
