/* ---------- Story and dossier cards, widgets and plugins ----------
 * Shared by the list pages (stories.html, dossiers.html) and the blocks that show stories and
 * dossiers on other pages: a story card, a dossier card, sidebar widgets (stories in the news
 * today, active dossiers, the story of an article) and main content plugins (a strip of story
 * cards, dossier cards, "Az esemény folytatódik"). Self-contained apart from the global tokens,
 * source marks, panel headings and media-fit. Shown in components/stories.html. */

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

.sw-photo { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); background: var(--panel); }
.sw-photo::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(0deg, var(--media-overlay-mid), transparent 45%); }
/* A card in a grid without a cover image: the section icon on a HUD field keeps the row even; a
   photo that fails to load (media-fit.js: is-missing) shows the same, with the icon kept hidden
   in the photo box */
.sw-photo-icon { display: none; }
.sw-photo:has(.media-fit.is-missing) .media-fit,
.sw-photo.is-fallback,
.sw-photo:has(.media-fit.is-missing) { display: grid; place-items: center; background: repeating-linear-gradient(0deg, transparent 0 15px, color-mix(in srgb, var(--hud-grid) 55%, transparent) 15px 16px), repeating-linear-gradient(90deg, transparent 0 15px, color-mix(in srgb, var(--hud-grid) 55%, transparent) 15px 16px), var(--panel-hover); }
.sw-photo.is-fallback::before,
.sw-photo:has(.media-fit.is-missing)::before { background: none; }
.sw-photo:has(.media-fit.is-missing) .sw-photo-icon { display: block; }
.sw-photo.is-fallback .icon,
.sw-photo:has(.media-fit.is-missing) .sw-photo-icon { color: color-mix(in srgb, var(--color-primary) 70%, var(--muted)); font-size: 40px; }
.sw-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; }
.sw-tag { padding: 3px 6px; background: var(--accent); color: var(--accent-ink); }
.sw-status { padding: 2px 5px; border: 1px solid var(--color-success); color: var(--color-success); }
.sw-status.is-paused { border-color: var(--color-warning-text); color: var(--color-warning-text); }
.sw-status.is-closed { border-color: var(--line); color: var(--muted); }
.sw-title { display: -webkit-box; overflow: hidden; color: var(--text); font-family: var(--font-heading); font-size: 17px; font-weight: 600; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
a.sw-title:hover, .sw-card:hover .sw-title { color: var(--color-primary); }
.sw-dev { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.sw-dev b { color: var(--color-primary); font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: .05em; }
.sw-stats { display: flex; flex-wrap: wrap; gap: 3px 10px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; }
.sw-stats strong { color: var(--text); font-weight: 600; }
.sw-marks { display: flex; align-items: center; gap: 3px; }
.sw-marks .more { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.sw-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.sw-cta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--color-primary) 55%, var(--line)); color: var(--color-primary); font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.sw-cta:hover { background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.sw-note { display: flex; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }
.sw-note .icon { flex: none; color: var(--muted); font-size: 16px; }

/* ---- Story card: cover image (or none), section, title, latest development, figures ---- */
.sw-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; color: var(--text); }
.sw-card-body { display: flex; flex: 1; flex-direction: column; gap: 9px; padding: 14px 16px; }

/* ---- Dossier card: cover image, status, title, description, tags, activity ---- */
.sw-dossier .sw-title { font-size: 19px; }
.sw-desc { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.sw-topics { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sw-topics > span { padding: 2px 7px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.sw-activity { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.sw-columns { display: grid; grid-template-columns: repeat(14, 5px); gap: 2px; align-items: end; height: 24px; }
.sw-columns span { display: flex; flex-direction: column-reverse; gap: 1px; height: 100%; }
.sw-columns i { display: block; min-height: 2px; height: calc(var(--n) / var(--max) * 100%); background: var(--color-primary); }
.sw-columns i.is-2 { background: color-mix(in oklab, var(--color-primary) 55%, var(--track)); }
.sw-columns span.is-empty::after { content: ""; display: block; height: 1px; background: var(--track); }
.sw-today { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; white-space: nowrap; }
.sw-today strong { color: var(--color-primary); }

/* ---- Widgets ---- */
/* Stories in the news today: ranked rows */
.sw-rank { display: grid; margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.sw-rank li + li { border-top: 1px solid var(--line); }
.sw-rank a { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 10px; padding: 9px 0; color: var(--text); counter-increment: rank; }
.sw-rank a::before { content: counter(rank, decimal-leading-zero); grid-row: span 2; color: var(--color-primary); font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding-top: 2px; }
.sw-rank b { display: -webkit-box; overflow: hidden; font-size: 13px; font-weight: 600; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.sw-rank a:hover b { color: var(--color-primary); }
.sw-rank .sw-stats { align-items: center; }
.sw-rank .source-avatar { width: 18px; height: 18px; font-size: 8px; }

/* Active dossiers: a row with a thumbnail, the title and the activity */
.sw-dossier-rows { display: grid; margin: 0; padding: 0; list-style: none; }
.sw-dossier-rows li + li { border-top: 1px solid var(--line); }
.sw-dossier-rows a { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 9px 0; color: var(--text); }
.sw-thumb { position: relative; grid-row: span 2; width: 44px; height: 44px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-hover); color: var(--color-primary); display: grid; place-items: center; }
.sw-thumb .icon { font-size: 18px; }
.sw-dossier-rows b { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sw-dossier-rows a:hover b { color: var(--color-primary); }
.sw-dossier-rows .sw-activity { gap: 8px; }

/* Counts: a row per item with its icon or source mark, the name and the count; a row links when
 * the item has a page */
.sw-counts { display: grid; margin: 0; padding: 0; list-style: none; }
.sw-counts li + li { border-top: 1px solid var(--line); }
.sw-counts li > * { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; color: var(--text); }
.sw-counts b { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sw-counts a:hover b, .sw-counts a[aria-current] b { color: var(--color-primary); }
.sw-counts .panel-icon { width: 22px; height: 22px; }
.sw-counts .source-avatar { width: 22px; height: 22px; font-size: 7px; }
.sw-count { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; white-space: nowrap; }
.sw-count strong { color: var(--text); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sw-fine { color: var(--muted); font-size: 11px; line-height: 1.5; }

/* The news read now: the source mark, the title in two lines, the source and the time */
.sw-reads { display: grid; margin: 0; padding: 0; list-style: none; }
.sw-reads li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; }
.sw-reads li + li { border-top: 1px solid var(--line); }
.sw-reads .source-avatar { width: 22px; height: 22px; font-size: 7px; }
.sw-reads a { display: grid; gap: 3px; min-width: 0; color: var(--text); }
.sw-reads b { display: -webkit-box; overflow: hidden; font-size: 13px; font-weight: 600; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.sw-reads a:hover b { color: var(--color-primary); }
.sw-reads small { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; }

/* The story of an article, with the latest articles of other sources */
.sw-story-of { display: grid; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sw-others { display: grid; margin: 0; padding: 0; list-style: none; }
.sw-others li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 0; }
.sw-others li + li { border-top: 1px solid var(--line); }
.sw-others a { display: grid; gap: 2px; min-width: 0; color: var(--text); font-size: 12px; }
.sw-others a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-others small { color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.sw-others a:hover span { color: var(--color-primary); }

/* ---- Plugins ---- */
.sp-head-body { padding: 16px 18px; }
.sp-cards { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 16px; }
.sp-cards > .sw-card { border: 1px solid var(--line); }
.sp-foot { display: flex; justify-content: flex-end; margin-top: 14px; }

/* "Az esemény folytatódik": the developments after the article that is read */
.sp-continues { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.sp-continues > * { display: grid; gap: 10px; align-content: start; min-width: 0; padding: 18px; }
.sp-continues > * + * { border-left: 1px solid var(--line); }
.sp-continues h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; }
.sp-continues h3 a { color: var(--text); }
.sp-continues h3 a:hover { color: var(--color-primary); }
.sp-timeline { position: relative; display: grid; margin: 0; padding: 0; list-style: none; }
.sp-timeline::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: 12px; width: 1px; background: var(--line); }
.sp-timeline li { position: relative; display: grid; gap: 3px; padding: 8px 0 8px 22px; }
.sp-timeline li::before { content: ""; position: absolute; left: 0; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 3px var(--panel); }
.sp-timeline li.is-read::before { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-bright), 0 0 0 3px var(--panel); }
.sp-timeline small { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; }
.sp-timeline small .accent { color: var(--color-primary); }
.sp-timeline p { font-size: 13px; line-height: 1.5; }
.sp-timeline li.is-read p { color: var(--muted); }

@media (max-width: 860px) {
  .sp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-continues { grid-template-columns: minmax(0, 1fr); }
  .sp-continues > * + * { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .sp-cards { grid-template-columns: minmax(0, 1fr); }
}
