/* ============================================================
   Stocky — Briefings (spec 08)
   Layered on colors_and_type.css + components.css. Reuses the
   .digest card; adds day grouping, ticker-move chips, card
   actions, and three layout scaffolds (feed / timeline / hero)
   so the periodic LLM digest has a real home at /briefings.
   No invented colors or radii — DS tokens only.
   ============================================================ */

/* page header (mirrors the dashboard's .page-h, Berkeley Mono H1) */
.bf-page-h { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 2px 0 0; }
.bf-page-h h1 { font-family: var(--font-display); font-size: clamp(24px, 2.4vw, 38px); font-weight: 600;
  margin: 0; letter-spacing: -0.5px; color: var(--text-primary); }
.bf-page-h .meta { font-family: var(--font-display); font-size: 13px; color: var(--text-muted); }
.bf-page-h .meta b { color: var(--text-secondary); font-weight: 600; }
.bf-sub { font-family: var(--font-body); font-size: 13px; line-height: 1.6; color: var(--text-muted);
  margin: 8px 0 0; max-width: 60ch; text-wrap: pretty; }

/* AI-generated provenance footnote (BYO-key + ~3/day cadence) */
.bf-note { display: flex; gap: 8px; align-items: flex-start; font-family: var(--font-ui);
  font-size: 11px; line-height: 1.5; color: var(--text-muted); margin: 22px 0 0; }
.bf-note svg { flex: none; margin-top: 1px; }

/* ----- day grouping ----- */
.bf-day { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; }
.bf-day:first-child { margin-top: 18px; }
.bf-day__label { font-family: var(--font-ui); font-size: 11px; letter-spacing: 1.25px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.bf-day__label b { color: var(--text-secondary); font-family: var(--font-display); font-weight: 700; }
.bf-day__rule { flex: 1; height: 0; border-top: 0.5px solid var(--border-default); }
.bf-day__cnt { font-family: var(--font-display); font-size: 11px; color: var(--text-muted); }

/* ----- card extensions (on top of .digest) ----- */
.bf-feed { display: flex; flex-direction: column; gap: 12px; }
/* keep narrative line length readable even when the card scales wide */
.bf-feed .digest__body { max-width: 78ch; }
/* read state changes ONLY the sage dot + left accent — title/body stay full strength */
.digest--read { opacity: 1; }
.digest--read .digest__title { color: var(--text-primary); font-weight: 600; }
.digest__time .live { color: var(--data-up); }
.bf-period-time { color: var(--text-muted); font-weight: 400; letter-spacing: 0; text-transform: none; }

/* full-width column that scales with the page gutters (like the watchlist),
   not a narrow centered box */
.bf-col { width: 100%; }

/* ----- horizontal tile scroller (heat cells + mentioned-ticker chips) -----
   Single line, scrolls when it overflows (mobile, or many tickers). A JS helper
   toggles scr-start/scr-mid/scr-end to fade whichever edge has hidden content,
   plus a faint chevron cue. When everything fits, no fade is applied. */
.bf-tilescroll { position: relative; }
.bf-tilerow { display: flex; gap: clamp(6px, 0.5vw, 10px); overflow-x: auto; overflow-y: hidden; padding-bottom: 1px;
  scroll-snap-type: x proximity; scrollbar-width: none; -ms-overflow-style: none; }
.bf-tilerow::-webkit-scrollbar { width: 0; height: 0; display: none; }
.bf-tilerow > * { flex: none; scroll-snap-align: start; }
.bf-tilescroll.scr-start .bf-tilerow { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent); }
.bf-tilescroll.scr-mid .bf-tilerow { -webkit-mask-image: linear-gradient(90deg, transparent, #000 26px, #000 calc(100% - 34px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 26px, #000 calc(100% - 34px), transparent); }
.bf-tilescroll.scr-end .bf-tilerow { -webkit-mask-image: linear-gradient(90deg, transparent, #000 26px);
  mask-image: linear-gradient(90deg, transparent, #000 26px); }
.bf-tilescroll__cue { position: absolute; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; display: none; place-items: center; pointer-events: none; color: var(--text-muted); }
.bf-tilescroll__cue--r { right: 1px; }
.bf-tilescroll__cue--l { left: 1px; }
.bf-tilescroll.scr-start .bf-tilescroll__cue--r,
.bf-tilescroll.scr-mid .bf-tilescroll__cue--r { display: grid; }
.bf-tilescroll.scr-mid .bf-tilescroll__cue--l,
.bf-tilescroll.scr-end .bf-tilescroll__cue--l { display: grid; }

/* mentioned-ticker chips (symbol + its move → link into detail) */
.bf-chip { display: inline-flex; align-items: center; gap: clamp(7px, 0.5vw, 10px); padding: clamp(6px, 0.5vw, 10px) clamp(11px, 0.9vw, 16px);
  border: 0.5px solid var(--border-default); background: var(--bg-surface); border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: clamp(11.5px, 0.88vw, 15px); text-decoration: none; cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out); }
.bf-chip:hover { border-color: var(--color-signal); background: var(--signal-bg); }
.bf-chip__sym { font-weight: 700; color: var(--text-primary); letter-spacing: 0; }
.bf-chip__d { font-variant-numeric: tabular-nums; font-weight: 600; }
.bf-chip__d.up { color: var(--data-up); } .bf-chip__d.down { color: var(--data-down); } .bf-chip__d.flat { color: var(--data-flat); }

/* card actions row (Ask Stocky / open) */
.bf-actions { display: inline-flex; align-items: center; gap: 6px; }
.bf-act { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-size: 11.5px;
  padding: 6px 11px; border: 0.5px solid var(--border-default); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); cursor: pointer; text-decoration: none;
  transition: color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out); }
.bf-act:hover { color: var(--color-signal); border-color: var(--color-signal); background: var(--signal-bg); }
.bf-act .stocky-icon { width: 15px; height: 15px; }
.bf-act svg { color: var(--text-muted); }
.bf-act:hover svg { color: var(--color-signal); }

/* freshness pill on the newest card */
.bf-fresh { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.4px; text-transform: uppercase; color: var(--color-signal);
  background: var(--signal-bg); border-radius: var(--radius-sm); padding: 3px 8px; }
.bf-fresh .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--color-signal); }

