/* Live log: "what Context.dev is reading right now" (livelog.js; docs/UI_ROUND_A.md section 2).
   Tokens come from base.css; the fallbacks keep the panel right if a token is missing. */

#reading.ll {
  --ll-bg: var(--paper-2, #EDE8DD);
  --ll-live: var(--live, #D9480F);
  --ll-blue: var(--ink-blue, #23406B);
  --ll-row: 32px;
  display: block; max-height: none; overflow: visible; flex-wrap: nowrap;
  margin: 14px 0 0; padding: 0;
  font: 400 13px/1.3 var(--sans); color: var(--ink-2);
  transition: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #reading.ll { --ll-bg: var(--paper-2, #1D1B18); --ll-live: var(--live, #FF7A45); --ll-blue: var(--ink-blue, #9DB8E8); }
}
:root[data-theme="dark"] #reading.ll { --ll-bg: var(--paper-2, #1D1B18); --ll-live: var(--live, #FF7A45); --ll-blue: var(--ink-blue, #9DB8E8); }
#reading.ll[hidden], [data-phase="start"] #reading.ll { display: none; }

/* the monkey peeking over the panel while it reads: mascot.css */
#reading.ll { position: relative; }

/* ---------- the panel during the hunt ---------- */
#reading .ll-panel {
  position: relative; z-index: 1;
  background: var(--ll-bg); border: 1px solid var(--hair); border-radius: 12px;
  padding: 0 14px 6px;
}
#reading .ll-head {
  display: flex; align-items: center; gap: 10px; min-height: 40px;
  border-bottom: 1px solid var(--hair);
}
#reading .ll-dot {
  flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ll-live);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ll-live) 18%, transparent);
  animation: ll-breathe 1.6s var(--ease) infinite;
}
#reading.ll[data-replay="1"] .ll-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); animation: none; }
#reading[data-state="done"] .ll-dot { animation: none; }
#reading .ll-title { font-weight: 500; color: var(--ink); white-space: nowrap; }
#reading .ll-t-short { display: none; }
#reading .ll-count {
  margin-left: auto; font: 400 12px/1 var(--mono); color: var(--ink-3); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#reading .ll-count b { font-weight: 500; color: var(--ink-2); }
#reading .ll-cd { flex: none; display: inline-flex; }
#reading .ll-head .ll-cd { padding-left: 14px; border-left: 1px solid var(--hair); margin-left: 4px; }

/* ---------- rows ---------- */
#reading .ll-rows { list-style: none; margin: 0; padding: 0; }
#reading .ll-row {
  display: grid; align-items: center; column-gap: 12px;
  grid-template-columns: 24px minmax(140px, 180px) minmax(0, 1fr) 150px 200px;
  height: var(--ll-row); white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--hair) 60%, transparent);
  transition: opacity 240ms var(--ease);
}
#reading .ll-panel .ll-row:last-child { border-bottom: 0; }
#reading .ll-row[data-s="skip"] { opacity: .55; }
#reading .ll-row[data-s="empty"] { opacity: .7; }

#reading .ll-mark {
  position: relative; width: 24px; height: 24px; border-radius: 50%;
  background: var(--receipt); box-shadow: inset 0 0 0 1px var(--hair);
  display: grid; place-items: center; overflow: hidden;
}
#reading .ll-mark::before {
  content: attr(data-l); font: normal 400 13px/1 var(--serif); color: var(--ink-2);
  font-variation-settings: "opsz" 24, "SOFT" 100;
}
#reading .ll-mark img {
  position: absolute; inset: 2px; width: 20px; height: 20px; border-radius: 50%;
  object-fit: contain; background: var(--receipt); opacity: 0; transition: opacity 200ms var(--ease);
}
#reading .ll-mark.has-img img { opacity: 1; }
#reading .ll-mark-q svg { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; }

#reading .ll-dom { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
#reading .ll-lane .ll-dom { font-weight: 400; color: var(--ink-2); }
#reading .ll-what { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
#reading .ll-via {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font: 400 11px/1 var(--mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis;
}
#reading .ll-via[hidden] { display: none; }
#reading .ll-via > i { flex: none; width: 4px; height: 4px; background: var(--ll-blue); border-radius: 1px; }
#reading .ll-via[data-cd="1"] > span { color: var(--ll-blue); }
#reading .ll-via[data-cd="0"] { color: var(--ink-3); }
#reading .ll-via[data-cd="0"] > i { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-3); width: 5px; height: 5px; }

