/* JOOCHART global market news ticker — scoped to .jc-market-ticker */

/* Header + ticker stick together on scroll */
.jc-chrome-sticky {
  --jc-ticker-h: 42px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg-elevated, #fff);
}

/* Subpage sticky panels sit below header + ticker */
body:has(.jc-chrome-sticky) {
  --jc-ticker-h: 42px;
  --jc-chrome-offset: calc(var(--header-h, 64px) + var(--jc-ticker-h));
}

.jc-chrome-sticky .site-header {
  position: relative;
  top: auto;
  border-bottom-color: transparent;
  box-shadow: none;
}

/* Scrolled border under ticker+header as one unit */
.jc-chrome-sticky:has(.site-header.is-scrolled) {
  border-bottom: 1px solid var(--color-border, #e4e7ec);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.jc-market-ticker {
  --jc-ticker-h: 42px;
  --jc-ticker-bg: #ffffff;
  --jc-ticker-line: #e4e7ec;
  --jc-ticker-text: #1d2939;
  --jc-ticker-label: #172033;
  --jc-ticker-muted: #98a2b3;
  --jc-ticker-cat: #475467;
  --jc-ticker-blue: #2457d6;
  --jc-ticker-breaking: #d92d20;
  display: flex;
  align-items: stretch;
  height: var(--jc-ticker-h);
  background: var(--jc-ticker-bg);
  border-bottom: 1px solid var(--jc-ticker-line);
  border-top: 1px solid var(--jc-ticker-line);
  color: var(--jc-ticker-text);
  font-family: inherit;
  overflow: hidden;
}

.jc-market-ticker__label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 168px;
  padding: 0 1rem 0 1.05rem;
  border-right: 1px solid var(--jc-ticker-line);
  background: #f8fafc;
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--jc-ticker-label);
  letter-spacing: -0.01em;
  white-space: nowrap;
  z-index: 2;
}

.jc-market-ticker__globe {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--jc-ticker-blue);
}

.jc-market-ticker__globe svg {
  display: block;
  overflow: visible;
}

.jc-market-ticker__globe-orb {
  opacity: 0.95;
}

.jc-market-ticker__globe-meridian {
  transform-origin: 12px 12px;
  animation: jc-ticker-globe-spin 6.5s linear infinite;
}

.jc-market-ticker__globe-lat {
  opacity: 0.85;
  animation: jc-ticker-globe-pulse 2.8s ease-in-out infinite;
}

@keyframes jc-ticker-globe-spin {
  from {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(0.15);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes jc-ticker-globe-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.jc-market-ticker__label-short,
.jc-market-ticker__label-mini {
  display: none;
}

.jc-market-ticker__viewport {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 1.25rem, #000 calc(100% - 1.25rem), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 1.25rem, #000 calc(100% - 1.25rem), transparent);
}

.jc-market-ticker__track {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  width: max-content;
  gap: 0;
  will-change: transform;
}

.jc-market-ticker__track.is-marquee {
  animation: jc-market-ticker-scroll var(--jc-ticker-duration, 40s) linear infinite;
}

.jc-market-ticker:hover .jc-market-ticker__track.is-marquee,
.jc-market-ticker:focus-within .jc-market-ticker__track.is-marquee {
  animation-play-state: paused;
}

@keyframes jc-market-ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.jc-market-ticker__set {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  width: max-content;
  flex: 0 0 auto;
  padding-right: 0.5rem;
}

.jc-market-ticker__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0.15rem;
  padding: 0.28rem 0.85rem;
  border-radius: 8px;
  color: var(--jc-ticker-text);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-decoration: none;
  white-space: nowrap;
  max-width: none;
  background: transparent;
  box-shadow: inset 0 0 0 0 transparent;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.jc-market-ticker__title {
  position: relative;
  font-weight: 550;
  color: inherit;
  transition:
    font-weight 180ms ease,
    letter-spacing 180ms ease,
    color 180ms ease;
}

.jc-market-ticker__title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--jc-ticker-blue);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0.9;
}

a.jc-market-ticker__item:hover,
a.jc-market-ticker__item:focus-visible {
  color: #1849a9;
  background: #eef4ff;
  box-shadow: inset 0 0 0 1px #d6e4ff;
  transform: translateY(-1px);
  text-decoration: none;
  outline: none;
}

a.jc-market-ticker__item:hover .jc-market-ticker__title,
a.jc-market-ticker__item:focus-visible .jc-market-ticker__title {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1849a9;
}

a.jc-market-ticker__item:hover .jc-market-ticker__title::after,
a.jc-market-ticker__item:focus-visible .jc-market-ticker__title::after {
  transform: scaleX(1);
}

a.jc-market-ticker__item:focus-visible {
  box-shadow:
    inset 0 0 0 1px #2457d6,
    0 0 0 2px rgba(36, 87, 214, 0.2);
}

.jc-market-ticker__item.is-static {
  cursor: default;
}

