/* ===== STAGE 8.5 — TRANSITION SECTION ===== */

.trans-section {
  position: relative;
  width: 100%;
  height: 100vh;
  background: var(--btrade-bg-dark, #0a0a0f);
  overflow: hidden;
  display: flex;
  align-items: center;
  z-index: 5;
}

/* ── Blur zone on left side ── */
.trans-blur-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 42%;
  height: 100%;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(10, 10, 15, 0.6);
  z-index: 10;
  pointer-events: none;
  /* Soft edge fade */
  mask-image: linear-gradient(to right, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
}

/* ===== LEFT: Ball + Words ===== */
.trans-left {
  position: relative;
  width: 42%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  flex-shrink: 0;
}

/* ── Ball ── */
.trans-ball {
  --size: 8vmin;
  width: var(--size);
  height: var(--size);
  position: absolute;
  bottom: 50%;
  left: calc(50% - var(--size) / 2);
  animation: tb-bounce 0.65s -0.325s cubic-bezier(0, 0, 0, 1) infinite;
  will-change: transform;
  z-index: 2;
}

.trans-ball::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--tb-color, #ff4757);
  border-radius: 50%;
  box-shadow: 0 0 30px color-mix(in srgb, var(--tb-color, #ff4757) 40%, transparent);
}

.trans-ball-top {
  position: absolute;
  top: -50%;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.trans-ball-top::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 100%;
  border-top-left-radius: calc(var(--size) / 2);
  border-top-right-radius: calc(var(--size) / 2);
  background-color: var(--tb-color, #ff4757);
  animation: tb-anti-bounce 0.65s -0.325s cubic-bezier(0, 0, 0, 1) infinite;
  will-change: transform;
}

@keyframes tb-bounce {
  0%, 100% {
    transform: translateY(-300%);
    animation-timing-function: cubic-bezier(0, 0, 1, 0);
  }
  50% {
    transform: translateY(0);
  }
}

@keyframes tb-anti-bounce {
  0%, 100% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 1, 0);
  }
  50% {
    transform: translateY(-100%);
  }
}

/* ── Phrase ── */
.trans-phrase {
  position: absolute;
  bottom: 50%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: "Poppins", "Cairo", sans-serif;
  font-size: clamp(6vmin, 8vmin, 80px);
  font-weight: 800;
  line-height: 1;
  display: grid;
  grid-template-areas: "layer";
  z-index: 1;
}

.trans-word {
  grid-area: layer;
  display: block;
  color: #fff;
  visibility: hidden;
  animation:
    tw-reveal 2.6s linear infinite,
    tw-bounce 2.6s ease infinite;
  will-change: transform, visibility;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.trans-word[data-index="0"] { animation-delay: 0s; }
.trans-word[data-index="1"] { animation-delay: 0.65s; }
.trans-word[data-index="2"] { animation-delay: 1.3s; }
.trans-word[data-index="3"] { animation-delay: 1.95s; }

@keyframes tw-reveal {
  0%, 25%, 100% { visibility: hidden; }
  1%, 24%       { visibility: visible; }
}

@keyframes tw-bounce {
  0%, 30%, 100% { transform: translateY(0); }
  12.5%         { transform: translateY(30%); }
}

/* ── Shadow under ball ── */
.trans-left::after {
  content: '';
  position: absolute;
  bottom: calc(50% - 4vmin);
  left: 50%;
  transform: translateX(-50%);
  width: 6vmin;
  height: 1.2vmin;
  background: radial-gradient(ellipse, rgba(255,255,255,0.06) 0%, transparent 70%);
  border-radius: 50%;
  animation: tb-shadow 0.65s -0.325s cubic-bezier(0, 0, 0, 1) infinite;
  z-index: 1;
}

@keyframes tb-shadow {
  0%, 100% {
    transform: translateX(-50%) scale(0.5);
    opacity: 0.3;
  }
  50% {
    transform: translateX(-50%) scale(1.2);
    opacity: 0.8;
  }
}

/* ===== RIGHT: Scrolling Showcase ===== */
.trans-showcase {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  z-index: 1;
  padding: 40px 0;
}

/* ── Track ── */
.trans-track {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.trans-track-inner {
  display: flex;
  gap: 20px;
  width: max-content;
  animation: trans-scroll-left 60s linear infinite;
}

.trans-track-inner.reverse {
  animation: trans-scroll-right 60s linear infinite;
}

@keyframes trans-scroll-left {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes trans-scroll-right {
  0%   { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* ── Image Cards ── */
.trans-img-card {
  flex-shrink: 0;
  width: 360px;
  height: 220px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(33, 150, 243, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  background: var(--btrade-bg-card, #111118);
}

.trans-img-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.85;
  transition: opacity 0.3s;
}

/* ===== HOVER pause ===== */
.trans-showcase:hover .trans-track-inner {
  animation-play-state: paused;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .trans-blur-zone {
    width: 45%;
  }

  .trans-left {
    width: 45%;
  }

  .trans-img-card {
    width: 300px;
    height: 185px;
  }
}

@media (max-width: 768px) {
  .trans-section {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    padding: 60px 0;
  }

  .trans-blur-zone {
    width: 100%;
    height: 45%;
    top: 0;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
  }

  .trans-left {
    width: 100%;
    height: 40vh;
    min-height: 280px;
  }

  .trans-phrase {
    font-size: 10vmin;
  }

  .trans-showcase {
    position: relative;
    padding: 20px 0;
  }

  .trans-img-card {
    width: 260px;
    height: 160px;
  }
}

@media (max-width: 480px) {
  .trans-img-card {
    width: 220px;
    height: 140px;
    border-radius: 12px;
  }

  .trans-ball {
    --size: 7vmin;
  }
}