/* ============================================================================
   HOW IT WORKS SECTION
   The mechanism reveal. 4 numbered steps, staggered entry, pulse connectors.
   Subtle slate background creates visual rhythm after white TOMORROW.
   ============================================================================ */

.how-works {
  background: #f8fafc;
  padding: var(--space-3xl) 0;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Subtle top border — visual break from TOMORROW */
.how-works::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(15, 23, 42, 0.06) 20%,
    rgba(15, 23, 42, 0.06) 80%,
    transparent 100%);
}

.how-works__content {
  max-width: var(--max-width-full);
  margin: 0 auto;
  padding: 0 var(--space-md);
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   HEADLINE — "HOW IT WORKS."
   -------------------------------------------------------------------------- */

.how-works__headline {
  font-family: 'NewPanamSkyline', var(--font-sans);
  font-size: var(--text-5xl);
  font-weight: var(--weight-black);
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: var(--tracking-tighter);
  line-height: var(--leading-none);
  margin: 0;
  opacity: 0;
  transform: translateY(16px);
}

.how-works--visible .how-works__headline {
  animation: how-works-reveal 0.6s var(--ease-snappy) forwards;
}

/* Blue pulsing period */
.how-works__dot {
  display: inline-block;
  color: #3b82f6;
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.3);
  animation: how-works-dot-pulse 2s ease-in-out infinite;
}

@keyframes how-works-dot-pulse {
  0%, 100% { text-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.3); }
  50% { text-shadow: 0 0 30px rgba(59, 130, 246, 0.9), 0 0 60px rgba(59, 130, 246, 0.5), 0 0 80px rgba(59, 130, 246, 0.2); }
}

/* --------------------------------------------------------------------------
   SUBHEAD
   -------------------------------------------------------------------------- */

.how-works__subhead {
  font-size: var(--text-lg);
  font-weight: var(--weight-light);
  color: var(--color-text-secondary);
  margin: var(--space-sm) 0 var(--space-2xl);
  opacity: 0;
  transform: translateY(12px);
}

.how-works--visible .how-works__subhead {
  animation: how-works-reveal 0.5s var(--ease-snappy) 0.2s forwards;
}

/* --------------------------------------------------------------------------
   STEPS — Numbered rows with icon + text
   -------------------------------------------------------------------------- */

.how-works__steps {
  display: flex;
  flex-direction: column;
}

.how-works__step {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  opacity: 0;
  transform: translateY(16px);
  position: relative;
}

.how-works__step:first-child {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.how-works__step:last-child {
  border-bottom: none;
}

.how-works__step--active {
  animation: how-works-reveal 0.5s var(--ease-snappy) forwards;
}

/* Active borders shift to blue */
.how-works--complete .how-works__step {
  border-color: rgba(59, 130, 246, 0.12);
  transition: border-color 0.8s var(--ease-default);
}

@keyframes how-works-reveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   NUMBER COLUMN — Large monospace number + icon
   -------------------------------------------------------------------------- */

.how-works__number-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  width: 5rem;
}

.how-works__number {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  color: rgba(15, 23, 42, 0.08);
  letter-spacing: -0.02em;
  line-height: 1;
  transition: color 0.6s var(--ease-default);
}

/* Numbers light up when step activates */
.how-works__step--active .how-works__number {
  color: rgba(59, 130, 246, 0.35);
  transition: color 0.3s var(--ease-snappy);
}

.how-works__icon {
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0.4;
  filter: invert(35%) sepia(85%) saturate(1500%) hue-rotate(200deg) brightness(95%);
  transition: opacity 0.6s var(--ease-default);
}

.how-works__icon svg {
  width: 100%;
  height: 100%;
}

.how-works__step--active .how-works__icon {
  opacity: 0.7;
}

/* Protocol code badge — engineering authority */
.how-works__code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: rgba(59, 130, 246, 0.4);
  border: 1px solid rgba(59, 130, 246, 0.15);
  padding: 0.1em 0.5em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.6s var(--ease-default), border-color 0.6s var(--ease-default);
}

.how-works__step--active .how-works__code {
  color: rgba(59, 130, 246, 0.7);
  border-color: rgba(59, 130, 246, 0.3);
}

/* --------------------------------------------------------------------------
   PULSE — Animated dot between number and text, shows data flow
   -------------------------------------------------------------------------- */

.how-works__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0);
  flex-shrink: 0;
  transition: background 0.3s var(--ease-default);
}

.how-works__step--active .how-works__pulse {
  background: rgba(59, 130, 246, 0.6);
  animation: how-works-pulse 2s ease-in-out infinite;
}

@keyframes how-works-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

/* --------------------------------------------------------------------------
   TEXT — Title + description
   -------------------------------------------------------------------------- */

.how-works__text {
  flex: 1;
  min-width: 0;
}

.how-works__title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin: 0;
  line-height: var(--leading-tight);
}

.how-works__desc {
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
  margin: var(--space-xs) 0 0;
}

/* --------------------------------------------------------------------------
   MOBILE — 768px
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .how-works {
    padding: var(--space-3xl) 0;
  }

  .how-works__headline {
    font-size: var(--text-4xl);
  }

  .how-works__subhead {
    font-size: var(--text-base);
    margin-bottom: var(--space-2xl);
  }

  .how-works__step {
    gap: var(--space-md);
    padding: var(--space-lg) 0;
  }

  .how-works__number-col {
    width: 3.5rem;
  }

  .how-works__number {
    font-size: var(--text-2xl);
  }

  .how-works__icon {
    width: 2rem;
    height: 2rem;
  }

  .how-works__pulse {
    display: none;
  }

  .how-works__code {
    font-size: 0.6rem;
  }

  .how-works__title {
    font-size: var(--text-base);
  }

  .how-works__desc {
    font-size: var(--text-sm);
  }
}
