/* ============================================================================
   news.css — Page-specific styles for News (list_news + view_news).
   Uses DS tokens only. No :root, no hex, no !important, no dark-mode rules.
   New shared components go in components.css (convergence rule).
============================================================================ */

/* ── Page wrapper ──────────────────────────────────────────────────────── */
.news-page {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--space-5) var(--space-16);
}

/* Hero migrado a .page-hero (components.css §5.12). */

/* ── Featured card ─────────────────────────────────────────────────────── */
.news-featured { margin-bottom: var(--space-8); }

.news-featured__card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-10);
    border: 1px solid var(--brand-ring);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-base), box-shadow var(--transition-base),
                border-color var(--transition-base);
    gap: var(--space-6);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.news-featured__card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--brand-soft) 0%, transparent 60%);
    pointer-events: none;
}

.news-featured__card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    border-color: var(--brand);
}
.news-featured__card:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.news-featured__body { flex: 1; min-width: 0; position: relative; z-index: 1; }

.news-featured__badges {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    align-items: center;
}

.news-featured__title {
    font-family: var(--font-display);
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text);
    margin: 0 0 var(--space-2);
    line-height: var(--line-tight);
}

.news-featured__summary {
    color: var(--text-muted);
    font-size: var(--font-size-base);
    margin: 0 0 var(--space-5);
    line-height: 1.65;
}

.news-featured__meta {
    display: flex;
    gap: var(--space-5);
    flex-wrap: wrap;
    font-size: var(--font-size-xs);
    color: var(--text-faint);
}

.news-featured__meta span {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}
.news-featured__meta .material-symbols-outlined { font-size: 1em; }

/* CTA arrow button (right side of featured card) */
.news-featured__cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--brand-gradient);
    color: var(--color-white);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.news-featured__card:hover .news-featured__cta {
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

@media (max-width: 768px) {
    .news-featured__card { flex-direction: column; padding: var(--space-6); }
    .news-featured__title { font-size: var(--font-size-xl); }
    .news-featured__cta { width: 100%; justify-content: center; }
}

/* ── Type filter bar ───────────────────────────────────────────────────── */
.news-filter-bar {
    margin-bottom: var(--space-8);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── News grid ─────────────────────────────────────────────────────────── */
.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-12);
}

@media (min-width: 768px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .news-grid { grid-template-columns: repeat(3, 1fr); }
}

/* News card */
.news-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform var(--transition-base), box-shadow var(--transition-base),
                border-color var(--transition-base);
    display: flex;
    flex-direction: column;
    position: relative;
}

.news-card:hover {
    transform: translateY(-4px);
    border-color: var(--brand-ring);
    box-shadow: var(--shadow-lg);
}

.news-card__link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

/* Top accent stripe (3px, colored per article type).
   Uses the same .badge-* class names returned by article_type_css. */
.news-card__accent {
    height: 3px;
    width: 100%;
}
.news-card__accent.badge-blue   { background: linear-gradient(90deg, var(--blue-500), var(--blue-400)); }
.news-card__accent.badge-purple { background: linear-gradient(90deg, var(--purple-700), var(--purple-400)); }
.news-card__accent.badge-green  { background: linear-gradient(90deg, var(--status-ok-dark), var(--green-400)); }
.news-card__accent.badge-orange { background: linear-gradient(90deg, var(--status-warn-dark), var(--amber-400)); }
.news-card__accent.badge-red    { background: linear-gradient(90deg, var(--status-danger-dark), var(--red-400)); }
.news-card__accent.badge-gray   { background: linear-gradient(90deg, var(--neutral-600), var(--neutral-400)); }
.news-card__accent.badge-gold   { background: linear-gradient(90deg, var(--status-warn), var(--amber-300)); }

.news-card__body { padding: var(--space-5) var(--space-5) var(--space-4); flex: 1; }

.news-card__badges {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: var(--space-3);
}

.news-card__title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text);
    margin: 0 0 var(--space-2);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card__summary {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    margin: 0 0 var(--space-4);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card__meta {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    font-size: var(--font-size-xs);
    color: var(--text-faint);
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
    margin-top: auto;
}
.news-card__meta span {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}
.news-card__meta .material-symbols-outlined { font-size: 1em; }

.news-card__admin {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    justify-content: flex-end;
    background: var(--bg);
}

.news-card__delete-btn { color: var(--status-danger); }
.news-card__delete-btn:hover { background: var(--color-danger-soft); color: var(--red-300); }

/* ── Badge modifier classes (editorial, not globally reusable) ─────────── */
/* Maps article_type_css values (badge-blue etc.) to DS tokens.            */
.badge.badge-blue,
.badge--meta    { background: var(--color-info-soft);    color: var(--blue-300);  }
.badge.badge-purple,
.badge--card    { background: var(--brand-soft);          color: var(--indigo-300); }
.badge.badge-green,
.badge--deck    { background: var(--color-success-soft); color: var(--green-300); }
.badge.badge-orange,
.badge--set     { background: var(--color-warning-soft); color: var(--amber-300); }
.badge.badge-red,
.badge--report  { background: var(--color-danger-soft);  color: var(--red-300);   }
.badge.badge-gray,
.badge--general { background: var(--surface-elevated);   color: var(--text-muted); }
.badge.badge-gold,
.badge--gold    { background: rgba(234, 179, 8, 0.15);   color: var(--color-gold); }

/* Shrink icons inside badge-like spans */
.news-featured__badges .material-symbols-outlined,
.news-card__badges .material-symbols-outlined {
    font-size: 0.8em;
    vertical-align: middle;
}

/* Featured star badge */
.badge--featured {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.15em 0.6em;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--color-warning-soft);
    color: var(--amber-300);
}

