.fullscreen-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  background-image: url('../assets/bg/hero-bg.webp');
  background-size: 100% auto; /* MODIFIED: Ensures full width, auto height */
  background-position: center; /* Keeps the image centered */
  background-repeat: no-repeat; /* ADDED: Prevents repetition if height is less than container */
  transition: background-image 0.8s ease-in-out; /* Transisi untuk background image */
}

/* Base state untuk animasi (tersembunyi) */
.nexmi-model-container, .lego-models-container { 
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, transform 0.8s ease, visibility 0s linear 0.8s, left 0.8s ease;
}

/* State aktif untuk animasi (terlihat) */
.nexmi-model-container.active, .lego-models-container.active { 
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease, transform 0.8s ease, visibility 0s linear 0s, left 0.8s ease;
}

.nexmi-model-container { 
  position: fixed; 
  bottom: 0; 
  left: 50%; 
  transform: translateX(-50%) translateY(100%); 
  z-index: 20; /* Di atas #hero (10), di bawah .main-header (1000) dan .floating-menu (1050) */
}
.nexmi-model-container.active {
  transform: translateX(-50%) translateY(0); 
}

.nexmi-model-container.active .lego-model.nexmi {
  opacity: 1;
  transform: translateY(0);
}

/* UPDATED: Corrected transform to include translateY(0) and adjusted position */
.nexmi-model-container.moved-right { 
  left: 90%; 
  transform: translateX(-50%) translateY(0) scale(1); 
}
.nexmi-model-container .lego-model { width: clamp(240px, 36vw, 360px); height: clamp(360px, 54vw, 540px); position: relative; }

.lego-models-container { 
  position: absolute; 
  bottom: 0; 
  left: 20%; 
  transform: translateX(-50%); 
  z-index: 5; /* Relatif terhadap #hero. #hero memiliki z-index 10. */
  display: flex; 
  align-items: flex-end; 
  gap: clamp(10px, 3vw, 20px); 
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}

.lego-models-container.active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.3s; 
}

.lego-model { 
  position: relative; 
  opacity: 0; 
  transform: translateY(50px); 
  transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}
.lego-model.entering { 
  opacity: 1;
  transform: translateY(0);
}

.lego-model img { 
  position: absolute; 
  width: 100%; 
  height: auto; 
  bottom: 0; 
  left: 0; 
}
.variant-model, .walk-frame { opacity: 0; }

.hero-cta { display: inline-flex; align-items: center; justify-content: center; background-color: var(--primary); color: white; border: none; padding: 12px 24px; font-size: 1.05rem; font-weight: 600; border-radius: 50px; cursor: pointer; transition: var(--transition); min-width: 200px; }
.hero-cta:hover { transform: translateY(-2px) scale(1.02); }
.hero-cta.story-cta { background-color: var(--pink); } 

.story-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); z-index: 4000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease; }
.story-modal.active { opacity: 1; visibility: visible; }
.story-modal-content { background: white; padding: 30px; border-radius: 12px; max-width: 600px; width: 90%; position: relative; }
.close-modal-button { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 2rem; cursor: pointer; }
.loader-container { text-align: center; }
.story-text { max-height: 60vh; overflow-y: auto; }

/* Friend UI Group Styles */
.friend-ui-group {
  display: none; /* Initially hidden, JS will set to 'flex' */
  flex-direction: column;
  align-items: center;
  gap: 10px; /* Space between close-up, name, description, and button */
  position: relative; /* For z-indexing and positioning close button */
  padding-top: 25px; /* Add padding to make space for the close button */
}

/* Close Friend UI Button */
.close-friend-ui-btn {
  position: absolute;
  top: 0px;
  right: 0px;
  background: rgba(0,0,0,0.3);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 18px;
  line-height: 26px; /* Adjust for vertical centering of '×' */
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 10; /* Ensure it's above other elements in the group */
  padding: 0;
}

.close-friend-ui-btn:hover {
  background: rgba(233, 30, 99, 0.8); /* var(--pink) with opacity */
  transform: scale(1.1);
}