#reading .ll-yield { display: flex; align-items: center; gap: 6px; min-width: 0; font: 400 12px/1 var(--mono); color: var(--ink-3); }
#reading .ll-yt { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
#reading .ll-row[data-s="done"] .ll-yt { color: var(--ok); }
#reading .ll-lane[data-s="done"] .ll-yt { color: var(--ink-2); }
#reading .ll-bar { display: none; position: relative; flex: none; width: 56px; height: 2px; border-radius: 1px; background: var(--hair); overflow: hidden; }
#reading .ll-row[data-s="reading"] .ll-bar { display: block; }
#reading .ll-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: 1px;
  background: var(--ll-live); animation: ll-creep 1.3s var(--ease) infinite;
}
#reading .ll-th { display: inline-flex; gap: 3px; flex: none; }
#reading .ll-th:empty { display: none; }
#reading .ll-ti {
  display: block; width: 18px; height: 18px; border-radius: 4px; object-fit: cover;
  background: var(--receipt); box-shadow: 0 0 0 1px var(--hair);
}
/* an offer with no usable photo: a small dot (it still flies to the line) */
#reading .ll-ti-x, .ll-fly.ll-ti-x {
  width: 8px; height: 8px; margin: 5px; border-radius: 50%; box-shadow: none;
  background: color-mix(in srgb, var(--ink-2) 55%, transparent);
}
#reading .ll-ti.aside { opacity: .35; }
#reading .ll-ti.is-logo { object-fit: contain; padding: 2px; opacity: .6; background: var(--receipt); }

/* after the hunt: the reel of sites we read (brand marks via Context.dev), each with its offer count */
#reading .ll-reel { display: inline-flex; align-items: center; gap: 7px; flex: 0 1 auto; min-width: 0; overflow: hidden; padding: 3px 4px 3px 0; }
#reading .ll-reel:empty { display: none; }
#reading .ll-rm { position: relative; flex: none; transition: transform 160ms var(--ease); }
#reading .ll-rm .ll-mark { width: 22px; height: 22px; box-shadow: 0 0 0 1.5px var(--ll-bg), inset 0 0 0 1px var(--hair); }
#reading .ll-rm .ll-mark img { inset: 2px; width: 18px; height: 18px; }
#reading .ll-rm:not(.got) .ll-mark { opacity: .45; filter: grayscale(1); }
#reading .ll-rm .ll-rb {
  position: absolute; right: -5px; top: -4px; min-width: 12px; height: 12px; padding: 0 3px; border-radius: 6px;
  background: var(--ok); color: #fff; font: 600 8px/12px var(--mono); font-style: normal; text-align: center;
  box-shadow: 0 0 0 1.5px var(--ll-bg);
}
#reading .ll-rm .ll-rb:empty { display: none; }
#reading .ll-rm[data-cd="1"] .ll-rb { background: var(--ll-blue); }
#reading .ll-rm:hover { transform: translateY(-2px); z-index: 2; }
#reading .ll-rmore { margin-left: 6px; font: 400 11px/1 var(--mono); color: var(--ink-3); }
#reading .ll-sum-text { flex: 1 1 320px; }
#reading .ll-more { color: var(--ink-3); }
#reading .ll-more:empty { display: none; }

/* a thumbnail flying down into the line (450 ms) */
.ll-fly {
  position: fixed; z-index: 55; pointer-events: none; margin: 0; display: block;
  border-radius: 4px; object-fit: cover; background: var(--receipt);
  box-shadow: 0 0 0 1px var(--hair), 0 2px 6px rgba(0,0,0,.10);
  will-change: transform, opacity;
}

