/* BrokerOS production composition with continuous scroll-linked depth. */

body[data-restored-motion-artifact] .story-panel:not(.close-panel) .panel-frame {
  isolation: isolate;
}

body[data-restored-motion-artifact] .story-panel:not(.close-panel) .stage {
  position: relative;
  z-index: 1;
}

.artifact-chapter-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 1.65vw, 28px);
  min-width: 0;
  margin: 0 auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  transition: none;
}

.persistent-header.is-chapter-nav-visible .artifact-chapter-nav {
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
}

.artifact-chapter-nav a {
  opacity: 0.48;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: none;
}

.artifact-chapter-nav a:hover,
.artifact-chapter-nav a:focus-visible,
.artifact-chapter-nav a.is-active { opacity: 1; }

.artifact-chapter-nav a.is-active { font-weight: 750; }

.persistent-header[data-header-theme="black"] .artifact-chapter-nav a.is-active {
  color: var(--lime);
}

/* Theme changes should register as chapter cuts, not color dissolves. */
body[data-restored-motion-artifact] .persistent-header,
body[data-restored-motion-artifact] .persistent-header .brand b,
body[data-restored-motion-artifact] .persistent-header .header-call {
  transition: none;
}

/* Give every chapter's scroll track and active fill the approved weight. */
body[data-restored-motion-artifact] .story-nav::before,
body[data-restored-motion-artifact] .story-progress {
  height: 4px;
}

/* Keep the tour moving: enough time to understand each state, without dead scroll. */
body[data-restored-motion-artifact] .story-3 { height: 240svh; }
body[data-restored-motion-artifact] .story-4 { height: 290svh; }
body[data-restored-motion-artifact] .proof-story { height: 220svh; }

.chapter-motion-grid {
  position: absolute;
  z-index: 0;
  top: -230px;
  right: 0;
  bottom: -230px;
  left: 0;
  display: block;
  background-image:
    var(--chapter-wash, radial-gradient(ellipse 85% 60% at 8% 44%, rgba(151, 157, 164, 0.14), rgba(151, 157, 164, 0.044) 38%, rgba(151, 157, 164, 0) 72%)),
    linear-gradient(to right, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-position: 0 0, 16.666vw 0, 0 0;
  background-size: 100% 100%, 20.833vw 100%, 100% 110px;
  pointer-events: none;
  will-change: transform;
}

.p-paper .chapter-motion-grid {
  background-image:
    var(--chapter-wash, radial-gradient(ellipse 85% 60% at 50% 50%, rgba(70, 76, 83, 0.08), rgba(70, 76, 83, 0.024) 40%, rgba(70, 76, 83, 0) 74%)),
    linear-gradient(to right, rgba(29, 33, 39, 0.124) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(29, 33, 39, 0.09) 1px, transparent 1px);
}

/* Give every chapter its own neutral light source and direction. */
#tracking .chapter-motion-grid {
  --chapter-wash: radial-gradient(ellipse 88% 62% at 6% 42%, rgba(151, 157, 164, 0.14), rgba(151, 157, 164, 0.044) 38%, rgba(151, 157, 164, 0) 72%);
}

#offers .chapter-motion-grid {
  --chapter-wash: linear-gradient(145deg, rgba(70, 76, 83, 0) 8%, rgba(70, 76, 83, 0.028) 34%, rgba(70, 76, 83, 0.09) 52%, rgba(70, 76, 83, 0) 80%);
}

#onboarding .chapter-motion-grid {
  --chapter-wash: radial-gradient(ellipse 78% 56% at 92% 55%, rgba(157, 163, 170, 0.128), rgba(157, 163, 170, 0.04) 42%, rgba(157, 163, 170, 0) 74%);
}

#referral .chapter-motion-grid {
  --chapter-wash: radial-gradient(circle at 28% 74%, rgba(76, 82, 88, 0.096), rgba(76, 82, 88, 0.028) 34%, rgba(76, 82, 88, 0) 64%);
}

#reports .chapter-motion-grid {
  --chapter-wash: linear-gradient(115deg, rgba(145, 151, 158, 0) 12%, rgba(145, 151, 158, 0.036) 33%, rgba(145, 151, 158, 0.144) 58%, rgba(145, 151, 158, 0) 84%);
}

#proof .chapter-motion-grid {
  --chapter-wash: radial-gradient(ellipse 100% 50% at 58% 14%, rgba(62, 68, 74, 0.088), rgba(62, 68, 74, 0.024) 44%, rgba(62, 68, 74, 0) 76%);
}

/* Product frames should feel deliberate and substantial without becoming cards. */
body[data-restored-motion-artifact] .demo-window {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.16);
}

body[data-restored-motion-artifact] .p-paper .demo-window {
  box-shadow: 0 24px 64px rgba(29, 33, 39, 0.1);
}

body[data-restored-motion-artifact] .demo-bar {
  background: rgba(255, 255, 255, 0.018);
  font-size: 11.5px;
}