/* ============================================================
   VARIATION B — time-of-day timeline rail
   ============================================================ */
.bf-timeline { display: flex; flex-direction: column; }
.bf-tl-item { display: grid; grid-template-columns: 104px 18px 1fr; gap: 16px; }
.bf-tl-time { text-align: right; padding-top: 4px; }
.bf-tl-time .name { display: block; font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--text-primary); }
.bf-tl-time .at { display: block; font-family: var(--font-display); font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.bf-tl-rail { position: relative; }
.bf-tl-rail::before { content: ""; position: absolute; left: 50%; top: 0; bottom: -12px; width: 1px;
  background: var(--border-default); transform: translateX(-50%); }
.bf-tl-item:last-child .bf-tl-rail::before { bottom: 50%; }
.bf-tl-node { position: absolute; left: 50%; top: 7px; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%; background: var(--bg-primary); border: 2px solid var(--text-muted); z-index: 1; }
.bf-tl-node.is-unread { border-color: var(--color-signal); box-shadow: 0 0 0 3px var(--signal-bg); }
.bf-tl-card { padding-bottom: 18px; }

/* ============================================================
   VARIATION C — hero + compact list
   ============================================================ */
.digest--hero { padding: 22px 24px; gap: 14px; border-left-width: 3px; }
.digest--hero .digest__title { font-size: 21px; letter-spacing: -0.3px; }
.digest--hero .digest__body { font-size: 14.5px; line-height: 1.7; max-width: 64ch; }

/* watchlist heat strip (overall movers behind the narration) */
.bf-heat__cell { display: flex; flex-direction: column; gap: clamp(2px, 0.3vw, 5px); min-width: clamp(82px, 6.5vw, 132px); padding: clamp(9px, 0.7vw, 13px) clamp(11px, 0.9vw, 16px);
  border: 0.5px solid var(--border-default); border-radius: var(--radius-sm); background: var(--bg-surface); text-decoration: none; cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out); }
.bf-heat__cell:hover { border-color: var(--color-signal); background: var(--signal-bg); }
.bf-heat__sym { font-family: var(--font-display); font-size: clamp(11px, 0.82vw, 14px); font-weight: 700; color: var(--text-primary); }
.bf-heat__d { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: clamp(12px, 0.95vw, 16px); font-weight: 600; }
.bf-heat__d.up { color: var(--data-up); } .bf-heat__d.down { color: var(--data-down); } .bf-heat__d.flat { color: var(--data-flat); }

