/* Grid layout for article cards */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 20px;
    width: 100%;
    justify-items: stretch;
}

/* article widget base */
.article-widget {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--color-text);
    background: var(--darker-gray);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 26px rgba(0,0,0,0.6);
    transition: transform .18s ease, box-shadow .18s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* decorative bottom gradient / shadow that should move with the card */
.article-widget::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2rem;
    border-bottom: 16px solid var(--darker-gray);
    background: linear-gradient(to bottom, transparent, var(--darker-gray));
    margin: 0;
    pointer-events: none;
    z-index: 0;
    transform: translateY(0);
    transition: transform .18s ease, opacity .18s ease;
    will-change: transform, opacity;
}

/* hover: move the card AND the pseudo-element in lockstep */
.article-widget:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 44px rgba(0,0,0,0.7);
}

/* Optional layout: image at top (if present) */
.article-image {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.45));
    display: block;
    flex-shrink: 0;
    margin-bottom: 10px;
}

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

/* meta row (author, bullet, date) */
.article-meta {
    position: relative; /* required for absolute positioning of .meta-sep */
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    color: var(--color-text-dim);
    font-size: 13px;
    margin-bottom: 6px;
    padding-right: 44px;
}
/* author: allow shrinking and truncate with ellipsis */
.article-meta .news-author {
    color: var(--color-secondary);
    font-weight: 600;
    font-size: 11px;

    display: inline-block;
    left: 0;
    min-width: 0;          /* important so it can shrink inside flex */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* headline */
.article-headline {
    font-size: 18px;
    line-height: 1.12;
    color: var(--color-tertiary);
    margin: 0 0 6px 0;
}

/* tags row uses your existing tag classes (news_tags.css) */
.news-grid .tags-list,
.tags-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 6px 0;
}

/* news tag fallback */
.news-grid .news-tag,
.news-tag {
    font-size: 10px;
    font-weight: bold;
    color: var(--color-primary);
    background-color: var(--lighter-gray);
    padding: 6px 10px;
    border-radius: 15px;
    margin: 0 0.25rem;
    text-transform: uppercase;
    display: inline-block;
}

/* preview summary area */
.news-preview {
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.5;
    margin-top: 6px;
    text-align: left;
    max-height: 7.5em; /* clamp preview height */
    /*overflow: hidden;*/
}

/* small date sits to the right */
.news-date {
    color: var(--color-text-dim);
    font-size: 11px;
    margin-left: auto;    /* push date to the right edge */
    white-space: nowrap;
    flex: 0 0 auto;
    right: 0;
    position: absolute;
}

/* triple-dot menu in top-right — keep it compact and ensure it doesn't overlap visually */
.article-menu {
    position: absolute;
    right: 5px;
    top: 20px;
    font-size: 18px;
    color: var(--color-text-dim);
    cursor: pointer;
    user-select: none;
    z-index: 6;
    padding: 6px;
    border-radius: 8px;
    background: transparent;
}

/* subtle hover style */
.article-menu:hover {
    color: var(--color-primary);
    background: rgba(255,255,255,0.02);
}

/* separator — absolutely positioned; centered vertically and moved horizontally via JS */
.article-meta .meta-sep {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* center the dot at the calculated left */
    pointer-events: none;
    font-size: 12px;
    color: var(--color-text-dim);
    opacity: .85;
    line-height: 1;
    z-index: 2;
    white-space: nowrap;
}


/* if you still sometimes see overlap on extremely long author strings,
   reduce the author font-size slightly on small screens: */
@media (max-width: 520px) {
    .article-meta .news-author { font-size: 10px; }
    .news-date { font-size: 10px; }
    .article-meta { padding-right: 48px; } /* give menu slightly more space */
}
/* menu options panel */
.article-menu-options {
    position: absolute;
    right: 10px;
    top: 36px;
    background: var(--darker-gray);
    border: 1px solid var(--primary-300);
    padding: 8px;
    border-radius: 10px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

/* simple menu button style */
.article-menu-options button {
    background: transparent;
    color: var(--color-primary);
    border: none;
    text-align: left;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
}
.article-menu-options button:hover {
    background: var(--lighter-gray);
}

/* loading indicator */
.news-loading {
    color: var(--color-text-dim);
    text-align: center;
    margin: 14px 0;
}

/* Responsive tweaks */
@media (max-width: 820px) {
    .article-image { height: 140px; }
    .article-headline { font-size: 16px; }
}

@media (max-width: 520px) {
    .article-image { height: 120px; }
    .article-headline { font-size: 15px; }
    .news-preview { font-size: 13px; }
}
