/* ── Actualités – styles spécifiques (complète styles.css) ──────────────────
   Toutes les variables de la charte graphique (--color-*, --radius-*, etc.)
   sont héritées de styles.css. Ce fichier ne redéfinit que les composants
   propres à la page Actualités.
   ────────────────────────────────────────────────────────────────────────── */

/* ── Section principale ─────────────────────────────────────────────────── */

.news-section {
    padding-top: 2.5rem;
}

/* ── États chargement / erreur ──────────────────────────────────────────── */

.news-loading {
    display: none;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-mist);
    font-size: 0.95rem;
    padding: 1.5rem 0;
}

.news-loading.active {
    display: flex;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.news-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(159, 216, 165, 0.3);
    border-top-color: var(--color-leaf);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.news-error {
    background: rgba(217, 178, 109, 0.1);
    border: 1px solid rgba(217, 178, 109, 0.3);
    border-radius: var(--radius-sm);
    color: var(--color-amber);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.news-date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.news-date {
    font-size: 0.9rem;
    color: var(--color-leaf);
    text-transform: capitalize;
    letter-spacing: 0.08em;
    margin: 0;
    min-height: 1.2em;
    text-align: center;
}

.news-date-button {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-sand);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base), transform var(--transition-base);
}

.news-date-button:hover,
.news-date-button:focus-visible {
    background: rgba(74, 161, 122, 0.15);
    border-color: rgba(159, 216, 165, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
    outline: none;
}

.news-date-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* ── Onglets domaines ───────────────────────────────────────────────────── */

.domain-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
}

.domain-tab {
    padding: 0.5rem 1.4rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-mist);
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.domain-tab:hover,
.domain-tab:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(159, 216, 165, 0.3);
    outline: none;
}

.domain-tab--active {
    background: rgba(74, 161, 122, 0.18);
    border-color: rgba(159, 216, 165, 0.5);
    color: #ffffff;
}

/* ── Panneaux domaines ──────────────────────────────────────────────────── */

.domain-panel {
    display: none;
}

.domain-panel--active {
    display: block;
}

/* ── Grille d'articles ──────────────────────────────────────────────────── */

.news-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1100px) {
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 760px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Tuile article ──────────────────────────────────────────────────────── */

.news-tile {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.news-tile:hover,
.news-tile:focus-visible {
    transform: translateY(-4px) scale(1.01);
    border-color: rgba(159, 216, 165, 0.4);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    outline: none;
}

.news-tile:focus-visible {
    box-shadow: 0 0 0 2px var(--color-forest);
}

.tile-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 350ms ease;
}

.news-tile:hover .tile-image {
    transform: scale(1.04);
}

.tile-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(3, 8, 7, 0.1) 0%,
        rgba(3, 8, 7, 0.5) 50%,
        rgba(3, 8, 7, 0.88) 100%
    );
}

.tile-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.85rem 1rem;
    z-index: 1;
}

.tile-title {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-sand);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Badge "Lu" */
.tile-read-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: rgba(74, 161, 122, 0.85);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    opacity: 0;
    transition: opacity 200ms ease;
    z-index: 2;
}

/* Article lu : tuile atténuée + badge visible */
.news-tile.is-read {
    opacity: 0.55;
}

.news-tile.is-read .tile-read-badge {
    opacity: 1;
}

.news-tile.is-read:hover {
    opacity: 0.8;
}

/* ── Popup overlay ──────────────────────────────────────────────────────── */

#popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#popup-overlay[hidden] {
    display: none;
}

#popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 8, 7, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.popup-dialog {
    position: relative;
    z-index: 1;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
}

/* ── Bannière popup ─────────────────────────────────────────────────────── */

.popup-banner {
    position: relative;
    height: 240px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: #071210;
}

#popup-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.popup-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(3, 8, 7, 0.05) 0%,
        rgba(3, 8, 7, 0.78) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
    gap: 0.4rem;
}

.domain-badge {
    display: inline-block;
    background: rgba(74, 161, 122, 0.25);
    border: 1px solid rgba(159, 216, 165, 0.4);
    color: var(--color-leaf);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    align-self: flex-start;
}

#popup-article-title {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    line-height: 1.3;
    color: #ffffff;
    margin: 0;
}

#popup-date {
    font-size: 0.8rem;
    color: var(--color-mist);
    text-transform: capitalize;
}

/* Croix fermeture */
#popup-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(3, 8, 7, 0.6);
    border: 1px solid var(--color-border);
    color: var(--color-sand);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-base);
    z-index: 2;
}

#popup-close:hover,
#popup-close:focus-visible {
    background: rgba(74, 161, 122, 0.3);
    outline: none;
}

/* ── Corps popup ────────────────────────────────────────────────────────── */

.popup-body {
    padding: 1.5rem;
    flex: 1;
}

#popup-content p {
    color: var(--color-mist);
    line-height: 1.75;
    margin-bottom: 1rem;
}

#popup-content p:last-child {
    margin-bottom: 0;
}

/* ── Pied popup (sources) ───────────────────────────────────────────────── */

.popup-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.popup-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-leaf);
    border: 1px solid rgba(159, 216, 165, 0.3);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    transition: background var(--transition-base), border-color var(--transition-base);
    text-decoration: none;
}

.source-link::after {
    content: "↗";
    font-size: 0.7rem;
    opacity: 0.7;
}

.source-link:hover,
.source-link:focus-visible {
    background: rgba(74, 161, 122, 0.12);
    border-color: rgba(159, 216, 165, 0.6);
    outline: none;
}

/* ── Responsive popup ───────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .news-date-nav {
        gap: 0.5rem;
    }

    .news-date {
        font-size: 0.8rem;
        letter-spacing: 0.05em;
    }

    .news-date-button {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 1.3rem;
    }

    .popup-banner {
        height: 180px;
    }

    .popup-body,
    .popup-footer {
        padding: 1rem;
    }
}