/* New / Draft / Patreon mini-badges */
.badge--new {
    display: inline-flex;
    padding: 0.15em 0.5em;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--color-danger-soft);
    color: var(--red-300);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge--draft {
    display: inline-flex;
    padding: 0.15em 0.5em;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--color-warning-soft);
    color: var(--amber-300);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Icon-only mini badges (patreon lock, AI sparkle) */
.badge--icon-only {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1);
    font-size: 0;
    border-radius: var(--radius-sm);
}
.badge--icon-only .material-symbols-outlined { font-size: 0.9rem; }
.badge--patreon { color: var(--status-danger); }
.badge--ai      { color: var(--purple-400); }

/* ── Pagination wrapper ─────────────────────────────────────────────────── */
.news-pagination {
    display: flex;
    justify-content: center;
    margin-top: var(--space-4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   VIEW_NEWS — article page styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Article page wrapper ──────────────────────────────────────────────── */
.article-page {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--space-5) var(--space-16);
}

/* ── Breadcrumb ────────────────────────────────────────────────────────── */
.article-breadcrumb {
    margin: var(--space-8) 0 var(--space-5);
}

/* ── Article header ────────────────────────────────────────────────────── */
.article-header {
    background: var(--brand-gradient);
    border-radius: var(--radius-xl);
    padding: var(--space-12) var(--space-10);
    margin-bottom: var(--space-10);
    color: var(--color-white);
    position: relative;
    overflow: hidden;
}

.article-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 80% at 90% 30%, var(--brand-soft) 0%, transparent 70%);
    pointer-events: none;
}

.article-header__content { position: relative; z-index: 1; }

.article-header__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.article-header__meta-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    font-size: var(--font-size-sm);
    opacity: 0.9;
}

.article-header__meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.article-header__meta-sep { opacity: 0.5; }

.article-header__meta-right {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Status badges in the header (on colored background) */
.article-header__badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.2em 0.65em;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.25);
}
.article-header__badge--success { background: rgba(16, 185, 129, 0.25); }
.article-header__badge--warn    { background: rgba(245, 158, 11, 0.25); }
.article-header__badge--new     { background: rgba(255, 215, 0, 0.2);   color: var(--color-gold); }

.article-header__title {
    font-family: var(--font-display);
    font-size: var(--font-size-4xl);
    font-weight: 800;
    line-height: var(--line-tight);
    margin: 0 0 var(--space-6);
    color: var(--color-white);
}

.article-header__summary {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    color: var(--color-white);
}
.article-header__summary p { margin: 0; line-height: 1.6; opacity: 0.95; }
.article-header__summary .material-symbols-outlined { opacity: 0.7; flex-shrink: 0; margin-top: 2px; }

.article-header__stats {
    display: flex;
    gap: var(--space-8);
    flex-wrap: wrap;
    font-size: var(--font-size-sm);
    opacity: 0.9;
}

.article-header__stat {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

@media (max-width: 768px) {
    .article-header { padding: var(--space-8) var(--space-6); margin-bottom: var(--space-8); }
    .article-header__title { font-size: var(--font-size-3xl); }
    .article-header__meta { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
    .article-header { padding: var(--space-6) var(--space-5); }
    .article-header__title { font-size: var(--font-size-2xl); }
}

/* ── Article main ──────────────────────────────────────────────────────── */
.article-main {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: var(--space-8);
    border: 1px solid var(--border);
}

.article-body {
    padding: var(--space-12) var(--space-12);
}

@media (max-width: 768px) {
    .article-body { padding: var(--space-8) var(--space-6); }
}
@media (max-width: 480px) {
    .article-body { padding: var(--space-6) var(--space-5); }
}

/* ── Patreon CTA block ─────────────────────────────────────────────────── */
.patreon-cta {
    margin: 0 var(--space-12) var(--space-8);
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    overflow: hidden;
}

.patreon-cta__inner {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-6) var(--space-8);
    flex-wrap: wrap;
}

.patreon-cta__icon {
    font-size: 2rem;
    color: var(--status-danger);
    flex-shrink: 0;
}

.patreon-cta__text { flex: 1; min-width: 200px; }
.patreon-cta__text strong { display: block; font-size: var(--font-size-base); color: var(--text); margin-bottom: var(--space-1); }
.patreon-cta__text p { margin: 0; font-size: var(--font-size-sm); color: var(--text-muted); }

@media (max-width: 768px) {
    .patreon-cta { margin: 0 var(--space-6) var(--space-6); }
    .patreon-cta__inner { padding: var(--space-5); }
    .patreon-cta__inner .btn--danger { width: 100%; justify-content: center; }
}

/* ── Article footer ────────────────────────────────────────────────────── */
.article-footer {
    background: var(--bg);
    padding: var(--space-6) var(--space-12);
    border-top: 1px solid var(--border);
}

.article-footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-5);
}

