/*
 * modern-enhancements.css — Color NewsMagazine
 * Performance: content-visibility, will-change, aspect-ratio, CSS containment
 * Modernisation: subtle glass effects, smoother transitions, better typography
 * Ne modifie PAS les couleurs ou la mise en page — uniquement les optimisations.
 */

/* ============================================================
 * 1. PERFORMANCE: CSS Containment + Content Visibility
 *    Tells the browser to skip off-screen rendering work.
 * ============================================================ */
.single-news,
.widget,
.single-sidebar,
.news-layouts-wrapper > div,
.col-lg-4,
.col-md-6 {
    content-visibility: auto;
    contain-intrinsic-size: 0 350px; /* estimated height prevents layout shift */
}

/* Always render above-the-fold hero/slider immediately */
.home-slider,
.header,
.template-preloader-rapper {
    content-visibility: visible;
}

/* ============================================================
 * 2. IMAGES — prevent layout shift (CLS), lazy-load ready
 * ============================================================ */
img {
    height: auto;
    max-width: 100%;
    vertical-align: middle;
    /* Smooth fade-in when lazy image loads */
    opacity: 1;
    transition: opacity 0.3s ease;
}
img[loading="lazy"] {
    opacity: 0;
}
img[loading="lazy"].loaded,
img:not([loading]) {
    opacity: 1;
}

/* Aspect-ratio containers prevent layout shift */
.news-head img,
.news-heads img {
    aspect-ratio: 3 / 2;
    object-fit: cover;
    width: 100%;
    will-change: transform; /* GPU compositing hint for sliders */
}

/* ============================================================
 * 3. MODERN GLASS / DEPTH EFFECTS (eye-catching, subtle)
 * ============================================================ */

/* Sticky header: subtle backdrop blur for modern feel */
.header.sticky-tops {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.97) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Card hover: lift effect — modern, performant (GPU only) */
.single-news.card,
.single-news.blog-head.card {
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.25s ease;
    will-change: transform, box-shadow;
    border-radius: 8px;
    overflow: hidden;
}
.single-news.card:hover,
.single-news.blog-head.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Category tags — pill style, modern */
.cat-links a,
a.cat-name {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: filter 0.2s ease;
}
.cat-links a:hover,
a.cat-name:hover {
    filter: brightness(1.15);
}

/* ============================================================
 * 4. TYPOGRAPHY — modern line-height, smooth rendering
 * ============================================================ */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance; /* Prevent orphaned words in headings */
}

p {
    text-wrap: pretty;
}

/* Title hover underline — modern link feedback */
.title-medium a,
.single-news h3 a {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 0.3s ease, color 0.2s ease;
}
.title-medium a:hover,
.single-news h3 a:hover {
    background-size: 100% 1px;
    text-decoration: none;
}

/* ============================================================
 * 5. NAVIGATION — smooth focus/hover states
 * ============================================================ */
.navbar-nav > li > a {
    position: relative;
    transition: color 0.2s ease;
}
.navbar-nav > li > a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    right: 50%;
    height: 2px;
    background-color: currentColor;
    transition: left 0.25s ease, right 0.25s ease;
}
.navbar-nav > li > a:hover::after,
.navbar-nav > li.current-menu-item > a::after {
    left: 0;
    right: 0;
}

/* ============================================================
 * 6. LANGUAGE POPUP & BUTTON — moved from header.php inline styles
 * ============================================================ */
.goog-te-banner-frame.skiptranslate,
.goog-te-gadget-icon,
.goog-te-gadget-simple,
.goog-logo-link,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-te-menu-frame,
.goog-te-gadget span,
.goog-te-combo {
    display: none !important;
}
#google_translate_element { display: none !important; }
html { position: relative !important; top: 0 !important; }

.lang-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    z-index: 99999;
}
.lang-popup.show {
    opacity: 1;
    visibility: visible;
}
.lang-popup-box {
    background: #fff;
    padding: 32px 40px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    animation: cnmPopupIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 92%;
    width: 480px;
}
@keyframes cnmPopupIn {
    from { transform: translateY(-24px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
.lang-popup-box h2 { margin-bottom: 10px; }
.lang-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.lang-options button {
    padding: 9px 18px;
    font-size: 14px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    background-color: #007bff;
    color: #fff;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.lang-options button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}
.change-lang-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.change-lang-btn:hover {
    background-color: #0056b3;
    box-shadow: 0 6px 20px rgba(0, 86, 179, 0.5);
}

/* ============================================================
 * 7. SCROLL-TO-TOP BUTTON (ScrollUp plugin)
 * ============================================================ */
#scrollUp {
    border-radius: 50% !important;
    width: 42px !important;
    height: 42px !important;
    line-height: 42px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}
#scrollUp:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

/* ============================================================
 * 8. PRELOADER — faster fade-out
 * ============================================================ */
.template-preloader-rapper {
    transition: opacity 0.4s ease;
}

/* ============================================================
 * 9. LAZY IMAGE FADE-IN via IntersectionObserver
 *    (activated by active.js inline script)
 * ============================================================ */
img.cnm-lazy {
    opacity: 0;
    transition: opacity 0.4s ease;
}
img.cnm-lazy.cnm-lazy--loaded {
    opacity: 1;
}

/* ============================================================
 * 10. FOCUS STYLES — accessibility + modern look
 * ============================================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 3px;
    border-radius: 3px;
}
