/* ============================================================
   AFFILIATE FOREX HUB — HOMEPAGE HERO
   "The Global Forex Intelligence Hub"

   Scoped entirely to .afh-hero. Nothing here leaks into the
   rest of the site. The cyan layer is the market; the gold
   core is Affiliate Forex Hub analysing it.
   ============================================================ */

.afh-hero {
  /* Surface */
  --h-bg-0: #05070b;
  --h-bg-1: #080b12;
  --h-bg-2: #0b1020;

  /* Market layer */
  --h-cyan: #22d3ee;
  --h-blue: #3b82f6;
  --h-blue-soft: #60a5fa;
  --h-violet: #8b5cf6;

  /* Brand — the intelligence layer at the centre */
  --h-gold: #d4a145;
  --h-gold-lt: #e3bd68;

  /* Verification only */
  --h-verified: #34d399;

  /* Text */
  --h-text: #eaf2ff;
  --h-text-2: #93a4bf;
  --h-text-3: #6e819e;

  --h-hairline: rgba(148, 178, 220, 0.14);
  --h-hairline-lt: rgba(148, 178, 220, 0.28);
  --h-glass: rgba(11, 17, 31, 0.72);

  --h-ease: cubic-bezier(0.16, 1, 0.3, 1);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--h-bg-0);
  color: var(--h-text);
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-optical-sizing: auto;
  padding: clamp(48px, 6vw, 96px) 0 clamp(56px, 7vw, 104px);
  -webkit-font-smoothing: antialiased;
}

/* Ambient light behind the scene. Deliberately off-centre and
   weighted right, where the globe sits. */
.afh-hero::before {
  content: '';
  position: absolute;
  inset: -20% -10% -30%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(52% 46% at 72% 42%, rgba(34, 211, 238, 0.14), transparent 68%),
    radial-gradient(44% 40% at 80% 70%, rgba(59, 130, 246, 0.12), transparent 70%),
    radial-gradient(40% 44% at 58% 22%, rgba(139, 92, 246, 0.07), transparent 72%),
    radial-gradient(70% 60% at 20% 80%, rgba(11, 16, 32, 0.9), transparent 70%);
}

/* A whisper of grain so the large dark field doesn't band. */
.afh-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(148, 178, 220, 0.055) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

.afh-hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(40px, 5vw, 72px);
  align-items: center;
}

/* Side by side only once the right column can actually hold the
   orbit. Below this the scene stacks and gets its full width. */
@media (min-width: 1180px) {
  .afh-hero__inner {
    grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
    gap: clamp(32px, 4vw, 64px);
  }
}

/* ------------------------------------------------------------
   Copy column
   ------------------------------------------------------------ */

.afh-hero__title {
  margin: 0 0 clamp(16px, 1.6vw, 22px);
  font-size: clamp(2.2rem, 1.15rem + 3.5vw, 3.75rem);
  line-height: 1.04;
  letter-spacing: -0.032em;
  font-weight: 600;
  color: var(--h-text);
  text-wrap: balance;
}

.afh-hero__title em {
  font-style: normal;
  color: var(--h-gold-lt);
}

.afh-hero__lede {
  margin: 0 0 clamp(28px, 3vw, 38px);
  max-width: 48ch;
  font-size: clamp(1rem, 0.94rem + 0.28vw, 1.1875rem);
  line-height: 1.62;
  color: var(--h-text-2);
}

/* Actions — same geometry as the site's own buttons (6px radius,
   16/32 padding, semibold) so they read as the same system. */
.afh-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: clamp(34px, 3.6vw, 48px);
}

.afh-btn {
  --_lift: 0px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 30px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.008em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 220ms var(--h-ease),
    box-shadow 220ms var(--h-ease),
    background-color 220ms var(--h-ease),
    border-color 220ms var(--h-ease);
  transform: translateY(var(--_lift));
}

.afh-btn__icon {
  width: 17px;
  height: 17px;
  flex: none;
  transition: transform 260ms var(--h-ease);
}

.afh-btn--primary {
  background: linear-gradient(180deg, var(--h-gold-lt), var(--h-gold));
  color: #1b1405;
  box-shadow: 0 6px 20px -8px rgba(212, 161, 69, 0.55);
}