body[data-restored-motion-artifact] .p-paper .demo-bar {
  background: rgba(29, 33, 39, 0.022);
}

body[data-restored-motion-artifact] .demo-example { opacity: 0.24; }
body[data-restored-motion-artifact] .search-field { box-shadow: inset 4px 0 0 var(--lime); }
body[data-restored-motion-artifact] .search-field b { color: var(--lime); font-weight: 700; }
body[data-restored-motion-artifact] .route-connector { height: 2px; transform-origin: left center; }
body[data-restored-motion-artifact] .report-head > span { white-space: nowrap; }

body[data-restored-motion-artifact] #referral .referral-intake {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
}

body[data-restored-motion-artifact] #referral .referral-intake .avatar {
  background: var(--ink);
  color: var(--lime);
}

body[data-restored-motion-artifact] #referral .referral-intake small,
body[data-restored-motion-artifact] #referral .referral-intake p {
  color: rgba(29, 33, 39, 0.68);
}

body[data-restored-motion-artifact] #reports .report-lines span:first-child {
  box-shadow: inset 4px 0 0 var(--lime);
}

body[data-restored-motion-artifact] #reports .coverage-grid .attention {
  background: var(--lime);
  color: var(--ink);
}

body[data-restored-motion-artifact] #reports .coverage-grid .attention b,
body[data-restored-motion-artifact] #reports .coverage-grid .attention small {
  color: var(--ink);
}

@media (min-width: 821px) {
  body[data-restored-motion-artifact] .story-art { padding-bottom: clamp(10px, 1.6vh, 18px); }
  body[data-restored-motion-artifact] .demo-window { height: clamp(400px, 59vh, 580px); }
}

/* Keep the page calm: only the feature being demonstrated gets to move. */
@media (prefers-reduced-motion: no-preference) {
  body[data-restored-motion-artifact] .story-copy.is-entering,
  body[data-restored-motion-artifact] .scene.is-entering,
  body[data-restored-motion-artifact] .scene.is-entering * {
    animation: none !important;
  }

  body[data-restored-motion-artifact] .story-panel:not(.close-panel) .panel-frame::after {
    animation: none !important;
  }

  body[data-restored-motion-artifact] .tour-instruction b {
    animation: scroll-arrow-bounce 1.4s ease-in-out 2 !important;
  }

  body[data-restored-motion-artifact] #tracking [data-scene="0"].is-entering .selected,
  body[data-restored-motion-artifact] #tracking [data-scene="1"].is-entering .person-row.active,
  body[data-restored-motion-artifact] #referral [data-scene="0"].is-entering .feed-card.loud {
    animation: artifact-signal-lock 420ms ease-out both !important;
  }

  body[data-restored-motion-artifact] #tracking [data-scene="2"].is-entering .bars i {
    animation: artifact-column-grow 620ms cubic-bezier(0.22, 0.7, 0.2, 1) both !important;
  }

  body[data-restored-motion-artifact] #offers [data-scene="0"].is-entering .offer-sent-line span,
  body[data-restored-motion-artifact] #offers [data-scene="2"].is-entering .acceptance-banner > span {
    animation: artifact-stamp 360ms cubic-bezier(0.22, 0.7, 0.2, 1) both !important;
  }

  body[data-restored-motion-artifact] #offers [data-scene="1"].is-entering .status-track .active i {
    animation: artifact-status-ping 560ms ease-out both !important;
  }

  body[data-restored-motion-artifact] #onboarding [data-scene="0"].is-entering .document-list {
    animation: artifact-package-open 480ms cubic-bezier(0.22, 0.7, 0.2, 1) both !important;
  }

  body[data-restored-motion-artifact] #onboarding [data-scene="1"].is-entering .signing-progress > i,
  body[data-restored-motion-artifact] #reports [data-scene="2"].is-entering .executive-grid i,
  body[data-restored-motion-artifact] #reports [data-scene="3"].is-entering .market-bar i,
  body[data-restored-motion-artifact] #proof [data-scene="1"].is-entering .comparison-fill {
    animation: artifact-bar-fill 620ms cubic-bezier(0.22, 0.7, 0.2, 1) both !important;
  }

  body[data-restored-motion-artifact] #onboarding [data-scene="2"].is-entering .route-connector {
    animation: artifact-bar-fill 460ms cubic-bezier(0.22, 0.7, 0.2, 1) both !important;
  }

  body[data-restored-motion-artifact] #onboarding [data-scene="2"].is-entering .route-connector:nth-of-type(2) {
    animation-delay: 180ms !important;
  }

  body[data-restored-motion-artifact] #referral [data-scene="1"].is-entering .celebration-selected::after {
    animation: artifact-bar-fill 500ms 80ms cubic-bezier(0.22, 0.7, 0.2, 1) both !important;
  }

  body[data-restored-motion-artifact] #referral [data-scene="2"].is-entering .message-turn-out .msg {
    animation: artifact-message-send 320ms ease-out both !important;
  }

  body[data-restored-motion-artifact] #referral [data-scene="2"].is-entering .message-turn-in .msg {
    animation: artifact-message-send 320ms 160ms ease-out both !important;
    transform-origin: left bottom;
  }

  body[data-restored-motion-artifact] #referral [data-scene="3"].is-entering .referral-intake,
  body[data-restored-motion-artifact] #reports [data-scene="1"].is-entering .coverage-grid .attention {
    animation: artifact-signal-lock 440ms ease-out both !important;
  }

  body[data-restored-motion-artifact] #reports [data-scene="0"].is-entering .report-lines span:first-child {
    animation: artifact-priority-mark 440ms ease-out both !important;
  }

  @keyframes artifact-signal-lock {
    0% { box-shadow: inset 0 0 0 0 rgba(29, 33, 39, 0); }
    58% { box-shadow: inset 0 0 0 3px rgba(29, 33, 39, 0.22); }
    100% { box-shadow: inset 0 0 0 1px rgba(29, 33, 39, 0.1); }
  }

  @keyframes artifact-column-grow {
    from { transform: scaleY(0.08); }
    to { transform: scaleY(1); }
  }

  @keyframes artifact-stamp {
    0% { opacity: 0.3; transform: scale(0.72); }
    64% { opacity: 1; transform: scale(1.08); }
    100% { opacity: 1; transform: scale(1); }
  }

  @keyframes artifact-status-ping {
    0% { box-shadow: 0 0 0 0 rgba(224, 228, 103, 0.62); }
    100% { box-shadow: 0 0 0 10px rgba(224, 228, 103, 0); }
  }

  @keyframes artifact-package-open {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0); }
  }

  @keyframes artifact-bar-fill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }

  @keyframes artifact-message-send {
    from { opacity: 0.25; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
  }

  @keyframes artifact-priority-mark {
    from { box-shadow: inset 0 0 0 var(--lime); }
    to { box-shadow: inset 4px 0 0 var(--lime); }
  }
}

