/* The ticker sits in the normal flow, below the navigation offset. */
.nnticker {
  --nnt-bg: #f5f7ff;
  --nnt-ink: #26334b;
  --nnt-link: #3438a3;
  --nnt-accent: #e5e8ff;
  --nnt-line: #dbe1f5;
  direction: rtl;
  color: var(--nnt-ink);
  background: var(--nnt-bg);
  border-bottom: 1px solid var(--nnt-line);
  font-size: .875rem;
  line-height: 1.55;
}

.dark .nnticker, .dark-mode .nnticker {
  --nnt-bg: #151e30;
  --nnt-ink: #e9eef8;
  --nnt-link: #bec5ff;
  --nnt-accent: #263359;
  --nnt-line: #303c59;
}

.nnticker__inner {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  max-width: 1360px;
  min-height: 42px;
  margin-inline: auto;
  padding: .25rem clamp(.75rem, 2vw, 1.25rem);
}

.nnticker__label {
  color: var(--nnt-link);
  background: var(--nnt-accent);
  border-radius: 6px;
  padding: .2rem .55rem;
  font-weight: 800;
  white-space: nowrap;
}

.nnticker__viewport {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nnticker__list {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.35rem;
  width: max-content;
  margin: 0;
  padding: .18rem .18rem;
  list-style: none;
}

.nnticker__item {
  flex: none;
  box-sizing: border-box;
  white-space: nowrap;
}

.nnticker__headline {
  color: var(--nnt-ink);
  font-weight: 650;
}

.nnticker a.nnticker__headline {
  color: var(--nnt-link);
  text-decoration: underline;
  text-underline-offset: .16em;
}

.nnticker a.nnticker__headline::after {
  content: '';
  display: inline-block;
  width: .33em;
  height: .33em;
  margin-inline: .42em .19em;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: translateY(-.08em) rotate(45deg);
}

.nnticker a:hover { text-decoration: underline; }

.nnticker__controls {
  display: flex;
  align-items: center;
  gap: .14rem;
}

.nnticker__controls button {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  min-height: 31px;
  padding: .08rem .3rem;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--nnt-link);
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}

.nnticker__controls button:hover {
  background: var(--nnt-accent);
  border-color: var(--nnt-line);
}

.nnticker :focus-visible {
  outline: 2px solid var(--nnt-link);
  outline-offset: 1px;
}

/* The public academic context already pairs each stage/grade theme with
   contrast-checked colors for both light and dark mode. */
body[data-academic-stage] .nnticker__label {
  color: var(--b16-on-action, var(--nnt-link));
  background: var(--b16-action, var(--nnt-accent));
}

body[data-academic-stage] .nnticker__controls button {
  color: var(--b16-action, var(--nnt-link));
  background: var(--b16-soft, transparent);
  border-color: var(--b16-line, transparent);
}

body[data-academic-stage] .nnticker :is(.nnticker__label, .nnticker__controls button):is(:hover, :active) {
  color: var(--b16-on-action-hover, var(--nnt-link));
  background: var(--b16-action-hover, var(--nnt-accent));
}

body[data-academic-stage] .nnticker__controls button:is(:hover, :active) {
  border-color: var(--b16-action-hover, var(--nnt-line));
}

body[data-academic-stage] .nnticker :is(.nnticker__label, .nnticker__controls button):focus-visible {
  outline-color: var(--b16-action, var(--nnt-link));
}

.nnticker [hidden] { display: none !important; }

.nnticker--desktop .nnticker__viewport {
  display: flex;
  overflow: hidden;
  overflow: clip;
}

.nnticker--desktop .nnticker__list { flex: none; }
.nnticker--moving .nnticker__list { will-change: transform; }

.nnticker--desktop .nnticker__item { min-width: 8rem; }

.nnticker--single .nnticker__viewport {
  overflow: visible;
  touch-action: pan-y;
}

.nnticker--single .nnticker__list {
  display: block;
  width: auto;
}

.nnticker--single .nnticker__item {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.nnticker--single .nnticker__item:not(.nnticker__item--expanded) .nnticker__headline {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.nnticker--single .nnticker__controls button {
  min-width: 36px;
  min-height: 36px;
}

.nnticker__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .nnticker__inner {
    min-height: 54px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label controls" "viewport viewport";
    gap: 0 .5rem;
  }
  .nnticker__label { grid-area: label; justify-self: start; }
  .nnticker__viewport { grid-area: viewport; }
  .nnticker__controls { grid-area: controls; }
  .nnticker:not(.nnticker--single) .nnticker__viewport { scroll-snap-type: x mandatory; }
  .nnticker:not(.nnticker--single) .nnticker__list { width: auto; gap: .75rem; }
  .nnticker:not(.nnticker--single) .nnticker__item {
    flex: 0 0 100%;
    scroll-snap-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
