/* Home stories: the same narrative, with controls and a composition for touch. */
.hps-chapter-controls {
  display: none;
  align-items: center;
  gap: .55rem;
  width: 100%;
  max-width: 38rem;
  margin-inline: auto;
  padding-top: .85rem;
  border-top: 1px solid rgba(232, 237, 242, .16);
  color: #c8cdda;
  font: .72rem/1.4 var(--hps-mono, monospace);
}
.has-chapter-player .hps-chapter-controls { display: flex; }
.hps-chapter-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: .65rem;
  border: 1px solid rgba(232, 237, 242, .24);
  border-radius: 50%;
  color: #ecedf3;
  background: rgba(5, 7, 15, .72);
  cursor: pointer;
  touch-action: manipulation;
}
.hps-chapter-controls svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.hps-chapter-controls [data-chapter-count] { min-width: 5rem; text-align: center; font-variant-numeric: tabular-nums; }
.hps-chapter-controls [data-chapter-play] { margin-left: auto; border-radius: 100px; padding-inline: 1rem; }
.hps-chapter-controls [data-chapter-play]::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #b5bad0; margin-right: .6rem; }
.is-playing .hps-chapter-controls [data-chapter-play]::before { background: #7dd3fc; }
.hps-chapter-controls button:focus-visible,
.hps-axiom__marks button:focus-visible,
.hps-stack__rail button:focus-visible { outline: 2px solid #c9aaff; outline-offset: 4px; }
.hps-chapter-controls button:hover { border-color: #c9aaff; }
.hps-loop__ring { display: none; }
.hps-relation { display: none; }
.hps-axiom__stage, .hps-loop__well, .hps-relation { touch-action: pan-y pinch-zoom; }

/* Controls remain available in the cinematic version, too. */
@media (min-width: 1080px) and (min-height: 740px) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .hps-axiom { grid-template-rows: auto 1fr auto auto; }
  .hps-axiom__marks { gap: 1.4rem; justify-content: center; }
  .hps-axiom__marks button { min-height: 44px; font-size: .7rem; color: #aab1c4; }
  .hps-axiom__marks button[aria-current] { color: #fff; }
  .hps-axiom__marks button span { margin-right: .4rem; color: #a998d9; }
  .hps-axiom .hps-chapter-controls { display: none; }
  .hps-loop .hps-chapter-controls { display: none; }
  .hps-stack.is-webgl .hps-stack__rail {
    display: flex;
    position: absolute;
    z-index: 5;
    bottom: 1.8rem;
    left: 50%;
    transform: translateX(-50%);
    flex-wrap: nowrap;
    gap: .4rem;
    padding: .4rem;
    border-radius: 100px;
    background: rgba(5, 7, 15, .86);
    border: 1px solid rgba(232, 237, 242, .14);
  }
  .hps-stack__rail button { min-height: 44px; padding-inline: 1rem; color: #b6bdd0; }
  .hps-stack__rail button[aria-current] { color: #fff; background: rgba(169, 141, 255, .16); border-color: #a98dff; }
  .hps-stack.is-webgl .hps-chapter-controls { display: none; }
  .hps-stack__story { top: 13%; }
  .hps-stack__story [data-story-sub] { max-width: 44ch; color: #afb7c9; }
}

/* Compact layouts keep the page in normal flow, including reduced motion. */
@media (max-width: 1079px), (max-height: 739px), (pointer: coarse), (prefers-reduced-motion: reduce) {
  #what-is-rivel.hps-axiom-sec { height: auto; min-height: 0; }
  #what-is-rivel, #loop, #founder-venture { scroll-margin-top: 6rem; }
  .hps-axiom-sec__stage, .hps-loop-sec__stage, .hps-stack-sec__stage {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    background: linear-gradient(180deg, rgba(5, 7, 15, .24), rgba(5, 7, 15, .76));
  }
  .hps-axiom-sec__stage { padding: 5rem 1.25rem 3rem; }
  .hps-axiom { display: flex; flex-direction: column; align-items: stretch; gap: 1.4rem; max-width: 44rem; }
  .hps-axiom__stage { grid-template-columns: minmax(0, 1fr); gap: 1.3rem; width: 100%; }
  .hps-axiom__orb { width: 10rem; height: 10rem; }
  .hps-axiom__orb-name { display: none; }
  .hps-axiom__copy { text-align: left; width: 100%; min-height: 13.5rem; }
  .hps-axiom__title { font-size: clamp(1.8rem, 7.6vw, 2.8rem); line-height: 1.12; text-wrap: balance; }
  .hps-axiom__mode { color: #c5b5e9; }
  .hps-axiom__lede { margin: 1rem 0 0; font-size: 1rem; line-height: 1.6; color: #bec4d2; max-width: 42ch; }
  .has-chapter-player .hps-axiom__marks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: .45rem;
    padding: 0;
  }
  .hps-axiom__marks button {
    width: 100%; min-height: 44px; padding: .55rem .35rem;
    border: 1px solid rgba(232, 237, 242, .2); border-radius: .5rem;
    font-size: .7rem; letter-spacing: 0; color: #bdc3d4; text-align: left;
    background: rgba(5, 7, 15, .6);
  }
  .hps-axiom__marks button span { color: #999fb4; font-size: .6rem; margin-right: .3rem; }
  .hps-axiom__marks button[aria-current] { color: #fff; border-color: #b099df; background: rgba(169, 141, 255, .12); }
  .has-chapter-player .hps-axiom__fallback,
  .has-chapter-player .hps-axiom__fallback-close { display: none; }
  .hps-axiom__fallback { display: grid; }

  .hps-loop { display: flex; flex-direction: column; height: auto; padding: 4.5rem 1.25rem 3rem; gap: 1.4rem; max-width: 46.5rem; margin-inline: auto; }
  .hps-loop-sec__copy { position: static; width: 100%; }
  #loop .hps-loop-sec__copy .hps-theatre-kicker,
  #loop .hps-loop-sec__copy .hps-lede { display: block; }
  #loop .hps-loop-sec__copy .hps-lede { color: #bec4d2; font-size: 1rem; }
  .hps-loop__well { position: relative; inset: auto; width: min(100%, 21rem); aspect-ratio: 1; margin: 0 auto; }
  .hps-loop__gl { display: none; }
  .hps-loop__ring { display: flex; position: absolute; inset: 12%; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; border: 1px solid rgba(187, 198, 218, .22); border-radius: 50%; color: var(--loop-lit); }
  .hps-loop__ring::before { content: ''; position: absolute; inset: .65rem; border: 1px dashed rgba(187, 198, 218, .12); border-radius: 50%; }
  .hps-loop__ring::after { content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--loop-lit); transform: rotate(var(--loop-angle)); transition: transform .7s cubic-bezier(.2,.7,.2,1), border-color .3s; }
  .hps-loop__ring span { font: .64rem var(--hps-mono, monospace); letter-spacing: .16em; color: #aeb8cb; }
  .hps-loop__ring b { font: .85rem var(--hps-mono, monospace); font-variant-numeric: tabular-nums; }
  .hps-loop__node { min-width: 44px; min-height: 44px; padding: 0; color: #c3cadd; }
  .hps-loop__node span { width: 44px; height: 44px; background: #0b1020; border-color: #4a5269; font-size: .72rem; }
  .hps-loop__node.is-active span { background: color-mix(in srgb, var(--loop-ink) 20%, #0b1020); }
  .hps-loop__node b { display: block; position: absolute; left: 50%; top: calc(100% + 4px); width: max-content; max-width: 6.8rem; height: auto; margin: 0; padding: 1px 3px; overflow: visible; clip-path: none; transform: translateX(-50%); font: .6rem/1.3 var(--hps-mono, monospace); letter-spacing: 0; text-transform: none; white-space: normal; text-align: center; background: #080c17; border-radius: 3px; }
  .hps-loop__hud { position: static; width: 100%; max-width: none; transform: none; align-items: flex-start; text-align: left; min-height: 12rem; }
  .hps-loop__title { font-size: 1.75rem; }
  .hps-loop__desc { display: block; min-height: 0; max-width: 42ch; font-size: 1rem; line-height: 1.6; color: #bec4d2; }
  .hps-loop__bridge { position: static; width: 100%; max-width: none; margin: 0; min-height: 2.6em; transform: none; font-size: .65rem; line-height: 1.5; white-space: normal; text-align: left; letter-spacing: .04em; }

  .hps-stack-sec__stage { padding: 4.5rem 1.25rem 3rem; }
  .hps-stack-sec__stage .hps-container { position: relative; height: auto; max-width: 44rem; padding: 0; }
  .hps-stack-sec__head { position: relative; width: auto; height: auto; overflow: visible; clip: auto; margin-bottom: 1.75rem; }
  .hps-stack-sec__head .hps-lede { display: block; -webkit-line-clamp: unset; overflow: visible; color: #bec4d2; font-size: 1rem; }
  .hps-stack-sec__head .hps-display { font: 400 clamp(1.8rem, 7.5vw, 2.8rem)/1.1 var(--hps-display, sans-serif); letter-spacing: -.035em; text-transform: none; }
  .hps-stack-sec__live { display: none; }
  .hps-stack { position: relative; inset: auto; display: flex; flex-direction: column; min-height: 0; gap: 1.3rem; }
  .hps-stack__view { display: none; }
  .hps-stack__story { position: relative; left: auto; top: auto; width: 100%; min-height: 10rem; text-align: left; transform: none; opacity: 1; filter: none; }
  .hps-stack__story h3 { font-size: clamp(1.4rem, 6vw, 2rem); line-height: 1.2; text-wrap: balance; }
  .hps-stack__story [data-story-sub] { font-size: .98rem; line-height: 1.6; max-width: 44ch; color: #bec4d2; margin: .7rem 0 0; }
  .hps-stack__story [data-story-sub][hidden] { display: none; }
  .hps-stack__rail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
  .hps-stack__rail button { width: 100%; min-height: 44px; padding: .55rem .4rem; font-size: .7rem; letter-spacing: .015em; color: #bcc4d8; border-radius: .5rem; background: rgba(5, 7, 15, .6); }
  .hps-stack__rail button[aria-current] { color: #fff; background: rgba(169, 141, 255, .12); border-color: #b099df; }
  .hps-stack.is-interactive .hps-stack__fallback { display: none; }
  .hps-relation { display: block; }
}

.hps-relation__sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.hps-relation__source { padding: 1.15rem .85rem; border: 1px solid #42405a; border-radius: .85rem; background: linear-gradient(145deg, #161327, #090e19); transition: border-color .5s, opacity .5s, transform .5s; }
.hps-relation__source--venture { border-color: #2e4859; background: linear-gradient(145deg, #101c2b, #090e19); }
.hps-relation__eyebrow { color: #c9aaff; font: .63rem var(--hps-mono, monospace); letter-spacing: .1em; text-transform: uppercase; }
.hps-relation__source--venture .hps-relation__eyebrow { color: #7dd3fc; }
.hps-relation__source h3 { margin: .6rem 0 .8rem; font: 400 1.15rem var(--hps-display, sans-serif); color: #f3f4fa; }
.hps-relation__source ul { display: flex; flex-wrap: wrap; gap: .4rem .65rem; list-style: none; padding: 0; margin: 0; font-size: .76rem; line-height: 1.5; color: #adb6ca; }
.hps-relation__junction { position: relative; height: 7rem; }
.hps-relation__junction svg { width: 100%; height: 100%; fill: none; stroke-width: 1.5; }
.hps-relation__wire { stroke: #434458; }
.hps-relation__signal { stroke: #c9aaff; stroke-dasharray: 18 180; animation: hps-relation-flow 3s linear infinite paused; }
.hps-relation__signal--return { stroke: #7dd3fc; animation-delay: -1.5s; }
.is-chapter-visible .hps-relation__signal { animation-play-state: running; }
.hps-relation__junction span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: .5rem .8rem; border: 1px solid #514a69; border-radius: 100px; color: #d6c8f5; background: #0c1020; font: .68rem var(--hps-mono, monospace); white-space: nowrap; }
.hps-relation__outcome { display: flex; align-items: center; gap: .75rem; padding: 1rem; border: 1px solid #44465e; border-radius: .7rem; color: #e1ddf2; background: #0c1020; transition: border-color .5s, box-shadow .5s; }
.hps-relation__outcome > span:first-child { font: .7rem var(--hps-mono, monospace); color: #aab6ef; }
.hps-relation__outcome strong { flex: 1; font-size: .86rem; font-weight: 500; }
.hps-stack[data-step="1"] .hps-relation__source--founder { border-color: #c9aaff; transform: translateY(-3px); }
.hps-stack[data-step="1"] .hps-relation__source--venture { opacity: .55; }
.hps-stack[data-step="2"] .hps-relation__source--venture { border-color: #7dd3fc; transform: translateY(-3px); }
.hps-stack[data-step="2"] .hps-relation__source--founder { opacity: .55; }
.hps-stack[data-step="3"] .hps-relation__outcome,
.hps-stack[data-step="5"] .hps-relation__outcome { border-color: #b3a0e8; }
.hps-stack[data-step="4"] .hps-relation__outcome { box-shadow: 0 5px 0 -1px #141c31, 0 6px 0 #4c4766, 0 11px 0 -1px #141c31, 0 12px 0 #4c4766; }
@keyframes hps-relation-flow { to { stroke-dashoffset: -198; } }

/* The readable diagram is also the fallback for unavailable/lost WebGL. */
.hps-stack.is-static-scene, .hps-stack:not(.is-interactive) { position: relative; inset: auto; display: flex; flex-direction: column; gap: 1.5rem; padding: 2rem 1rem; max-width: 44rem; margin: auto; }
.hps-stack.is-static-scene .hps-relation { display: block; }
.hps-stack.is-static-scene .hps-stack__view, .hps-stack:not(.is-interactive) .hps-stack__view { display: none; }
.hps-stack.is-static-scene .hps-stack__story { position: static; transform: none !important; opacity: 1 !important; filter: none !important; width: 100%; min-height: 9rem; }
.hps-stack.is-static-scene .hps-stack__rail { position: static; display: flex; flex-wrap: wrap; transform: none; }
.hps-stack.is-static-scene .hps-stack__rail button { min-height: 44px; }
.hps-stack.is-static-scene .hps-chapter-controls { display: flex; }
.hps-stack.is-static-scene .hps-stack__fallback { display: none; }
.hps-stack-sec__stage:has(.is-static-scene) { height: auto; min-height: 0; max-height: none; }

@media (max-width: 380px) {
  .hps-axiom__copy { min-height: 15.2rem; }
  .hps-loop__hud { min-height: 14.5rem; }
  .hps-stack__story { min-height: 12rem; }
  .hps-loop__node b { font-size: .57rem; }
  .hps-relation__source { padding-inline: .65rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hps-relation *, .hps-axiom__copy *, .hps-loop__ring::after { animation: none !important; transition: none !important; }
  .hps-chapter-controls [data-chapter-play] { display: none; }
}

/* Honest availability: upcoming stores are labels, the working web app is the CTA. */
.hps-availability { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: clamp(2rem, 6vw, 6rem); max-width: 72rem; margin: 5rem auto 2rem; padding: clamp(2rem, 5vw, 4rem) 1.5rem; border-top: 1px solid #2d3041; }
.hps-availability__eyebrow { margin: 0 0 1.1rem; color: #c4b6e7; font: .7rem var(--hps-mono, monospace); letter-spacing: .12em; text-transform: uppercase; }
.hps-availability h2 { margin: 0 0 1rem; font: 400 clamp(1.8rem, 3.5vw, 3rem)/1.14 var(--hps-display, sans-serif); letter-spacing: -.03em; color: #f5f5fb; }
.hps-availability__copy > p:not(.hps-availability__eyebrow) { max-width: 40ch; color: #b4bdce; font-size: 1rem; line-height: 1.65; margin-bottom: 1.5rem; }
.hps-availability__platforms { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.hps-availability__platforms li { display: flex; align-items: center; gap: 1rem; padding: 1.5rem 1.2rem; background: rgba(10, 15, 28, .85); border: 1px solid #303548; border-radius: .85rem; }
.hps-availability__platforms svg { width: 25px; height: 30px; fill: none; stroke: #acb5cc; stroke-width: 1.4; flex: none; }
.hps-availability__platforms div { display: flex; flex-direction: column; gap: .3rem; }
.hps-availability__platforms div span { font: .65rem var(--hps-mono, monospace); color: #a8b2c9; }
.hps-availability__platforms strong { font-size: 1.05rem; color: #e4e9f6; font-weight: 500; }
.hps-availability__status { margin-left: auto; color: #c6c0d8; font-size: .72rem; padding: .4rem .65rem; border: 1px solid #42445b; border-radius: 100px; white-space: nowrap; }
@media (max-width: 800px) {
  .hps-availability { grid-template-columns: 1fr; margin: 3rem 1.25rem 0; padding: 3rem 0; }
  .hps-availability__platforms li { padding: 1.2rem .8rem; gap: .8rem; }
  .hps-availability__status { font-size: .65rem; padding: .4rem .5rem; }
}

/* If modules fail or JavaScript is disabled, keep the narrative in document flow. */
#what-is-rivel:not(.has-chapter-player) { height: auto; }
#what-is-rivel:not(.has-chapter-player) .hps-axiom-sec__stage { position: relative; height: auto; min-height: 0; max-height: none; overflow: visible; }
#what-is-rivel:not(.has-chapter-player) .hps-axiom__fallback { display: grid; gap: 1rem; list-style: none; padding: 0; }
#what-is-rivel:not(.has-chapter-player) .hps-axiom__fallback-close { display: block; }
#what-is-rivel:not(.has-chapter-player) .hps-axiom__marks { display: none; }
.hps-loop:not(.has-chapter-player) { position: relative; height: auto; padding: 4rem 1.25rem; max-width: 44rem; margin: auto; }
.hps-loop-sec__stage:has(.hps-loop:not(.has-chapter-player)) { height: auto; min-height: 0; max-height: none; overflow: visible; }
.hps-loop:not(.has-chapter-player) .hps-loop-sec__copy { position: static; width: auto; }
.hps-loop:not(.has-chapter-player) .hps-loop__well,
.hps-loop:not(.has-chapter-player) .hps-loop__hud,
.hps-loop:not(.has-chapter-player) .hps-loop__bridge { display: none; }
.hps-loop:not(.has-chapter-player) .hps-loop__steps[hidden] { display: grid; gap: 1.5rem; margin-top: 2rem; color: #bec4d2; }
.hps-loop:not(.has-chapter-player) .hps-loop__steps article::before { content: attr(data-num) ' · ' attr(data-title); display: block; color: #f2f4fa; margin-bottom: .4rem; }
.hps-stack:not(.is-interactive) .hps-stack__story,
.hps-stack:not(.is-interactive) .hps-stack__rail { display: none; }