.afh-btn--primary:hover {
  --_lift: -2px;
  box-shadow: 0 16px 34px -14px rgba(212, 161, 69, 0.72);
}

.afh-btn--ghost {
  background: rgba(148, 178, 220, 0.06);
  border-color: var(--h-hairline-lt);
  color: var(--h-text);
}

.afh-btn--ghost:hover {
  --_lift: -2px;
  background: rgba(148, 178, 220, 0.11);
  border-color: rgba(148, 178, 220, 0.42);
}

.afh-btn:hover .afh-btn__icon {
  transform: translateX(3px);
}

/* Trust row — the site's real numbers, brought into the hero. */
.afh-trust {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 28px;
  padding-top: clamp(24px, 2.6vw, 32px);
  border-top: 1px solid var(--h-hairline);
  max-width: 540px;
}

@media (min-width: 560px) {
  .afh-trust { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.afh-trust__n {
  display: block;
  font-size: clamp(1.4rem, 1.2rem + 0.7vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--h-text);
  font-variant-numeric: tabular-nums;
}

.afh-trust__l {
  display: block;
  margin-top: 5px;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--h-text-3);
}

/* ------------------------------------------------------------
   The stage
   ------------------------------------------------------------ */

.afh-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  aspect-ratio: 1 / 1;
  perspective: 1200px;
  transform-style: preserve-3d;
  /* Driven by scroll: hero dissolves upward into the broker section */
  will-change: transform, opacity;
}

.afh-stage__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 900ms var(--h-ease);
}

.afh-stage__canvas.is-live { opacity: 1; }

/* Bezel rings. These are the permanent composition — if WebGL
   never loads, this plus the core and cards still reads. */
.afh-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid var(--h-hairline);
  border-radius: 50%;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  animation: afh-ring-in 1.1s var(--h-ease) forwards;
}

.afh-ring--1 {
  width: 62%; height: 62%;
  animation-delay: 1s;
  border-color: rgba(34, 211, 238, 0.22);
}
.afh-ring--2 { width: 82%; height: 82%; animation-delay: 1.12s; }
.afh-ring--3 { width: 99%; height: 99%; animation-delay: 1.24s; }

@keyframes afh-ring-in {
  from { opacity: 0; transform: translate(-50%, -50%) rotateX(74deg) scale(0.82); }
  to   { opacity: 1; transform: translate(-50%, -50%) rotateX(74deg) scale(1); }
}

.afh-ring__spin {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: conic-gradient(from 0deg, transparent 0 62%, rgba(34, 211, 238, 0.5) 78%, transparent 92%) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: afh-spin 14s linear infinite;
}

.afh-ring--3 .afh-ring__spin { animation-duration: 26s; animation-direction: reverse; }

@keyframes afh-spin { to { transform: rotate(360deg); } }

/* The core: Affiliate Forex Hub itself. */
.afh-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74px;
  height: 74px;
  margin: -37px 0 0 -37px;
  z-index: 20;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 38% 34%, rgba(255, 233, 186, 0.95), rgba(212, 161, 69, 0.82) 42%, rgba(120, 86, 24, 0.5) 72%, rgba(10, 14, 24, 0.25) 100%);
  box-shadow:
    0 0 0 1px rgba(227, 189, 104, 0.4),
    0 10px 34px -10px rgba(212, 161, 69, 0.6);
  opacity: 0;
  animation: afh-core-in 1s var(--h-ease) 0.25s forwards;
}

@keyframes afh-core-in {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: scale(1); }
}

.afh-core__mark { width: 32px; height: 32px; color: #241a06; }

.afh-core__halo {
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  border: 1px solid rgba(227, 189, 104, 0.24);
  animation: afh-breathe 6s ease-in-out infinite;
}

@keyframes afh-breathe {
  0%, 100% { transform: scale(1);    opacity: 0.85; }
  50%      { transform: scale(1.09); opacity: 0.35; }
}

/* ------------------------------------------------------------
   Connection lines (analysis pulse)
   ------------------------------------------------------------ */

.afh-links {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.afh-links__line {
  stroke: rgba(34, 211, 238, 0.7);
  stroke-width: 1.25;
  fill: none;
  stroke-dasharray: 4 5;
  opacity: 0;
  transition: opacity 420ms var(--h-ease);
}

.afh-links__line.is-on { opacity: 1; animation: afh-dash 1.4s linear infinite; }

@keyframes afh-dash { to { stroke-dashoffset: -18; } }

.afh-links__pulse {
  fill: var(--h-cyan);
  opacity: 0;
  filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.9));
}

