/*
 * Story cards on the list pages (All Stories, Grouped Stories, Headlines).
 * Linked after theme.css by articles.html and headlines_feed.html, so the two
 * lists can't drift apart. Card layout: image, headline, one metadata row,
 * the Left/Center/Right balance, the summary (Headlines only), one action row.
 */

.story {
    /* "Back to Feed" lands on #story-<id>; clear the sticky top bar
       (65px desktop, 80px phone). */
    scroll-margin-top: 96px;
    background: var(--surface);
    border-radius: 16px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.story:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,0.1); }

.story-layout { display: flex; }

.story-image {
    width: 260px;
    min-width: 260px;
    min-height: 180px;
    background: var(--btn-muted-bg);
    position: relative;
    overflow: hidden;
}
.story-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.story:hover .story-image img { transform: scale(1.05); }
.story-image-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-faint); font-size: 40px;
    background: linear-gradient(135deg, rgba(164, 60, 181, 0.1) 0%, rgba(164, 60, 181, 0.02) 100%);
}

.story-content { flex: 1; min-width: 0; padding: 22px 24px; display: flex; flex-direction: column; }

.story h2 { font-size: var(--fs-card-title); font-weight: 800; color: var(--text); line-height: 1.3; letter-spacing: -0.3px; margin-bottom: 8px; }
.story h2 a { color: inherit; text-decoration: none; }
.story h2 a:hover { color: var(--accent-text); text-decoration: underline; }

/* One muted row: "Updated 3 hours ago · 7 articles · AI headline", plus flags. */
.card-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 0;
    font-size: var(--fs-meta); color: var(--text-muted);
    margin-bottom: 16px;
}
.card-meta .meta-item + .meta-item::before { content: "·"; margin: 0 8px; color: var(--text-faint); }
.card-flag {
    margin-left: 10px;
    padding: 2px 8px; border-radius: 6px;
    font-size: var(--fs-label); font-weight: 700;
    background: var(--accent); color: #fff;
}
.card-flag.flag-new { background: var(--bias-1-bg); color: var(--bias-1-fg); }

/* Left / Center / Right article counts. */
.bias-balance {
    display: flex;
    margin-bottom: 16px;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.bias-col { flex: 1; text-align: center; padding: 8px 5px 6px; }
.bias-col + .bias-col { border-left: 1px solid var(--border); }
.bias-col-label {
    display: inline-block;
    font-size: var(--fs-label); font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
    border-bottom: 2px solid currentColor; padding-bottom: 2px; margin-bottom: 2px;
}
.bias-col.left .bias-col-label   { color: var(--bias-left-text); }
.bias-col.center .bias-col-label { color: var(--bias-center-text); }
.bias-col.right .bias-col-label  { color: var(--bias-right-text); }
.bias-col-count { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.2; }

.summary {
    background: var(--summary-bg);
    border-left: 4px solid var(--accent);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    border-radius: 0 12px 12px 0;
}
.summary.pending { color: var(--text-faint); font-style: italic; background: var(--btn-muted-bg); border-left-color: var(--border); }
.summary-label { font-size: var(--fs-label); font-weight: 800; text-transform: uppercase; color: var(--accent-text); letter-spacing: 1px; margin-bottom: 6px; }

.btn {
    display: inline-block; border: none; padding: 8px 16px; border-radius: 10px;
    font-size: var(--fs-label); font-weight: 600; cursor: pointer; white-space: nowrap;
    text-decoration: none; transition: all 0.2s;
}
.btn-dark         { background: var(--accent); color: white; }
.btn-dark:hover   { background: var(--accent-dark); transform: translateY(-1px); }
.btn-muted        { background: var(--btn-muted-bg); color: var(--btn-muted-text); }
.btn-muted:hover  { background: var(--input-border); }

/* The card's buttons sit side by side and wrap when the card is narrow. */
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.card-actions > * { flex: 1 1 220px; }
.card-actions form { display: flex; }
.card-actions .btn { width: 100%; text-align: center; padding: 11px 12px; font-size: var(--fs-meta); font-weight: 700; }

@media (max-width: 900px) {
    .story-layout { flex-direction: column; }
    .story-image { width: 100%; height: 200px; min-width: unset; }
}
