/* ================================================================
   HOW IT WORKS — "Illuminated Journey" Redesign
   Premium timeline with glowing connectors and staggered reveals
   ================================================================ */

.hiw {
  position: relative;
  padding: 140px 0 120px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 25% 10%, rgba(26,42,108,0.14) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 85%, rgba(215,180,106,0.06) 0%, transparent 55%),
    radial-gradient(ellipse 100% 100% at 50% 50%, #060a18 0%, #020304 100%);
}

/* --- Noise grain overlay --- */
.hiw::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}

/* --- Ambient floating shapes (CSS only, lightweight) --- */
.hiw-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hiw-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: hiwFloat 18s ease-in-out infinite;
}

.hiw-shape:nth-child(1) {
  width: 6px; height: 6px;
  background: rgba(215,180,106,0.5);
  top: 12%; left: 8%;
  animation-delay: 0s;
  animation-duration: 22s;
}
.hiw-shape:nth-child(2) {
  width: 4px; height: 4px;
  background: rgba(100,140,255,0.4);
  top: 28%; right: 12%;
  animation-delay: 3s;
  animation-duration: 26s;
}
.hiw-shape:nth-child(3) {
  width: 8px; height: 8px;
  background: rgba(215,180,106,0.3);
  bottom: 20%; left: 15%;
  animation-delay: 6s;
  animation-duration: 20s;
}
.hiw-shape:nth-child(4) {
  width: 3px; height: 3px;
  background: rgba(160,200,255,0.5);
  top: 55%; right: 7%;
  animation-delay: 2s;
  animation-duration: 28s;
}
.hiw-shape:nth-child(5) {
  width: 5px; height: 5px;
  background: rgba(215,180,106,0.35);
  bottom: 35%; right: 22%;
  animation-delay: 8s;
  animation-duration: 24s;
}
.hiw-shape:nth-child(6) {
  width: 2px; height: 2px;
  background: rgba(255,255,255,0.5);
  top: 70%; left: 30%;
  animation-delay: 4s;
  animation-duration: 30s;
}

@keyframes hiwFloat {
  0%, 100% { opacity: 0; transform: translateY(0) scale(1); }
  15% { opacity: 0.8; }
  50% { opacity: 0.4; transform: translateY(-40px) scale(1.3); }
  85% { opacity: 0.7; }
}

/* --- Section Header --- */
.hiw-header {
  text-align: center;
  margin-bottom: 90px;
  position: relative;
  z-index: 5;
}

.hiw-badge {
  display: inline-block;
  padding: 8px 22px;
  background: rgba(215,180,106,0.08);
  border: 1px solid rgba(215,180,106,0.28);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: rgba(215,180,106,0.95);
  text-transform: uppercase;
  margin-bottom: 22px;
}

.hiw-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 700;
  margin: 0 0 14px;
  background: linear-gradient(135deg, #ffffff 0%, #d7b46a 55%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}

.hiw-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(14px, 1.2vw, 17px);
  color: rgba(255,255,255,0.5);
  margin: 0;
  font-weight: 400;
}

/* --- Timeline Container --- */
.hiw-timeline {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  z-index: 5;
}

/* Vertical center line */
.hiw-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  z-index: 1;
}

.hiw-line-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(215,180,106,0.12) 8%,
    rgba(215,180,106,0.25) 50%,
    rgba(215,180,106,0.12) 92%,
    transparent 100%
  );
}

.hiw-line-glow {
  position: absolute;
  left: -4px;
  right: -4px;
  top: 0;
  bottom: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(215,180,106,0.08) 8%,
    rgba(215,180,106,0.15) 50%,
    rgba(215,180,106,0.08) 92%,
    transparent 100%
  );
  filter: blur(6px);
}

/* Animated pulse traveling down the line */
.hiw-line-pulse {
  position: absolute;
  left: -3px;
  width: 8px;
  height: 80px;
  border-radius: 4px;
  background: linear-gradient(180deg, transparent, rgba(215,180,106,0.6), transparent);
  filter: blur(2px);
  animation: hiwPulseDown 4s ease-in-out infinite;
}

@keyframes hiwPulseDown {
  0% { top: -80px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: calc(100% + 80px); opacity: 0; }
}

/* --- Step Row --- */
.hiw-step {
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  align-items: center;
  position: relative;
  z-index: 5;
  margin-bottom: 60px;
}

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

/* --- Node (center dot on timeline) --- */
.hiw-node {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 56px;
  height: 56px;
  z-index: 10;
}

.hiw-node-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(215,180,106,0.35);
  transition: all 0.5s ease;
}

.hiw-step:hover .hiw-node-ring {
  border-color: rgba(215,180,106,0.7);
  box-shadow: 0 0 20px rgba(215,180,106,0.25), inset 0 0 12px rgba(215,180,106,0.1);
}

.hiw-node-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f5e4a0, #d7b46a 60%, #b8935a);
  box-shadow: 0 0 14px rgba(215,180,106,0.5), 0 0 40px rgba(215,180,106,0.15);
  transition: transform 0.4s ease;
}

.hiw-step:hover .hiw-node-dot {
  transform: scale(1.3);
}

