/* Recent Updates card (v4): a white card under the Welcome page's table of
   contents listing the last 30 days of substantive public changelog entries,
   rolling upward in a loop. styles/recent-updates-ticker-v4.js builds it from
   /changelog/entries.json on the Welcome page only; without the script the
   page is unchanged. The card is plain paper so it does not compete with the
   Welcome box: a neutral border, a thin rule in --handbook-accent (set in each
   handbook's _quarto.yml header) along the top, and no colored bars (Bryan,
   2026-10-09). Rows sit under one heading per day. The window scrolls under
   the pointer, with a thin scrollbar while the card is hovered. On wide
   windows the margin column grows a little into the empty screen inset so
   the card has more room. Canonical copy:
   handbook-recursive/kit/styles/recent-updates-ticker-v4.css. Published
   stylesheets are immutable; future changes need a new version. */

.ru-ticker {
  --ru-ticker-speed: 52;        /* pixels per second; the script reads it */
  --ru-ticker-max: 36rem;       /* tallest the rolling window grows */
  --ru-ticker-accent: var(--handbook-accent, #1765ad);
  --ru-ticker-paper: #ffffff;
  --ru-ticker-text: #1f2937;
  --ru-ticker-link: #1765ad;
  --ru-ticker-muted: #5b6b7f;
  --ru-ticker-rule: #e6eaf0;
  --ru-ticker-edge: #d3dae3;
  --ru-ticker-hover: #f4f6f9;
  --ru-ticker-milestone: #a16207;
  --ru-ticker-evidence: #0f766e;
  --ru-ticker-policy: #4338ca;
  --ru-ticker-developments: #0369a1;
  --ru-ticker-content: #047857;
  --ru-ticker-revision: #6d28d9;
  --ru-ticker-accuracy: #be123c;
  --ru-ticker-head-text: color-mix(in srgb, var(--ru-ticker-accent) 60%, var(--ru-ticker-text));
  margin: 1.4rem 0 0;
  border: 1px solid var(--ru-ticker-edge);
  border-top: 3px solid var(--ru-ticker-accent);
  border-radius: 10px;
  background: var(--ru-ticker-paper);
  box-shadow: 0 1px 2px rgba(10, 37, 64, 0.05);
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ru-ticker-text);
}

.quarto-dark .ru-ticker,
[data-bs-theme="dark"] .ru-ticker {
  --ru-ticker-paper: #1e2228;
  --ru-ticker-text: #e9ecef;
  --ru-ticker-link: #8ecaff;
  --ru-ticker-muted: #abb8c7;
  --ru-ticker-rule: #3a424d;
  --ru-ticker-edge: #454d58;
  --ru-ticker-hover: #262c34;
  --ru-ticker-milestone: #facc15;
  --ru-ticker-evidence: #2dd4bf;
  --ru-ticker-policy: #a5b4fc;
  --ru-ticker-developments: #7dd3fc;
  --ru-ticker-content: #6ee7b7;
  --ru-ticker-revision: #c4b5fd;
  --ru-ticker-accuracy: #fda4af;
  --ru-ticker-head-text: color-mix(in srgb, var(--ru-ticker-accent) 50%, var(--ru-ticker-text));
  box-shadow: none;
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .ru-ticker {
    --ru-ticker-head-text: var(--ru-ticker-text);
  }
}

/* The script marks the margin column on the Welcome page. From 1500px up the
   column takes a share of the empty screen inset, up to 64px at 1683px and
   wider; the body column and the gutter beside it are untouched. */
#quarto-margin-sidebar.ru-ticker-host {
  --ru-ticker-extend: clamp(0px, (100vw - 1500px) * 0.35, 64px);
  width: calc(100% + var(--ru-ticker-extend));
}

.ru-ticker-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0.55rem 0.85rem;
  border-bottom: 1px solid var(--ru-ticker-rule);
}

.ru-ticker-label {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--ru-ticker-head-text);
}

