/* ═══════════════════════════════════════════════════════════════════
   RIVEL · THE LOOP ENGINE
   A circuit, not a card grid.
   01 Direction → 07 New State returns to 02 State (same cyan).
   ═══════════════════════════════════════════════════════════════════ */

/* overflow-x:clip on .hps computes the other axis to auto and
   breaks ScrollTrigger pinSpacing. The loop chapter needs a
   visible containing block so the next section waits below. */
.hps:has(#loop) { overflow: visible; }

.hps-section.hps-loop-sec {
  padding: 0;
  overflow: visible;
  overflow-anchor: none;
}

#founder-venture.hps-section {
  position: relative;
  z-index: 1;
}

.hps-loop-sec .pin-spacer,
.hps-loop-sec__stage {
  background: transparent;
  background-color: transparent;
}

.hps-loop-sec__stage {
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  overflow: hidden;
  overflow-anchor: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-sizing: border-box;
  padding: 5rem clamp(1.25rem, 4vw, 4rem) 1.1rem;
}

.hps-loop-sec__stage .hps-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.hps-loop-sec__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--hps-space-3, .85rem);
  max-width: 62rem;
  flex: 0 0 auto;
  margin: 0 0 .4rem;
}
.hps-loop-sec__head .hps-display {
  margin: 0;
}
.hps-loop-sec__head .hps-lede {
  margin: 0;
  max-width: 36ch;
  color: rgba(255, 255, 255, .58);
}
.hps-loop-sec__live {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .75rem;
  width: 100%;
  max-width: 22rem;
  margin: .55rem 0 0;
  white-space: nowrap;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--layer-lit, var(--loop-lit, #c9aaff));
}
.hps-loop-sec__live-rule {
  flex: 1 1 auto;
  min-width: 1.25rem;
  height: 1px;
  background: color-mix(in oklab, var(--loop-ink, #9c43fe) 62%, transparent);
  transition: background .45s ease;
}

.hps-loop {
  --loop-angle: 0deg;
  --loop-ink: var(--layer-ink, #9c43fe);
  --loop-lit: var(--layer-lit, #c9aaff);
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: .15rem 0 0;
}

.hps-loop__stage {
  position: relative;
  width: min(100%, 46rem, calc(100svh - 20rem));
  aspect-ratio: 1;
  max-height: none;
  flex: 0 0 auto;
}

.hps-loop__aura {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%,
      color-mix(in oklab, var(--loop-ink) 34%, transparent),
      transparent 68%),
    conic-gradient(from var(--loop-angle),
      color-mix(in oklab, var(--loop-ink) 0%, transparent),
      color-mix(in oklab, var(--loop-ink) 22%, transparent) 12%,
      transparent 28%,
      transparent);
  filter: blur(18px);
  opacity: .9;
  transition: background .55s ease;
}

.hps-loop__orbit,
.hps-loop__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hps-loop__svg { overflow: visible; }

.hps-loop__bezel {
  stroke: rgba(255, 255, 255, .1);
  stroke-width: 0.22;
}
.hps-loop__well {
  stroke: color-mix(in oklab, var(--loop-ink) 22%, transparent);
  stroke-width: 0.28;
}
.hps-loop__track {
  stroke: rgba(255, 255, 255, .1);
  stroke-width: 0.32;
}

.hps-loop__ticks line {
  stroke: rgba(255, 255, 255, .14);
  stroke-width: 0.18;
}
.hps-loop__ticks line.is-major {
  stroke: rgba(255, 255, 255, .28);
  stroke-width: 0.28;
}

.hps-loop__arcs path {
  fill: none;
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: .16;
  transition: opacity .45s cubic-bezier(.2, 0, 0, 1), stroke-width .45s cubic-bezier(.2, 0, 0, 1);
}
.hps-loop__arcs path.is-done { opacity: .9; }
.hps-loop__arcs path.is-live {
  opacity: 1;
  stroke-width: 1.85;
  filter: url(#hps-loop-glow);
}

.hps-loop__bridge-arc {
  fill: none;
  stroke: var(--rg-state-ink);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-dasharray: 4 3.5;
  opacity: 0;
  transform-origin: 50px 50px;
  transition: opacity .55s ease;
}
.hps-loop.is-closing .hps-loop__bridge-arc {
  opacity: 1;
  animation: hps-bridge-run 1.6s cubic-bezier(.2, 0, 0, 1) both;
}

.hps-loop__return {
  stroke: var(--rg-state-ink);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 28 220;
  stroke-dashoffset: 28;
  opacity: 0;
  transition: opacity .5s ease;
}
.hps-loop.is-closing .hps-loop__return { opacity: .55; }

.hps-loop__trail {
  fill: none;
  stroke: var(--loop-ink, #9c43fe);
  stroke-width: 1.45;
  stroke-linecap: round;
  opacity: .42;
}
.hps-loop__playhead {
  transform-origin: 0 0;
  pointer-events: none;
}
.hps-loop__halo {
  fill: var(--loop-ink, #9c43fe);
  opacity: .28;
  filter: url(#hps-loop-head);
}
.hps-loop__rim {
  fill: none;
  stroke: var(--loop-lit, #c9aaff);
  stroke-width: 0.38;
}
.hps-loop__core {
  fill: #fff;
  filter: url(#hps-loop-head);
}
.hps-loop__tip {
  fill: none;
  stroke: #fff;
  stroke-width: 0.38;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hps-loop__nodes { position: absolute; inset: 0; pointer-events: none; }
.hps-loop__node {
  pointer-events: auto;
  position: absolute;
  left: 0; top: 0;
  width: 2.85rem;
  height: 2.85rem;
  margin: -1.425rem 0 0 -1.425rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, .08), transparent 58%),
    rgba(8, 10, 18, .55);
  color: rgba(255, 255, 255, .46);
  font-family: 'JetBrains Mono', 'Geist Mono', ui-monospace, monospace;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .1em;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .45s cubic-bezier(.2, 0, 0, 1), color .35s ease, border-color .35s ease, box-shadow .45s ease;
}
.hps-loop__node::after {
  content: '';
  position: absolute;
  top: .28rem;
  width: .22rem;
  height: .22rem;
  border-radius: 50%;
  background: color-mix(in oklab, var(--layer-ink) 55%, transparent);
}
.hps-loop__node.is-done {
  color: var(--layer-lit);
  border-color: color-mix(in oklab, var(--layer-ink) 42%, transparent);
}
.hps-loop__node.is-active,
.hps-loop__node.is-kin {
  color: #fff;
  border-color: color-mix(in oklab, var(--layer-ink) 78%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .14),
    0 0 0 5px color-mix(in oklab, var(--layer-ink) 14%, transparent),
    0 0 22px color-mix(in oklab, var(--layer-ink) 32%, transparent);
  z-index: 2;
}
.hps-loop__node.is-active { transform: scale(1.14); }
.hps-loop__node.is-kin:not(.is-active) { transform: scale(1.06); }
.hps-loop__node:hover {
  color: var(--layer-lit);
  border-color: color-mix(in oklab, var(--layer-ink) 55%, transparent);
}
.hps-loop__node:focus-visible,
.hps-loop__rail button:focus-visible {
  outline: 1px solid var(--layer-lit, #fff);
  outline-offset: 3px;
}

.hps-loop__hud {
  position: absolute;
  inset: 24.8%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .42rem;
  padding: clamp(1.35rem, 2.4vw, 2rem) 1.35rem 1.45rem;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--layer-ink) 34%, transparent);
  color: #fff;
  text-align: center;
  overflow: hidden;
  transition: border-color .45s ease, box-shadow .45s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    0 0 48px color-mix(in oklab, var(--layer-ink) 16%, transparent);
}
.hps-loop__hud.rg-glass {
  border-radius: 50%;
}
.hps-loop__hud::before {
  content: '';
  position: absolute;
  inset: 8% 18% auto;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .16), transparent 70%);
  pointer-events: none;
  z-index: 1;
}
.hps-loop__hud::after {
  content: '';
  position: absolute;
  top: 16%;
  left: 30%;
  right: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--layer-lit), transparent);
  opacity: .7;
}
.hps-loop__hud.is-swap .hps-loop__num,
.hps-loop__hud.is-swap .hps-loop__title,
.hps-loop__hud.is-swap .hps-loop__desc {
  opacity: 0;
}
.hps-loop__num,
.hps-loop__title,
.hps-loop__desc {
  position: relative;
  z-index: 2;
  transition: opacity .18s ease;
}
.hps-loop__num {
  font-family: 'JetBrains Mono', 'Geist Mono', ui-monospace, monospace;
  font-size: .64rem;
  letter-spacing: .2em;
  color: var(--layer-lit);
  opacity: 1;
}
.hps-loop__title {
  font-family: var(--hps-display, 'PP Neue Machina', sans-serif);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.4vw, 2.05rem);
  letter-spacing: -.03em;
  line-height: 1.02;
  margin: 0;
  opacity: 1;
}
.hps-loop__desc {
  margin: 0;
  font-size: .78rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, .62);
  max-width: 24ch;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 1;
}
.hps-loop__bridge {
  position: absolute;
  left: 50%;
  bottom: 7.5%;
  transform: translate(-50%, 4px);
  margin: 0;
  min-height: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .58rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--rg-state-lit);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 3;
  transition: opacity .45s ease, transform .45s ease;
}
.hps-loop.is-closing .hps-loop__bridge {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hps-loop__rail {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin: .85rem 0 0;
  padding: .28rem .45rem;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 100vw;
  background: rgba(255, 255, 255, .025);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.hps-loop__rail li {
  display: flex;
  align-items: center;
  gap: 0;
}
.hps-loop__rail li:not(:last-child)::after {
  content: '';
  width: .7rem;
  height: 1px;
  margin: 0 .12rem;
  background: rgba(255, 255, 255, .16);
}
.hps-loop__rail button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .34);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .6rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  padding: .38rem .42rem;
  border-radius: 100vw;
  cursor: pointer;
  transition: color .3s ease, background .3s ease;
}
.hps-loop__rail li.is-done button { color: rgba(255, 255, 255, .68); }
.hps-loop__rail li.is-active button {
  color: #fff;
  background: color-mix(in oklab, var(--loop-ink) 16%, transparent);
}
.hps-loop.is-closing .hps-loop__rail li:nth-child(2) button,
.hps-loop.is-closing .hps-loop__rail li:nth-child(7) button {
  color: var(--rg-state-lit);
}

@keyframes hps-bridge-run {
  from { stroke-dashoffset: 36; }
  to { stroke-dashoffset: 0; }
}

@media (min-width: 800px) {
  .hps-loop-sec__stage .hps-container {
    display: grid;
    grid-template-columns: minmax(22rem, 0.38fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: clamp(1.75rem, 3.6vw, 3.75rem);
    row-gap: .8rem;
    align-items: center;
  }
  .hps-loop-sec__head {
    grid-column: 1;
    grid-row: 1;
    max-width: 28rem;
    margin: 0;
    padding: 0;
    align-self: center;
  }
  .hps-loop-sec__head .hps-display {
    font-size: clamp(2.7rem, 4vw, 3.55rem);
    text-wrap: balance;
  }
  .hps-loop {
    display: contents;
  }
  .hps-loop__stage {
    grid-column: 2;
    grid-row: 1;
    width: min(100%, 50rem, calc(100svh - 10.25rem));
    justify-self: start;
  }
  .hps-loop__rail {
    grid-column: 2;
    grid-row: 2;
    width: min(100%, 50rem, calc(100svh - 10.25rem));
    justify-self: start;
    margin: 0;
  }
  .hps-loop__node {
    width: 2.95rem;
    height: 2.95rem;
    margin: -1.475rem 0 0 -1.475rem;
  }
}

@media (max-width: 720px) {
  .hps-loop-sec__stage {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 5.25rem 1.25rem 2.25rem;
  }
  .hps-loop { display: flex; min-height: 0; padding-bottom: .25rem; }
  .hps-loop__stage { max-height: none; width: min(100%, 22.5rem); }
  .hps-loop__hud { inset: 24%; padding: 1.1rem; border-radius: 50%; }
  .hps-loop__desc { font-size: .8rem; display: none; }
  .hps-loop__node { width: 2.2rem; height: 2.2rem; margin: -1.1rem 0 0 -1.1rem; font-size: .6rem; }
  .hps-loop__rail {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding-bottom: .35rem;
  }
  .hps-loop__bridge { font-size: .6rem; letter-spacing: .1em; }
}

@media (prefers-reduced-motion: reduce) {
  .hps-loop__node,
  .hps-loop__arcs path,
  .hps-loop__hud,
  .hps-loop__hud .hps-loop__num,
  .hps-loop__hud .hps-loop__title,
  .hps-loop__hud .hps-loop__desc,
  .hps-loop__rail button,
  .hps-loop__bridge,
  .hps-loop-sec__live { transition: none; }
  .hps-loop.is-closing .hps-loop__bridge-arc { animation: none; }
}

@supports not (color: color-mix(in oklab, red 50%, transparent)) {
  .hps-loop__node.is-active { box-shadow: 0 0 24px rgba(156, 67, 254, .35); }
  .hps-loop__hud { border-color: rgba(255, 255, 255, .2); }
  .hps-loop__aura { background: radial-gradient(circle, rgba(156, 67, 254, .28), transparent 68%); }
}
