/* ==========================================================================
   AGENTIC ENGINE WORKSPACE
   A high-fidelity, interactive "Neural Network" visualization
   ========================================================================== */

#agentic-engine {
  position: relative;
  
  /* Auto-scaling framework:
     - MacBook-like aspect ratio (16:10)
     - Constrained to fit nicely in viewport
     - Looks like a device screen */
  
  /* Width: 90% of viewport, capped at 1600px for huge screens */
  width: 90vw;
  max-width: 1600px;
  
  /* Height: 92% of viewport height - fill most of screen */
  height: 92vh;
  max-height: 1100px;
  min-height: 600px;
  
  margin: 0 auto;
  margin-top: 4vh;
  margin-bottom: 4vh;
  
  background: #000000;
  border-radius: clamp(12px, 1.5vw, 24px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 2.5vw, 40px);
  color: #ffffff;
  
  /* Initial Scale State for Scroll Animation */
  transform: scale(0.5); 
  transform-origin: center center;
  transition: transform 0.15s ease-out;
  
  /* MacBook-style shadow and bezel effect */
  box-shadow: 
    0 25px 80px -15px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.08),
    inset 0 0 0 1px rgba(255,255,255,0.03);
}

/* Background Canvas for Neural Grid */
#neural-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none; /* Mouse interacts via JS event listener on section */
}

/* Main Container */
.engine-container {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  height: 100%;
  gap: 40px;
  /* Ensure content fits within the scaled view */
}

/* ==========================================================================
   LEFT: CONTROL PANEL (TABS)
   ========================================================================== */

.engine-controls {
  width: 30%; /* Proportional width */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0;
}

.control-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse-green 2s infinite;
}

.control-title {
  font-family: 'Space Grotesk', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
}

.control-tabs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  justify-content: center;
}

.control-tab {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-align: left;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.control-tab:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(5px);
}

.control-tab.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  transform: scale(1.05) translateX(10px); /* Make it pop out */
  z-index: 10;
}

.control-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #FF9900; /* Spark Brand Color */
  box-shadow: 0 0 10px #FF9900;
}

.tab-num {
  font-family: 'Space Grotesk', monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.control-tab.active .tab-num {
  color: #FF9900;
}

.tab-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tab-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
}

.tab-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.control-status {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: 'Space Grotesk', monospace;
  font-size: 10px;
}

.status-line {
  display: flex;
  justify-content: space-between;
}

.status-line .label {
  color: rgba(255, 255, 255, 0.4);
}

.status-line .value {
  color: #ffffff;
}

.text-success { color: #22c55e; }

/* ==========================================================================
   RIGHT: THE SCREEN (VISUALIZER)
   ========================================================================== */

.engine-display {
  flex-grow: 1;
  position: relative;
  perspective: 1000px;
}

.display-glass {
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 20px 50px rgba(0,0,0,0.5),
    inset 0 0 0 1px rgba(255,255,255,0.05);
  transition: transform 0.4s ease;
  cursor: none; /* Hide default cursor inside the display */
}

.display-glass::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* ==========================================================================
   ENGINE INTRO ANIMATION
   ========================================================================== */

.engine-intro {
  position: absolute;
  inset: 0;
  background: #000000;
  z-index: 50; /* Above everything else initially */
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease-out;
  border-radius: inherit; /* Match parent rounded corners */
}

.engine-intro.finished {
  opacity: 0;
  pointer-events: none;
}

.intro-brand-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.intro-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: #ffffff;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease-out;
}

.intro-text.visible {
  opacity: 1;
  transform: translateY(0);
}

.intro-arrow {
  position: absolute;
  bottom: -15px;
  left: 6%;
  width: 88%;
  height: 20px;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.intro-arrow.visible {
  opacity: 1;
}

.intro-star {
  position: absolute;
  bottom: -15px;
  left: 6%;
  width: 20px;
  height: 20px;
  opacity: 0;
  background: linear-gradient(135deg, #6366f1 0%, #ec4899 50%, #f59e0b 100%);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  z-index: 10;
}

.intro-star.animate {
  opacity: 1;
  animation: introSlide 1s ease-out forwards;
}

@keyframes introSlide {
  0% { left: 6%; bottom: -15px; opacity: 1; }
  100% { left: 94%; bottom: -15px; opacity: 0; }
}

/* ==========================================================================
   VIDEO WRAPPER UI (Antigravity Style)
   ========================================================================== */

.video-wrapper {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* Changed: Don't block interactions - only button should be interactive */
  cursor: none; /* Hide default cursor to show custom one */
  opacity: 0; /* Hidden initially, revealed after intro */
  transition: opacity 0.5s ease 1s; /* Delay appearance */
}

.engine-intro.finished ~ .video-wrapper {
  opacity: 1;
}

/* Play Button */
.video-control-button {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
  pointer-events: auto;
}

.video-control-button:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.2);
}

.video-control-button .symbol {
  fill: #ffffff;
}

/* Custom Cursor (The Pill) */
.custom-cursor {
  position: absolute; /* Changed from fixed to move within container */
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 30; /* Above video-wrapper (z-index: 20) but not excessive */
  transform: translate3d(0, 0, 0); /* JS will handle translation */
  opacity: 0;
  transition: opacity 0.2s ease;
  will-change: transform;
}

