/*
story-cards.css
Role: gallery card styles.
Responsibility: story cards, card metadata, and gallery loading shells.
Note: Modify only from the latest local file.
*/
.card {
    background: var(--panel);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: var(--space-sm);
}

.signal-card {
    border-top: none;
}

.local-card {
    border-top: 5px solid var(--border-local);
}

.story-card-trigger {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.story-card-trigger:hover .title,
.story-card-trigger:focus-visible .title {
    color: var(--link-text);
}

.story-card-trigger:focus-visible {
    outline: 2px solid var(--border-accent);
    outline-offset: -2px;
}

.card-image-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--image-bg);
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-body {
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
}

.title {
    font-size: var(--text-body);
    font-weight: 700;
    line-height: var(--leading-body);
    margin-bottom: 2px;
    color: var(--text);
    text-shadow: var(--text-shadow-heading);
}

.card-bottom-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.card-meta-block {
    display: flex;
    justify-content: center;
    width: 100%;
    align-self: stretch;
    max-width: 100%;
    box-sizing: border-box;
    background: var(--panel-soft);
    border-radius: var(--radius);
    padding: 7px var(--space-sm);
}

.card-meta-block-wide {
    display: flex;
    width: 100%;
    align-self: stretch;
    box-sizing: border-box;
}

.card-signal-label {
    min-width: 0;
    white-space: nowrap;
    color: var(--muted);
    font-size: var(--text-meta);
    line-height: var(--leading-body);
    font-weight: 400 !important;
    font-family: inherit !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.card-meta-line-signals {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: end;
}

.card-signal-meter {
    min-width: 0;
    width: 100%;
}

.card-meta-line-signals > .card-signal-meter {
    display: flex;
    flex-direction: column;
    justify-self: stretch;
    align-self: stretch;
    min-width: 0;
    width: 100%;
}

.card-meta-line-signals > .card-signal-meter .signal-card-bar,
.card-meta-line-signals > .card-signal-meter .signal-card-bar-scalar-mini {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.card-signal-label {
    display: block;
    margin-bottom: -8px;
}


.signal-card-bar-scalar-mini {
    margin-top: 0;
    height: 7px;
}

.card-meta-line-signals .signal-card-marker {
    top: -1px;
    width: 14px;
    height: 10px;
}

.card-meta-line {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    font-size: var(--text-meta);
    color: var(--muted);
    line-height: var(--leading-body);
}

.meta-dot {
    color: var(--muted-2);
}

.card-meta-subline,
.card-excerpt,
.summary,
.source-list,
.source-pill,
.source-overflow,
.source-overflow-menu,
.source-overflow-toggle,
.source-overflow-link {
    display: none !important;
}

.card-footer {
    margin-top: auto;
}

.debug-line {
    font-size: 0.8rem;
    color: var(--debug);
    margin-top: var(--space-sm);
    line-height: 1.4;
}

.empty {
    color: var(--muted-2);
    background: var(--panel);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.filter-empty-message {
    width: fit-content;
    max-width: min(100%, 560px);
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.loading-shell {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    min-height: 240px;
}

.loading-shell[hidden] {
    display: none !important;
}

.loading-shell-card {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: 0 8px 36px rgba(0, 0, 0, 0.1), var(--shadow);
    padding: 20px 24px;
    border: 1px solid var(--border);
    width: min(calc(100% - 32px), 460px);
    text-align: center;
}

.loading-shell-title {
    font-size: var(--text-panel);
    font-weight: 700;
    color: var(--text);
}

.loading-error {
    margin-bottom: 18px;
}

#story-sections,
#debug-sections {
    min-height: 220px;
}


.article-flat-card .article-flat-source {
    font-weight: 600;
    color: var(--text);
}

.article-flat-card .card-meta-sep {
    color: var(--muted-2);
}

.card-logo-wrap {
    background: var(--panel-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.card-logo {
    max-width: 120px;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    opacity: 0.75;
}