.hiw-node-num {
  position: absolute;
  font-family: 'Cinzel Decorative', serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(215,180,106,0.7);
  letter-spacing: 0.05em;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* --- Card --- */
.hiw-card {
  position: relative;
  padding: 36px 32px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.015) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.hiw-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: radial-gradient(
    400px circle at var(--mx, 50%) var(--my, 50%),
    rgba(215,180,106,0.08),
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.hiw-card:hover::before {
  opacity: 1;
}

.hiw-card:hover {
  border-color: rgba(215,180,106,0.25);
  transform: translateY(-6px);
  box-shadow:
    0 20px 60px rgba(0,0,0,0.4),
    0 0 0 1px rgba(215,180,106,0.1) inset;
}

/* Card placement: odd rows card-left, even rows card-right */
.hiw-step:nth-child(odd) .hiw-card { grid-column: 1; }
.hiw-step:nth-child(odd) .hiw-node { grid-column: 2; grid-row: 1; }
.hiw-step:nth-child(odd) .hiw-spacer { grid-column: 3; }

.hiw-step:nth-child(even) .hiw-card { grid-column: 3; }
.hiw-step:nth-child(even) .hiw-node { grid-column: 2; grid-row: 1; }
.hiw-step:nth-child(even) .hiw-spacer { grid-column: 1; }

/* Connector line from node to card */
.hiw-connector {
  position: absolute;
  top: 50%;
  height: 1px;
  width: 40px;
  background: linear-gradient(90deg, rgba(215,180,106,0.0), rgba(215,180,106,0.3));
  z-index: 4;
}

.hiw-step:nth-child(odd) .hiw-connector {
  right: -40px;
  background: linear-gradient(90deg, rgba(215,180,106,0.3), rgba(215,180,106,0.0));
}

.hiw-step:nth-child(even) .hiw-connector {
  left: -40px;
}

/* --- Card Content --- */
.hiw-card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  color: rgba(215,180,106,0.85);
  transition: transform 0.4s ease, filter 0.4s ease;
}

.hiw-card:hover .hiw-card-icon {
  transform: scale(1.12) rotate(4deg);
  filter: drop-shadow(0 0 10px rgba(215,180,106,0.3));
}

.hiw-card-icon svg {
  width: 100%;
  height: 100%;
}

.hiw-card-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 700;
  color: #f0ece4;
  margin: 0 0 10px;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.hiw-card-desc {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.55);
  margin: 0;
}

/* --- Large ghost number behind card --- */
.hiw-card-ghost {
  position: absolute;
  top: -10px;
  right: 18px;
  font-family: 'Cinzel Decorative', serif;
  font-size: 96px;
  font-weight: 900;
  color: rgba(215,180,106,0.035);
  line-height: 1;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

/* --- Tags under description --- */
.hiw-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.hiw-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(215,180,106,0.06);
  border: 1px solid rgba(215,180,106,0.18);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(215,180,106,0.75);
  text-transform: uppercase;
}

/* --- Reveal animations (scroll triggered) --- */
.hiw-step {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.hiw-step:nth-child(1) { transition-delay: 0s; }
.hiw-step:nth-child(2) { transition-delay: 0.12s; }
.hiw-step:nth-child(3) { transition-delay: 0.24s; }
.hiw-step:nth-child(4) { transition-delay: 0.36s; }

/* --- Bottom decorative divider --- */
.hiw-end-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 80px;
  position: relative;
  z-index: 5;
}

.hiw-end-line {
  flex: 1;
  max-width: 100px;
  height: 1px;
  background: rgba(215,180,106,0.2);
}

.hiw-end-icon {
  color: rgba(215,180,106,0.45);
  font-size: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 820px) {
  .hiw {
    padding: 100px 0 80px;
  }

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

  /* Switch to single-column left-aligned timeline */
  .hiw-timeline {
    padding-left: 50px;
  }

  .hiw-line {
    left: 24px;
    transform: none;
  }

  .hiw-step {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 48px;
  }

  .hiw-step:nth-child(odd) .hiw-card,
  .hiw-step:nth-child(even) .hiw-card {
    grid-column: unset;
    flex: 1;
  }

  .hiw-step:nth-child(odd) .hiw-node,
  .hiw-step:nth-child(even) .hiw-node {
    grid-column: unset;
    grid-row: unset;
    flex-shrink: 0;
    margin-left: -38px;
  }

  .hiw-spacer {
    display: none !important;
  }

  .hiw-connector {
    display: none;
  }

  .hiw-node {
    width: 44px;
    height: 44px;
  }

  .hiw-node-dot {
    width: 10px;
    height: 10px;
  }

  .hiw-card {
    padding: 28px 24px;
  }

  .hiw-card-ghost {
    font-size: 64px;
  }
}

@media (max-width: 480px) {
  .hiw {
    padding: 80px 0 60px;
  }

  .hiw-timeline {
    padding-left: 40px;
  }

  .hiw-card {
    padding: 24px 20px;
  }

  .hiw-card-title {
    font-size: 17px;
  }

  .hiw-card-desc {
    font-size: 13px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PERF LOW: instant reveals, no animations
   ═══════════════════════════════════════════════════════════════ */

html.perf-low .hiw-step {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

html.perf-low .hiw-shape {
  display: none !important;
}

html.perf-low .hiw-line-pulse {
  display: none !important;
}

html.perf-low .hiw-card::before {
  display: none !important;
}