/* Give the opening thesis an intentional two-part hierarchy. */
.hero-panel h1 {
  max-width: 18ch;
  font-size: clamp(42px, 6vw, 96px);
}

.hero-lead {
  max-width: 34ch;
  margin-top: clamp(22px, 3.2vh, 34px);
  color: #ffffff;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 600;
  line-height: 1.2;
}

.hero-lead + .hero-cycle { margin-top: 18px; }

/* Match the last approved pre-rail closing hierarchy. */
.close-refrain { font-size: clamp(16px, 1.35vw, 20px); }

.close-conversion {
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 48px);
  margin-top: clamp(30px, 4.2vh, 46px);
}

.close-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
}

.close-price span {
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 650;
}

.close-price strong {
  font-size: clamp(34px, 3.6vw, 52px);
  font-weight: 750;
  line-height: 0.9;
}

.close-price .close-price-cadence { color: rgba(29, 33, 39, 0.72); }
.close-panel .go { margin-top: 0; }

@media (max-width: 820px) {
  .persistent-header { flex-wrap: nowrap; }
  .artifact-chapter-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    justify-content: flex-start;
    gap: 22px;
    margin: 0;
    padding: 9px 18px 11px;
    overflow-x: auto;
    background: inherit;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .artifact-chapter-nav::-webkit-scrollbar { display: none; }
  .artifact-chapter-nav a { font-size: 11px; }
  .story-panel:not(.close-panel) .panel-frame { padding-top: 112px; }

  .chapter-motion-grid {
    background-position: 0 0, 16.666vw 0, 0 0;
    background-size: 100% 100%, 41.666vw 100%, 100% 94px;
  }

  .close-refrain { font-size: 15px; }
  .close-conversion {
    align-items: flex-start;
    flex-direction: column;
    gap: 22px;
    margin-top: 30px;
  }
  .close-price { gap: 8px; }
  .close-price strong { font-size: 38px; }
  .close-panel .go { padding: 12px 15px; font-size: 12px; }
}

@media (max-width: 600px) {
  .hero-panel h1 {
    max-width: 100%;
    font-size: clamp(34px, 9.2vw, 38px);
  }
  .hero-lead {
    max-width: 28ch;
    margin-top: 22px;
    font-size: 19px;
  }
}

@media (max-width: 360px) {
  .hero-panel h1 { font-size: 32px; }
  .hero-lead { font-size: 18px; }
}

@media (max-width: 600px) and (max-height: 700px) {
  .close-refrain { font-size: 13px; }
  .close-conversion { gap: 16px; margin-top: 20px; }
  .close-price span { font-size: 13px; }
  .close-price strong { font-size: 32px; }
  .close-panel .go { padding: 10px 13px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .chapter-motion-grid { will-change: auto; }
}
