/* ============================================================
   CHAPTER V — THE NEXT CHAPTER
   chapter-v.css
   ============================================================ */

/* ============================================================
   GOALS SECTION
   ============================================================ */
.goals-section {
  padding-bottom: var(--space-16);
}

.goals-list {
  display: flex;
  flex-direction: column;
}

.goal-row {
  display: grid;
  grid-template-columns: 80px 1fr 200px;
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-8) 0;
  position: relative;
}

.goal-row__num {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  color: var(--red);
  font-weight: 400;
  line-height: 1;
  flex-shrink: 0;
}

.goal-row__text {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Progress bar — on the right */
.goal-row__bar-wrap {
  display: flex;
  align-items: center;
}

.goal-row__bar {
  width: 100%;
  height: 2px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.goal-row__bar-fill {
  height: 100%;
  background: var(--red);
  position: absolute;
  left: 0; top: 0;
  transition: width 1.2s var(--ease-out);
  /* Start at 0, animate to data width on scroll-in */
  width: 0 !important;
}

.goal-row.visible .goal-row__bar-fill {
  width: var(--target-width, 0%) !important;
}

/* ============================================================
   OPEN TO STRIP
   ============================================================ */
.open-to-strip {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-24) 0;
}

.open-to-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: var(--space-8);
  align-items: start;
}

.open-to-item {
  text-align: center;
  padding: 0 var(--space-4);
}

.open-to-item__label {
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.open-to-sep {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--amber);
  display: flex;
  align-items: flex-start;
  padding-top: 0.5rem;
  user-select: none;
}

/* ============================================================
   PROGRESS BAR ANIMATION — driven by JS
   ============================================================ */
.goal-row__bar-fill {
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.goal-row.visible .goal-row__bar-fill {
  width: var(--target-width, 0%) !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .goal-row {
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto;
  }

  .goal-row__bar-wrap {
    grid-column: 2;
    grid-row: 2;
  }

  .open-to-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .open-to-sep {
    display: none;
  }

  .open-to-item {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-6);
  }

  .open-to-item:last-child {
    border-bottom: none;
  }
}

@media (max-width: 600px) {
  .goal-row {
    grid-template-columns: 48px 1fr;
    gap: var(--space-4);
  }

  .goal-row__num {
    font-size: 2rem;
  }
}
