/* Spatial trade journey. The markup stays readable without JavaScript. */
#trade-journey {
  --journey-ink: #25241f;
  --journey-paper: #fffdf7;
  --journey-red: #b60d32;
  --journey-rule: rgba(37, 36, 31, 0.15);
  position: relative;
  isolation: isolate;
  color: var(--journey-ink);
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  column-gap: clamp(24px, 4vw, 76px);
}

#trade-journey .journey-narrative { grid-column: 1; grid-row: 1; min-width: 0; }
#trade-journey .journey-sticky { grid-column: 2; grid-row: 1; min-width: 0; }
#trade-journey .journey-step { position: relative; padding: 32px 0; }
#trade-journey .journey-step > :not(.trade-object) { max-width: 440px; }
#trade-journey .journey-step h3 { text-wrap: balance; }
#trade-journey .journey-step p { text-wrap: pretty; }
#trade-stage { position: relative; width: 100%; }

#trade-journey .trade-object {
  --object-opacity: 1;
  --object-lift: 0px;
  box-sizing: border-box;
  position: relative;
  width: min(100%, 432px);
  padding: clamp(22px, 2.4vw, 34px);
  margin: 24px auto;
  color: var(--journey-ink);
  background: var(--journey-paper);
  border: 1px solid rgba(37, 36, 31, 0.16);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 14px 35px -22px rgba(35, 27, 17, 0.27);
}
#trade-journey .trade-object::before {
  content: '';
  position: absolute;
  inset: 5px 5px auto;
  height: 1px;
  background: rgba(37, 36, 31, 0.05);
}
#trade-journey .trade-object::after {
  content: '';
  position: absolute;
  inset: auto 6px -5px;
  height: 5px;
  border: 1px solid rgba(37, 36, 31, 0.12);
  border-top: 0;
  border-radius: 0 0 2px 2px;
  background: #e9e6dd;
  z-index: -1;
}
#trade-journey .folio-kicker {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #777367;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#trade-journey .folio-title {
  margin: 23px 0 20px;
  color: var(--journey-ink);
  font-size: clamp(22px, 2.1vw, 31px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.045em;
}
#trade-journey .folio-rule { height: 1px; margin: 20px 0; background: var(--journey-rule); }
#trade-journey .folio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(37, 36, 31, 0.08);
  font-size: 12px;
  line-height: 1.5;
}
#trade-journey .folio-row:last-child { border-bottom: 0; }
#trade-journey .folio-row > :first-child { color: #777367; }
#trade-journey .folio-row > :last-child { text-align: right; }
#trade-journey .folio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  color: var(--journey-red);
  background: rgba(182, 13, 50, 0.055);
  border: 1px solid rgba(182, 13, 50, 0.13);
  border-radius: 2px;
  font-size: 10px;
  line-height: 1.3;
}
#trade-journey .folio-message {
  position: relative;
  max-width: 88%;
  padding: 15px 17px;
  margin: 17px 0 7px;
  border: 1px solid rgba(37, 36, 31, 0.09);
  border-radius: 2px 12px 12px;
  background: #f2f0e8;
  font-size: 13px;
  line-height: 1.65;
}
#trade-journey .folio-message.is-reply {
  margin-left: auto;
  background: #faf5ef;
  border-radius: 12px 2px 12px 12px;
}
#trade-journey .folio-message small { display: block; margin-top: 8px; color: #8c887b; font-size: 9px; }
#trade-journey .folio-document {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(37, 36, 31, 0.09);
  font-size: 12px;
}
#trade-journey .folio-document::before {
  content: '';
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 27px;
  border: 1px solid #aca89d;
  background: linear-gradient(#aca89d, #aca89d) 5px 10px / 10px 1px no-repeat,
    linear-gradient(#aca89d, #aca89d) 5px 15px / 10px 1px no-repeat,
    linear-gradient(#aca89d, #aca89d) 5px 20px / 6px 1px no-repeat;
}
#trade-journey .folio-document small { display: block; margin-top: 4px; color: #8c887b; font-size: 10px; }
#trade-journey .folio-document > span:last-child { margin-left: auto; color: var(--journey-red); }
#trade-journey .folio-assist {
  padding: 17px;
  margin-top: 20px;
  border-left: 2px solid var(--journey-red);
  background: #f4f1e8;
  font-size: 12px;
  line-height: 1.75;
}
#trade-journey .folio-assist strong { display: block; margin-bottom: 7px; font-weight: 500; }
#trade-journey .folio-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0;
  gap: 16px;
  font-size: 12px;
}
#trade-journey .folio-route > i {
  flex: 1;
  height: 1px;
  background: var(--journey-rule);
  position: relative;
}
#trade-journey .folio-route > i::after {
  content: '';
  position: absolute;
  right: 0;
  top: -3px;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--journey-red);
  border-right: 1px solid var(--journey-red);
  transform: rotate(45deg);
}

