/* www/static/css/news.css
 * news.ungovr.org brand tokens + page styles.
 * UnGovr Oversight family chrome: warm-cream shared surfaces, ink primary
 * (news.ungovr.org has no single member hue of its own, it aggregates every
 * member's coverage), factual tone throughout, no red/alarm anywhere.
 * Parallels www/static/css/agegating.css, watchwatch.css, computecompute.css.
 */

:root {
  --nw-ink: #31302b;
  --nw-accent: #5a4634;
  --nw-gold: #a98637;
  --nw-bg: #faf8f3;
  --nw-bg-elevated: #ffffff;
  --nw-bg-muted: #ede9df;
  --nw-border: #d4cebe;
  --nw-text: #1f2937;
  --nw-text-muted: #5f6776;
  --nw-text-inverse: #faf8f3;
  --nw-font-display: 'Fraunces', 'Newsreader', Georgia, serif;
  --nw-font-body: 'Newsreader', Georgia, serif;
  --nw-font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must always win — page JS toggles visibility with it,
   and any styled display (flex/grid) on an id/class selector would otherwise
   override the UA's [hidden] rule (the .nw-active bug class, now global). */
[hidden] { display: none !important; }

body {
  background: var(--nw-bg);
  color: var(--nw-text);
  font-family: var(--nw-font-body);
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4 {
  font-family: var(--nw-font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 1.5rem 0 0.75rem;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

a { color: var(--nw-accent); text-decoration-color: rgba(90, 70, 52, 0.3); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--nw-accent); }

main { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem 3rem; display: block; }

button { font: inherit; }

/* ---- UnGovr Oversight network ribbon ------------------------------------- */

.nw-ribbon {
  background: var(--nw-ink);
  color: rgba(250, 248, 243, 0.75);
  font-family: var(--nw-font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  padding: 0.35rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  align-items: baseline;
}
.nw-ribbon a { color: rgba(250, 248, 243, 0.85); text-decoration: none; }
.nw-ribbon a:hover { color: #ffffff; text-decoration: underline; }
.nw-ribbon-brand { text-transform: uppercase; letter-spacing: 0.14em; color: rgba(250, 248, 243, 0.55); }
.nw-ribbon-here { color: #ffffff; font-weight: 600; }

/* ---- Header ---------------------------------------------------------------- */

.nw-header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--nw-border);
}
.nw-brand { display: flex; flex-direction: column; line-height: 1.15; }
.nw-wordmark {
  font-family: var(--nw-font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--nw-ink);
  text-decoration: none;
}
.nw-wordmark span { color: var(--nw-accent); }
.nw-family {
  font-family: var(--nw-font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nw-text-muted);
  margin-top: 0.2rem;
}
.nw-header-right { display: flex; align-items: center; gap: 0.8rem; }
.nw-pill {
  font-family: var(--nw-font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nw-text-inverse);
  background: var(--nw-accent);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}
.nw-gear {
  font-family: var(--nw-font-mono);
  font-size: 0.78rem;
  color: var(--nw-text);
  background: var(--nw-bg-elevated);
  border: 1px solid var(--nw-border);
  border-radius: 999px;
  padding: 0.32rem 0.8rem;
  cursor: pointer;
}
.nw-gear:hover { border-color: var(--nw-accent); color: var(--nw-accent); }

/* ---- Compact topline --------------------------------------------------------
 * The news should start as high as possible: the old hero (kicker + display
 * headline + lede) collapses into one body-size line — the h1 text stays for
 * search and assistive tech, styled as a tagline. */
.nw-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.9rem;
  padding: 0.9rem 0 0.2rem;
}
.nw-topline-title {
  margin: 0;
  font-family: var(--nw-font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--nw-text);
}
.nw-topline-stats { font-size: 0.85rem; color: var(--nw-text-muted); }

/* ---- "How UnGovr News works" disclosure -------------------------------------
 * Closed: one small link-style line. Open: the two-column explainer panel
 * appears as a muted well. */
.nw-gnews { margin: 0 0 0.7rem; }
.nw-gnews summary {
  cursor: pointer;
  font-family: var(--nw-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  color: var(--nw-accent);
  margin: 0;
}
.nw-gnews summary:hover { text-decoration: underline; }
.nw-gnews summary::marker { color: var(--nw-accent); }
.nw-gnews[open] summary { margin-bottom: 0.6rem; }
.nw-gnews p { margin: 0; color: var(--nw-text-muted); max-width: 68ch; }
.nw-gnews a { color: var(--nw-accent); }
.nw-gnews-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 2.2rem;
  background: var(--nw-bg-muted);
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  padding: 1rem 1.6rem;
}
@media (max-width: 760px) {
  .nw-gnews-cols { grid-template-columns: 1fr; }
}

/* ---- Filter bar -------------------------------------------------------------- */

.nw-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--nw-border);
  border-bottom: 1px solid var(--nw-border);
  margin-bottom: 0.4rem;
}
.nw-topic-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.nw-chip {
  font-family: var(--nw-font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nw-text);
  background: var(--nw-bg-elevated);
  border: 1px solid var(--nw-border);
  border-radius: 999px;
  padding: 0.32rem 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.nw-chip:hover { border-color: var(--nw-accent); color: var(--nw-accent); }
.nw-chip-on { background: var(--nw-ink); border-color: var(--nw-ink); color: var(--nw-text-inverse); }
.nw-chip-on:hover { color: var(--nw-text-inverse); }
.nw-chip-n { opacity: 0.7; font-variant-numeric: tabular-nums; }

.nw-combo { position: relative; flex: 1 1 12rem; min-width: 10rem; max-width: 18rem; }
.nw-combo input {
  width: 100%;
  font-family: var(--nw-font-body);
  font-size: 0.9rem;
  padding: 0.4rem 1.7rem 0.4rem 0.6rem;
  border: 1px solid var(--nw-border);
  border-radius: 6px;
  background: var(--nw-bg-elevated);
  color: var(--nw-text);
}
.nw-combo input::placeholder { color: var(--nw-text-muted); opacity: 1; }
.nw-combo input:focus { outline: 2px solid var(--nw-accent); outline-offset: 0; }
.nw-combo-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--nw-text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.25rem;
  cursor: pointer;
}
.nw-combo-clear:hover { color: var(--nw-text); }
.nw-combo-list {
  position: absolute;
  left: 0;
  top: calc(100% + 2px);
  z-index: 30;
  min-width: 100%;
  max-width: 22rem;
  max-height: 17rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--nw-bg-elevated);
  border: 1px solid var(--nw-border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(31, 41, 55, 0.14);
}
.nw-combo-list li { padding: 0.3rem 0.6rem; font-size: 0.85rem; white-space: nowrap; cursor: pointer; }
.nw-combo-list li:hover { background: var(--nw-bg-muted); color: var(--nw-accent); }

.nw-paid-toggle {
  font-size: 0.88rem;
  color: var(--nw-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* ---- Active-filter chip row -------------------------------------------------- */

/* Location filter labeling (#4155): the combobox reads as a location filter,
   not a mystery box. */
.nw-locfilter {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.nw-loc-label {
  font-family: var(--nw-font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nw-text-muted);
}

/* Near-you row (#4155): detected coarse location + one-click state filter +
   precise browser-location button. */
.nw-nearbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  padding: 0.4rem 0;
  margin-bottom: 0.4rem;
}
.nw-nearbar-label {
  font-family: var(--nw-font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nw-text-muted);
}
.nw-nearbar-loc {
  font-size: 0.82rem;
  color: var(--nw-text-muted);
}
.nw-nearbtn {
  font-family: var(--nw-font-mono);
  font-size: 0.74rem;
  color: var(--nw-text);
  background: var(--nw-bg-elevated);
  border: 1px solid var(--nw-border);
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  cursor: pointer;
}
.nw-nearbtn:hover { border-color: var(--nw-accent); color: var(--nw-accent); }
.nw-nearbtn:disabled { opacity: 0.6; cursor: default; }
.nw-nearbar-note {
  font-size: 0.78rem;
  color: var(--nw-text-muted);
}

.nw-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  background: var(--nw-bg-muted);
  border: 1px solid var(--nw-border);
  padding: 0.4rem 0.7rem;
  margin: 0 0 1.6rem;
}
.nw-active-label {
  font-family: var(--nw-font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nw-text-muted);
}
.nw-fchip {
  font-family: var(--nw-font-mono);
  font-size: 0.74rem;
  color: var(--nw-text);
  background: var(--nw-bg-elevated);
  border: 1px solid var(--nw-border);
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  cursor: pointer;
}
.nw-fchip span { color: var(--nw-text-muted); margin-left: 0.2rem; }
.nw-fchip:hover { border-color: var(--nw-accent); color: var(--nw-accent); }
.nw-fchip:hover span { color: var(--nw-accent); }

/* ---- Story bands ------------------------------------------------------------- */

.nw-band { padding: 1.8rem 0 2.2rem; border-bottom: 1px solid var(--nw-border); }
.nw-band:last-of-type { border-bottom: none; }
/* Tags never restate their section (#4162): inside a topic band every card
   shares the band's topic, so the topic chip is noise there. It stays
   visible in mixed-topic contexts — Top Stories, and the near-you rail
   (whose cards are JS-cloned OUT of their band, so this scope no longer
   applies to the clone). */
.nw-topic-band .nw-tag-topic { display: none; }

.nw-band h2 {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--nw-ink);
  margin-bottom: 1.1rem;
}
.nw-band-site {
  font-family: var(--nw-font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--nw-text-muted);
  text-decoration: none;
}
.nw-band-site:hover { color: var(--nw-accent); text-decoration: underline; }
.nw-near-where { font-family: var(--nw-font-mono); font-size: 0.85rem; color: var(--nw-text-muted); }
.nw-empty { color: var(--nw-text-muted); font-size: 0.94rem; }

/* ---- Cards -------------------------------------------------------------------- */

.nw-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.1rem;
}

