/* The Cloud page + the politician attention ticker */

/* ---------- Ticker ---------- */
.ticker-bar {
  position: sticky; top: calc(65px + env(safe-area-inset-top)); z-index: 19;
  display: flex; align-items: stretch; height: 36px; overflow: hidden;
  background: var(--ink); color: var(--bg); font: 600 13px/1 var(--mono);
  border-bottom: 1px solid var(--line);
}
.ticker-bar[hidden] { display: none; }
.tk-label {
  position: relative; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 14px;
  background: var(--center); color: #fff; letter-spacing: .08em; font-size: 11px; z-index: 2;
}
.tk-label b { font-weight: 800; }
.tk-info {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgb(255 255 255 / .8); background: transparent; color: #fff;
  font: 800 12px/1 var(--mono); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.tk-tip {
  position: absolute; left: 8px; top: 40px; width: min(280px, 80vw); padding: 10px 12px; border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 500 13px/1.4 var(--body); letter-spacing: 0; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transform: translateY(-4px); transition: opacity .15s, transform .15s;
}
.tk-label.open .tk-tip, .tk-label:hover .tk-tip, .tk-info:focus-visible + .tk-tip { opacity: 1; transform: none; }
.tk-viewport { flex: 1; min-width: 0; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 24px), transparent 100%); }
.tk-track { display: flex; width: max-content; height: 100%; animation: tk-scroll var(--tk-dur, 60s) linear infinite; will-change: transform; }
.tk-run { display: flex; align-items: center; height: 100%; }
/* Pause only for a real mouse hover, keyboard focus, or while a finger is held down.
   Phones keep a sticky "hover" after a tap, which used to freeze the ticker. */
