/* AI news ticker bar. Forest & Acid tokens with literal fallbacks, so it also renders on pages
   that do not define the custom properties. Motion is transform-only; reduced motion turns it
   into a row you scroll by hand. */
.ai-ticker {
  --tk-h: 52px;
  position: relative; z-index: 5;
  display: flex; align-items: stretch; height: var(--tk-h); overflow: hidden;
  background: var(--ink, #0A0F0C); color: var(--paper, #F2ECD9);
  border: 1px solid rgba(242, 236, 217, 0.14);
  font: 400 calc(13.5px + 4pt)/1 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;   /* 4pt up from 13.5px (Kevin, 29 Nov 2026) */
  text-align: left; box-sizing: border-box;
}
.ai-ticker *, .ai-ticker *::before, .ai-ticker *::after { box-sizing: border-box; }
.ai-ticker a, .ai-ticker button { -webkit-tap-highlight-color: transparent; }   /* own pressed states instead */
/* In a reading column (articles, case studies): a rounded bar under the masthead. */
.ai-ticker--page { margin: 18px 0 0; border-radius: 6px; }
/* Under a full-width top bar (home and the other site pages). */
.ai-ticker--bleed { border-left: 0; border-right: 0; }

.ai-ticker__label {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 10px;
  border-right: 1px solid rgba(242, 236, 217, 0.14);
}
.ai-ticker__chip {
  font: 600 10.5px/1 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink, #0A0F0C); background: var(--acid, #E8FF3A); padding: 6px 8px 5px; border-radius: 4px; white-space: nowrap;
}
.ai-ticker__time {
  font: 500 10.5px/1 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.06em;
  color: var(--muted, #8FA398); white-space: nowrap;
}
.ai-ticker__time:empty { display: none; }

.ai-ticker__viewport {
  flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}
.ai-ticker__track {
  display: flex; width: max-content; will-change: transform;
  animation: ai-ticker-scroll var(--tk-dur, 60s) linear infinite;
}
@keyframes ai-ticker-scroll { to { transform: translateX(calc(-1 * var(--tk-dist, 50%))); } }
.ai-ticker:hover .ai-ticker__track,
.ai-ticker:focus-within .ai-ticker__track,
.ai-ticker.is-paused .ai-ticker__track { animation-play-state: paused; }

.ai-ticker__list { display: flex; margin: 0; padding: 0 0 0 18px; list-style: none; }
.ai-ticker__item { display: flex; align-items: center; white-space: nowrap; }
/* An acid dot after every item, including the last, so the join between the two copies matches. */
.ai-ticker__item::after {
  content: ''; flex: none; width: 6px; height: 6px; margin: 0 18px; border-radius: 50%;
  background: var(--acid, #E8FF3A); box-shadow: 0 0 8px rgba(232, 255, 58, 0.55);
}
.ai-ticker__link {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 2px;
  color: var(--paper, #F2ECD9); text-decoration: none; border-radius: 3px;
}
.ai-ticker__link:hover .ai-ticker__headline { color: var(--acid, #E8FF3A); text-decoration: underline; text-underline-offset: 3px; }
.ai-ticker__link:focus-visible { outline: 2px solid var(--acid, #E8FF3A); outline-offset: 1px; }
.ai-ticker__src { color: var(--muted, #8FA398); font-size: calc(12.5px + 4pt); }
.ai-ticker__sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.ai-ticker__pause {
  flex: none; position: relative; width: 44px; height: 100%; margin: 0; padding: 0; border: 0;
  border-left: 1px solid rgba(242, 236, 217, 0.14); background: transparent; color: var(--paper, #F2ECD9);
  display: grid; place-items: center; cursor: pointer;
}
.ai-ticker__pause::before { content: ''; position: absolute; inset: 0; }   /* the button is already 44 px wide and at least 50 px tall */
.ai-ticker__pause:hover { color: var(--acid, #E8FF3A); }
.ai-ticker__pause:focus-visible { outline: 2px solid var(--acid, #E8FF3A); outline-offset: -3px; }
.ai-ticker__pause[hidden] { display: none; }
.ai-ticker__pause svg { width: 16px; height: 16px; fill: currentColor; }
.ai-ticker__pause .i-play { display: none; }
.ai-ticker.is-paused .ai-ticker__pause .i-play { display: block; }
.ai-ticker.is-paused .ai-ticker__pause .i-pause { display: none; }

/* Phones: a still story card instead of the scrolling row. One headline at a time, in full, that
   moves on after a reading pause; previous / pause / next, swipe, and the full list on demand. */
.ai-ticker__m { display: none; }
@media (max-width: 640px) {
  .ai-ticker {
    display: block; height: auto; padding: 12px 12px 4px; border-radius: 8px;
    font-size: calc(12.5px + 4pt);
  }
  .ai-ticker--bleed { border-radius: 0; }
  .ai-ticker--page { margin-top: 14px; }
  .ai-ticker__viewport, .ai-ticker__pause { display: none !important; }
  .ai-ticker__label { border: 0; padding: 0 64px 0 0; gap: 10px; }
  .ai-ticker__time { display: inline; }

  .ai-ticker__m { display: block; }
  .ai-ticker__m-count {
    position: absolute; top: 14px; right: 14px;
    font: 600 11px/1 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.08em; color: var(--muted, #8FA398);
  }
  .ai-ticker__m-story { margin: 10px 0 0; min-height: calc(3 * 1.3em + 1.4em); }
  .ai-ticker__m-story .ai-ticker__link { display: block; padding: 0; white-space: normal; }
  .ai-ticker__m-story .ai-ticker__headline {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
    font-weight: 500; line-height: 1.3; color: var(--paper, #F2ECD9);
  }
  .ai-ticker__m-story.is-long .ai-ticker__headline { font-size: calc(10.5px + 4pt); }
  .ai-ticker__m-story.is-tight .ai-ticker__headline { font-size: calc(9px + 4pt); }
  .ai-ticker__m-story .ai-ticker__src {
    display: block; margin-top: 6px; font: 600 11px/1.2 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--acid, #E8FF3A);
  }
  .ai-ticker__m-story .ai-ticker__link:active .ai-ticker__headline,
  .ai-ticker__m-story .ai-ticker__link:hover .ai-ticker__headline { text-decoration: underline; text-underline-offset: 3px; }
  .ai-ticker__m-story.is-in { animation: ai-ticker-in .35s ease-out both; }
  @keyframes ai-ticker-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

  .ai-ticker__m-progress { height: 2px; margin: 10px 0 2px; background: rgba(242, 236, 217, 0.12); border-radius: 2px; overflow: hidden; }
  .ai-ticker__m-progress i { display: block; height: 100%; background: var(--acid, #E8FF3A); transform: scaleX(0); transform-origin: 0 50%; }
  .ai-ticker__m-progress.is-running i { animation: ai-ticker-fill linear forwards; }
  @keyframes ai-ticker-fill { to { transform: scaleX(1); } }

  .ai-ticker__m-controls { display: flex; align-items: center; gap: 4px; margin: 0 -6px; }
  .ai-ticker__m-btn, .ai-ticker__m-all {
    min-width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 22px; background: transparent;
    color: var(--paper, #F2ECD9); display: inline-grid; place-items: center; cursor: pointer;
  }
  .ai-ticker__m-btn svg { width: 20px; height: 20px; }
  .ai-ticker__m-btn:active, .ai-ticker__m-all:active { background: rgba(242, 236, 217, 0.1); }
  .ai-ticker__m-btn:focus-visible, .ai-ticker__m-all:focus-visible { outline: 2px solid var(--acid, #E8FF3A); outline-offset: -2px; }
  .ai-ticker__m-all {
    margin-left: auto; padding: 0 14px; font: 600 11px/1 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--acid, #E8FF3A);
  }

  .ai-ticker__m-list { list-style: none; margin: 4px 0 8px; padding: 0; border-top: 1px solid rgba(242, 236, 217, 0.14); }
  .ai-ticker__m-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(242, 236, 217, 0.1); }
  .ai-ticker__m-list li:last-child { border-bottom: 0; }
  .ai-ticker__m-rank { flex: none; width: 1.4em; font: 600 13px/1.6 'JetBrains Mono', ui-monospace, monospace; color: var(--acid, #E8FF3A); }
  .ai-ticker__m-list .ai-ticker__link { display: block; padding: 0; white-space: normal; }
  .ai-ticker__m-list .ai-ticker__headline { font-size: calc(11.5px + 4pt); line-height: 1.35; }
  .ai-ticker__m-list .ai-ticker__src {
    display: block; margin-top: 4px; font: 600 10.5px/1.2 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted, #8FA398);
  }
}

/* Reduced motion: nothing moves; the stories become a row you scroll by hand. */
@media (prefers-reduced-motion: reduce) {
  .ai-ticker__track { animation: none; }
  .ai-ticker__viewport { overflow-x: auto; -webkit-mask-image: none; mask-image: none; scrollbar-width: thin; }
  .ai-ticker__dup, .ai-ticker__pause { display: none !important; }
  .ai-ticker__m-story.is-in { animation: none; }
  .ai-ticker__m-progress, .ai-ticker__m-btn.is-play { display: none; }   /* phones: no auto-advance, so nothing to pause */
}

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