.article-footer__tag {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.article-footer__actions { display: flex; gap: var(--space-3); }

@media (max-width: 768px) {
    .article-footer { padding: var(--space-5) var(--space-6); }
    .article-footer__inner { flex-direction: column; align-items: stretch; }
    .article-footer__actions { justify-content: center; }
}

/* ── Article prev/next navigation ─────────────────────────────────────── */
.article-nav {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: var(--space-8);
}

.article-nav__container {
    display: flex;
    align-items: stretch;
}

.article-nav__link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-8);
    text-decoration: none;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.article-nav__link:hover:not(.is-disabled) {
    background: var(--surface-elevated);
    color: var(--brand);
}
.article-nav__link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.article-nav__link.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.article-nav__link--next { justify-content: flex-end; }

.article-nav__icon {
    width: 44px;
    height: 44px;
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}
.article-nav__link:hover:not(.is-disabled) .article-nav__icon {
    background: var(--brand);
    color: var(--color-white);
}

.article-nav__content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.article-nav__label {
    font-size: var(--font-size-xs);
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.article-nav__title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text);
}
.article-nav__link:hover:not(.is-disabled) .article-nav__title { color: var(--brand); }

.article-nav__divider {
    width: 1px;
    background: var(--border);
    align-self: stretch;
}

@media (max-width: 768px) {
    .article-nav__container { flex-direction: column; }
    .article-nav__divider { width: 100%; height: 1px; }
    .article-nav__link { padding: var(--space-6); }
}

/* ── Table styles (AI-generated content — view_news only) ─────────────── */
.table-container {
    margin: var(--space-6) auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
}

.table-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--brand-gradient);
    background-size: 200% 100%;
    animation: table-shimmer 3s ease-in-out infinite;
}

@keyframes table-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50%       { background-position: 100% 50%; }
}

.table-row {
    display: flex;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
    min-height: 52px;
    align-items: center;
}

.table-row:last-child { border-bottom: none; }

.table-row:first-child {
    background: var(--brand-soft);
    border-bottom: 2px solid var(--brand-ring);
    font-weight: 700;
}

.table-row:hover:not(:first-child) {
    background: var(--surface-elevated);
}

.table-row:nth-child(even):not(:first-child) {
    background: rgba(255, 255, 255, 0.02);
}

.table-cell {
    flex: 1;
    padding: var(--space-4) var(--space-5);
    border-right: 1px solid var(--border);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    min-height: 52px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.table-cell:first-child {
    justify-content: flex-start;
    color: var(--text);
    font-weight: 600;
    padding-left: var(--space-6);
}

.table-cell:last-child { border-right: none; }

.table-row:first-child .table-cell { color: var(--text); }

.table-separator {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--border) 50%, transparent 100%);
    margin: var(--space-2) var(--space-5);
}

.table-line {
    padding: var(--space-3) var(--space-5);
    font-size: var(--font-size-xs);
    color: var(--text-faint);
    font-style: italic;
    text-align: center;
    width: 100%;
}

@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        padding: var(--space-4);
    }
    .table-cell { padding: var(--space-3) var(--space-4); font-size: var(--font-size-xs); min-height: 44px; }
    .table-row  { min-height: 44px; }
}

/* HTML table (product-info) — also generated by AI */
table.product-info {
    width: 100%;
    margin: var(--space-6) 0;
    border-collapse: collapse;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

table.product-info thead th {
    background: var(--brand-soft);
    color: var(--text);
    font-weight: 700;
    font-size: var(--font-size-lg);
    padding: var(--space-6) var(--space-8);
    text-align: center;
    border-bottom: 2px solid var(--brand-ring);
}

table.product-info tbody th {
    background: var(--surface-elevated);
    color: var(--text);
    font-weight: 600;
    padding: var(--space-5) var(--space-8);
    text-align: left;
    border-right: 1px solid var(--border);
    width: 30%;
    vertical-align: top;
}

table.product-info tbody td {
    background: var(--surface);
    color: var(--text-muted);
    padding: var(--space-5) var(--space-8);
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table.product-info tbody tr:hover {
    background: var(--surface-elevated);
}

table.product-info tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

table.product-info ul { margin: 0; padding-left: var(--space-5); }
table.product-info li { margin-bottom: var(--space-2); color: var(--text-muted); }

@media (max-width: 768px) {
    table.product-info { font-size: var(--font-size-sm); }
    table.product-info thead th,
    table.product-info tbody th,
    table.product-info tbody td { padding: var(--space-4) var(--space-5); }
}