.afh-links__pulse.is-on { opacity: 1; }

/* ------------------------------------------------------------
   Currency layer — deeper, quieter, no numbers
   ------------------------------------------------------------ */

.afh-fx {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 5px;
  background: rgba(8, 12, 22, 0.55);
  border: 1px solid rgba(148, 178, 220, 0.1);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--h-text-3);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms var(--h-ease);
}

.afh-fx.is-in { opacity: 1; }

.afh-fx__spark { width: 34px; height: 12px; overflow: visible; }

.afh-fx__spark path {
  fill: none;
  stroke: rgba(34, 211, 238, 0.65);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 90;
  stroke-dashoffset: 90;
  animation: afh-draw 4.5s var(--h-ease) infinite;
}

@keyframes afh-draw {
  0%        { stroke-dashoffset: 90; opacity: 0; }
  14%       { opacity: 1; }
  55%, 78%  { stroke-dashoffset: 0; opacity: 1; }
  100%      { stroke-dashoffset: 0; opacity: 0; }
}

/* ------------------------------------------------------------
   Broker cards in orbit
   ------------------------------------------------------------ */

.afh-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 178px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--h-glass);
  border: 1px solid var(--h-hairline-lt);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  color: var(--h-text);
  text-decoration: none;
  transform-origin: 50% 50%;
  transition:
    border-color 320ms var(--h-ease),
    box-shadow 320ms var(--h-ease),
    background-color 320ms var(--h-ease);
  will-change: transform;
}

/* Static ring, used until the engine takes over — and kept as the
   final state if it never does. The engine writes an inline
   transform, which supersedes these. */
.afh-card:nth-of-type(1) { transform: translate(-50%, -50%) translate(186px, -48px); }
.afh-card:nth-of-type(2) { transform: translate(-50%, -50%) translate(58px, 146px); }
.afh-card:nth-of-type(3) { transform: translate(-50%, -50%) translate(-188px, 38px); }
.afh-card:nth-of-type(4) { transform: translate(-50%, -50%) translate(-48px, -154px); }

@media (max-width: 767px) {
  .afh-card:nth-of-type(1) { transform: translate(-50%, -50%) translate(104px, -34px); }
  .afh-card:nth-of-type(2) { transform: translate(-50%, -50%) translate(0px, 108px); }
  .afh-card:nth-of-type(3) { transform: translate(-50%, -50%) translate(-104px, -34px); }
}

.afh-card:focus-visible {
  outline: 2px solid var(--h-cyan);
  outline-offset: 3px;
}

.afh-card__top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.afh-card__logo {
  width: 24px;
  height: 24px;
  flex: none;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px;
}

.afh-card__name {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.afh-card__rate {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--h-gold-lt);
  font-variant-numeric: tabular-nums;
}

.afh-card__star { width: 11px; height: 11px; flex: none; }

.afh-card__reg {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  color: var(--h-text-2);
}

.afh-card__shield { width: 12px; height: 12px; flex: none; color: var(--h-verified); }

/* Detail block: collapsed by default, expands without disturbing
   siblings (cards are absolutely positioned). */
.afh-card__more {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 380ms var(--h-ease),
    opacity 280ms var(--h-ease);
}

.afh-card__more > div { overflow: hidden; }

/* Label left, value right — a narrow card has no room for columns. */
.afh-card__facts {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--h-hairline);
}

.afh-card__facts > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.afh-card__k {
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--h-text-3);
  white-space: nowrap;
}

.afh-card__v {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--h-text);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.afh-card__go {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--h-cyan);
}

.afh-card__go svg { width: 11px; height: 11px; }

.afh-card.is-open {
  width: 198px;
  background: rgba(13, 21, 38, 0.86);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 18px 44px -18px rgba(34, 211, 238, 0.5);
}

.afh-card.is-open .afh-card__more {
  grid-template-rows: 1fr;
  opacity: 1;
}

