/*
 * Fameen News — feuille de style responsive.
 * Chargée après style.css (functions.php). Approche desktop-first :
 * points de rupture descendants 1024 (tablette) / 768 (mobile) / 480 (petit mobile).
 * Charte : #1C2F6B / #D71920 / #FFFFFF / #F3F5F7 / #444444.
 */

/* ==========================================================================
   Tablette (≤ 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .fn-layout { grid-template-columns: 1fr; }
  .fn-sidebar { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; align-items: start; }
  .fn-header__ads { display: none; }
  .fn-hero-carousel { min-height: 400px; }
  .fn-hero-modern { grid-template-columns: 1fr; }
  .fn-hero-main { min-height: 380px; }
  .fn-hero-list { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .fn-hero-list__item { border-bottom: 0; }
  .fn-grid--3, .fn-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .fn-rubriques { grid-template-columns: repeat(3, 1fr); }
  .fn-footer__widgets { grid-template-columns: repeat(2, 1fr); }
  .fn-values, .fn-offers { grid-template-columns: repeat(2, 1fr); }
  .fn-packs { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }
}

/* ==========================================================================
   Mobile (≤ 768px) — menu tiroir + accordéons, grilles 1 colonne
   ========================================================================== */
@media (max-width: 768px) {
  .fn-menu-toggle { display: inline-flex; padding: 14px 16px; }
  .fn-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--fn-navy-dark);
    box-shadow: var(--fn-shadow-hover);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .fn-nav.is-open { display: block; }
  .fn-nav ul { flex-direction: column; }
  .fn-nav li { display: block; position: relative; }
  .fn-nav a { padding: 14px 20px; border-bottom: 1px solid rgba(255, 255, 255, .08); display: block; }

  /* Sous-menu mobile : replié par défaut, ouvert via le bouton ▾ */
  .fn-nav .menu-item-has-children > a,
  .fn-nav .page_item_has_children > a { padding-right: 56px; }
  .fn-nav .menu-item-has-children > a::after,
  .fn-nav .page_item_has_children > a::after { content: none; }
  .fn-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0; right: 0;
    width: 52px; height: 51px;
    background: rgba(255, 255, 255, .06);
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, .1);
    color: var(--fn-white);
    font-size: 13px;
    cursor: pointer;
    transition: transform .2s ease, background .2s ease;
  }
  .fn-nav li.is-open > .fn-submenu-toggle { background: var(--fn-red); transform: rotate(180deg); border-left: 0; }
  .fn-nav .sub-menu {
    display: none;
    position: static;
    background: rgba(0, 0, 0, .18);
    box-shadow: none;
    border-radius: 0;
    border-top: 0;
    min-width: 0;
  }
  /* Sur mobile, seule l'ouverture via le bouton compte (pas le survol) */
  .fn-nav li:hover > .sub-menu,
  .fn-nav li:focus-within > .sub-menu { display: none; }
  .fn-nav li.is-open > .sub-menu { display: block; }
  .fn-nav li:last-child > .sub-menu { left: auto; right: auto; }

  /* Mega menu mobile : accordéon simple, aperçu d'articles masqué */
  .fn-nav li.menu-item-has-children { position: relative; }
  .fn-mega {
    position: static;
    background: rgba(0, 0, 0, .18);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .fn-nav li:hover > .fn-mega,
  .fn-nav li:focus-within > .fn-mega { display: none; }
  .fn-nav li.is-open > .fn-mega { display: block; }
  .fn-mega__inner { display: block; max-width: none; padding: 0; }
  .fn-mega .fn-mega__links { display: flex; flex-direction: column; flex: none; }
  .fn-mega .fn-mega__links a {
    color: rgba(255, 255, 255, .85);
    border-radius: 0;
    padding: 12px 20px 12px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
  }
  .fn-mega .fn-mega__links a:hover { background: rgba(255, 255, 255, .06); color: var(--fn-white); }
  .fn-mega .fn-mega__links .current-menu-item > a { background: transparent; color: var(--fn-white); }
  .fn-mi { color: rgba(255, 255, 255, .6); }
  .fn-mega .fn-mega__links a:hover .fn-mi { color: var(--fn-white); }
  .fn-mega .fn-mega__posts { display: none; }
  .fn-nav .sub-menu a { color: rgba(255, 255, 255, .85); padding-left: 36px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
  .fn-navbar__inner { position: relative; }
  .fn-navbar .fn-btn-subscribe { padding: 0 16px; font-size: 12px; }

  .fn-topbar__links { display: none; }

  .fn-hero { grid-template-columns: 1fr; }
  .fn-hero-carousel { min-height: 340px; }
  .fn-hero-carousel .fn-hero-card__title { font-size: 22px; }
  .fn-hero-carousel .fn-hero-card__excerpt { display: none; }
  .fn-hero__secondary { grid-template-rows: none; grid-template-columns: 1fr; }
  .fn-hero__secondary .fn-hero-card { min-height: 150px; }

  /* Hero immersif — mobile : liste empilée sous le grand visuel */
  .fn-hero-modern { grid-template-columns: 1fr; }
  .fn-hero-main { min-height: 320px; }
  .fn-hero-main__title { font-size: 24px; }
  .fn-hero-main__excerpt { display: none; }
  .fn-hero-list { grid-template-columns: 1fr; }

  .fn-breaking__time, .fn-breaking__nav { display: none; }

  .fn-grid, .fn-grid--3, .fn-grid--4 { grid-template-columns: 1fr; }
  .fn-related .fn-grid { grid-template-columns: 1fr; }
  .fn-rubriques { grid-template-columns: 1fr; }
  .fn-sidebar { grid-template-columns: 1fr; }

  .fn-article { padding: 24px 20px; }
  .fn-article__title { font-size: 27px; }
  .fn-article__content { font-size: 16.5px; }
  .fn-page { padding: 28px 22px; }
  .fn-page__title { font-size: 27px; }

  .fn-list-item { grid-template-columns: 1fr; }
  .fn-list-item__body { padding: 0 20px 18px; }

  .fn-info-cards, .fn-ad-formats { grid-template-columns: 1fr; }
  .fn-archive-header { padding: 24px; }
  .fn-archive-header__title { font-size: 25px; }
  .fn-archive-header--author { grid-template-columns: 72px 1fr; }

  .fn-footer__widgets { grid-template-columns: 1fr; gap: 32px; }
  .fn-footer__bottom { flex-direction: column; text-align: center; }

  /* Pages institutionnelles */
  .fn-page-hero { padding: 36px 0 30px; }
  .fn-page-hero h1 { font-size: 27px; }
  .fn-split { grid-template-columns: 1fr; gap: 24px; }
  .fn-split__media { min-height: 200px; }
  .fn-duo { grid-template-columns: 1fr; }
  .fn-values { grid-template-columns: 1fr; }
  .fn-checklist { grid-template-columns: 1fr; }
  .fn-group-block { grid-template-columns: 1fr; padding: 28px 22px; text-align: center; }
  .fn-engage { padding: 26px 20px; }
  .fn-offers, .fn-packs { grid-template-columns: 1fr; }
  .fn-contact-layout { grid-template-columns: 1fr; }
  .fn-form { padding: 22px 18px; }
  .fn-cta-row .fn-btn { width: 100%; justify-content: center; }

  .fn-author-box { grid-template-columns: 64px 1fr; padding: 18px; }
  .fn-post-nav { flex-direction: column; }
  .fn-post-nav a:last-child { text-align: left; }

  /* Publicités articles — formats mobiles */
  .fn-adslot--top .fn-ad__placeholder { min-height: 100px; max-width: 320px; margin: 0 auto; } /* 320x100 */
  .fn-adslot--inline .fn-ad__placeholder { min-height: 250px; max-width: 300px; margin: 0 auto; } /* 300x250 */
  .fn-adslot--middle { display: none; } /* 728x90 : desktop uniquement, lecture mobile préservée */
  .fn-adslot--sidebar600 { position: static; } /* pas de sticky quand la sidebar passe sous le contenu */
  .fn-sticky-ad { display: block; }
  body.fn-has-sticky-ad { padding-bottom: 78px; }
  body.fn-has-sticky-ad .fn-back-top { bottom: 92px; }

  /* Zones publicitaires du thème (fameen_ad_zone) — mobile */
  .fn-adzone { margin: 20px auto; }
  .fn-adzone--sidebar600 { position: static; } /* la demi-page ne colle plus quand la sidebar passe sous le contenu */
  .fn-adzone--sidebar600 .fn-adzone__fallback { min-height: 250px; } /* pas d'immense vide 600px sur mobile */
}

/* ==========================================================================
   Petit mobile (≤ 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .fn-topbar__date { display: none; }
  .fn-logo__text { font-size: 24px; }
  .fn-logo img { max-height: 56px; }
  .fn-hero-carousel { min-height: 280px; }
  .fn-hero-main { min-height: 260px; }
  .fn-hero-main__title { font-size: 20px; }
  .fn-breaking__label { padding: 6px 10px; font-size: 11px; }
  .fn-share__btn { padding: 9px 14px; font-size: 13px; }
  .fn-article__title { font-size: 23px; }
}

/* ==========================================================================
   Audit UX (2026-07) — Phase 1 : expérience de lecture des articles
   Chargé en dernier → prioritaire. Objectifs : mesure de lecture confortable,
   corps en serif éditorial, image plafonnée, en-tête allégé sur les articles.
   ========================================================================== */

/* Mesure de lecture : ~66-72 caractères au lieu de ~83 */
.fn-article__content { max-width: 680px; }

/* Corps en serif éditorial (les titres restent en Montserrat) */
.fn-article__content p,
.fn-article__content li,
.fn-article__content blockquote {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  line-height: 1.75;
}

/* Taille de lecture confortable sur desktop/tablette (le mobile garde 16,5px) */
@media (min-width: 769px) {
  .fn-article__content p,
  .fn-article__content li,
  .fn-article__content blockquote { font-size: 18.5px; }
}

/* Image d'article : hauteur plafonnée pour ne pas écraser le début de lecture */
.fn-article__thumb img { width: 100%; max-height: 460px; object-fit: cover; }

/* Pages ARTICLE : on allège le chrome publicitaire du haut → accès rapide au titre
   (le fil « Breaking News », éditorial, est conservé) */
.single-post .fn-header__ads,
.single-post .fn-adzone--header { display: none; }

/* ==========================================================================
   Audit UX (2026-07) — Phase 2 : repli de marque pour les articles sans image
   Remplace les cadres gris vides (aspect-ratio + fond gris) par un visuel de
   marque. Cible uniquement les vignettes SANS <img> (via :has()).
   ========================================================================== */
.fn-mini-card__thumb:not(:has(img)),
.fn-card__thumb:not(:has(img)),
.fn-rubrique__lead-thumb:not(:has(img)),
.fn-list-item__thumb:not(:has(img)),
.fn-popular-item__thumb:not(:has(img)),
.fn-hero-card:not(:has(img)),
.fn-hero-main:not(:has(img)),
.fn-hero-list__thumb:not(:has(img)) {
  position: relative;
  background: linear-gradient(135deg, #1C2F6B 0%, #101c3f 100%);
}
.fn-mini-card__thumb:not(:has(img))::before,
.fn-card__thumb:not(:has(img))::before,
.fn-rubrique__lead-thumb:not(:has(img))::before,
.fn-list-item__thumb:not(:has(img))::before,
.fn-popular-item__thumb:not(:has(img))::before,
.fn-hero-main:not(:has(img))::before,
.fn-hero-list__thumb:not(:has(img))::before {
  content: "Fameen News";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .30);
  font-family: "Montserrat", "Poppins", sans-serif;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: clamp(11px, 1.6vw, 18px);
  pointer-events: none;
}

/* ==========================================================================
   Refonte page d'accueil (2026-07) — hero immersif + respiration générale.
   Chargé en dernier → prioritaire sur les anciennes règles .fn-hero-carousel
   (conservées mais inertes : plus aucun template n'utilise ce balisage).
   ========================================================================== */

/* --- Hero immersif : 1 grand article + liste de 5 secondaires --- */
.fn-hero-modern {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.fn-hero-main {
  position: relative;
  display: block;
  min-height: 480px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--fn-navy-dark);
  box-shadow: 0 12px 32px rgba(28, 47, 107, .16);
}
.fn-hero-main img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.fn-hero-main:hover img { transform: scale(1.03); }
.fn-hero-main__gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 20%, rgba(0, 16, 38, .55) 60%, rgba(0, 14, 32, .94) 100%);
}
.fn-hero-main__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
}
.fn-hero-main__title {
  color: var(--fn-white);
  font-family: var(--fn-font-heading);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.4px;
  margin: 14px 0 10px;
}
.fn-hero-main:hover .fn-hero-main__title { text-decoration: underline; text-decoration-color: var(--fn-red); text-underline-offset: 5px; }
.fn-hero-main__excerpt { display: block; color: rgba(255, 255, 255, .84); font-size: 15.5px; line-height: 1.55; margin: 0 0 14px; max-width: 60ch; }
.fn-hero-main__meta { display: flex; gap: 18px; color: rgba(255, 255, 255, .72); font-size: 13px; }

