/* ==========================================================================
   The Terminal — pinned 3D product tour, horizontal reel, live markets
   ========================================================================== */

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body { overflow-x: hidden; }

#trails {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

main { position: relative; z-index: 2; }

.hide-sm { }
@media (max-width: 900px) { .hide-sm { display: none !important; } }

/* ---------------- Tour ---------------- */
.tour { height: 560vh; position: relative; }

.tour__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.tour__head {
  position: absolute;
  top: 16vh;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
  padding: 0 20px;
}

.tour__title {
  margin: 16px 0 16px;
  font-size: clamp(54px, 10vw, 168px);
  color: var(--white);
}

.tour__title .serif { color: var(--mint); font-weight: 400; }
.tour__word { display: inline-block; }

.tour__lede { margin: 0; color: var(--muted); font-size: 16px; }

.stage3d {
  perspective: 1400px;
  perspective-origin: 50% 20%;
  width: min(1240px, 94vw);
  z-index: 2;
}

/* ---------------- Terminal mock ---------------- */
.term {
  --r: 14px;
  display: grid;
  grid-template-columns: 1fr 250px 270px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "top top top"
    "chart book entry"
    "pos pos entry";
  height: min(72vh, 700px);
  gap: 1px;
  background: #1a1d1f;
  border: 1px solid #2f3336;
  border-radius: var(--r);
  overflow: hidden;
  transform-origin: 50% 0%;
  box-shadow: 0 60px 160px rgba(0, 186, 124, 0.18), 0 0 0 1px rgba(124, 255, 203, 0.05);
  will-change: transform;
  font-size: 12px;
}

.term > * { background: #000; position: relative; transition: opacity 0.6s var(--ease-out), filter 0.6s var(--ease-out); }

/* Spotlight: dim non-focused zones during the tour */
.term[data-focus] > [data-zone] { opacity: 0.22; filter: saturate(0.3) blur(1px); }
.term[data-focus="chart"] > [data-zone="chart"],
.term[data-focus="book"] > [data-zone="book"],
.term[data-focus="entry"] > [data-zone="entry"],
.term[data-focus="positions"] > [data-zone="positions"] {
  opacity: 1;
  filter: none;
  box-shadow: inset 0 0 0 1px rgba(124, 255, 203, 0.5), 0 0 60px rgba(124, 255, 203, 0.25);
  z-index: 2;
}

.term__top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 10px 16px;
  white-space: nowrap;
  overflow: hidden;
}

.term__pair { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--white); }
.term__tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: rgba(0, 186, 124, 0.15); color: var(--bull); }

.term__stat { display: flex; flex-direction: column; gap: 2px; }
.term__stat span { font-size: 10px; color: var(--muted); }
.term__stat b { font-weight: 500; color: var(--paper); font-variant-numeric: tabular-nums; }

