.interactive-pipeline-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 30px 0;
  width: 100%;
}

.pipeline-visuals {
  position: relative;
  width: 100%;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

/* Container holding the stacked images */
.pipeline-stack {
  position: relative;
  width: 100%;
  aspect-ratio: 4606 / 1530; /* Aspect ratio of full diagram */
}

/* Background image - fully desaturated */
.pipeline-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  filter: grayscale(100%) opacity(0.3);
  transition: filter 0.4s ease;
}

/* When not hovering over the container, show full color background */
.pipeline-visuals:not(:hover) .pipeline-bg {
  filter: grayscale(0%) opacity(1);
}

/* The individual full-color tiles */
.pipeline-tile {
  position: absolute;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.98);
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
  z-index: 5;
}

/* 
  Tiles 1, 3, and 4 are aligned perfectly via width/left calculations.
  Tile 2 was the one slightly shifted. I've re-applied the top offset to fix its vertical alignment 
  and the left offset to fix its horizontal alignment.
*/
.tile-1 { top: 0.588%; height: 98.823%; left: 0%; width: 24.96%; }
.tile-2 { top: 0.588%; height: 98.823%; left: 8.901%; width: 36.60%; } 
.tile-3 { top: 0%; height: 100%; left: 26.68%; width: 56.81%; }
.tile-4 { top: 0.751%; height: 98.496%; left: 68.05%; width: 31.82%; }

/* When a specific zone is hovered, show its corresponding tile */
.pipeline-visuals:has(.zone-1:hover) .tile-1 { opacity: 1; transform: scale(1.02); z-index: 10; filter: drop-shadow(0 0 15px rgba(59,130,246,0.3));}
.pipeline-visuals:has(.zone-2:hover) .tile-2 { opacity: 1; transform: scale(1.02); z-index: 10; filter: drop-shadow(0 0 15px rgba(59,130,246,0.3));}
.pipeline-visuals:has(.zone-3:hover) .tile-3 { opacity: 1; transform: scale(1.02); z-index: 10; filter: drop-shadow(0 0 15px rgba(59,130,246,0.3));}
.pipeline-visuals:has(.zone-4:hover) .tile-4 { opacity: 1; transform: scale(1.02); z-index: 10; filter: drop-shadow(0 0 15px rgba(59,130,246,0.3));}

/* Overlay for hover detection */
.pipeline-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 20;
}

.pipeline-zone {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: pointer;
}

.zone-1 { clip-path: polygon(0% 0%, 25.20% 0%, 9.34% 100%, 0% 100%); }
.zone-2 { clip-path: polygon(25.20% 0%, 42.31% 0%, 26.48% 100%, 9.34% 100%); }
.zone-3 { clip-path: polygon(42.31% 0%, 83.71% 0%, 67.87% 100%, 26.48% 100%); }
.zone-4 { clip-path: polygon(83.71% 0%, 100% 0%, 100% 100%, 67.87% 100%); }

/* Text Container */
.pipeline-text-container {
  min-height: 140px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px 25px;
  border: 1px solid #e2e8f0;
  position: relative;
  display: flex;
  align-items: flex-start;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  transition: border-color 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
}

.pipeline-info-block {
  position: absolute;
  top: 20px;
  left: 25px;
  right: 25px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.pipeline-info-block.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  position: relative;
  top: 0; left: 0; right: 0;
}

.pipeline-info-block h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  transition: color 0.4s ease;
}

.pipeline-info-block p {
  margin: 0;
  font-size: 1rem;
  color: #475569;
  line-height: 1.6;
}

/* The sliding pointer (speech bubble triangle) */
.pipeline-pointer {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 20px;
  height: 20px;
  background-color: inherit; /* changed from background */
  border-left: 1px solid;
  border-top: 1px solid;
  transform: translateX(-50%) rotate(45deg);
  transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.4s ease, border-color 0.4s ease, opacity 0.2s ease;
  z-index: 5;
  opacity: 0; /* Hidden by default */
}

/* Contextual States for the Text Box based on active info block */

/* 1. Input State */
.pipeline-text-container[data-active="info-1"] {
  border-color: #0070C0; 
  box-shadow: 0 4px 15px rgba(0, 112, 192, 0.15);
  background-color: rgba(234, 245, 247, 0.4);
}
.pipeline-text-container[data-active="info-1"] .pipeline-pointer {
  left: 4.548%; /* (0 + 419) / 2 = 209.5px */
  border-color: #0070C0;
  background-color: rgba(234, 245, 247, 0.4);
  opacity: 1;
}