.bf-list { display: flex; flex-direction: column; gap: 8px; }
.bf-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 13px 15px; border: 0.5px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--bg-primary); cursor: pointer; text-decoration: none;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out); }
.bf-row:hover { border-color: var(--color-signal); background: var(--bg-surface); }
.bf-row--unread { border-left: 3px solid var(--color-signal); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.bf-row__time { font-family: var(--font-display); font-size: 11px; color: var(--text-muted); white-space: nowrap; min-width: 96px; }
.bf-row__time b { display: block; color: var(--text-secondary); font-weight: 700; font-size: 11.5px; letter-spacing: 0.3px; }
.bf-row__ttl { font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-row__ttl b { color: var(--text-primary); font-weight: 600; }
.bf-row__meta { font-family: var(--font-display); font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.bf-row__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-signal); }
.bf-list-h { font-family: var(--font-ui); font-size: 11px; letter-spacing: 1.25px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin: 22px 0 10px; }

/* ----- header row: title + meta + mark-all-read ----- */
.bf-headrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bf-markall { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-ui); font-size: 12px;
  color: var(--text-muted); background: transparent; border: 0.5px solid var(--border-default);
  border-radius: var(--radius-sm); padding: 7px 12px; cursor: pointer; white-space: nowrap;
  transition: color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out); }
.bf-markall:hover { color: var(--color-signal); border-color: var(--color-signal); background: var(--signal-bg); }
.bf-markall:disabled { opacity: 0.45; cursor: default; }
.bf-markall:disabled:hover { color: var(--text-muted); border-color: var(--border-default); background: transparent; }
.bf-unread-c { font-family: var(--font-display); }

/* unread count chip in the meta line */
.bf-page-h .meta .bf-cnt { color: var(--color-signal); font-weight: 700; }

/* ----- states (loading / empty / no-key / failure) ----- */
.bf-statebox { padding: 20px 0 8px; }
.bf-statebox .state-fig { max-width: 420px; }
.bf-skel-feed { display: flex; flex-direction: column; gap: 12px; }
.bf-skel-card { border: 0.5px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--bg-primary); padding: 16px 18px; display: flex; flex-direction: column; gap: 11px; }
.bf-skel-card .skel--title { width: 64%; }
.bf-skel-tiles { display: flex; gap: 6px; }
.bf-skel-tiles .skel { width: 72px; height: 30px; }

/* the no-key nudge reuses .state-fig; give the icon the sage key tone */
.bf-nokey .state-fig__icon { background: var(--signal-bg); color: var(--color-signal); border-color: transparent; }

/* ambient auto-read: when an unread card dwells in view it "breathes" its sage
   dot + left accent, then marks read. Slow + ease-in-out so it reads as calm,
   not a flash — cadence is a ~7x multiple of the DS slow threshold (360ms). */
@keyframes bf-breathe-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes bf-breathe-edge {
  0%, 100% { border-left-color: var(--color-signal); }
  50% { border-left-color: color-mix(in oklab, var(--color-signal) 26%, transparent); }
}
.bf-breathing .digest__dot,
.bf-breathing .bf-row__dot { animation: bf-breathe-dot 2.4s var(--ease-in-out) infinite; }
.bf-breathing.digest--unread,
.bf-breathing.bf-row--unread { animation: bf-breathe-edge 2.4s var(--ease-in-out) infinite; }
@media (prefers-reduced-motion: reduce) {
  .bf-breathing .digest__dot, .bf-breathing .bf-row__dot,
  .bf-breathing.digest--unread, .bf-breathing.bf-row--unread { animation: none; }
}

/* responsive: collapse the timeline rail + heat on narrow screens */
@media (max-width: 640px) {
  .bf-tl-item { grid-template-columns: 1fr; gap: 4px; }
  .bf-tl-rail { display: none; }
  .bf-tl-time { text-align: left; padding-top: 0; display: flex; align-items: baseline; gap: 8px; }
  .bf-tl-time .at { margin-top: 0; }
  .bf-row { grid-template-columns: 1fr auto; }
  .bf-row__time { grid-column: 1 / -1; min-width: 0; }
  .digest--hero { padding: 18px 16px; }
  .digest--hero .digest__title { font-size: 18px; }
  .digest--hero .digest__body { font-size: 13.5px; }
  .bf-headrow { align-items: flex-start; }
}
