/* =========================================
   HOW IT WORKS — Services Page
   ========================================= */

#how-it-works {
  position: relative;
  padding: 120px 80px;
  background: var(--bg-primary);
  overflow: hidden;
  text-align: center;
}

/* Radial glow pulse behind content */
#how-it-works::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.07) 0%, transparent 65%);
  animation: hiwGlowPulse 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

/* Scan line */
#how-it-works::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: rgba(56, 189, 248, 0.05);
  animation: hiwScanLine 8s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes hiwGlowPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.95); opacity: 0.8; }
  50%       { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
}

@keyframes hiwScanLine {
  0%   { top: 0; }
  100% { top: 100%; }
}

/* Lift all direct children above pseudo-elements */
#how-it-works > * {
  position: relative;
  z-index: 1;
}

/* ---- Header text ---- */
.hiw-header {
  margin-bottom: 64px;
}

.hiw-label {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--accent-blue);
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease 0s, transform 0.7s ease 0s;
}

.hiw-label.visible {
  opacity: 1;
  transform: translateY(0);
}

.hiw-heading {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 56px;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease 0.15s, transform 0.7s ease 0.15s;
}

.hiw-heading.visible {
  opacity: 1;
  transform: translateY(0);
}

.hiw-body {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 36px;
  line-height: 1.8;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease 0.3s, transform 0.7s ease 0.3s;
}

.hiw-body.visible {
  opacity: 1;
  transform: translateY(0);
}

.hiw-glow-line {
  width: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent-blue), transparent);
  margin: 0 auto;
  transition: width 0.8s ease 0.45s;
}

.hiw-glow-line.visible {
  width: 200px;
}

/* ---- Icon row ---- */
.hiw-icons {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: nowrap;
  margin-bottom: 48px;
}

.hiw-icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: default;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.hiw-icons.visible .hiw-icon-item:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.0s; }
.hiw-icons.visible .hiw-icon-item:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.1s; }
.hiw-icons.visible .hiw-icon-item:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.2s; }
.hiw-icons.visible .hiw-icon-item:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.3s; }
.hiw-icons.visible .hiw-icon-item:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 0.4s; }
.hiw-icons.visible .hiw-icon-item:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 0.5s; }

.hiw-icon-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.hiw-icon-circle svg {
  width: 32px;
  height: 32px;
  stroke: var(--accent-blue);
  transition: transform 0.3s ease;
}

.hiw-icon-item:hover .hiw-icon-circle {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--accent-blue);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.hiw-icon-item:hover .hiw-icon-circle svg {
  transform: scale(1.15);
}

.hiw-icon-label {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.hiw-icon-item:hover .hiw-icon-label {
  color: #fff;
}

/* ---- Animated connection line ---- */
.hiw-connection {
  width: 80%;
  max-width: 720px;
  margin: 0 auto 52px;
  opacity: 0;
  transition: opacity 0.5s ease 0.7s;
}

.hiw-connection.visible {
  opacity: 1;
}

.hiw-connection-line {
  position: relative;
  height: 1px;
  background: rgba(56, 189, 248, 0.2);
  overflow: hidden;
}

.hiw-dot {
  position: absolute;
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38BDF8;
  box-shadow: 0 0 10px #38BDF8, 0 0 22px rgba(56, 189, 248, 0.6);
  animation: hiwDotTravel 3s linear infinite;
}

@keyframes hiwDotTravel {
  0%   { left: -10px; }
  100% { left: calc(100% + 10px); }
}

/* ---- Bottom tagline ---- */
.hiw-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  color: var(--text-muted);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease 0.9s, transform 0.7s ease 0.9s;
}

.hiw-tagline.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Tablet: 3×2 grid ---- */
@media (max-width: 1024px) {
  .hiw-icons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    flex-wrap: unset;
  }
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
  #how-it-works {
    padding: 60px 24px;
  }

  .hiw-heading {
    font-size: 36px;
  }

  .hiw-body {
    font-size: 15px;
  }

  .hiw-header {
    margin-bottom: 48px;
  }

  .hiw-icons {
    grid-template-columns: repeat(2, 1fr);
    max-width: 300px;
    gap: 24px;
  }

  .hiw-connection {
    width: 90%;
  }

  .hiw-tagline {
    font-size: 18px;
  }
}