.nw-card {
  position: relative;   /* anchors the .nw-card-juris edge tab */
  display: flex;
  gap: 0.9rem;
  background: var(--nw-bg-elevated);
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  padding: 0.9rem;
}
.nw-thumb {
  flex: none;
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--nw-bg-muted);
}
.nw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nw-card-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.nw-headline {
  font-family: var(--nw-font-display);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.3;
  color: var(--nw-text);
  text-decoration: none;
}
.nw-headline:hover { color: var(--nw-accent); text-decoration: underline; }
.nw-ext { font-size: 0.85em; margin-left: 0.2em; color: var(--nw-text-muted); }

.nw-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--nw-text-muted);
  margin-top: 0.35rem;
}
.nw-meta time { font-family: var(--nw-font-mono); font-variant-numeric: tabular-nums; }
/* Card edge tab (#4104): "Location - Source" set INTO the card's top border
   line at the right edge (fieldset-legend style — the card background masks
   the border where the label crosses it). The location half is a button that
   filters like a chip; the source half replaces the outlet suffix the
   headline used to carry. */
.nw-card-juris {
  position: absolute;
  top: -0.62em;
  right: 14px;
  max-width: 78%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--nw-font-mono);
  font-size: 0.65rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nw-accent);
  background: var(--nw-bg-elevated);
  padding: 0 0.45rem;
}
.nw-card-juris button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.nw-card-juris button:hover { text-decoration: underline; }
.nw-pay {
  font-family: var(--nw-font-mono);
  font-size: 0.82em;
  font-weight: 600;
  color: var(--nw-gold);
  cursor: help;
}
.nw-also { font-size: 0.76rem; color: var(--nw-text-muted); }