.term__live { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.term__chart { grid-area: chart; min-height: 0; }
.term__chart canvas { position: absolute; inset: 30px 0 0 0; width: 100%; height: calc(100% - 30px); }
.term__tabs { position: absolute; top: 8px; left: 12px; display: flex; gap: 12px; color: var(--muted); font-size: 11px; }
.term__tabs .on { color: var(--white); }
.term__ohlc { position: absolute; top: 8px; right: 12px; font-size: 10px; color: var(--muted); }

.term__book { grid-area: book; display: flex; flex-direction: column; min-height: 0; padding: 8px 0; }
.term__h { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 0 12px 6px; font-size: 10px; color: var(--muted); }
.term__h span:not(:first-child) { text-align: right; }

.book { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#asks { justify-content: flex-end; }

.book__row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 2px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.book__row span:not(:first-child) { text-align: right; color: var(--paper); }
.book__row i { position: absolute; top: 1px; bottom: 1px; right: 0; opacity: 0.16; transition: width 0.5s var(--ease-out); }
.book__row.ask span:first-child { color: var(--bear); }
.book__row.bid span:first-child { color: var(--bull); }
.book__row.ask i { background: var(--bear); }
.book__row.bid i { background: var(--bull); }
.book__row.flash { animation: flash 0.6s; }
@keyframes flash { from { background: rgba(255, 255, 255, 0.08); } }

.book__mid { padding: 6px 12px; font-size: 15px; color: var(--white); border-top: 1px solid #16181c; border-bottom: 1px solid #16181c; font-variant-numeric: tabular-nums; }

.term__entry { grid-area: entry; padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.seg { display: flex; gap: 4px; padding: 3px; background: #16181c; border-radius: 8px; }
.seg button { flex: 1; padding: 6px 0; border-radius: 6px; font-size: 11px; color: var(--muted); }
.seg button.on { background: #2f3336; color: var(--white); }

.side { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side button { padding: 10px 0; border-radius: 8px; font-weight: 600; background: #16181c; color: var(--muted); transition: background 0.3s, color 0.3s; }
.side__long.on { background: var(--bull); color: #00140c; }
.side__short.on { background: var(--bear); color: #fff; }

.field { display: flex; justify-content: space-between; padding: 10px 12px; background: #16181c; border-radius: 8px; font-size: 11px; color: var(--muted); }
.field span { color: var(--white); }

.lev__row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.lev__row b { color: var(--white); font-weight: 500; }
.lev input { width: 100%; accent-color: var(--bull); }

.agent { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed rgba(124, 255, 203, 0.35); border-radius: 8px; font-size: 10px; color: var(--muted); }
.agent__badge { color: var(--mint); font-size: 11px; }

.place { margin-top: auto; padding: 13px 0; border-radius: 10px; background: var(--bull); color: #00140c; font-weight: 700; font-size: 14px; transition: transform 0.2s, box-shadow 0.3s; }
.place:hover { box-shadow: 0 0 30px rgba(0, 186, 124, 0.5); }
.place:active { transform: scale(0.98); }
.place.short { background: var(--bear); color: #fff; }
.demo-note { margin: 0; font-size: 9px; color: var(--subtle); text-align: center; text-transform: uppercase; letter-spacing: 0.14em; }

.term__pos { grid-area: pos; padding: 8px 12px 10px; }
.pos__tabs { display: flex; gap: 16px; font-size: 10px; color: var(--muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; }
.pos__tabs .on { color: var(--white); }
.pos { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.pos th { text-align: left; font-weight: 400; color: var(--muted); font-size: 10px; padding: 3px 0; }
.pos td { padding: 4px 0; color: var(--paper); }

@media (max-width: 900px) {
  .term {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "top top" "chart chart" "book entry";
    grid-template-rows: auto 1fr 260px;
    height: 76vh;
  }
  .term__pos { display: none; }
}

/* ---------------- Captions ---------------- */
.captions { position: absolute; left: clamp(20px, 4vw, 60px); bottom: 7vh; z-index: 4; width: min(380px, 88vw); }

.caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px 22px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.caption.is-on { opacity: 1; transform: none; }
.caption h3 { margin: 10px 0 8px; font-size: 22px; letter-spacing: -0.03em; color: var(--white); }
.caption p:last-child { margin: 0; font-size: 14px; line-height: 1.55; color: rgba(231, 233, 234, 0.72); }

/* ---------------- Reel ---------------- */
/* Negative margin tucks the reel under the empty tail of the sticky tour */
.reel { height: 100vh; overflow: hidden; position: relative; margin-top: -32vh; }
.reel__track { display: flex; align-items: center; gap: 24px; height: 100%; padding: 0 6vw; width: max-content; will-change: transform; }

.reel__intro { width: min(520px, 80vw); flex-shrink: 0; padding-right: 4vw; }
.reel__intro h2 { margin: 18px 0 0; font-size: clamp(48px, 6.5vw, 104px); color: var(--white); }
.reel__intro .serif { color: var(--mint); font-weight: 400; }

.card {
  position: relative;
  flex-shrink: 0;
  width: min(380px, 78vw);
  height: min(520px, 70vh);
  padding: 26px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  transition: border-color 0.4s, transform 0.6s var(--ease-out);
}
.card:hover { border-color: rgba(124, 255, 203, 0.4); transform: translateY(-8px); }
.card__n { position: absolute; top: 22px; left: 26px; font-size: 11px; color: var(--muted); }
.card h3 { margin: 0 0 10px; font-size: 26px; letter-spacing: -0.03em; color: var(--white); }
.card p { margin: 0; font-size: 14px; line-height: 1.55; color: rgba(231, 233, 234, 0.7); }

.card__art { position: absolute; inset: 60px 26px 170px; display: grid; place-items: center; }
.card__art--search { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; }
.card__art--search span { font-family: var(--font-mono); font-size: 12px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; animation: float 4s ease-in-out infinite; }
.card__art--search span:nth-child(2n) { animation-delay: -1.5s; color: var(--gold); }
.card__art--search span:nth-child(3n) { animation-delay: -2.5s; color: var(--mint); }
@keyframes float { 50% { transform: translateY(-8px); } }

.card__art--key span { font-size: 80px; filter: drop-shadow(0 0 30px rgba(255, 212, 0, 0.5)); animation: float 5s ease-in-out infinite; }
.card__art--sign span { padding: 14px 18px; border-radius: 12px; border: 1px solid rgba(124, 255, 203, 0.35); color: var(--mint); font-size: 12px; box-shadow: 0 0 40px rgba(124, 255, 203, 0.15); }
.card__art--tradfi { display: flex; gap: 10px; justify-content: center; align-items: center; }
.card__art--tradfi span { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--gold); padding: 14px; border-radius: 12px; background: rgba(255, 212, 0, 0.08); }
.card__art--ai span { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: #fff; background: radial-gradient(circle at 35% 30%, #c9b3ff, var(--purple) 45%, #1a0d33 80%); box-shadow: 0 0 80px rgba(152, 94, 255, 0.5); animation: float 6s ease-in-out infinite; }
.card__art--journal { display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
.card__art--journal i { width: 26px; border-radius: 6px 6px 0 0; background: linear-gradient(var(--mint), var(--bull)); animation: bars 2.4s ease-in-out infinite alternate; }
.card__art--journal i:nth-child(1) { height: 40%; }
.card__art--journal i:nth-child(2) { height: 70%; animation-delay: -0.6s; }
.card__art--journal i:nth-child(3) { height: 50%; animation-delay: -1.2s; background: linear-gradient(#ff8a92, var(--bear)); }
.card__art--journal i:nth-child(4) { height: 85%; animation-delay: -1.8s; }
.card__art--journal i:nth-child(5) { height: 65%; animation-delay: -0.3s; }
@keyframes bars { to { transform: scaleY(0.7); transform-origin: bottom; } }

/* ---------------- Markets ---------------- */
.markets { padding: 20vh clamp(20px, 7vw, 120px) 12vh; max-width: 1300px; margin: 0 auto; }
.markets__head h2 { margin: 16px 0 50px; font-size: clamp(48px, 7vw, 112px); color: var(--white); }
.markets__head .serif { color: var(--mint); font-weight: 400; }

.markets__table { border-top: 1px solid var(--line); }
.mrow { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr 0.8fr 1fr; align-items: center; padding: 18px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; transition: background 0.3s; }
.mrow:not(.mrow--h):hover { background: rgba(255, 255, 255, 0.03); }
.mrow--h { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; padding: 14px 4px; }
.mrow span:not(:first-child) { text-align: right; }
.mrow__name { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; color: var(--white); }
.mrow__px { font-family: var(--font-mono); font-size: 16px; color: var(--paper); border-radius: 4px; padding: 2px 4px; }
.mrow__px.up { animation: up 0.9s; }
.mrow__px.down { animation: down 0.9s; }
@keyframes up { from { background: rgba(0, 186, 124, 0.35); } }
@keyframes down { from { background: rgba(244, 33, 46, 0.35); } }
.mrow .mono { font-size: 13px; }
.markets__note { margin-top: 18px; font-size: 11px; color: var(--muted); }

@media (max-width: 900px) { .mrow { grid-template-columns: 1.2fr 1fr 0.8fr; } }

/* ---------------- Wallets ---------------- */
.wallets { padding: 10vh 0; text-align: center; }
.marquee { overflow: hidden; margin-top: 30px; mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
.marquee__inner { display: flex; gap: 60px; width: max-content; font-size: clamp(40px, 6vw, 90px); color: rgba(255, 255, 255, 0.14); animation: marquee 40s linear infinite; }
.marquee__inner span { transition: color 0.3s; }
.marquee__inner span:hover { color: var(--white); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------------- CTA ---------------- */
.cta { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; text-align: center; padding: 10vh 20px; }
.cta h2 { margin: 0; font-size: clamp(64px, 12vw, 200px); color: var(--white); }
.cta .serif { color: var(--mint); font-weight: 400; }
.cta__row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); }
.reveal.is-revealed { opacity: 1; transform: none; }
