/* ==========================================================================
   AUTHIFY — Trust Flow (Scene 02)
   Minimal hub-and-spoke diagram: Businesses <-> Authify <-> Customers,
   with three trust attributes branching below. Glass surfaces + animated
   gold connectors, consistent with the rest of the site's design system.
   ========================================================================== */

.flow{
  position: relative;
  background: var(--color-bg-elevated);
}

.flow__diagram{
  position: relative;
  padding: var(--space-2xl) var(--space-lg);
  border-radius: var(--radius-xl);
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}
.flow__diagram::before{
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--color-border) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.5;
  pointer-events: none;
}

/* ---- Header, now living inside the same card as the diagram -----------*/
.flow__diagram .section-header{
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-xl);
}

/* ---- Hub row: Business <-> Authify <-> Customer ---------------------- */
.flow__hub{
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.flow__side{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3xs);
  width: 15rem;
  flex-shrink: 0;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--glass-surface-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  transition: transform var(--dur-mid) var(--ease-glass), box-shadow var(--dur-mid) var(--ease-glass);
}
.flow__side:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-float);
}
.flow__side-icon{
  width: 3rem; height: 3rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--gold-500);
  margin-bottom: var(--space-2xs);
}
.flow__side-icon .icon{ width: 1.375rem; height: 1.375rem; }
.flow__side h3{ font-size: var(--text-base); }
.flow__side p{ font-size: calc(var(--text-xs) * 0.8); color: var(--color-text-muted); }

/* ---- Center hub -------------------------------------------------------*/
.flow__center{
  position: relative;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding-inline: var(--space-sm);
}
.flow__center-icon{ position: relative; z-index: 1; display: flex; }
.flow__center-icon img{
  height: 2.25rem;
  width: auto;
  object-fit: contain;
}

/* ---- Connector links between side cards and the hub --------------------*/
.flow__link{
  position: relative;
  flex: 1;
  min-width: 3rem;
  max-width: 7rem;
  height: 1px;
}
.flow__link-line{
  position: absolute; inset-inline: 0; top: 0;
  height: 1px;
  background-image: repeating-linear-gradient(90deg, var(--color-border-strong) 0 6px, transparent 6px 13px);
}
.flow__link-arrow{
  position: absolute; top: 0; left: 0;
  width: 9px; height: 9px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-top: 2px solid var(--gold-500);
  border-right: 2px solid var(--gold-500);
  opacity: 0;
}
.flow__diagram.is-visible .flow__link-arrow{
  animation: link-travel 2.6s var(--ease-smooth) infinite;
}
.flow__diagram.is-visible .flow__link--right .flow__link-arrow{ animation-delay: 1.3s; }
@keyframes link-travel{
  0%{ left: 0%; opacity: 0; }
  10%{ opacity: 1; }
  88%{ opacity: 1; }
  100%{ left: 100%; opacity: 0; }
}

/* ---- Branch: hub down to the three trust attributes --------------------*/
.flow__branch{
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.flow__branch-stem{
  width: 1px;
  height: var(--space-lg);
  background-image: repeating-linear-gradient(180deg, var(--color-border-strong) 0 6px, transparent 6px 13px);
}
.flow__branch-bar{
  width: min(64%, 30rem);
  height: 1px;
  background-image: repeating-linear-gradient(90deg, var(--color-border-strong) 0 6px, transparent 6px 13px);
}

.flow__features{
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  max-width: 40rem;
  margin-inline: auto;
}

.flow__feature{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3xs);
}
.flow__feature-connector{
  width: 1px;
  height: var(--space-sm);
  margin-bottom: var(--space-2xs);
  background-image: repeating-linear-gradient(180deg, var(--color-border-strong) 0 6px, transparent 6px 13px);
}
.flow__feature-icon{
  width: 2.75rem; height: 2.75rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  background: var(--glass-surface-strong);
  border: 1px solid var(--glass-border);
  color: var(--gold-500);
  box-shadow: var(--shadow-glass);
  margin-bottom: var(--space-3xs);
  transition: transform var(--dur-mid) var(--ease-glass), box-shadow var(--dur-mid) var(--ease-glass);
}
.flow__feature-icon .icon{ width: 1.25rem; height: 1.25rem; }
.flow__feature:hover .flow__feature-icon{
  transform: translateY(-3px);
  box-shadow: var(--shadow-gold);
  color: var(--gold-contrast);
  background: linear-gradient(160deg, var(--gold-200), var(--gold-400));
}
.flow__feature h4{ font-size: var(--text-sm); }
.flow__feature p{ font-size: calc(var(--text-xs) * 0.8); color: var(--color-text-muted); }