/* Enhanced desktop camera. All transforms are confined to this section. */
#trade-journey.motion-ready:not(.motion-static) .journey-narrative { padding: 14vh 0 12vh; }
#trade-journey.motion-ready:not(.motion-static) .journey-step {
  min-height: 72vh;
  min-height: 72svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5vh 0;
}
#trade-journey.motion-ready:not(.motion-static) .journey-sticky {
  position: sticky;
  top: 95px;
  align-self: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: calc(100vh - 120px);
  height: calc(100svh - 120px);
  min-height: 460px;
  max-height: 890px;
  overflow: hidden;
}
#trade-journey.motion-ready:not(.motion-static) #trade-stage {
  flex: 1;
  min-height: 390px;
  perspective: 1400px;
  perspective-origin: 50% 42%;
  overflow: visible;
  contain: layout style;
}
#trade-journey.motion-ready:not(.motion-static) .stage-camera,
#trade-journey.motion-ready:not(.motion-static) .stage-world {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
#trade-journey.motion-ready:not(.motion-static) .stage-camera { transform-origin: 50% 50%; }
#trade-journey.motion-ready:not(.motion-static) .trade-object {
  position: absolute;
  left: 50%;
  top: 46%;
  margin: 0;
  width: 432px;
  max-width: none;
  min-height: 304px;
  opacity: var(--object-opacity);
  transform: translate(-50%, -50%) translate3d(var(--object-x), var(--object-y), calc(var(--object-z) + var(--object-lift))) rotateZ(var(--object-angle));
  transform-style: preserve-3d;
  backface-visibility: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 22px 30px -21px rgba(35, 27, 17, 0.3),
    0 40px 60px -40px rgba(35, 27, 17, 0.19);
}
#trade-journey.motion-ready:not(.motion-static) .trade-object.is-active {
  border-color: rgba(37, 36, 31, 0.23);
}
#trade-journey.motion-ready:not(.motion-static) .trade-object::after { transform: translateZ(-1px); }
#trade-journey .trade-floor {
  position: absolute;
  left: calc(50% - 340px);
  top: calc(46% + 198px);
  width: 3150px;
  height: 600px;
  background-image: repeating-linear-gradient(90deg, transparent 0 79px, rgba(37, 36, 31, 0.042) 79px 80px),
    repeating-linear-gradient(0deg, transparent 0 79px, rgba(37, 36, 31, 0.042) 79px 80px);
  border-top: 1px solid rgba(37, 36, 31, 0.065);
  transform-origin: 50% 0;
  transform: translateZ(-100px) rotateX(78deg);
  pointer-events: none;
}
#trade-journey .trade-rail {
  position: absolute;
  left: 50%;
  top: calc(46% + 206px);
  width: 2470px;
  height: 72px;
  transform: translateZ(-80px);
  transform-style: preserve-3d;
  pointer-events: none;
}
#trade-journey .trade-rail-line,
#trade-journey .trade-rail-active {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  background: rgba(37, 36, 31, 0.22);
}
#trade-journey .trade-rail-active { background: var(--journey-red); width: 0; }
#trade-journey .trade-station {
  position: absolute;
  top: -5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 120px;
  transform: translateX(-5px);
  color: #847f72;
  font-size: 9px;
  line-height: 1.3;
}
#trade-journey .trade-station i {
  display: block;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(37, 36, 31, 0.32);
  background: #f5f2ea;
  border-radius: 50%;
}
#trade-journey .trade-station b { margin-top: 9px; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; }
#trade-journey .trade-station > span { text-transform: uppercase; letter-spacing: 0.12em; }
#trade-journey [data-journey-progress] { transform-origin: left center; }
#trade-journey [data-journey-goto] { touch-action: manipulation; }
#trade-journey [data-journey-goto].is-current { color: var(--journey-red); }
[data-motion-toggle] { touch-action: manipulation; }
[data-motion-toggle][hidden] { display: none !important; }

/* Pausing leaves a complete, in-order story without a hidden card stack. */
#trade-journey.motion-static { display: block; }
#trade-journey.motion-static .journey-sticky { display: none; }
#trade-journey.motion-static .journey-narrative { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
#trade-journey.motion-static .journey-step { min-width: 0; padding: 16px 0; }
#trade-journey.motion-static .journey-step > .trade-object { width: 100%; margin: 28px 0 0; }
#trade-journey.motion-static .trade-object { transform: none; opacity: 1; }

@media (min-width: 901px) and (max-height: 740px) {
  #trade-journey.motion-ready:not(.motion-static) .journey-sticky { top: 76px; min-height: 400px; }
  #trade-journey.motion-ready:not(.motion-static) #trade-stage { min-height: 345px; perspective: 1700px; }
  #trade-journey.motion-ready:not(.motion-static) .trade-object { width: 388px; padding: 24px; min-height: 284px; }
  #trade-journey .trade-rail { top: calc(46% + 182px); }
  #trade-journey .trade-floor { top: calc(46% + 174px); }
}
@media (max-width: 1100px) and (min-width: 901px) {
  #trade-journey { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); column-gap: 28px; }
  #trade-journey.motion-ready:not(.motion-static) .trade-object { width: 376px; padding: 24px; }
}
@media (max-width: 900px) {
  #trade-journey { display: block; }
  #trade-journey .journey-narrative { padding: 0; }
  #trade-journey.motion-static .journey-narrative { grid-template-columns: 1fr 1fr; gap: 36px; }
  #trade-journey .journey-step { padding: 20px 0; }
  #trade-journey .trade-object { max-width: 100%; padding: 22px; }
  #trade-journey .folio-title { font-size: 27px; }
  #trade-journey .trade-floor, #trade-journey .trade-rail { display: none; }
}
@media (max-width: 600px) {
  #trade-journey.motion-static .journey-narrative { grid-template-columns: 1fr; gap: 44px; }
  #trade-journey .journey-step { padding: 0; }
  #trade-journey .journey-step > :not(.trade-object) { max-width: 100%; }
  #trade-journey .trade-object { max-width: 100%; }
  #trade-journey .folio-title { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  #trade-journey *, #trade-journey *::before, #trade-journey *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