/* ---------- after done: one summary line, the full log on demand ---------- */
#reading .ll-sum {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; row-gap: 4px;
  min-height: 40px; padding: 8px 14px;
  background: var(--ll-bg); border: 1px solid var(--hair); border-radius: 12px;
}
#reading .ll-sum[hidden], #reading .ll-panel[hidden], #reading .ll-log[hidden] { display: none; }
#reading .ll-sum-text { flex: 1 1 auto; min-width: 0; color: var(--ink-2); }
#reading .ll-toggle { text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 3px; }
#reading .ll-sum-text b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
#reading .ll-sum-text b.ll-cd-n { color: var(--ll-blue); }
#reading .ll-ok { color: var(--ok); font-weight: 500; }
#reading[data-cut="1"] .ll-ok { color: var(--ink-2); }
#reading .ll-s-rec { color: var(--ink-3); }
#reading .ll-toggle {
  flex: none; border: 0; background: transparent; padding: 4px 2px; margin: -4px 0;
  font: 500 12px/1 var(--sans); color: var(--ink-2); cursor: pointer; border-radius: 4px;
}
#reading .ll-toggle:hover { color: var(--ink); }
#reading .ll-toggle:focus-visible { outline: 2px solid var(--ll-blue); outline-offset: 2px; }
#reading .ll-sum .ll-cd { padding-left: 14px; border-left: 1px solid var(--hair); }

#reading .ll-log {
  margin-top: 6px; max-height: 280px; overflow: auto; overscroll-behavior: contain;
  background: var(--ll-bg); border: 1px solid var(--hair); border-radius: 12px; padding: 4px 14px 8px;
}
#reading .ll-group h3 {
  margin: 10px 0 2px; font: 500 12px/1.4 var(--sans); color: var(--ink-3);
}
#reading .ll-group h3 span { font: 400 11px/1 var(--mono); margin-left: 4px; }
#reading .ll-log .ll-row:last-child { border-bottom: 0; }

@keyframes ll-breathe { 50% { opacity: .35; } }
@keyframes ll-creep { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ---------- narrower desktop: drop the "what" column first ---------- */
@media (max-width: 900px) and (min-width: 641px) {
  #reading .ll-row { grid-template-columns: 24px minmax(120px, 1fr) 150px 180px; }
  #reading .ll-what { display: none; }
}

/* ---------- phone: mark, domain, yield; three rows; the mark moves to the summary ---------- */
@media (max-width: 640px) {
  #reading.ll { margin-top: 10px; font-size: 13px; }
  #reading .ll-panel { padding: 0 12px 4px; }
  #reading .ll-head { gap: 8px; min-height: 36px; }
  #reading .ll-t-long { display: none; }
  #reading .ll-t-short { display: inline; }
  #reading .ll-head .ll-cd { display: none; }
  #reading .ll-row { grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 10px; }
  #reading .ll-what, #reading .ll-via { display: none; }
  #reading .ll-panel .ll-rows > li:nth-child(n+4) { display: none; }
  #reading .ll-bar { width: 32px; }
  #reading .ll-th { gap: 2px; }
  #reading .ll-sum { padding: 8px 12px; gap: 8px 12px; }
  #reading .ll-s-long { display: none; }
  #reading .ll-sum .ll-cd { padding-left: 0; border-left: 0; flex-basis: 100%; }
  #reading .ll-log { padding: 2px 12px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  #reading .ll-dot { animation: none; }
  #reading .ll-bar::after { animation: ll-breathe 1.6s linear infinite; width: 100%; transform: none; }
}

/* round B: the searches counter (Context.dev ran them too) and the summary that credits search + reads */
#reading .ll-cdw b.ll-cd-n { color: var(--ll-blue, var(--ink-blue)); }
@media (max-width: 640px) { #reading .ll-cq { display: none; } }
/* the searches strip: every Context.dev web search stays in view, with the pages it found */
#reading .ll-qs {
  margin: 0; padding: 7px 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  border-bottom: 1px solid var(--hair); font: 400 12px/1.4 var(--sans); color: var(--ink-2);
}
#reading .ll-qs[hidden] { display: none; }
#reading .ll-qk { font: 500 11px var(--mono); color: var(--ll-blue, var(--ink-blue)); }
#reading .ll-q { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
#reading .ll-q svg { flex: none; fill: none; stroke: var(--ink-3); stroke-width: 1.6; }
#reading .ll-q b { font: 500 11.5px var(--mono); color: var(--ink); white-space: nowrap; }
#reading .ll-q[data-s="reading"] b { color: var(--ink-3); }
@media (max-width: 640px) { #reading .ll-qs { gap: 2px 10px; font-size: 11.5px; } #reading .ll-qk { display: none; } }