.afh-card.is-analyzing {
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 14px 38px -16px rgba(34, 211, 238, 0.42);
}

/* ------------------------------------------------------------
   Comparison criteria, revealed during an analysis pass
   ------------------------------------------------------------ */

/* Outer element is positioned every frame by the engine, so it
   carries no transition. The inner pill owns the entrance. */
.afh-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 40;
  pointer-events: none;
}

.afh-chip__b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(8, 13, 24, 0.82);
  border: 1px solid rgba(34, 211, 238, 0.3);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--h-text-2);
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.82);
  transform-origin: 50% 50%;
  transition:
    opacity 400ms var(--h-ease),
    transform 520ms var(--h-ease);
}

.afh-chip.is-in .afh-chip__b {
  opacity: 1;
  transform: scale(1);
}

.afh-chip__b svg { width: 10px; height: 10px; flex: none; color: var(--h-verified); }

.afh-chip--verified .afh-chip__b {
  border-color: rgba(52, 211, 153, 0.36);
  color: #cfeee1;
}

/* Scroll handoff: faint guides descending toward the real
   broker cards below. Revealed only as the hero recedes. */
.afh-descend {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 140px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
}

.afh-descend span {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(34, 211, 238, 0.45));
}

.afh-descend span:nth-child(1) { left: 63%; }
.afh-descend span:nth-child(2) { left: 78%; height: 72%; opacity: 0.6; }

/* Honesty note — the market layer is illustrative, not a feed. */
.afh-stage__note {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  color: var(--h-text-3);
  white-space: nowrap;
  opacity: 0;
  animation: afh-fade-in 900ms var(--h-ease) 2.4s forwards;
}

@keyframes afh-fade-in { to { opacity: 1; } }

/* ------------------------------------------------------------
   Copy entrance — fast, so the message never waits on the scene
   ------------------------------------------------------------ */

.afh-rise {
  opacity: 0;
  animation: afh-rise 760ms var(--h-ease) forwards;
}

@keyframes afh-rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.afh-d1 { animation-delay: 0.12s; }
.afh-d2 { animation-delay: 0.26s; }
.afh-d3 { animation-delay: 0.40s; }
.afh-d4 { animation-delay: 0.54s; }

/* ------------------------------------------------------------
   Browser surfaces
   ------------------------------------------------------------ */

.afh-hero ::selection {
  background: rgba(34, 211, 238, 0.28);
  color: #ffffff;
}

.afh-hero :focus-visible {
  outline: 2px solid var(--h-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   Tablet
   ------------------------------------------------------------ */

/* ------------------------------------------------------------
   Mobile — a different composition, not a shrunken one
   ------------------------------------------------------------ */

@media (max-width: 767px) {
  .afh-hero { padding: 36px 0 44px; }

  .afh-stage {
    max-width: 340px;
    /* Sits behind and below the message, never over it */
    margin-top: 4px;
  }

  .afh-card {
    width: 124px;
    padding: 8px 9px;
    border-radius: 10px;
    /* backdrop-filter is the expensive one on phones */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(10, 16, 29, 0.9);
  }

  .afh-card__logo { width: 18px; height: 18px; }
  .afh-card__name { font-size: 0.6875rem; }
  .afh-card__rate { font-size: 0.625rem; }
  .afh-card__reg { display: none; }

  .afh-core { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
  .afh-core__mark { width: 24px; height: 24px; }

  .afh-fx { font-size: 0.5625rem; padding: 4px 7px; }
  .afh-fx__spark { width: 26px; }

  .afh-chip { font-size: 0.5rem; padding: 3px 7px; }
}

/* ------------------------------------------------------------
   Reduced motion — a composed still life, not a dead page
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .afh-hero *,
  .afh-hero *::before,
  .afh-hero *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.12s !important;
  }

  .afh-rise,
  .afh-ring,
  .afh-core,
  .afh-stage__note { opacity: 1; }

  .afh-ring { transform: translate(-50%, -50%) rotateX(74deg); }
  .afh-ring__spin { display: none; }
  .afh-fx { opacity: 1; }
  .afh-fx__spark path { stroke-dashoffset: 0; opacity: 1; }
  .afh-core__halo { opacity: 0.5; }
}