/* 2. Planning State */
.pipeline-text-container[data-active="info-2"] {
  border-color: #78206E; 
  box-shadow: 0 4px 15px rgba(120, 32, 110, 0.15);
  background-color: rgba(255, 242, 254, 0.4);
}
.pipeline-text-container[data-active="info-2"] .pipeline-pointer {
  left: 17.911%; /* (442 + 1208) / 2 = 825px */
  border-color: #78206E;
  background-color: rgba(255, 242, 254, 0.4);
  opacity: 1;
}

/* 3. Grounding State */
.pipeline-text-container[data-active="info-3"] {
  border-color: #3B7D23; 
  box-shadow: 0 4px 15px rgba(59, 125, 35, 0.15);
  background-color: rgba(233, 248, 228, 0.4);
}
.pipeline-text-container[data-active="info-3"] .pipeline-pointer {
  left: 47.177%; /* (1232 + 3114) / 2 = 2173px */
  border-color: #3B7D23;
  background-color: rgba(233, 248, 228, 0.4);
  opacity: 1;
}

/* 4. Reporting State */
.pipeline-text-container[data-active="info-4"] {
  border-color: #595959; 
  box-shadow: 0 4px 15px rgba(89, 89, 89, 0.15);
  background-color: rgba(232, 232, 232, 0.4);
}
.pipeline-text-container[data-active="info-4"] .pipeline-pointer {
  left: 83.966%; /* (3139 + 4596) / 2 = 3867.5px */
  border-color: #595959;
  background-color: rgba(232, 232, 232, 0.4);
  opacity: 1;
}

/* Default State */
.pipeline-text-container[data-active="info-default"] {
  border-color: #e2e8f0;
  background-color: #f8fafc;
}
.pipeline-text-container[data-active="info-default"] .pipeline-pointer {
  opacity: 0;
}

/* Dynamically color the headers based on the active state */
.pipeline-text-container[data-active="info-1"] #info-1 h3 { color: #0070C0; }
.pipeline-text-container[data-active="info-2"] #info-2 h3 { color: #78206E; }
.pipeline-text-container[data-active="info-3"] #info-3 h3 { color: #3B7D23; }
.pipeline-text-container[data-active="info-4"] #info-4 h3 { color: #595959; }
/* Duplicated state for the Methodology Deep Dive section */

/* 1. Input State */
.pipeline-text-container[data-active="method-1"] {
  border-color: #0070C0; 
  box-shadow: 0 4px 15px rgba(0, 112, 192, 0.15);
  background-color: rgba(234, 245, 247, 0.4);
}
.pipeline-text-container[data-active="method-1"] .pipeline-pointer {
  left: 4.548%;
  border-color: #0070C0;
  background-color: rgba(234, 245, 247, 0.4);
  opacity: 1;
}

/* 2. Planning State */
.pipeline-text-container[data-active="method-2"] {
  border-color: #78206E; 
  box-shadow: 0 4px 15px rgba(120, 32, 110, 0.15);
  background-color: rgba(255, 242, 254, 0.4);
}
.pipeline-text-container[data-active="method-2"] .pipeline-pointer {
  left: 17.911%;
  border-color: #78206E;
  background-color: rgba(255, 242, 254, 0.4);
  opacity: 1;
}

/* 3. Grounding State */
.pipeline-text-container[data-active="method-3"] {
  border-color: #3B7D23; 
  box-shadow: 0 4px 15px rgba(59, 125, 35, 0.15);
  background-color: rgba(233, 248, 228, 0.4);
}
.pipeline-text-container[data-active="method-3"] .pipeline-pointer {
  left: 47.177%;
  border-color: #3B7D23;
  background-color: rgba(233, 248, 228, 0.4);
  opacity: 1;
}

/* 4. Reporting State */
.pipeline-text-container[data-active="method-4"] {
  border-color: #595959; 
  box-shadow: 0 4px 15px rgba(89, 89, 89, 0.15);
  background-color: rgba(232, 232, 232, 0.4);
}
.pipeline-text-container[data-active="method-4"] .pipeline-pointer {
  left: 83.966%;
  border-color: #595959;
  background-color: rgba(232, 232, 232, 0.4);
  opacity: 1;
}

/* Dynamically color the headers based on the active state */
.pipeline-text-container[data-active="method-1"] #method-1 h3 { color: #0070C0; }
.pipeline-text-container[data-active="method-2"] #method-2 h3 { color: #78206E; }
.pipeline-text-container[data-active="method-3"] #method-3 h3 { color: #3B7D23; }
.pipeline-text-container[data-active="method-4"] #method-4 h3 { color: #595959; }

