/* ---------- Discovery widgets (Django: web/components/category_share.html, source_pick.html,
 * topic_pick.html) ----------
 * Sidebar widgets that lead a reader around the site: the share of the main categories (the press
 * review sections) in the news of the last 24 hours, a source and a topic picked at random among
 * the active ones (they change every hour). They build on the sidebar widget family of
 * story-widgets.css (`.sw`, `.panel-heading`) and the source marks. A main category keeps its hue
 * of the named palette wherever it shows, as the categories are fixed. Every text is cut. */

.dw { min-width: 0; color: var(--text); }
.dw-body { display: grid; gap: 12px; padding: 14px 16px 16px; }
.dw p { margin: 0; }

/* ---- Category share: one bar of 100%, then a row per category ---- */
.dw-share-bar { display: flex; height: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--track); }
.dw-share-bar span { flex: 0 0 var(--share); min-width: 2px; background: var(--section-color, var(--muted)); }
.dw-share-bar span + span { box-shadow: -1px 0 0 var(--panel); }

.dw-share-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.dw-share-list a { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 44px; align-items: center; gap: 8px; padding: 5px 0; color: var(--text); font-size: 12px; }
.dw-share-list a:hover .dw-share-name { color: var(--cyan); }
.dw-share-list .icon { width: 15px; height: 15px; color: var(--section-color, var(--muted)); font-size: 15px; }
.dw-share-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.dw-share-count { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; white-space: nowrap; }
.dw-share-value { color: var(--text); font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-align: right; }

/* Compact: the bar and a legend of chips */
.dw-share-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 0; list-style: none; }
.dw-share-legend a { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; white-space: nowrap; }
.dw-share-legend a::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--section-color, var(--muted)); }
.dw-share-legend b { color: var(--text); font-weight: 600; }

.dw-note { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; line-height: 1.6; }
.dw-note b { color: var(--text); font-weight: 600; }
.dw-note.is-warning { color: var(--color-warning-text); }

/* ---- Source and topic picks ---- */
.dw-pick-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; color: inherit; }
.dw-pick-head:hover .dw-pick-name { color: var(--cyan); }
.dw-pick-head .source-avatar { width: 52px; height: 52px; font-size: 13px; }
.dw-pick-head .source-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dw-pick-icon { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid color-mix(in srgb, var(--section-color, var(--accent)) 45%, var(--line)); background: color-mix(in srgb, var(--section-color, var(--accent)) 10%, transparent); color: var(--section-color, var(--accent)); }
.dw-pick-icon .icon { width: 26px; height: 26px; font-size: 26px; }
.dw-pick-icon.has-image { overflow: hidden; background: none; }
.dw-pick-icon.has-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dw-pick-text { display: grid; gap: 4px; min-width: 0; }
.dw-pick-name { overflow: hidden; color: var(--text); font-family: var(--font-heading); font-size: 16px; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.dw-pick-desc { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dw-pick-path { overflow: hidden; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .05em; text-overflow: ellipsis; white-space: nowrap; }

.dw-stats { display: flex; flex-wrap: wrap; gap: 3px 12px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; }
.dw-stats strong { color: var(--text); font-weight: 600; }

.dw-latest { display: grid; margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.dw-latest li { border-bottom: 1px solid var(--line); }
.dw-latest a { display: grid; gap: 3px; padding: 8px 0; color: var(--text); }
.dw-latest a:hover b { color: var(--cyan); }
.dw-latest b { display: -webkit-box; overflow: hidden; font-family: var(--font-heading); font-size: 12px; font-weight: 500; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dw-latest small { overflow: hidden; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }

.dw-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dw-rotation { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; white-space: nowrap; }
.dw-rotation .icon { width: 12px; height: 12px; font-size: 12px; }
.dw-cta { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-size: 11px; font-weight: 600; white-space: nowrap; }
.dw-cta .icon { width: 14px; height: 14px; font-size: 14px; }
.dw-cta:hover { color: var(--cyan); }

/* Nothing to show: a short empty state, never zeros */
.dw-empty { display: grid; justify-items: center; gap: 6px; padding: 18px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.dw-empty .icon { width: 24px; height: 24px; color: var(--line-bright); font-size: 24px; }
.dw-empty strong { color: var(--text); font-family: var(--font-heading); font-size: 13px; font-weight: 600; }

/* ---- The signed-in reader's follows (sources and topics) with today's new news ---- */
.dw-follows { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.dw-follows a { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 0; color: var(--text); font-size: 12px; }
.dw-follows a:hover .dw-follow-name { color: var(--cyan); }
.dw-follows .source-avatar { width: 22px; height: 22px; font-size: 8px; }
.dw-follows .source-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dw-follows .icon { width: 16px; height: 16px; justify-self: center; color: var(--section-color, var(--accent)); font-size: 16px; }
.dw-follow-img { display: block; width: 16px; height: 16px; justify-self: center; object-fit: cover; }
.dw-follow-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.dw-follow-new { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; white-space: nowrap; }
.dw-follow-new b { color: var(--accent); font-weight: 600; }
.dw-follows a.is-quiet .dw-follow-new b { color: var(--muted); }