.nw-morecov { font-size: 0.78rem; color: var(--nw-text-muted); margin-top: 0.35rem; }
.nw-morecov a { color: var(--nw-text-muted); }
.nw-morecov a:hover { color: var(--nw-accent); }

.nw-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.6rem; }
.nw-tag {
  font-family: var(--nw-font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  white-space: nowrap;
}
.nw-tag-topic { background: var(--nw-ink); color: var(--nw-text-inverse); }
.nw-tag-topic:hover { background: var(--nw-accent); }
.nw-tag-kind { border-color: rgba(169, 134, 55, 0.55); color: var(--nw-accent); background: rgba(169, 134, 55, 0.12); }
.nw-tag-kind:hover { border-color: var(--nw-gold); background: rgba(169, 134, 55, 0.2); }
.nw-tag-loc { border-color: var(--nw-border); color: var(--nw-text-muted); background: var(--nw-bg-elevated); }
.nw-tag-loc:hover { border-color: var(--nw-accent); color: var(--nw-accent); }

.nw-context {
  font-family: var(--nw-font-mono);
  font-size: 0.7rem;
  color: var(--nw-text-muted);
  text-decoration: none;
  margin-left: auto;
  white-space: nowrap;
}
.nw-context:hover { color: var(--nw-accent); text-decoration: underline; }

/* ---- Settings panel ----------------------------------------------------------
 * A fixed sheet on the right edge, not a full-screen modal: the page stays
 * visible and scrollable behind it (Task 12 owns the open/close wiring). */

.nw-settings-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 100;
  width: min(360px, 100vw);
  background: var(--nw-bg);
  border-left: 1px solid var(--nw-border);
  box-shadow: -8px 0 24px rgba(31, 41, 55, 0.16);
  overflow-y: auto;
}
.nw-settings-inner { padding: 1.6rem 1.4rem; }
.nw-settings-inner h2 { margin-top: 0; }
#nw-settings-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.6rem; }
#nw-settings-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--nw-text);
}
#nw-settings-form select {
  font-family: var(--nw-font-body);
  font-size: 0.9rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--nw-border);
  border-radius: 6px;
  background: var(--nw-bg-elevated);
  color: var(--nw-text);
}
#nw-set-topics {
  border: 1px solid var(--nw-border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
#nw-set-topics legend {
  font-family: var(--nw-font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nw-text-muted);
  padding: 0 0.3rem;
}
#nw-set-topics label { flex-direction: row; align-items: center; gap: 0.5rem; }
.nw-btn {
  font-family: var(--nw-font-mono);
  font-size: 0.85rem;
  color: var(--nw-text-inverse);
  background: var(--nw-ink);
  border: 1px solid var(--nw-ink);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  display: inline-block;
}
.nw-btn:hover { background: var(--nw-accent); border-color: var(--nw-accent); color: var(--nw-text-inverse); }
.nw-btn-quiet {
  background: none;
  color: var(--nw-text-muted);
  border-color: var(--nw-border);
  margin-top: 0.8rem;
}
.nw-btn-quiet:hover { background: none; color: var(--nw-text); border-color: var(--nw-text-muted); }
#nw-settings-saved {
  font-family: var(--nw-font-mono);
  font-size: 0.8rem;
  color: var(--nw-gold);
  align-self: center;
}

