/* ============================================================
   Alpha Finance v2: the newsfeed
   Loaded after sentiment.css (panels, feed line, mini bars, tables) and
   before terminal.css. Story cards, the wire chips and the feed table.
   ============================================================ */

/* ---------- hero (same shape as the sentiment views) ---------- */

.nwshero { border-bottom: 1px solid var(--line); }
.nwshero-grid { display: grid; grid-template-columns: 1fr 400px; gap: 0 56px; align-items: center; }
.nwshero-inner { padding: 26px 0 0; max-width: 680px; }
.nwshero h1 { font-family: var(--display); font-size: clamp(28px, 3.4vw, 40px); font-weight: 700; line-height: 1.06; letter-spacing: -0.028em; }
.nwshero .dek { margin-top: 12px; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.nwshero-side { padding: 24px 0 10px; }
.nwsstats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nwsstat { padding: 13px 15px 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.nwsstat-k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.nwsstat-v { margin-top: 9px; font-family: var(--display); font-size: 19px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.nwsstat-v.bull { color: var(--pos-text); }
.nwsstat-v.bear { color: var(--neg-text); }
.nwsstat-s { margin-top: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.04em; color: var(--muted); }

/* ---------- tone chips ---------- */

.tone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tone i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone.bull { color: var(--pos-text); background: color-mix(in srgb, var(--pos) 14%, transparent); }
.tone.bear { color: var(--neg-text); background: color-mix(in srgb, var(--neg) 14%, transparent); }
.tone.flat { color: var(--muted); background: var(--bg-2); }

/* ---------- major stories ---------- */

.story-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.story {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  min-height: 150px;
}
.story.is-lead { border-color: var(--line-2); }
.story-img {
  display: block;
  margin: -16px -16px 2px;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.story-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.story:hover .story-img img { transform: scale(1.03); }
.story-top { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; color: var(--muted); }
.story-top .n { color: var(--text); font-weight: 500; }
.story-top .tone { margin-left: auto; }
.story h3 { font-family: var(--display); font-size: 14.5px; font-weight: 700; line-height: 1.3; letter-spacing: -0.012em; color: var(--text); }
.story h3 a { color: inherit; }
.story h3 a:hover { color: var(--lime); }
.story p { font-size: 12.5px; line-height: 1.5; color: var(--text-2); flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story-wires { display: flex; flex-wrap: wrap; gap: 4px; }
.story-wires a {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}
.story-wires a:hover { color: var(--text); border-color: var(--line-2); }
.story-assets { display: flex; gap: 4px; }
.story-assets span, .nwtable .asset {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--text-2);
}

/* ---------- filters ---------- */

.nw-bar { align-items: center; }
.nw-filters { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nw-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.nw-chips button {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.nw-chips button[aria-pressed="true"] { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.nw-chips button:hover { color: var(--text); }
.nw-select {
  height: 30px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b727c' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 12px;
  font-size: 12px;
  color: var(--text-2);
  appearance: none;
  -webkit-appearance: none;
}
.nw-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  width: 200px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
}
.nw-search:focus-within { border-color: var(--line-2); }
.nw-search svg { width: 12px; height: 12px; flex-shrink: 0; }
.nw-search input { flex: 1; min-width: 0; border: 0; background: none; font-size: 12.5px; color: var(--text); outline: none; }
.nw-search input::placeholder { color: var(--muted); }
.nw-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- the feed table ---------- */

.nwtable { white-space: normal; }
.nwtable th, .nwtable td { text-align: left; }
.nwtable td { height: auto; padding: 11px 14px; vertical-align: top; }
.nwtable td.t { width: 80px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; padding-top: 13px; }
.nwtable td.h { min-width: 320px; }
.nwtable .hrow { display: flex; gap: 14px; align-items: flex-start; }
.nwtable .hrow > div { min-width: 0; flex: 1; }
.nwtable .th {
  display: block;
  flex-shrink: 0;
  width: 96px;
  aspect-ratio: 16 / 10;
  border-radius: 5px;
  background: var(--bg-2);
  overflow: hidden;
}
.nwtable .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nwtable td.h a { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.4; color: var(--text); }
.nwtable td.h a:hover { color: var(--lime); }
.nwtable td.h small { display: block; margin-top: 3px; font-size: 12px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nwtable td.w { width: 110px; white-space: nowrap; font-size: 12px; color: var(--text-2); padding-top: 13px; }
.nwtable td.a { width: 120px; padding-top: 12px; }
.nwtable td.a .asset { margin-right: 3px; }
.nwtable td.s { width: 96px; padding-top: 12px; }
.nwtable tr.is-day td { height: 30px; padding: 6px 14px; background: var(--bg-2); font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.nw-foot { align-items: center; }
.nw-more {
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
}
.nw-more:hover { color: var(--text); border-color: var(--line-2); }
.nw-more[hidden] { display: none; }

/* day bars: a diverging bar from the centre */
.tone-bar { position: relative; height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.tone-bar::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.tone-bar i { position: absolute; top: 0; bottom: 0; }
.tone-bar i.pos { left: 50%; background: var(--pos); }
.tone-bar i.neg { right: 50%; background: var(--neg); }

/* ---------- responsive ---------- */

@media (max-width: 1180px) { .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1080px) { .nwshero-grid { grid-template-columns: 1fr; } .nw-filters { margin-left: 0; } }
@media (max-width: 760px) {
  .story-grid { grid-template-columns: minmax(0, 1fr); }
  .nwtable td.a, .nwtable td.w { display: none; }
  .nwtable .th { width: 64px; }
  .nw-search { width: 100%; }
}

/* Assets in the news: the tag carries its mark, so the name column is wider
   than the shared one and lays the mark, the ticker and the tone on a line. */
#nw-assets .mini-head, #nw-assets .mini-row { grid-template-columns: 190px 1fr 70px; }
#nw-assets .mini-n { display: flex; align-items: center; gap: 8px; }
#nw-assets .mini-n .exlogo { width: 18px; height: 18px; }
#nw-assets .mini-n b { font-weight: 600; }
#nw-assets .mini-n small { margin-left: 0; }