@media (hover: hover) and (pointer: fine) { .ticker-bar:hover .tk-track { animation-play-state: paused; } }
.ticker-bar:has(:focus-visible) .tk-track, .ticker-bar.held .tk-track { animation-play-state: paused; }
@keyframes tk-scroll { to { transform: translateX(-50%); } }
.tk-item {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; margin: 0 2px;
  color: inherit; text-decoration: none; border-radius: 8px; white-space: nowrap;
}
.tk-item:hover, .tk-item:focus-visible { background: rgb(255 255 255 / .1); }
.tk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--center); flex: none; }
.tk-dot[data-b="left"] { background: #6f9bff; } .tk-dot[data-b="right"] { background: #ff6b6e; }
.tk-name { font-family: var(--body); font-weight: 700; font-size: 13px; }
.tk-ch { font-weight: 800; font-size: 12px; }
.tk-ch.up { color: #4ee38a; } .tk-ch.down { color: #ff7b7d; } .tk-ch.new { color: #ffd34d; } .tk-ch.flat { color: rgb(255 255 255 / .6); }
@media (prefers-color-scheme: dark) {
  .ticker-bar { background: #050608; color: #f2f1ee; }
  .tk-ch.up { color: #36d17a; }
}
@media (min-width: 860px) { .ticker-bar { top: calc(69px + env(safe-area-inset-top)); } }
@media (max-height: 520px) { .ticker-bar { display: none; } }
/* Reduced motion: no scrolling animation; swipe/scroll it by hand instead */
@media (prefers-reduced-motion: reduce) {
  .tk-track { animation: none !important; }
  .tk-viewport { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: none; mask-image: none; }
  .tk-viewport::-webkit-scrollbar { display: none; }
  .tk-run[aria-hidden="true"] { display: none; }
}
/* Pinned News filter sits under the ticker now */
.lcr { top: calc(101px + env(safe-area-inset-top)); }
@media (min-width: 860px) { .lcr { top: calc(105px + env(safe-area-inset-top)); } }
@media (min-width: 860px) { .side, .rail-side { top: 117px; max-height: calc(100vh - 133px); } }

/* ---------- The Cloud page ---------- */
.cl-page { max-width: 1240px; }
.cl-head { align-items: flex-end; }
.cl-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.cl-filters select { min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; max-width: 100%; }
.cl-count { margin: 0 0 12px; color: var(--ink-2); }
.cl-sym { font: 800 1em/1 var(--mono); }
.cl-sym[data-b="left"] { color: var(--left); } .cl-sym[data-b="center"] { color: var(--center); } .cl-sym[data-b="right"] { color: var(--right); }

.cl-switch { display: flex; width: 100%; margin-bottom: 12px; }
.cl-switch button { flex: 1; }
.cl-grid { display: grid; gap: 14px; }
.cl-col { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 14px 18px; border-top: 5px solid var(--c); min-width: 0; }
.cl-col[data-b="left"] { --c: var(--left); --soft: var(--left-soft); }
.cl-col[data-b="center"] { --c: var(--center); --soft: var(--center-soft); }
.cl-col[data-b="right"] { --c: var(--right); --soft: var(--right-soft); }
.cl-col h2 { font-size: 20px; display: flex; gap: 8px; align-items: center; margin-bottom: 10px; color: var(--c); }
.cl-words { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; min-height: 180px; padding: 6px 0; }
.cl-w {
  border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 8px; line-height: 1.05;
  color: color-mix(in srgb, var(--c) calc(55% + var(--t) * 45%), var(--ink-2));
  font-family: var(--display); font-weight: calc(500 + var(--t) * 300);
  font-size: calc(14px + var(--t) * 22px);
  transition: background .15s, transform .15s;
}
.cl-w:hover, .cl-w:focus-visible { background: var(--soft); transform: translateY(-1px); }
.cl-empty { color: var(--ink-2); font-size: 14px; text-align: center; }
@media (max-width: 899px) {
  .cl-grid[data-show="left"] .cl-col:not([data-side="left"]),
  .cl-grid[data-show="shared"] .cl-col:not([data-side="shared"]),
  .cl-grid[data-show="right"] .cl-col:not([data-side="right"]) { display: none; }
  .cl-words { min-height: 220px; }
}
@media (min-width: 900px) {
  .cl-switch { display: none; }
  .cl-grid { grid-template-columns: 1fr 1fr 1fr; }
  .cl-words { min-height: 320px; }
}

.cl-only { margin-top: 22px; }
.cl-only h2 { font-size: 22px; }
.cl-only-grid { display: grid; gap: 14px; margin-top: 10px; }
@media (min-width: 700px) { .cl-only-grid { grid-template-columns: 1fr 1fr; } }
.cl-only-grid h3 { font-size: 16px; margin-bottom: 8px; }
.cl-only-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-only-w { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; min-height: 40px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink); }
.cl-only-w span { font: 600 12px var(--mono); color: var(--ink-2); margin-left: 4px; }
.cl-only-w[data-b="left"] { border-color: color-mix(in srgb, var(--left) 40%, var(--line)); }
.cl-only-w[data-b="right"] { border-color: color-mix(in srgb, var(--right) 40%, var(--line)); }

.cl-note { background: var(--surface); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); border-left: 5px solid var(--center); max-width: 760px; }
.cl-note h3 { font-size: 20px; margin-bottom: 6px; }
.cl-how { margin-top: 22px; max-width: 760px; }
.cl-how summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.cl-how p { color: var(--ink-2); }

.cl-skel { display: grid; gap: 14px; }
@media (min-width: 900px) { .cl-skel { grid-template-columns: 1fr 1fr 1fr; } }
.cl-skel i { display: block; height: 260px; border-radius: 18px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: cl-shimmer 1.2s linear infinite; }
@keyframes cl-shimmer { to { background-position: -200% 0; } }

/* term drawer */
.cl-term h2 { font-size: 30px; margin: 4px 0 6px; }
.cl-term-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.cl-term-counts div { background: var(--surface); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); border-top: 4px solid var(--c); }
.cl-term-counts [data-b="left"] { --c: var(--left); } .cl-term-counts [data-b="center"] { --c: var(--center); } .cl-term-counts [data-b="right"] { --c: var(--right); }
.cl-term-counts b { display: block; font: 800 26px/1 var(--display); }
.cl-term-counts span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.cl-spark { width: 100%; height: 80px; background: var(--surface); border-radius: 12px; }
.cl-spark path { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.cl-spark .sp-left { stroke: var(--left); } .cl-spark .sp-right { stroke: var(--right); }
.cl-spark circle.sp-left { fill: var(--left); } .cl-spark circle.sp-right { fill: var(--right); }
.cl-spark .sp-axis { stroke: var(--line); }
.cl-spark-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; margin-top: 6px; }
.cl-spark-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.cl-spark-legend i[data-b="left"] { background: var(--left); } .cl-spark-legend i[data-b="right"] { background: var(--right); }
.cl-stories { display: grid; gap: 8px; }
.cl-story { display: grid; gap: 4px; background: var(--surface); border-radius: 12px; padding: 10px 12px; text-decoration: none; box-shadow: var(--shadow); }
.cl-story .badge { justify-self: start; }
.cl-story b { font-size: 15px; line-height: 1.3; }
.cl-share-img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); margin: 10px 0 14px; }

/* teaser in the News rail */
.cl-teaser-rows { display: grid; gap: 8px; }
.cl-teaser-rows > div { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.cl-teaser-rows .cl-sym { width: 18px; }
.cl-chip { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); }
.cl-chip[data-b="left"] { background: var(--left-soft); color: var(--left); }
.cl-chip[data-b="center"] { background: var(--center-soft); color: var(--center); }
.cl-chip[data-b="right"] { background: var(--right-soft); color: var(--right); }

@media (prefers-reduced-motion: reduce) { .cl-skel i { animation: none; } .cl-w { transition: none; } }

/* Phones: keep the clouds above the fold */
@media (max-width: 599px) {
  .cl-head { flex-wrap: nowrap; gap: 10px; margin-bottom: 10px; }
  .cl-head h1 { font-size: 30px; }
  .cl-head p { font-size: 14px; }
  .cl-head .btn { flex: none; padding: 8px 12px; font-size: 13px; }
  .cl-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .cl-filters .seg { grid-column: 1 / -1; display: flex; }
  .cl-filters .seg button { flex: 1; padding: 6px 4px; font-size: 14px; }
  .cl-filters select { width: 100%; font-size: 15px; padding: 6px 10px; }
  .cl-count { font-size: 13px; }
}

/* Cloud words: full-size tap targets on phones and tablets */
@media (max-width: 1023px) {
  .cl-words { gap: 0 6px; }
  .cl-w { min-height: 44px; display: inline-flex; align-items: center; padding: 4px 8px; }
}
