/* ============================================================
   Gantry — Watching (watching.jsx)
   Layout classes for the two readings of one watchlist: `.cg-wr-*` is
   the RANKED view (worth a check-in, the default), `.cg-watching-*` is
   the FEED (newest first) and the furniture both share. Every colour,
   radius, ease and face is a design-system token; the controls are DS
   primitives. Motion is CSS-only and switches off under
   prefers-reduced-motion.

   The `.cg-wr-*` block moved here from the retired attention.css when
   the ranked view replaced the feed on this screen (2026-09-11).
   ============================================================ */

/* An editorial column: the page is text-led, and a feed wider than ~70
   characters reads slower, not richer. */
.cg-page.cg-watching { max-width: 1040px; }

.cg-watching-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 32px;
  align-items: end;
  margin: 26px 0 20px;
}
.cg-watching-head h1 { margin: 4px 0 6px; }
.cg-watching-side { display: grid; justify-items: end; gap: 10px; }
.cg-watching-pulse { display: flex; align-items: baseline; gap: 10px; }
/* The number is the page's one piece of display type: serif, tabular, and
   it counts — up on arrival, down as things are read. */
.cg-watching-num {
  font-family: var(--font-serif);
  font-size: 46px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  transition: color .5s var(--ease);
}
.cg-watching-num.is-zero { color: var(--fg-4); }
.cg-watching-pulse-label { font-size: 13px; color: var(--fg-3); }
.cg-watching-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Organization chips — one per watched org, with its unread count. The
   pressed chip is ink-inverse, the way a selected control is everywhere
   else; gold is the count, never a fill. */
.cg-watching-orgs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 0 0 22px; padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}
.cg-watching-chip {
  appearance: none;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  font: inherit; font-size: 12px;
  color: var(--fg-2);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.cg-watching-chip:hover { border-color: var(--fg-3); color: var(--fg); }
.cg-watching-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cg-watching-chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.cg-watching-chip-n { font-size: 10.5px; color: var(--brand-text); }
.cg-watching-chip[aria-pressed="true"] .cg-watching-chip-n { color: var(--brand); }
.cg-watching-tools { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.cg-watching-tools-label { font-size: 12px; color: var(--fg-3); }

/* The mode switch and whichever controls that mode owns — the ranked view's
   discipline/window pair, the feed's unread switch. One row, so changing
   mode does not move the list under the reader's cursor. */
.cg-watching-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 24px;
  align-items: end;
  margin: 0 0 20px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}
.cg-watching-filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.cg-watching-field { display: grid; gap: 4px; min-width: 170px; }
.cg-watching-field-label {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.cg-watching-select {
  appearance: none;
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 7px 10px;
  cursor: pointer;
}
.cg-watching-select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* One group per EVENT KIND, each hanging off a spine that draws down on
   arrival; the kind label sits on it as a hollow node with a rule drawing
   across. (The class name is `-day` for the shape, which the feed kept when
   it stopped grouping by calendar day.) */
.cg-watching-day { position: relative; padding-left: 24px; margin-bottom: 22px; }
.cg-watching-day::before {
  content: ""; position: absolute; left: 5px; top: 20px; bottom: -14px; width: 1px;
  background: var(--line-2);
  transform-origin: top;
  animation: cg-watching-spine .7s var(--ease) both;
}
.cg-watching-day:last-child::before { bottom: 8px; }
.cg-watching-day-label {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 4px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-3);
}
.cg-watching-day-label::before {
  content: ""; position: absolute; left: -24px; top: 50%;
  width: 11px; height: 11px; margin-top: -6px;
  border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line-strong);
}
.cg-watching-day-label::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
  transform-origin: left;
  animation: cg-watching-rule .8s var(--ease) both;
}

/* The group's TONE. Adverse first-among-equals, growth acknowledged, neutral
   left alone — three states, expressed once per group and nowhere on a row,
   so nothing here can be read as a confidence score. */
.cg-watching-day[data-tone="adverse"]::before { background: var(--bad); }
.cg-watching-day[data-tone="growth"]::before { background: var(--good); }
.cg-watching-day[data-tone="adverse"] .cg-watching-day-label { color: var(--bad); }
.cg-watching-day[data-tone="adverse"] .cg-watching-day-label::before {
  border-color: var(--bad);
}
.cg-watching-day[data-tone="growth"] .cg-watching-day-label::before {
  border-color: var(--good);
}
.cg-watching-rows { list-style: none; margin: 0; padding: 0; }
.cg-watching-row {
  position: relative;
  display: grid;
  /* Two columns, not three: the data-quality dot that used to sit in the
     first one is gone. An event's tone is a property of what happened, and
     it is carried by the GROUP (see [data-tone] below), not by a marker on
     every row that read as a confidence score. */
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 11px 10px 11px 8px;
  border-bottom: 1px dashed var(--line);
  border-radius: var(--r-sm);
  animation: cg-watching-in .4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 28ms);
  transition: background .2s var(--ease);
}
.cg-watching-row:hover { background: var(--bg-1); }
.cg-watching-row:last-child { border-bottom: 0; }
/* The unread mark: a gold rule on the spine beside the row. It recedes in
   place when the watch is read, rather than the row vanishing. */
