/* ==========================================================================
   Streams — built from the "Streams" screen of design/Epileptic News.dc.html.
   Serves every classified listing: a sentiment class, a ticker, an outlet, the
   whole archive.
   ========================================================================== */

.epi-streams-page {
	max-width: var(--shell);
	margin: 0 auto;
	padding: 30px var(--gutter) 80px;
}

.epi-streams-page__head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 26px;
}

.epi-streams-page__eyebrow {
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 2px;
	color: var(--fg-faint);
	text-transform: uppercase;
	margin-bottom: 10px;
}

.epi-streams-page__title {
	font-size: 44px;
	font-weight: 600;
	letter-spacing: -1.8px;
}

.epi-streams-page__controls {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.epi-segment {
	display: flex;
	padding: 4px;
	border-radius: 11px;
	background: var(--bg-card);
	border: 1px solid var(--line);
}

.epi-segment__item {
	font-family: var(--font-mono);
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 1.4px;
	text-transform: uppercase;
	padding: 8px 15px;
	border-radius: var(--r-chip);
	color: var(--fg-faint);
	transition: color 160ms ease, background 160ms ease;
	white-space: nowrap;
}

.epi-segment__item:hover { color: var(--fg); }

.epi-segment__item[aria-current] { background: rgba(255, 255, 255, 0.06); }

/* --- the watch toggle ------------------------------------------------------
 * Same shell as the sort control beside it: on a ticker archive the two sit in
 * one row and a button that looked like a different species would read as an
 * advert. `display: contents` keeps the <form> out of the flex layout so the
 * button itself is the flex item.
 * -------------------------------------------------------------------------- */

.epi-watchform { display: contents; }

.epi-watchbtn {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px;
	border-radius: var(--r-ctrl);
	border: 1px solid var(--line);
	background: var(--bg-card);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 1.2px;
	color: var(--fg-dim);
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.epi-watchbtn:hover { color: var(--fg); border-color: var(--line-hover); }

.epi-watchbtn.is-on {
	color: var(--ui-bull);
	border-color: rgba(47, 217, 138, 0.45);
	background: rgba(47, 217, 138, 0.08);
}

.epi-watchbtn:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }

.epi-sort {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px;
	border-radius: var(--r-ctrl);
	border: 1px solid var(--line);
	background: var(--bg-card);
	font-family: var(--font-mono);
	font-size: 10px;
	letter-spacing: 1.2px;
	color: var(--fg-dim);
	text-transform: uppercase;
	white-space: nowrap;
}

.epi-sort:hover { color: var(--fg); border-color: var(--line-hover); }

.epi-streams-page__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 22px;
	align-items: start;
}

