/* =========================================
   STRATEGY CHART COMPONENT (Perfect Responsiveness)
   ================================********* */

/* --- 1. Container Layout --- */
.strategy-chart-wrapper {
  display: flex;
  flex-direction: column; 
  gap: 6rem; 
  margin: 4rem 0;
  font-family: "Geist", sans-serif;
  width: 100%; 
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  .strategy-chart-wrapper {
    flex-direction: row; 
    align-items: stretch;
    gap: 3rem; 
  }
}

/* --- 2. The Graph Area --- */
.chart-graph {
  position: relative;
  
  /* Desktop Aspect Ratio */
  aspect-ratio: 1 / 0.9; 

  background-color: transparent; 
  
  border-left: 2px solid var(--color-secondary);
  border-bottom: 2px solid var(--color-secondary);
  
  /* BASE MARGIN (Desktop Default): 
     3.5rem gives plenty of room for the label. */
  margin-left: 3.5rem; 
  width: calc(100% - 3.5rem - 15px); 
  
  transform-origin: bottom left;
  transform: scale(0.95);
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* --- AXIS ARROWS --- */
.chart-graph::before {
  content: '';
  position: absolute;
  top: 0; left: -6px; width: 0; height: 0; 
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid var(--color-secondary);
  transform: translateY(-100%);
}

.chart-graph::after {
  content: '';
  position: absolute;
  bottom: -6px; right: 0; width: 0; height: 0; 
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 10px solid var(--color-secondary);
  transform: translateX(100%);
}

/* --- AXIS LABELS --- */
.axis-label {
  position: absolute;
  font-size: 0.8rem; 
  font-weight: 500;
  color: var(--color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  white-space: nowrap;
}

.x-axis {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(2.5rem); /* Desktop Position */
}

.y-axis {
  top: 50%;
  left: 8px;
  transform: translate(-50%, -50%) rotate(-90deg) translateY(-2.5rem); /* Desktop Position */
}


/* --- 3. The Bubbles --- */
.chart-bubble {
  position: absolute;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
  transform: translate(-50%, 50%) scale(0); 
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); 
  box-shadow: 0 0 0 2px var(--color-bg-main); 
}

.bubble-blue { background-color: #D1E1F5; color: #191919; z-index: 1; }   
.bubble-purple { background-color: #A99BF0; color: #191919; z-index: 3; }
.bubble-dark { background-color: var(--color-primary); color: var(--color-bg-main); z-index: 2; }


/* --- 4. The Legend --- */
.chart-legend {
  flex: 1; width: 100%; min-width: 160px; 
  opacity: 0; transform: translateY(20px); 
  transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (min-width: 1024px) {
  .chart-legend { transform: translateX(20px); }
}

.legend-list {
  list-style: none; padding: 0; margin: 0 0 1.5rem 0;
  font-size: 1rem; line-height: 1.4; 
  color: var(--color-secondary);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); 
  column-gap: 0.5rem; row-gap: 0.3rem;   
}

@media (min-width: 1024px) {
  .legend-list { display: block; }
  .legend-list li { margin-bottom: 0.3rem; }
}

.legend-list strong { color: var(--color-primary); margin-right: 0.4rem; }

.legend-keys {
  display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.8rem;
}

@media (min-width: 1024px) {
  .legend-keys { flex-direction: column; gap: 0.5rem; }
}

.key-item {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.9rem; color: var(--color-secondary); margin-right: 1rem;
}

.dot {
  width: 12px; height: 12px; border-radius: 50%;
  box-shadow: 0 0 0 1px var(--color-bg-main); 
}

.key-purple { background-color: #A99BF0; }
.key-dark { background-color: var(--color-primary); }


/* --- ANIMATION TRIGGERS --- */
.animate-chart.is-visible .chart-graph { opacity: 1; transform: scale(1); }
.animate-chart.is-visible .chart-legend { opacity: 1; transform: translateX(0) translateY(0); transition-delay: 0.9s; }
.animate-chart.is-visible .chart-bubble { transform: translate(-50%, 50%) scale(1); }

/* Stagger Delays */
.animate-chart.is-visible .chart-bubble:nth-child(1),
.animate-chart.is-visible .chart-bubble:nth-child(2) { transition-delay: 0.4s; }
.animate-chart.is-visible .chart-bubble:nth-child(3),
.animate-chart.is-visible .chart-bubble:nth-child(4) { transition-delay: 0.5s; }
.animate-chart.is-visible .chart-bubble:nth-child(5) { transition-delay: 0.6s; }
.animate-chart.is-visible .chart-bubble:nth-child(6) { transition-delay: 0.7s; }
.animate-chart.is-visible .chart-bubble:nth-child(7) { transition-delay: 0.8s; }
.animate-chart.is-visible .chart-bubble:nth-child(8) { transition-delay: 0.9s; }
.animate-chart.is-visible .chart-bubble:nth-child(9) { transition-delay: 1.0s; }


/* =========================================
   RESPONSIVE ADJUSTMENTS
   ================================********* */

/* 1. TABLET / SMALL LAPTOP (< 1024px) 
   The Fix: Right when it turns single column, reduce the margin 
   so it doesn't look awkwardly empty on the left. */
@media (max-width: 1023px) {
  .chart-graph {
    margin-left: 2.5rem; /* Reduced from 3.5rem */
    width: calc(100% - 2.5rem - 15px);
  }
  
  .y-axis {
    /* Pull label closer (2rem) */
    transform: translate(-50%, -50%) rotate(-90deg) translateY(-2rem);
  }

  .x-axis {
    /* Pull label closer (2rem) */
    transform: translateX(-50%) translateY(2rem);
  }
}

/* 2. MOBILE / PHONE (< 600px)
   Maximize space even further for tiny screens. */
@media (max-width: 600px) {
  .chart-graph { 
    aspect-ratio: 1 / 1; 
    margin-left: 2rem; /* Reduced from 2.5rem */
    width: calc(100% - 2rem - 15px);
  }
  
  .axis-label { font-size: 0.85rem; } 
  .chart-bubble { width: 30px; height: 30px; font-size: 0.8rem; }
}