.flow__link.is-lit .flow__link-line{
  background-image: repeating-linear-gradient(90deg, var(--gold-400) 0 6px, transparent 6px 13px);
}
.flow__center.is-active .flow__center-icon{
  transform: scale(1.06);
}

/* ---- Entrance choreography --------------------------------------------*/
.flow__diagram.is-visible .flow__side,
.flow__diagram.is-visible .flow__center,
.flow__diagram.is-visible .flow__feature{
  animation: flow-in 640ms var(--ease-out) both;
}
.flow__diagram.is-visible .flow__side:first-of-type{ animation-delay: 40ms; }
.flow__diagram.is-visible .flow__center{ animation-delay: 200ms; }
.flow__diagram.is-visible .flow__side:last-of-type{ animation-delay: 360ms; }
.flow__diagram.is-visible .flow__feature:nth-child(2){ animation-delay: 480ms; }
.flow__diagram.is-visible .flow__feature:nth-child(3){ animation-delay: 580ms; }
.flow__diagram.is-visible .flow__feature:nth-child(4){ animation-delay: 680ms; }
@keyframes flow-in{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce){
  .flow__link-arrow{ animation: none !important; opacity: 0.55; }
}

/* ---- Responsive --------------------------------------------------------*/
@media (max-width: 820px){
  .flow__diagram{ padding: var(--space-xl) var(--space-md); }
  .flow__hub{ flex-direction: column; gap: var(--space-sm); }
  .flow__link{
    width: 1px; height: 2.25rem; max-width: none; min-width: 0; flex: none;
  }
  .flow__link-line{
    inset-inline: auto; left: 0; top: 0; bottom: 0; width: 1px; height: auto;
    background-image: repeating-linear-gradient(180deg, var(--color-border-strong) 0 6px, transparent 6px 13px);
  }
  .flow__link-arrow{
    border-top: none; border-right: none;
    border-bottom: 2px solid var(--gold-500);
    border-left: 2px solid var(--gold-500);
    left: 0; top: 0;
  }
  .flow__diagram.is-visible .flow__link-arrow{ animation-name: link-travel-vertical; }
  @keyframes link-travel-vertical{
    0%{ top: 0%; opacity: 0; }
    10%{ opacity: 1; }
    88%{ opacity: 1; }
    100%{ top: 100%; opacity: 0; }
  }
  .flow__side{ width: 100%; max-width: 22rem; box-sizing: border-box; }
  .flow__features{ grid-template-columns: 1fr; gap: var(--space-md); max-width: 20rem; margin-inline: auto; }
  .flow__branch-bar{ display: none; }
  .flow__branch-stem{ height: var(--space-md); }
}

@media (max-width: 480px){
  .flow__diagram{
    padding: var(--space-lg) var(--space-sm);
    border-radius: var(--radius-lg);
  }
  .flow__diagram .section-header{ margin-bottom: var(--space-lg); }
  .flow__diagram .section-header p{ font-size: var(--text-sm); }
  .flow__side{ max-width: 100%; padding: var(--space-sm); }
  .flow__center-icon img{ height: 1.75rem; width: auto; }
  .flow__features{ max-width: 100%; }
}