.cg-watching-row::before {
  content: ""; position: absolute; left: -19px; top: 12px; bottom: 12px; width: 2px;
  background: var(--brand); border-radius: 1px;
  opacity: 0; transform: scaleY(.3); transform-origin: center;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.cg-watching-row.is-unread::before { opacity: 1; transform: scaleY(1); }
.cg-watching-text { font-size: 14px; line-height: 1.35; color: var(--fg); transition: font-weight .2s; }
.cg-watching-row.is-unread .cg-watching-text { font-weight: 500; }
.cg-watching-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  margin-top: 3px;
  font-size: 11px; color: var(--fg-3);
}
.cg-watching-meta a {
  color: var(--fg-2); text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.cg-watching-meta a:hover { color: var(--brand-text); border-bottom-color: currentColor; }
.cg-watching-kind { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-4); }
.cg-watching-time { font-size: 11px; color: var(--fg-3); white-space: nowrap; padding-top: 2px; }
.cg-watching-foot {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 18px 0 8px;
  font-size: 11px; color: var(--fg-4);
}
.cg-watching-error { margin: 12px 0; font-size: 12px; color: var(--bad); }


/* ============================================================
   The RANKED view — entities, best first, each with its reasons
   ============================================================ */
.cg-wr-list { display: grid; gap: 0; }

.cg-wr-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  animation: cg-watching-in .4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * .022s);
}
.cg-wr-row:first-child { border-top: 1px solid var(--line); }

/* The same gold spine the feed's unread rows carry, for the same reason and
   in the same place: a row is marked new when a fact behind it arrived after
   the reader last looked at the watch it came through, and the mark recedes
   in place when it is read rather than the row vanishing. */
.cg-wr-row::before {
  content: ""; position: absolute; left: -19px; top: 16px; bottom: 16px; width: 2px;
  background: var(--brand); border-radius: 1px;
  opacity: 0; transform: scaleY(.3); transform-origin: center;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.cg-wr-row.is-unread::before { opacity: 1; transform: scaleY(1); }

/* The rank is the page's second piece of display type: serif, tabular, and
   quiet — it orders the page, it is not the point of it. */
.cg-wr-rank {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--fg-4);
  text-align: right;
}

.cg-wr-main { min-width: 0; }
.cg-wr-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.cg-wr-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a.cg-wr-name:hover { border-bottom-color: var(--brand); }
a.cg-wr-name:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* How this row reached the reader — watched, on a list you watch, in a
   discipline you watch. Metadata, not a verdict, so it carries no status
   colour. */
.cg-wr-rel {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
/* Gold, like every other unread count on this screen. */
.cg-wr-new { font-size: 10.5px; color: var(--brand-text); }

.cg-wr-reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }

.cg-wr-reason {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 9px;
  font-size: 13.5px;
  color: var(--fg-2);
}
.cg-wr-reason-body { min-width: 0; }
/* The KIND leads the line, so a reader scanning the page reads a column of
   nouns — "Exclusions · Building permits · Grants awarded" — before they
   read a single sentence. */
.cg-wr-reason-kind {
  color: var(--fg-3);
  margin-right: 8px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cg-wr-reason-text { color: var(--fg); }
.cg-wr-reason-when {
  font-size: 12px;
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Every entity the event names, as its own link — the clinic behind "a
   permit at one of its locations" is one click away. */
.cg-wr-named { display: block; margin-top: 3px; font-size: 12.5px; color: var(--fg-3); }
.cg-wr-named-link {
  color: var(--fg-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
}
.cg-wr-named-link:hover { color: var(--fg); border-bottom-color: var(--brand); }
.cg-wr-named-role { color: var(--fg-4); }

/* Same three-column grid as a reason row, so the trend mark lands in the
   dot column and the movements read as part of the same list rather than as
   a differently-indented afterthought. */
.cg-wr-move {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 9px;
  font-size: 13.5px;
  color: var(--fg-2);
}
.cg-wr-move .cg-trend { justify-self: center; }
.cg-wr-move strong { font-weight: 500; color: var(--fg); }

.cg-wr-more { margin-top: 8px; font-size: 12px; color: var(--fg-4); }

@keyframes cg-watching-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes cg-watching-spine { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes cg-watching-rule  { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 760px) {
  .cg-watching-head { grid-template-columns: 1fr; }
  .cg-watching-side { justify-items: start; }
  .cg-watching-actions { justify-content: flex-start; }
  .cg-watching-row { grid-template-columns: minmax(0, 1fr); }
  .cg-watching-time { grid-column: 1; padding-top: 0; }
  .cg-watching-tools { margin-left: 0; width: 100%; }
  .cg-watching-controls { grid-template-columns: minmax(0, 1fr); }
  .cg-wr-row { grid-template-columns: 26px minmax(0, 1fr); }
  .cg-wr-rank { font-size: 16px; }
  .cg-wr-reason, .cg-wr-move { grid-template-columns: auto minmax(0, 1fr); }
  .cg-wr-reason-when { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .cg-watching-row, .cg-watching-day::before, .cg-watching-day-label::after,
  .cg-watching-row::before, .cg-watching-chip, .cg-watching-num, .cg-watching-text,
  .cg-wr-row, .cg-wr-row::before {
    animation: none !important; transition: none !important;
  }
}
