/* css/interactions.css */

/* --- High-Fidelity FigPal Design System --- */

#figpal-container {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  transform: translate(28px, 28px);
  will-change: top, left;
  width: 0;
  height: 0;
  overflow: visible;
  color-scheme: light;
}

body.figpal-disabled #figpal-container,
body.figpal-disabled #figpal-home {
  display: none !important;
  opacity: 0 !important;
}

/* Home / Signpost Restoration (Original SVG Namepost) */
#figpal-home {
  position: fixed;
  right: 40px;
  bottom: 30px;
  /* Accounts for the pole extending ~30px below the container */
  transform: translateX(-50%);
  width: auto;
  height: 25.8px;
  pointer-events: auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
  opacity: 1;
  visibility: visible;
}

.figpal-sign-left,
.figpal-sign-right {
  width: 14.03px;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.figpal-sign-left {
  background-image: url('../media/NamePost/sign_left.svg');
}

.figpal-sign-right {
  background-image: url('../media/NamePost/sign_right.svg');
}

.figpal-sign-pole {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 61.35px;
  background-size: contain;
  background-repeat: no-repeat;
  background-image: url('../media/NamePost/pole.svg');
  z-index: -1;
}

.figpal-sign-mid {
  height: 100%;
  background-color: #DCAB6E;
  box-shadow: inset 0 1.684px 0 black, inset 0 -1.684px 0 black;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: -1px;
  margin-right: -1px;
  min-width: 56px;
}

#figpal-home-text {
  font-family: 'Poppins', 'Inter', -apple-system, sans-serif;
  font-weight: 600;
  font-size: 9px;
  color: #000;
  text-align: center;
  position: relative;
  top: 1px;
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* Character Restoration */
#figpal-follower {
  position: absolute;
  width: 52px;
  height: 58px;
  display: block;
  transform: translate(-50%, -50%);
  z-index: 20;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#figpal-container.resting #figpal-follower {
  animation: figpal-float 3s ease-in-out infinite;
}

@keyframes figpal-float {

  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0px);
  }

  50% {
    transform: translate(-50%, -50%) translateY(-6px);
  }
}

/* --- Precision Panel Overlay --- */
.figpal-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2147483646;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  user-select: none;
}

.figpal-panel-overlay.visible {
  display: flex;
}

.figpal-panel-container {
  width: 508px;
  height: 420px;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  position: relative;
}

.figpal-panel-header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #E6E6E6;
  flex-shrink: 0;
}

.figpal-header-title {
  font-size: 13px;
  font-weight: 500;
  color: #1A1A1A;
}

.figpal-panel-close-abs {
  background: none;
  border: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.figpal-panel-content {
  flex: 1;
  display: flex;
  padding: 18px 28px;
  gap: 16px;
  background: #FFFFFF;
  overflow: hidden;
}

/* Left Column */
.figpal-panel-main {
  width: 334px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Tabs */
.figpal-tab-bar {
  display: flex;
  background: #F5F5F5;
  border-radius: 4px;
  padding: 0;
  gap: 0;
  align-self: center;
}

.figpal-tab {
  width: 38px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid transparent;
}

.figpal-tab.active {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.figpal-icon-container {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.figpal-icon-container img {
  width: 100%;
  height: 100%;
}

.figpal-tab.active .figpal-icon-container {
  opacity: 1;
}

/* Construction / Preview Area */
.figpal-construction-palette {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figpal-stage-area {
  width: 334px;
  height: 182px;
  background: #CDCDCD;
  border: 1px solid #C0C0C0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.figpal-nav-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  z-index: 10;
}

.figpal-nav-overlay.left {
  left: 0;
}

.figpal-nav-overlay.right {
  right: 0;
}

.figpal-nav-btn {
  width: 29px;
  height: 24px;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figpal-nav-btn:hover {
  background: #FFFFFF;
}

.chevron {
  width: 6px;
  height: 6px;
  border-left: 1.5px solid #1A1A1A;
  border-bottom: 1.5px solid #1A1A1A;
}

.chevron.left {
  transform: rotate(45deg);
}

.chevron.right {
  transform: rotate(-135deg);
}

/* Centerpiece Preview */
.figpal-pal-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.figpal-pal-layers {
  width: 74px;
  height: 84px;
  position: relative;
  z-index: 2;
  margin-bottom: -10px;
}

.figpal-stage-disc {
  width: 95px;
  height: 32px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figpal-stage-svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Interaction Details */
.figpal-interaction-row {
  margin-top: 14px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.figpal-color-dots {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.color-dot {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  transition: transform 0.1s;
}

.color-dot.selected {
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #0D99FF;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.figpal-namer-row {
  width: 156px;
  height: 35px;
  background: #F5F5F5;
  border: 0.5px solid #E6E6E6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 14px;
}

.figpal-namer-input {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 9px;
  color: #1A1A1A;
  outline: none;
  letter-spacing: -0.18px;
}

/* Right Column (Sidebar) */
.figpal-panel-sidebar {
  width: 100px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
}

.figpal-sidebar-card {
  border: 1px solid #E6E6E6;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  background: #FFFFFF;
}

.figpal-label {
  font-size: 9px;
  color: #1A1A1A;
  white-space: nowrap;
}

.figpal-surprise-btn {
  width: 63px;
  height: 64px;
  background: #FFFFFF;
  border: 1px solid #E6E6E6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.figpal-main-save-btn {
  width: 100%;
  height: 32px;
  background: #0D99FF;
  border: none;
  border-radius: 60px;
  color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.figpal-main-save-btn:hover {
  background: #0081E0;
}

.figpal-bts-link {
  display: block;
  font-size: 9px;
  color: #007BE5;
  text-decoration: underline;
  margin-top: 8px;
  text-align: center;
}

.figpal-divider {
  width: 100%;
  height: 1px;
  background: #E6E6E6;
}

/* --- Video Lightbox Modal --- */
.full-width video {
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.full-width video:hover {
  transform: scale(1.015);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}

.lightbox {
  display: none;
  position: fixed;
  z-index: 2147483647; /* Ensure it is on top of everything, including panel overlays */
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.visible {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox.visible .lightbox-content {
  transform: scale(1);
}

.lightbox-content video {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
  outline: none;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: #ffffff;
  font-size: 40px;
  font-weight: 300;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  user-select: none;
}

.lightbox-close:hover {
  color: var(--accent);
  transform: scale(1.1);
}

/* --- Image Hover Styles --- */
article img {
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

article img:hover {
  transform: scale(1.015);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}