.ru-ticker-count {
  color: var(--ru-ticker-muted);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ru-ticker-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid var(--ru-ticker-edge);
  border-radius: 999px;
  background: var(--ru-ticker-paper);
  color: var(--ru-ticker-muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.ru-ticker-toggle:hover {
  color: var(--ru-ticker-link);
  border-color: currentColor;
}

.ru-ticker-toggle:focus-visible {
  outline: 2px solid var(--ru-ticker-link);
  outline-offset: 2px;
}

.ru-ticker-viewport {
  position: relative;
  height: var(--ru-ticker-height, 28rem);
  padding: 0 0.85rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 0.9rem,
    #000 calc(100% - 1.4rem),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 0.9rem,
    #000 calc(100% - 1.4rem),
    transparent 100%
  );
}

.ru-ticker-track {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.ru-ticker.is-rolling .ru-ticker-track {
  animation: ru-ticker-roll var(--ru-ticker-duration, 60s) linear infinite;
}

/* The roll waits for the pointer, for keyboard focus, for the pause button,
   and for a hidden tab. */
.ru-ticker:hover .ru-ticker-track,
.ru-ticker:focus-within .ru-ticker-track,
.ru-ticker.is-paused .ru-ticker-track,
.ru-ticker.is-touched .ru-ticker-track,
.ru-ticker.is-idle .ru-ticker-track {
  animation-play-state: paused;
}

.ru-ticker:hover .ru-ticker-viewport,
.ru-ticker:focus-within .ru-ticker-viewport {
  scrollbar-color: var(--ru-ticker-edge) transparent;
}

.ru-ticker-viewport::-webkit-scrollbar {
  width: 6px;
}

.ru-ticker-viewport::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: transparent;
}

.ru-ticker:hover .ru-ticker-viewport::-webkit-scrollbar-thumb,
.ru-ticker:focus-within .ru-ticker-viewport::-webkit-scrollbar-thumb {
  background: var(--ru-ticker-edge);
}

/* The track rolls by one copy of the list (the script sets the distance),
   then starts over on identical rows. */
@keyframes ru-ticker-roll {
  from { transform: translateY(0); }
  to { transform: translateY(var(--ru-ticker-shift, -25%)); }
}

.ru-ticker-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0;
}

/* One heading per day: the date once, the day's count beside it. */
.ru-ticker-day {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.7rem;
  padding: 0.3rem 0.2rem 0.3rem;
  border-bottom: 1px solid var(--ru-ticker-edge);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-transform: uppercase;
}

.ru-ticker-day:first-child {
  margin-top: 0.1rem;
}

.ru-ticker-day-date {
  color: var(--ru-ticker-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ru-ticker-day-count {
  color: var(--ru-ticker-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ru-ticker-item {
  padding: 0.55rem 0.2rem 0.6rem;
  border-bottom: 1px solid var(--ru-ticker-rule);
}

.ru-ticker-item:hover {
  background: var(--ru-ticker-hover);
}

/* The category word carries the only color in a row. */
.ru-ticker-cat {
  color: var(--ru-ticker-cat, var(--ru-ticker-muted));
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
}

.ru-ticker .ru-cat-milestone { --ru-ticker-cat: var(--ru-ticker-milestone); }
.ru-ticker .ru-cat-evidence { --ru-ticker-cat: var(--ru-ticker-evidence); }
.ru-ticker .ru-cat-policy { --ru-ticker-cat: var(--ru-ticker-policy); }
.ru-ticker .ru-cat-developments { --ru-ticker-cat: var(--ru-ticker-developments); }
.ru-ticker .ru-cat-content { --ru-ticker-cat: var(--ru-ticker-content); }
.ru-ticker .ru-cat-revision { --ru-ticker-cat: var(--ru-ticker-revision); }
.ru-ticker .ru-cat-accuracy { --ru-ticker-cat: var(--ru-ticker-accuracy); }

.ru-ticker-headline {
  display: block;
  margin-top: 0.2rem;
  color: var(--ru-ticker-link);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.36;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.ru-ticker-headline:hover {
  text-decoration: underline;
}

span.ru-ticker-headline {
  color: var(--ru-ticker-text);
}

.ru-ticker-chapter {
  display: inline-block;
  margin-top: 0.25rem;
  color: var(--ru-ticker-muted);
  font-size: 0.72rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.ru-ticker-chapter:hover {
  color: var(--ru-ticker-link);
}

.ru-ticker a:focus-visible {
  outline: 2px solid var(--ru-ticker-link);
  outline-offset: 3px;
  border-radius: 2px;
}

.ru-ticker-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0.55rem 0.85rem 0.65rem;
  border-top: 1px solid var(--ru-ticker-rule);
  font-size: 0.76rem;
}

.ru-ticker-foot a {
  color: var(--ru-ticker-link);
  font-weight: 600;
  text-decoration: none;
}

.ru-ticker-foot a:hover {
  text-decoration: underline;
}

/* The rows fit, the reader asked for reduced motion, or there is one row:
   a plain list, scrollable if it ever needs to be. */
.ru-ticker.is-static .ru-ticker-viewport {
  height: auto;
  max-height: var(--ru-ticker-height, 28rem);
  overflow-y: auto;
  -webkit-mask-image: none;
  mask-image: none;
}

.ru-ticker.is-static .ru-ticker-toggle {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .ru-ticker .ru-ticker-track {
    animation: none !important;
  }
}

/* Quarto drops the margin column below 992px; the strip in the page remains. */
@media (max-width: 991.98px) {
  .ru-ticker {
    display: none;
  }

  #quarto-margin-sidebar.ru-ticker-host {
    width: auto;
  }
}

@media print {
  .ru-ticker {
    display: none !important;
  }
}
