/* ==========================================================================
   rssnews.io workspace: Θέματα and Πηγές views (js/explore.js)
   Workspace redesign, phases 3-4 (2026-10-31). Spec WORKSPACE-PHASE34-SPEC.md §2.

   Tokens only from editorial.css (--ink --muted --rule --rule-strong --field
   --surface --paper --hover --nav-active --accent --red --font-* --r-*) and
   the section dots in workspace.css. Loaded after editorial.css.

   Layout stability: every slot that data fills later has a fixed minimum
   height (count line, three story rows, the status line), so data arriving
   moves nothing.
   ========================================================================== */

/* custom.css sets every p/li/span/div to 1rem/1.6; here they follow their
   parent (0,0,1, loaded later). Every class rule below still wins. */
:where(.wse) :is(p, li, span, div, label) {
  font-size: inherit;
  line-height: inherit;
}

.wse {
  font-family: var(--font-ui);
  color: var(--ink);
}
.wse ul,
.wse ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.wse p { margin: 0; }
.wse :is(a, button, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wse-head { margin: 0 0 16px; }
.wse-title {
  margin: 0;
  font: 700 22px/28px var(--font-headline);
  color: var(--ink);
}
.wse-sub {
  min-height: 20px;
  margin-top: 4px;
  font: 400 14px/20px var(--font-ui);
  color: var(--muted);
}
.wse-sub.is-empty { visibility: hidden; }

/* ==========================================================================
   Θέματα: one card per section, then the Καιρός tool card
   ========================================================================== */
.wse-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.wse-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
}
.wse-card-title {
  display: flex;
  align-items: center;
  margin: 0;
  font: 700 17px/24px var(--font-headline);
  color: var(--ink);
}
.wse-card-title .ws-dot { margin: 0 8px 0 0; }
.wse-count {
  min-height: 18px;
  margin: 2px 0 10px;
  font: 400 13px/18px var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
/* Three rows of 69px whatever the data (border 1 + 6 + 38 + 2 + 16 + 6, border-box);
   min-height, so
   text spacing overrides grow it instead of clipping */
.wse-stories { min-height: 207px; }
.wse-story {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 69px;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
}
.wse-story:first-child { border-top: 0; }
.wse-story.is-skeleton::before,
.wse-story.is-skeleton::after {
  content: "";
  display: block;
  height: 12px;
  margin: 5px 0;
  border-radius: 3px;
  background: var(--hover);
}
.wse-story.is-skeleton::after { width: 55%; }
.wse-story-link {
  min-height: 38px;
  font: 600 14.5px/19px var(--font-headline);
  color: var(--ink);
  text-decoration: none;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.wse-story-link:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.wse-story-count {
  font: 400 12px/16px var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.wse-story-empty {
  justify-content: center;
  font: 400 13px/18px var(--font-ui);
  color: var(--muted);
}
.wse-more {
  align-self: flex-start;
  margin-top: auto;
  padding: 8px 0 2px;
  font: 600 14px/20px var(--font-ui);
  color: var(--red);
  text-decoration: none;
}
.wse-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.wse-tool .wse-tool-icon {
  width: 16px;
  margin-right: 8px;
  font-size: 15px;
  text-align: center;
  color: var(--muted);
}
.wse-tool-note {
  margin: 6px 0 12px;
  font: 400 14px/20px var(--font-ui);
  color: var(--muted);
}

/* ==========================================================================
   Πηγές: filter, sort, one row per source
   ========================================================================== */
.wse-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}
.wse-field {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 420px;
}
.wse-label {
  font: 600 13px/18px var(--font-ui);
  color: var(--ink);
}
.wse-filter {
  height: 40px;
  padding: 0 12px;
  font: 400 15px/20px var(--font-ui);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--field);
  border-radius: var(--r-ui);
}
.wse-filter::placeholder { color: var(--muted); }
.wse-seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-ui);
}
.wse-seg-btn {
  min-height: 40px;
  padding: 0 14px;
  font: 500 14px/20px var(--font-ui);
  color: var(--ink);
  background: var(--surface);
  border: 0;
  cursor: pointer;
}
.wse-seg-btn + .wse-seg-btn { border-left: 1px solid var(--rule-strong); }
.wse-seg-btn[hidden] { display: none; }
.wse-seg-btn[aria-pressed="true"] {
  font-weight: 700;
  background: var(--nav-active);
}
.wse-seg-btn:hover { background: var(--hover); }
.wse-seg-btn:focus-visible { outline-offset: -2px; }
.wse-status {
  min-height: 20px;
  margin: 14px 0 6px;
  font: 400 13px/20px var(--font-ui);
  color: var(--muted);
}

.wse-src {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
  grid-template-areas: "fav main today actions";
  align-items: center;
  column-gap: 12px;
  min-height: 60px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
}
.wse-src[hidden] { display: none; }
.wse-fav {
  grid-area: fav;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fav-plate);
}
.wse-fav img {
  display: block;
  width: 16px;
  height: 16px;
  max-width: none;
}
.wse-fav.is-fallback {
  background: var(--hover);
  font: 700 11px/20px var(--font-ui);
  color: var(--muted);
}
.wse-src-main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wse-src-name {
  overflow: hidden;
  font: 600 15px/20px var(--font-ui);
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wse-src-sections {
  font: 400 12.5px/18px var(--font-ui);
  color: var(--muted);
}
.wse-src-sec {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}
.wse-src-sec .ws-dot { width: 7px; height: 7px; margin: 0 5px 0 0; }
.wse-src-today {
  grid-area: today;
  font: 400 13px/18px var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.wse-src-actions {
  grid-area: actions;
  display: flex;
  gap: 8px;
}
.wse-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  font: 600 13px/18px var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-ui);
  cursor: pointer;
}
.wse-btn:hover { background: var(--hover); }
.wse-src-myfeed::before {
  content: "+";
  content: "+" / "";
  font-weight: 700;
}
.wse-src-myfeed[aria-pressed="true"] {
  background: var(--nav-active);
  border-color: var(--accent);
}
.wse-src-myfeed[aria-pressed="true"]::before {
  content: "✓";
  content: "✓" / "";
  color: var(--accent);
}
.wse-empty,
.wse-error-text {
  padding: 16px 0;
  font: 400 14px/20px var(--font-ui);
  color: var(--muted);
}
.wse-error { padding-bottom: 16px; }

/* Phones: name and today on one line, the actions under them */
@media (max-width: 599px) {
  .wse-src {
    grid-template-columns: 20px minmax(0, 1fr) auto;
    grid-template-areas:
      "fav main today"
      ". actions actions";
    row-gap: 8px;
  }
  .wse-seg { width: 100%; }
  .wse-seg-btn { flex: 1 1 0; }
  .wse-field { max-width: none; }
}

@media (pointer: coarse) {
  .wse-btn { min-height: 44px; }
  .wse-seg-btn { min-height: 44px; }
  .wse-filter { height: 44px; }
}

@media (prefers-reduced-motion: no-preference) {
  .wse-btn,
  .wse-seg-btn { transition: background-color 0.12s ease, border-color 0.12s ease; }
}

@media (forced-colors: active) {
  .wse-card { border-color: CanvasText; }
  .wse-seg-btn[aria-pressed="true"],
  .wse-src-myfeed[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}