.engine-display:hover .custom-cursor {
  opacity: 1;
}

.cursor-content {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: #000000;
  padding: 8px 16px;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.cursor-content .symbol {
  fill: #000000;
  width: 16px;
  height: 16px;
}

.cursor-content .call-to-action {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
}

/* Slides */
.slide {
  position: absolute;
  inset: 0;
  padding: 40px;
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 10; /* Below video-wrapper (20) and custom-cursor (30) */
}

.slide.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Visuals inside slides */
.slide-visual {
  width: 100%;
  height: 100%;
  position: relative;
}

.slide-content-text {
  position: absolute;
  bottom: 0;
  left: 0;
  max-width: 90%;
}

.slide-content-text h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #fff, #aaa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.slide-content-text p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.5;
}

/* Mock Visuals - Adjusted Scale */
.mock-doc {
  width: 200px;
  height: 280px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%) rotate(-5deg);
  border-radius: 4px;
  padding: 15px;
}

.doc-header {
  height: 30px;
  background: rgba(255,255,255,0.1);
  margin-bottom: 15px;
  border-radius: 2px;
}

.doc-lines .line {
  height: 6px;
  background: rgba(255,255,255,0.1);
  margin-bottom: 8px;
  border-radius: 2px;
}
.w-70 { width: 70%; }
.w-90 { width: 90%; }
.w-60 { width: 60%; }

.keyword-highlight {
  position: absolute;
  width: 80px;
  height: 10px;
  background: rgba(255, 153, 0, 0.3); /* Spark Orange Highlight */
  border: 1px solid rgba(255, 153, 0, 0.6);
  border-radius: 2px;
}

/* Annotations (Tooltips) */
.annotation-point {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #FF9900;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 0 0 4px rgba(255, 153, 0, 0.2);
  transition: all 0.3s ease;
}

.annotation-point:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 8px rgba(255, 153, 0, 0.4);
}

.annotation-point::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 11px;
  font-family: 'Space Grotesk', monospace;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.annotation-point:hover::after {
  opacity: 1;
}

/* Animation Keyframes */
@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - Auto-scaling framework
   ========================================================================== */

/* Extra Large Screens (4K, Projectors) */
@media (min-width: 2560px) {
  #agentic-engine {
    max-width: 2200px;
    max-height: 1300px;
  }
  
  .slide-content-text h3 {
    font-size: 42px;
  }
  
  .slide-content-text p {
    font-size: 18px;
  }
  
  .tab-name {
    font-size: 20px;
  }
}

/* Large Screens */
@media (max-width: 1440px) {
  #agentic-engine {
    width: 92vw;
    height: 90vh;
  }
}

/* Medium Screens (Laptops) */
@media (max-width: 1200px) {
  #agentic-engine {
    width: 94vw;
    height: 88vh;
    padding: clamp(15px, 2vw, 30px);
  }
  
  .engine-controls {
    width: 35%;
  }
  
  .tab-name {
    font-size: 14px;
  }
  
  .tab-desc {
    font-size: 10px;
  }
  
  .slide-content-text h3 {
    font-size: 24px;
  }
  
  .slide-content-text p {
    font-size: 13px;
  }
}

/* Tablets */
@media (max-width: 1024px) {
  #agentic-engine {
    width: 90vw;
    aspect-ratio: 4 / 3; /* More square for tablets */
    min-height: 450px;
    max-height: 80vh;
    padding: 20px;
    margin-top: 3vh;
    margin-bottom: 3vh;
  }

  .engine-container {
    flex-direction: column;
    height: 100%;
    gap: 15px;
  }
  
  .engine-controls {
    width: 100%;
    order: 2;
    flex-shrink: 0;
  }
  
  .control-header, .control-status {
    display: none; 
  }

  .control-tabs {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
    gap: 8px;
    justify-content: flex-start;
  }

  .control-tab {
    min-width: 140px;
    padding: 12px;
    flex-shrink: 0;
  }

  .engine-display {
    flex-grow: 1;
    min-height: 300px;
    order: 1;
  }
}

/* Mobile Phones */
@media (max-width: 768px) {
  #agentic-engine {
    width: 94vw;
    aspect-ratio: 3 / 4; /* Portrait orientation for mobile */
    max-height: 85vh;
    border-radius: 16px;
    padding: 15px;
  }
  
  .control-tab {
    min-width: 120px;
    padding: 10px;
    gap: 10px;
  }
  
  .tab-num {
    font-size: 10px;
  }
  
  .tab-name {
    font-size: 13px;
  }
  
  .tab-desc {
    display: none;
  }
  
  .engine-display {
    min-height: 250px;
  }
  
  .slide {
    padding: 20px;
  }
  
  .slide-content-text h3 {
    font-size: 20px;
  }
  
  .slide-content-text p {
    font-size: 12px;
  }
  
  .annotation-point {
    width: 8px;
    height: 8px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  #agentic-engine {
    width: 96vw;
    aspect-ratio: 9 / 14;
    border-radius: 12px;
    padding: 10px;
  }
  
  .control-tab {
    min-width: 100px;
    padding: 8px;
  }
  
  .display-glass {
    border-radius: 12px;
  }
}
