/**
 * How It Works – Same logic as AI Dashboard: dotted bg, aligned sections, responsive.
 * Si Funksionon timeline uses project colors: --bg-deep, --accent, --glow, --border, etc.
 */

/* ─── Page (dotted bg from body.landing-page – same as landing & pricing) ────── */
.how-it-works-page {
  min-height: 100vh;
  padding-top: 0; /* .landing-main provides navbar clearance */
  /* background from body.landing-page in landing-base.css */
}

/* ─── Hero (same layout as Performance Dashboard: star → title → subtitle, same gap & fonts) ─── */
.how-it-works-page .hiw-hero {
  padding-top: 64px;
  padding-bottom: 0;
  padding-left: var(--landing-container-padding);
  padding-right: var(--landing-container-padding);
  max-width: var(--landing-container-max);
  margin-left: auto;
  margin-right: auto;
}

.how-it-works-page .hiw-hero-content {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  perspective: 800px;
}

/* Star/logo — same as .tmto-pd-logo on performance dashboard */
.how-it-works-page .hiw-hero-logo {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  object-fit: contain;
  opacity: 0;
  animation: hero-star-spin 0.45s ease-out forwards;
}

/* Title — exact same font/size as .tmto-pd-title (Performance Logic) */
.how-it-works-page .hiw-hero-title {
  font-family: var(--font-sans);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 6px;
  background: linear-gradient(270deg, #07E0FD 0%, #247CC6 31.92%, #54308C 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  opacity: 0;
  animation: hero-headline-reveal 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s forwards;
}

/* Subtitle — exact same as .tmto-pd-sub */
.how-it-works-page .hiw-hero-tagline {
  font-size: 12px;
  color: var(--text-muted, #8797AD);
  letter-spacing: 2px;
  margin: 0 auto;
  max-width: 520px;
  font-family: var(--font-sans);
  text-align: center;
  opacity: 0;
  animation: hero-subtitle-in 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.45s forwards;
}

@media (prefers-reduced-motion: reduce) {
  .how-it-works-page .hiw-hero-logo,
  .how-it-works-page .hiw-hero-title,
  .how-it-works-page .hiw-hero-tagline {
    opacity: 1;
    animation: none;
  }
}

/* ─── Si Funksionon? — Vertical Timeline (alternating left/right, gradient line) ─ */
.hiw-timeline-section {
  padding: 8px var(--landing-container-padding) 100px;
  position: relative;
}

.hiw-timeline-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.hiw-timeline-subtitle {
  text-align: center;
  font-size: 1rem;
  color: var(--text-muted, #7B8BA5);
  margin: 0 0 48px;
  letter-spacing: 0.02em;
}

/* Vertical timeline line — starts below subtitle so it doesn’t touch text */
.hiw-timeline-line {
  position: absolute;
  top: 72px;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent 0%, #54308C 5%, #247CC6 50%, #07E0FD 95%, transparent 100%);
  opacity: 0.7;
  box-shadow: 0 0 20px rgba(36, 124, 198, 0.25);
  z-index: 0;
}

/* Step: alternating left/right */
.hiw-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 32px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hiw-step:last-child { margin-bottom: 0; }

.hiw-step.hiw-inview {
  opacity: 1;
  transform: translateY(0);
}

.hiw-step:nth-child(3).hiw-inview { transition-delay: 0s; }
.hiw-step:nth-child(4).hiw-inview { transition-delay: 0.06s; }
.hiw-step:nth-child(5).hiw-inview { transition-delay: 0.12s; }
.hiw-step:nth-child(6).hiw-inview { transition-delay: 0.18s; }
.hiw-step:nth-child(7).hiw-inview { transition-delay: 0.24s; }
.hiw-step:nth-child(8).hiw-inview { transition-delay: 0.3s; }
.hiw-step:nth-child(9).hiw-inview { transition-delay: 0.36s; }

.hiw-step-left {
  flex-direction: row;
  padding-right: calc(50% + 38px);
  justify-content: flex-end;
  text-align: right;
}

.hiw-step-right {
  flex-direction: row-reverse;
  padding-left: calc(50% + 38px);
  justify-content: flex-end;
  text-align: left;
}

/* Circle: number with subtle gradient ring (muted) */
.hiw-step-node {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--bg-deep, #040810) 0, var(--bg-deep, #040810) 24px, transparent 24px),
              linear-gradient(90deg, rgba(84, 48, 140, 0.5) 0%, rgba(36, 124, 198, 0.45) 50%, rgba(7, 224, 253, 0.4) 100%);
  box-shadow: 0 0 12px rgba(36, 124, 198, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.5s ease;
}

.hiw-step.hiw-inview .hiw-step-node {
  transform: translateX(-50%) scale(1);
  box-shadow: 0 0 16px rgba(7, 224, 253, 0.15), 0 2px 12px rgba(0, 0, 0, 0.15);
}

.hiw-step-num {
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1;
  list-style: none;
}
.hiw-step-num::before,
.hiw-step-num::after {
  display: none;
  content: none;
}

/* Card — glassmorphism, border color per step */
.hiw-step-card {
  flex: 1;
  min-width: 0;
  padding: 22px 26px;
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid;
  border-radius: 14px;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.5s ease, border-color 0.35s ease, transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform: translateY(8px);
}

.hiw-step:nth-child(3) .hiw-step-card { border-color: #54308C; }
.hiw-step:nth-child(4) .hiw-step-card { border-color: #6B3BA3; }
.hiw-step:nth-child(5) .hiw-step-card { border-color: #247CC6; }
.hiw-step:nth-child(6) .hiw-step-card { border-color: #1A9FD4; }
.hiw-step:nth-child(7) .hiw-step-card { border-color: #07C5E8; }
.hiw-step:nth-child(8) .hiw-step-card { border-color: #07E0FD; }
.hiw-step:nth-child(9) .hiw-step-card { border-color: #5AF0FF; }

.hiw-step.hiw-inview .hiw-step-card {
  transform: translateY(0);
  box-shadow: 0 0 20px rgba(36, 124, 198, 0.12), 0 8px 32px rgba(0, 0, 0, 0.18);
}

.hiw-step-heading {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text, #E8EDF5);
  margin: 0 0 8px;
}

.hiw-step-desc,
.hiw-step-list {
  font-size: 0.95rem;
  color: var(--text-muted, #7B8BA5);
  margin: 0;
  line-height: 1.5;
}

.hiw-step-list {
  padding-left: 1.2em;
  list-style: disc;
}

.hiw-step-list li {
  margin-bottom: 6px;
}

.hiw-step-list li:last-child { margin-bottom: 0; }

/* ─── Responsive: timeline left, single column ───────────────────────────────── */
@media (max-width: 768px) {
  .how-it-works-page .hiw-hero {
    padding-top: 32px;
    padding-bottom: 0;
    padding-left: var(--landing-container-padding-tablet);
    padding-right: var(--landing-container-padding-tablet);
  }

  .hiw-timeline-section {
    padding: 6px var(--landing-container-padding-tablet) 64px;
  }

  .hiw-timeline-subtitle {
    font-size: 0.95rem;
    margin-bottom: 40px;
    letter-spacing: 0.03em;
  }

  .hiw-timeline-line {
    top: 64px;
    left: 28px;
    transform: none;
    width: 1.5px;
    opacity: 0.8;
  }

  .hiw-step,
  .hiw-step-left,
  .hiw-step-right {
    flex-direction: row;
    padding-left: 0;
    padding-right: 0;
    text-align: left;
    padding-left: 76px;
    gap: 0;
    margin-bottom: 28px;
  }

  .hiw-step-node {
    position: absolute;
    left: 0;
    transform: scale(0.92);
    width: 52px;
    height: 52px;
  }

  .hiw-step.hiw-inview .hiw-step-node {
    transform: scale(1);
  }

  .hiw-step-card {
    margin-left: 0;
    padding: 20px 22px;
    border-radius: 16px;
    transform: translateY(6px);
  }

  .hiw-step.hiw-inview .hiw-step-card {
    transform: translateY(0);
  }

  .hiw-step-heading {
    font-size: 1.15rem;
    margin-bottom: 6px;
  }

  .hiw-step-desc,
  .hiw-step-list {
    font-size: 0.9rem;
    line-height: 1.55;
  }
}

@media (max-width: 480px) {
  .how-it-works-page .hiw-hero {
    padding-top: 24px;
    padding-bottom: 0;
    padding-left: var(--landing-container-padding-mobile);
    padding-right: var(--landing-container-padding-mobile);
  }

  .how-it-works-page .hiw-hero-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
  }

  .how-it-works-page .hiw-hero-title {
    font-size: clamp(1.4rem, 5vw, 1.75rem);
    line-height: 1.25;
  }

  .how-it-works-page .hiw-hero-tagline {
    font-size: 12px;
    letter-spacing: 1px;
  }

  .hiw-timeline-section {
    padding: 4px var(--landing-container-padding-mobile) 56px;
  }

  .hiw-timeline-subtitle {
    font-size: 0.9rem;
    margin-bottom: 32px;
  }

  .hiw-timeline-line {
    top: 56px;
    left: 22px;
    width: 1.5px;
  }

  .hiw-step,
  .hiw-step-left,
  .hiw-step-right {
    padding-left: 64px;
    margin-bottom: 24px;
  }

  .hiw-step-node {
    width: 42px;
    height: 42px;
    left: 0;
    transform: scale(0.94);
    background: radial-gradient(circle at center, var(--bg-deep, #040810) 0, var(--bg-deep, #040810) 19px, transparent 19px),
                linear-gradient(90deg, rgba(84, 48, 140, 0.45) 0%, rgba(36, 124, 198, 0.4) 50%, rgba(7, 224, 253, 0.35) 100%);
    box-shadow: 0 0 12px rgba(36, 124, 198, 0.12);
  }

  .hiw-step.hiw-inview .hiw-step-node {
    transform: scale(1);
    box-shadow: 0 0 14px rgba(7, 224, 253, 0.18), 0 2px 10px rgba(0, 0, 0, 0.2);
  }

  .hiw-step-num {
    font-size: 0.95rem;
  }

  .hiw-step-card {
    padding: 18px 20px;
    border-radius: 18px;
    transform: translateY(6px);
  }

  .hiw-step.hiw-inview .hiw-step-card {
    transform: translateY(0);
  }

  .hiw-step-heading {
    font-size: 1.08rem;
    margin-bottom: 6px;
  }

  .hiw-step-desc,
  .hiw-step-list {
    font-size: 0.875rem;
  }

  .hiw-step-list {
    padding-left: 1.15em;
  }
}

@media (max-width: 380px) {
  .how-it-works-page .hiw-hero-title {
    font-size: 1.3rem;
  }

  .how-it-works-page .hiw-hero-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .hiw-timeline-section {
    padding: 36px var(--landing-container-padding-sm) 48px;
  }

  .hiw-step,
  .hiw-step-left,
  .hiw-step-right {
    padding-left: 58px;
    margin-bottom: 22px;
  }

  .hiw-step-node {
    width: 38px;
    height: 38px;
  }

  .hiw-step-card {
    padding: 16px 18px;
    border-radius: 16px;
  }

  .hiw-step-heading {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hiw-step,
  .hiw-step.hiw-inview {
    opacity: 1;
    transform: none;
    transition: none;
    transition-delay: 0s;
  }

  .hiw-step-node,
  .hiw-step.hiw-inview .hiw-step-node {
    transform: translateX(-50%) scale(1);
  }

  .hiw-step-card,
  .hiw-step.hiw-inview .hiw-step-card {
    transform: none;
  }
}

@media (max-width: 768px) {
  @media (prefers-reduced-motion: reduce) {
    .hiw-step-node,
    .hiw-step.hiw-inview .hiw-step-node {
      transform: scale(1);
    }
  }
}

/* ─── Why traders section: smooth professional scroll-in animation ───────────── */
.how-it-works-page .why-traders-section .section-title,
.how-it-works-page .why-traders-section .why-card.fade-up {
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  animation: none;
}

@keyframes hiw-why-reveal {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.how-it-works-page .why-traders-section.why-traders-visible .section-title {
  animation: hiw-why-reveal 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0s forwards;
}

.how-it-works-page .why-traders-section.why-traders-visible .why-traders-grid .why-card.fade-up:nth-child(1) {
  animation: hiw-why-reveal 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s forwards;
}
.how-it-works-page .why-traders-section.why-traders-visible .why-traders-grid .why-card.fade-up:nth-child(2) {
  animation: hiw-why-reveal 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.22s forwards;
}
.how-it-works-page .why-traders-section.why-traders-visible .why-traders-grid .why-card.fade-up:nth-child(3) {
  animation: hiw-why-reveal 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.34s forwards;
}
.how-it-works-page .why-traders-section.why-traders-visible .why-traders-grid .why-card.fade-up:nth-child(4) {
  animation: hiw-why-reveal 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.46s forwards;
}

@media (prefers-reduced-motion: reduce) {
  .how-it-works-page .why-traders-section .section-title,
  .how-it-works-page .why-traders-section .why-card.fade-up {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