/* ---- Footer --------------------------------------------------------------------
 * Full-bleed muted-cream band, methodology prose on the left, network links
 * on the right; wraps to a single stacked column on narrow screens. */

.nw-footer {
  background: var(--nw-bg-muted);
  border-top: 1px solid var(--nw-border);
  margin-top: 2rem;
  padding: 2.2rem 1.5rem;
}
.nw-foot-method { max-width: 1080px; margin: 0 auto; }
.nw-foot-method h2 { margin-top: 0; font-size: 1.15rem; }
.nw-foot-method p { color: var(--nw-text-muted); max-width: 68ch; font-size: 0.94rem; }
.nw-foot-method a { color: var(--nw-accent); }
.nw-foot-net {
  max-width: 1080px;
  margin: 1.2rem auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--nw-border);
  font-family: var(--nw-font-mono);
  font-size: 0.78rem;
  color: var(--nw-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
}
.nw-foot-net a { color: var(--nw-text-muted); text-decoration: none; }
.nw-foot-net a:hover { color: var(--nw-accent); text-decoration: underline; }

/* ---- Responsive ------------------------------------------------------------------ */

@media (max-width: 720px) {
  .nw-cards { grid-template-columns: 1fr; }
  .nw-card { flex-direction: column; }
  .nw-thumb { width: 100%; height: 160px; }
  .nw-context { margin-left: 0; }
  .nw-settings-panel { width: 100%; }
}

/* ---- Analysis class (#4144) ------------------------------------------ */
.nw-navlink {
  font: inherit; text-decoration: none; color: inherit;
  padding: 0.2rem 0.6rem; border: 1px solid currentColor;
  border-radius: 999px; font-size: 0.85rem;
}
.nw-navlink:hover { border-color: var(--nw-accent); color: var(--nw-accent); }
.nw-tag-analysis {
  background: var(--nw-ink); color: var(--nw-text-inverse); border-color: var(--nw-ink);
}
.nw-analysis-box {
  border: 1px solid var(--nw-ink); border-radius: 6px;
  padding: 0.75rem 1rem; margin: 1.25rem 0;
}
.nw-analysis-box h2 {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 1rem; margin: 0 0 0.5rem;
}
.nw-analysis-box .nw-analysis-all { font-size: 0.85rem; }
.nw-analysis-box ul { list-style: none; margin: 0; padding: 0; }
.nw-analysis-box li { margin: 0.35rem 0; }
.nw-analysis-meta { display: block; font-size: 0.8rem; opacity: 0.75; }
.nw-analysis-band .nw-cards { margin-top: 0.5rem; }
