/* ─────────────────────────────────────────────────────
   Ticker Block — Frontend Styles
───────────────────────────────────────────────────── */

.tb-block {
  display: grid;
  grid-template-columns: 45fr 55fr;
  height: 78vh;
  overflow: hidden;
  border-radius: 0px;
  background-color: #1a182c;
}

/* ── Left: image column ─────────────────────────── */
.tb-image-col {
  position: relative;
  overflow: hidden;
  background: #111;
}

.tb-image {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.tb-image.is-active {
  opacity: 1;
}

.tb-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tb-image-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  text-align: center;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0.1) 60%,
    transparent 100%
  );
  z-index: 10;
}

.tb-image-overlay span {
  font-family: var(--wp--preset--font-family--pp-fragment);
  font-size: clamp(2rem, -0.143rem + 5.714vw, 5rem);
  text-transform: uppercase;
  font-weight: 500;
  color: #fff;
  line-height: 1.25;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  letter-spacing: -0.01em;
}

/* ── Logo box ───────────────────────────────────── */
/*
  --tb-logo-top is set dynamically in JS, measured from the bottom
  of the overlay text span + a fixed gap. Falls back to 50% + 4rem.
  This ensures the logo and line stay correctly positioned even when
  the overlay text wraps to 2 or more lines.
*/
@keyframes tb-bob {
  0% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

/*
  .tb-logo-group is the moving container — it bobs as one unit,
  carrying the logo box, line, and pin together.
  Positioned absolutely within .tb-image using --tb-logo-top.
  overflow: visible so the line and pin can extend outside the box.
*/
.tb-logo-group {
  position: absolute;
  left: auto;
  right: auto;
  top: var(--tb-logo-top, calc(50% + 4rem));
  width: 9rem;
  height: 5.5rem;
  border: 1px solid rgba(255, 255, 255, 0.9);
  overflow: visible;
  box-sizing: border-box;
  transition:
    top 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    left 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    right 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Line and pin — bottom-left default: from top-right corner, angled upward */
.tb-logo-group::before {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: clamp(6rem, 8vw, 14rem);
  height: 1px;
  background: rgba(255, 255, 255, 0.9);
  transform-origin: left center;
  transform: rotate(-18deg);
  pointer-events: none;
  z-index: 5;
}
.tb-logo-group::after {
  content: "";
  position: absolute;
  left: calc(100% + clamp(6rem, 8vw, 14rem) * 0.951 - 0px);
  top: calc(clamp(6rem, 8vw, 14rem) * -0.309 - 4px);
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: transparent;
  pointer-events: none;
  z-index: 5;
}

/* top-left: from bottom-right corner, going right and downward */
.tb-logo-group[data-logo-pos="top-left"]::before {
  top: auto;
  right: auto;
  bottom: 0;
  left: 100%;
  transform-origin: left center;
  transform: rotate(18deg);
}
.tb-logo-group[data-logo-pos="top-left"]::after {
  top: auto;
  right: auto;
  bottom: calc(clamp(6rem, 8vw, 14rem) * -0.309 - 4px);
  left: calc(100% + clamp(6rem, 8vw, 14rem) * 0.951 - 0px);
}

/* bottom-right: from top-left corner, going left and upward */
.tb-logo-group[data-logo-pos="bottom-right"]::before {
  top: 0;
  left: auto;
  bottom: auto;
  right: 100%;
  transform-origin: right center;
  transform: rotate(18deg);
}
.tb-logo-group[data-logo-pos="bottom-right"]::after {
  top: calc(clamp(6rem, 8vw, 14rem) * -0.309 - 4px);
  left: auto;
  right: calc(100% + clamp(6rem, 8vw, 14rem) * 0.951 - 0px);
}

/* top-right: from bottom-left corner, going left and downward */
.tb-logo-group[data-logo-pos="top-right"]::before {
  top: auto;
  left: auto;
  bottom: 0;
  right: 100%;
  transform-origin: right center;
  transform: rotate(-18deg);
}
.tb-logo-group[data-logo-pos="top-right"]::after {
  top: auto;
  left: auto;
  bottom: calc(clamp(6rem, 8vw, 14rem) * -0.309 - 4px);
  right: calc(100% + clamp(6rem, 8vw, 14rem) * 0.951 - 0px);
}

.tb-logo-box {
  width: 100%;
  height: 100%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  box-sizing: border-box;
}

.tb-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ── Right: ticker column ───────────────────────── */
.tb-text-col {
  position: relative;
  overflow: hidden;
}

/* Fade masks */
.tb-text-col::before,
.tb-text-col::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 25%;
  z-index: 2;
  pointer-events: none;
}

.tb-text-col::before {
  top: 0;
  background: linear-gradient(to bottom, #1a182c 0%, transparent 100%);
}

.tb-text-col::after {
  bottom: 0;
  background: linear-gradient(to top, #1a182c 0%, transparent 100%);
}

/* Active line rule */
.tb-active-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
  border-top: 0px solid rgba(0, 0, 0, 0.1);
  border-bottom: 0px solid rgba(0, 0, 0, 0.1);
}

/* Ticker strip */
.tb-ticker {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 0 4rem;
  z-index: 3;
  will-change: transform;
}

.tb-item {
  display: flex;
  align-items: center;
  width: 100%;
  flex-shrink: 0;
  cursor: default;
}

.tb-item span {
  line-height: 1.3;
  color: #665eea;
  font-family: var(--wp--preset--font-family--pp-fragment);
  font-size: clamp(2rem, 0.571rem + 3.81vw, 4rem);
  transition:
    color 0.4s ease,
    font-size 0.4s ease,
    font-weight 0.3s ease;
  filter: inherit;
  text-transform: uppercase;
  white-space: nowrap;
}

.tb-item.is-active span {
  text-transform: uppercase;
  color: #fff;
  font-weight: 400;
  font-size: clamp(2rem, -0.143rem + 5.714vw, 5rem);
}

/* Progress bar */
.tb-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--tb-active-color, #000);
  width: 0%;
  z-index: 10;
  opacity: 0.2;
  display: none;
}

/* ── Mobile: stacked squares ────────────────────── */
@media (max-width: 840px) {
  .tb-block {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
    border-radius: 8px;
  }

  .tb-image-col {
    aspect-ratio: 1 / 1;
    position: relative;
    height: auto;
  }

  .tb-text-col {
    aspect-ratio: 3 / 1;
    position: relative;
    height: auto;
  }

  .tb-image-overlay span {
  }
  .tb-item {
    justify-content: center;
  }
  .tb-item span {
  }

  .tb-item.is-active span {
  }
}

/* ── Wide / Full align ──────────────────────────── */
.alignwide .tb-block,
.alignfull .tb-block {
  border-radius: 0;
}