.epi-rows {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* --- one row --------------------------------------------------------------- */

.epi-row {
	display: grid;
	grid-template-columns: 54px 200px minmax(0, 1fr) 130px;
	gap: 20px;
	align-items: center;
	padding: 16px 20px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-left: 2px solid var(--ui-neut);
	border-radius: 12px;
	background: var(--bg-soft);
	transition: background 160ms ease, border-color 160ms ease;
}

.epi-row:hover { background: #0F1218; border-color: var(--line-hover); }

.epi-row__score {
	font-family: var(--font-mono);
	font-size: 22px;
	font-weight: 600;
	letter-spacing: -1px;
}

.epi-row__media {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: var(--r-chip);
	background: var(--bg-raised);
	background-image: var(--media-hatch);
	overflow: hidden;
}

.epi-row__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.epi-row__title {
	font-size: 17px;
	line-height: 1.25;
	letter-spacing: -0.5px;
	font-weight: 600;
	margin-bottom: 7px;
}

.epi-row__title a { color: var(--fg); }

.epi-row__dek {
	font-size: 13px;
	line-height: 1.5;
	color: var(--fg-mute);
	max-width: 78ch;
}

.epi-row__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 7px;
	font-family: var(--font-mono);
}

.epi-row__src {
	font-size: 10px;
	letter-spacing: 1.2px;
	color: var(--fg-label);
	text-transform: uppercase;
	text-align: right;
}

.epi-row__age { font-size: 10px; color: var(--fg-ghost); }

.epi-row__tag {
	font-size: 9px;
	letter-spacing: 1.2px;
	padding: 3px 7px;
	border-radius: 4px;
	border: 1px solid currentColor;
	text-transform: uppercase;
}

/* --- rail ------------------------------------------------------------------ */

.epi-streams-page__rail {
	position: sticky;
	top: 112px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.epi-statline {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 0;
	border-bottom: 1px solid var(--line-soft);
}

.epi-statline:last-child { border-bottom: 0; }

.epi-statline__k { font-size: 12.5px; color: var(--fg-dim); }

.epi-statline__v {
	font-family: var(--font-mono);
	font-size: 13px;
	font-weight: 500;
}

.epi-tickerlist {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.epi-tickerlist__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-family: var(--font-mono);
	font-size: 11.5px;
	color: var(--fg-soft);
}

.epi-tickerlist__row span:last-child { color: var(--fg-faint); }

/* --- pagination ------------------------------------------------------------ */

.epi-pagination {
	margin-top: 26px;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 1px;
}

.epi-pagination .page-numbers {
	padding: 8px 13px;
	border-radius: var(--r-chip);
	border: 1px solid var(--line);
	background: var(--bg-card);
	color: var(--fg-dim);
}

.epi-pagination .page-numbers.current {
	background: rgba(255, 255, 255, 0.06);
	color: var(--fg);
}

/* --- narrow ---------------------------------------------------------------- */

@media (max-width: 1080px) {
	.epi-streams-page__grid { grid-template-columns: minmax(0, 1fr); }
	.epi-streams-page__rail { position: static; }
}

@media (max-width: 860px) {
	.epi-row { grid-template-columns: 46px minmax(0, 1fr) 110px; }
	.epi-row__media { display: none; }
}

@media (max-width: 640px) {
	.epi-streams-page__title { font-size: 30px; letter-spacing: -1.2px; }
	.epi-row { grid-template-columns: 42px minmax(0, 1fr); gap: 14px; }
	.epi-row__meta {
		grid-column: 1 / -1;
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		gap: 10px;
		flex-wrap: wrap;
	}
	.epi-row__src { text-align: left; }
}

/* ==========================================================================
   The narrative filter.

   Sits above the listing on every Streams archive. Chips are real checkboxes
   with the box hidden — so the whole control is keyboard-reachable and works
   with the script blocked, which matters on a control that decides what news
   the reader is shown.
   ========================================================================== */

.epi-tags {
	border: 1px solid var(--line);
	border-radius: var(--r-panel);
	background: var(--card-gradient);
	padding: 18px 20px;
	margin-bottom: 20px;
}

.epi-tags.is-on { border-color: rgba(47, 125, 255, 0.32); }

.epi-tags__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 18px;
	margin-bottom: 14px;
}

.epi-tags__note {
	font-size: 13px;
	line-height: 1.55;
	color: var(--fg-dim);
	margin-top: 8px;
	max-width: 78ch;
}

.epi-tags__note strong { color: var(--fg); }

.epi-tags__actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

.epi-tags__apply,
.epi-tags__clear {
	font-family: var(--font-mono);
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: 1.3px;
	text-transform: uppercase;
	border-radius: var(--r-ctrl);
	padding: 9px 14px;
	cursor: pointer;
	transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.epi-tags__apply {
	border: 1px solid transparent;
	background: var(--ui-accent);
	color: #fff;
}

.epi-tags__apply:hover { background: #1B5AD9; }

.epi-tags__clear {
	border: 1px solid var(--line-strong);
	background: transparent;
	color: var(--fg-faint);
}

.epi-tags__clear:hover { border-color: var(--ui-bear); color: var(--ui-bear); }

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

.epi-tags__row {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}

.epi-tags__row--chosen {
	padding-bottom: 14px;
	margin-bottom: 14px;
	border-bottom: 1px solid var(--line-soft);
}

.epi-tag {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: rgba(8, 9, 12, 0.5);
	padding: 7px 11px;
	cursor: pointer;
	font-size: 12.5px;
	color: var(--fg-body);
	transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
	user-select: none;
}

/* The box itself is gone, not display:none — a hidden input cannot be focused,
   and the chip has to be reachable by keyboard. */
.epi-tag input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.epi-tag:hover { border-color: var(--line-hover); color: var(--fg); }

.epi-tag:focus-within {
	outline: 2px solid var(--ui-accent);
	outline-offset: 2px;
}

.epi-tag.is-on {
	border-color: rgba(47, 125, 255, 0.5);
	background: rgba(47, 125, 255, 0.14);
	color: var(--fg);
}

.epi-tag.is-on .epi-tag__word { font-weight: 600; }

.epi-tag__x {
	font-size: 15px;
	line-height: 1;
	color: var(--fg-faint);
}

.epi-tag.is-on:hover .epi-tag__x { color: var(--ui-bear); }

.epi-tag__n {
	font-family: var(--font-mono);
	font-size: 9px;
	letter-spacing: 0.6px;
	color: var(--fg-ghost);
	background: rgba(255, 255, 255, 0.05);
	border-radius: 5px;
	padding: 2px 5px;
}

/* A word nothing has been written about. Still selectable — the corpus grows —
   but it should not look like a full shelf. */
.epi-tag.is-empty { opacity: 0.45; }
.epi-tag.is-empty:hover { opacity: 0.8; }

/* --- the free field ---------------------------------------------------------- */

.epi-tags__foot {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: 16px;
	flex-wrap: wrap;
}

.epi-tags__field {
	flex: 1;
	min-width: 220px;
	height: 40px;
	padding: 0 13px;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-ctrl);
	background: var(--bg-card);
	color: var(--fg);
	font-size: 13.5px;
	font-family: inherit;
}

.epi-tags__field::placeholder { color: var(--fg-ghost); }
.epi-tags__field:focus { outline: none; border-color: var(--ui-accent); }

.epi-tags__where {
	font-family: var(--font-mono);
	font-size: 9.5px;
	letter-spacing: 1.1px;
	text-transform: uppercase;
	color: var(--fg-ghost);
}

.epi-tags__where a { color: var(--ui-accent-soft); }
.epi-tags__where a:hover { color: var(--ui-accent-bright); }

/* --- the filtered empty state -------------------------------------------------- */

.epi-empty--filtered {
	border: 1px dashed rgba(255, 255, 255, 0.14);
	border-radius: var(--r-panel);
	padding: 26px 24px;
	text-align: left;
}

.epi-empty--filtered p {
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--fg-dim);
	margin-bottom: 16px;
}

.epi-empty--filtered strong { color: var(--fg); }

@media (max-width: 720px) {
	.epi-tags { padding: 15px 14px; }
	.epi-tags__head { flex-direction: column; gap: 12px; }
	.epi-tags__actions { width: 100%; }
	.epi-tags__apply, .epi-tags__clear { flex: 1; }
	.epi-tags__foot { flex-direction: column; align-items: stretch; }
}