.fn-hero-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fn-hero-list__item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--fn-border);
}
.fn-hero-list__item:first-child { padding-top: 2px; }
.fn-hero-list__item:last-child { border-bottom: 0; }
.fn-hero-list__thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--fn-gray-light);
}
.fn-hero-list__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.fn-hero-list__item:hover .fn-hero-list__thumb img { transform: scale(1.06); }
.fn-hero-list__body { display: flex; flex-direction: column; min-width: 0; }
.fn-hero-list__body .fn-cat-badge { align-self: flex-start; font-size: 9.5px; padding: 3px 8px; margin-bottom: 5px; }
.fn-hero-list__title { font-size: 14px; font-weight: 700; line-height: 1.4; color: #1A1D2B; }
.fn-hero-list__item:hover .fn-hero-list__title { color: var(--fn-red); }
.fn-hero-list__date { font-size: 11.5px; color: var(--fn-gray); margin-top: 6px; }

/* --- Respiration générale : sections mieux espacées --- */
.fn-sechead { margin: 44px 0 22px; }
.fn-sechead:first-child { margin-top: 0; }

/* --- Cartes "Dernières actualités" : élévation douce type carte moderne --- */
.fn-mini-card {
  background: var(--fn-white);
  border-radius: 12px;
  padding: 10px 10px 16px;
  transition: box-shadow .25s ease, transform .25s ease;
}
.fn-mini-card:hover { box-shadow: 0 10px 28px rgba(28, 47, 107, .12); transform: translateY(-2px); }
.fn-mini-card__thumb { border-radius: 8px; }