.jc-market-ticker__item.is-static:hover {
  transform: none;
  background: transparent;
  box-shadow: none;
}

.jc-market-ticker__category {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: #eef4ff;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--jc-ticker-blue);
  letter-spacing: -0.01em;
  line-height: 1.2;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.jc-market-ticker__category[data-tone="blue"] {
  background: #eef4ff;
  color: #2457d6;
}
.jc-market-ticker__category[data-tone="violet"] {
  background: #f4ebff;
  color: #6941c6;
}
.jc-market-ticker__category[data-tone="teal"] {
  background: #e0f7f4;
  color: #0f766e;
}
.jc-market-ticker__category[data-tone="amber"] {
  background: #fef4e6;
  color: #b54708;
}
.jc-market-ticker__category[data-tone="rose"] {
  background: #fce8ec;
  color: #c01048;
}
.jc-market-ticker__category[data-tone="indigo"] {
  background: #eef0ff;
  color: #3538cd;
}
.jc-market-ticker__category[data-tone="cyan"] {
  background: #e0f5fb;
  color: #0e7490;
}
.jc-market-ticker__category[data-tone="orange"] {
  background: #fff1e7;
  color: #c4320a;
}
.jc-market-ticker__category[data-tone="emerald"] {
  background: #e6f7ef;
  color: #027a48;
}
.jc-market-ticker__category[data-tone="purple"] {
  background: #f3e8ff;
  color: #7a3aed;
}

a.jc-market-ticker__item:hover .jc-market-ticker__category,
a.jc-market-ticker__item:focus-visible .jc-market-ticker__category {
  filter: saturate(1.15) brightness(0.97);
  box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.08);
}

.jc-market-ticker__breaking {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #fef3f2;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--jc-ticker-breaking);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.jc-market-ticker__separator {
  flex: 0 0 auto;
  width: 3px;
  height: 3px;
  margin: 0 0.15rem;
  border-radius: 50%;
  background: #c0c7d1;
  color: transparent;
  font-size: 0;
  line-height: 0;
  user-select: none;
}

.jc-market-ticker__status {
  padding: 0 1rem;
  font-size: 0.8rem;
  color: var(--jc-ticker-cat);
  white-space: nowrap;
}

/* Mobile: single headline rotation */
.jc-market-ticker__mobile {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  padding: 0 0.75rem 0 0.65rem;
  overflow: hidden;
}

.jc-market-ticker__mobile-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  width: 100%;
  color: var(--jc-ticker-text);
  font-size: 0.875rem;
  font-weight: 550;
  letter-spacing: -0.015em;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 280ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.jc-market-ticker__mobile-item.is-leave {
  opacity: 0;
  transform: translateY(-4px);
}

.jc-market-ticker__mobile-item.is-enter {
  opacity: 0;
  transform: translateY(4px);
}

a.jc-market-ticker__mobile-item:hover,
a.jc-market-ticker__mobile-item:focus-visible {
  color: #1849a9;
}

a.jc-market-ticker__mobile-item:hover .jc-market-ticker__title,
a.jc-market-ticker__mobile-item:focus-visible .jc-market-ticker__title {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a.jc-market-ticker__mobile-item:hover .jc-market-ticker__category,
a.jc-market-ticker__mobile-item:focus-visible .jc-market-ticker__category {
  filter: saturate(1.15) brightness(0.97);
}

.jc-market-ticker__mobile-item .jc-market-ticker__title {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) {
  .jc-market-ticker__label {
    min-width: 120px;
    padding-left: 0.75rem;
  }

  .jc-market-ticker__label-full {
    display: none;
  }

  .jc-market-ticker__label-short {
    display: inline;
  }
}

@media (max-width: 768px) {
  .jc-market-ticker {
    --jc-ticker-h: 40px;
  }

  .jc-market-ticker__label {
    min-width: 78px;
    padding: 0 0.6rem 0 0.7rem;
  }

  .jc-market-ticker__label-short {
    display: none;
  }

  .jc-market-ticker__label-mini {
    display: inline;
  }

  .jc-market-ticker__viewport {
    display: flex;
  }

  .jc-market-ticker__mobile {
    display: none;
  }

  .jc-market-ticker__item {
    font-size: 0.8125rem;
    padding: 0.22rem 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jc-market-ticker__track.is-marquee {
    animation: none !important;
    transform: none !important;
  }

  .jc-market-ticker__globe-meridian,
  .jc-market-ticker__globe-lat {
    animation: none !important;
    opacity: 0.9 !important;
    transform: none !important;
  }

  .jc-market-ticker__mobile-item,
  .jc-market-ticker__mobile-item.is-leave,
  .jc-market-ticker__mobile-item.is-enter {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .jc-market-ticker.is-reduced .jc-market-ticker__viewport {
    -webkit-mask-image: none;
    mask-image: none;
    overflow: hidden;
  }

  .jc-market-ticker.is-reduced .jc-market-ticker__track {
    padding-right: 0;
  }
}