/* Friend Close-up Frame Styles (adapted) */
.friend-closeup-frame {
  width: 200px; /* Increased size to 120px from 100px */
  height: 200px; /* Increased size to 120px from 100px */
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white */
  border: 3px solid var(--primary); /* Default border color */
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: scale(0.7) translateY(30px);
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.25, 1, 0.5, 1), 
              transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), 
              visibility 0s linear 0.35s;
  /* margin-bottom: 8px; /* Space before name, or use gap in parent */
}

.friend-closeup-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures the image covers the circle without distortion */
}

.friend-closeup-frame.active {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
  transition-delay: 0.15s; /* Delay to appear after model typically starts entering */
}

/* Optional: Friend-specific border colors */
#blossomCloseupFrame.active {
  border-color: var(--pink); /* Assuming --pink is defined for Blossom */
}
#yodaCloseupFrame.active { 
  border-color: #795548; /* Brownish color for Yoda */
}
/* #rosieCloseupFrame.active { border-color: var(--rosie-color); } */


/* Friend Name Label Styles */
.friend-name-label {
  color: white;
  font-size: 1rem; /* Slightly larger for better visibility */
  font-weight: 600;
  text-align: center;
  margin: 0; /* Rely on parent gap for spacing */
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6); /* Enhanced shadow for readability */
}

/* Friend Description Styles */
.friend-description {
  color: white;
  font-size: 0.8rem; /* Adjusted for potentially longer text */
  font-weight: 500;
  text-align: left; /* Changed from center to left for bullet points */
  margin: 0; /* Rely on parent gap for spacing */
  min-height: 100px; /* Increased to accommodate longer bulleted lists */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  padding: 0 10px; /* Some horizontal padding if text gets wide */
  box-sizing: border-box;
  width: 100%; /* Ensure it takes width of its container for centering */
  max-width: 280px; /* Prevent it from becoming too wide, adjusted slightly */
  line-height: 1.5; /* Good for readability */
  white-space: pre-line; /* Allows \n to create line breaks */
  opacity: 0; /* For fade-in effect if desired, though typing handles appearance */
  transition: opacity 0.3s ease; /* For gentle appearance if not typed */
}
.friend-description:not(:empty) { /* Apply opacity once there's content */
    opacity: 1;
}


/* Typing Cursor Animation */
.typing-cursor {
  display: inline-block;
  width: 2px; /* Or 1px for a thinner cursor */
  height: 1em; /* Matches the line height of the text */
  background-color: white;
  margin-left: 3px;
  animation: typing-cursor-blink 0.7s infinite;
  vertical-align: text-bottom; /* Aligns cursor with text baseline */
}

@keyframes typing-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* UPDATED: Info Picture Container Styles to mirror info cards */
.info-pic-container {
  position: absolute;
  /* Duplicating layout from .hero-info-cards-container */
  bottom: 0;
  left: 50%;
  transform: translateX(-65%);
  width: clamp(60%, 60vw, 960px);
  display: flex;
  gap: clamp(10px, 3vw, 20px);
  justify-content: flex-start;
  align-items: flex-end; /* Align images to the bottom */
  z-index: 6; 
  pointer-events: none;
}

.info-pic-wrapper {
  flex: 1; /* Distribute width equally */
  height: 50vh; /* MODIFIED: Set to half of viewport height as requested */
  opacity: 0;
  visibility: hidden;
  display: flex;
  align-items: flex-end;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
              transform 0.3s cubic-bezier(0.25, 1, 0.5, 1),
              visibility 0s linear 0.6s;
  pointer-events: auto;
}

.info-pic-container.active .info-pic-wrapper {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-property: opacity, transform, visibility;
  transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1), cubic-bezier(0.25, 1, 0.5, 1), linear;
  transition-duration: 0.6s, 0.3s, 0s;
}

/* Staggered animation for picture wrappers, matching info cards */
.info-pic-container.active .info-pic-wrapper:nth-child(1) { transition-delay: 0.8s; }
.info-pic-container.active .info-pic-wrapper:nth-child(2) { transition-delay: 1.0s; }
.info-pic-container.active .info-pic-wrapper:nth-child(3) { transition-delay: 1.2s; }

.info-pic-wrapper img {
  width: 100%;
  object-fit: contain;
}
