/*
Theme Name: Signal AI Pro
Theme URI: https://tekfold.com
Author: Tekfold
Description: Thème éditorial professionnel pour site tech/IA : hero stable (texte toujours dans le cadre), design responsive, accessibilité, SEO. Version complète et propre.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: signal-ai-pro
*/

:root {
  --bg: #ffffff;
  --bg-alt: #f4f5f7;
  --bg-soft: #fafbfc;
  --text: #16181d;
  --text-muted: #525b67;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-red: #e63946;
  --accent-gold: #f4a623;
  --border: #e5e7eb;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 8px 24px rgba(16, 24, 40, 0.06);
  --font-headline: "Source Serif 4", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max-width: 1200px;
  --header-h: 68px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; display: block; height: auto; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- ACCESSIBILITÉ ---------- */
.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 999;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- TOP BAR ---------- */
.topbar {
  background: #101318;
  color: #d7dce2;
  font-size: 12.5px;
}
.topbar .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 38px;
  overflow: hidden;
}
.topbar-label {
  background: var(--accent-red);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10.5px;
  padding: 3px 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.topbar-ticker {
  display: flex;
  gap: 36px;
  white-space: nowrap;
  animation: ticker 36s linear infinite;
}
.topbar-ticker a { color: #d7dce2; transition: color 0.15s ease; }
.topbar-ticker a:hover { color: #fff; }
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .topbar-ticker { animation: none; overflow-x: auto; }
  html { scroll-behavior: auto; }
}

/* ---------- HEADER ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  display: flex;
  align-items: center;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}
.site-logo {
  font-family: var(--font-headline);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}
.site-logo .logo-accent { color: var(--accent); }

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  align-items: center;
}
.main-nav a {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.main-nav a:hover { color: var(--text); background: var(--bg-alt); }
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a { color: var(--accent); background: var(--bg-alt); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.search-toggle, .nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background 0.15s ease;
}
.search-toggle:hover, .nav-toggle:hover { background: var(--bg-alt); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; }
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.header-search {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.header-search form {
  display: flex;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
}
.header-search input[type="search"] {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
}
.header-search button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 190;
}
.nav-overlay.is-open { display: block; }

/* ---------- HERO / À LA UNE ---------- */
.hero { padding: 32px 0 44px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
}
.trending-sidebar { align-self: start; }

.hero-main {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  min-height: 320px;
  height: 100%;
  max-height: 460px;
}
/* Conteneur image plein, sans padding-top : le texte est DANS le cadre */
.hero-main .hero-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.hero-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-main::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0.42) 40%, rgba(0,0,0,0.75) 72%, rgba(0,0,0,0.88) 100%);
  pointer-events: none;
}
.hero-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 28px;
  z-index: 2;
  max-width: 100%;
  overflow: hidden;
}
.hero-overlay .tag-featured { margin-bottom: 12px; }
.hero-overlay h1 {
  font-family: var(--font-headline);
  color: #fff;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.22;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  /* Titre jamais débordant : tronqué à 3 lignes max */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
  text-overflow: ellipsis;
}

/* ---------- SIDEBAR TENDANCES ---------- */
.trending-sidebar {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.trending-sidebar h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--text);
}
.trending-item {
  display: flex;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.trending-item:last-child { border-bottom: none; }
.trending-number {
  font-family: var(--font-headline);
  font-size: 26px;
  font-weight: 700;
  color: var(--border);
  line-height: 1;
  min-width: 30px;
}
.trending-item h4 { font-size: 14px; line-height: 1.45; margin: 0; }
.trending-item a:hover { color: var(--accent); }

.gh-item { padding: 7px 0; border-bottom: 1px solid var(--border); }
.gh-item:last-child { border-bottom: none; }
.gh-lang {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; padding: 2px 7px; border-radius: 3px;
  background: var(--bg-alt); color: var(--text-muted); flex-shrink: 0;
}
.gh-desc {
  display: block; font-size: 12px; color: var(--text-muted);
  line-height: 1.4; margin: 3px 0 0 24px;
}

/* ---------- TAGS / BADGES ---------- */
.tag-category, .tag-featured {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 3px;
}
.tag-category { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.tag-featured { background: var(--accent-gold); color: #16181d; }

/* ---------- GRID / CARDS ---------- */
.section-title {
  font-family: var(--font-headline);
  font-size: 24px;
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
}
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
  padding-bottom: 48px;
}
.article-card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.article-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.article-card .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: block;
  background: var(--bg-alt);
}
.article-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}
.article-card:hover .thumb img { transform: scale(1.05); }
.article-card .card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex-grow: 1; }
.article-card h2 {
  font-family: var(--font-headline);
  font-size: 18px;
  line-height: 1.4;
  margin: 0 0 8px;
  transition: color 0.15s ease;
}
.article-card:hover h2 { color: var(--accent); }
.card-excerpt { font-size: 13.5px; color: var(--text-muted); margin: 0 0 14px; flex-grow: 1; }
.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- BREADCRUMBS ---------- */
.breadcrumbs {
  font-size: 13px;
  color: var(--text-muted);
  padding: 20px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { opacity: 0.45; }
.breadcrumbs [aria-current="page"] { color: var(--text); font-weight: 600; }

/* ---------- SINGLE POST ---------- */
.single-post { padding: 32px 0 72px; }
.single-post .post-header {
  max-width: 780px;
  margin: 0 auto 24px;
}
.single-post h1 {
  font-family: var(--font-headline);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.18;
  margin: 16px 0;
}
.post-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}
.featured-image {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}
.post-content {
  max-width: 760px;
  margin: 0 auto;
  font-size: 17.5px;
}
.post-content h2 { font-family: var(--font-headline); font-size: 26px; margin: 36px 0 14px; }
.post-content h3 { font-family: var(--font-headline); font-size: 20px; margin: 28px 0 12px; }
.post-content p { margin: 0 0 20px; }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-content img { border-radius: var(--radius-sm); }
.post-content ul, .post-content ol { padding-left: 24px; margin: 0 0 20px; }
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
  margin: 24px 0;
  padding: 16px 22px;
  border-left: 4px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
.post-content pre, .post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.post-content pre {
  background: #16181d;
  color: #e5e7eb;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}
.post-content code { background: var(--bg-alt); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.post-content pre code { background: none; padding: 0; }

.post-tags {
  max-width: 760px;
  margin: 28px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.share-box {
  max-width: 760px;
  margin: 28px auto 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.share-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-right: 4px; }
.share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
  transition: all 0.2s ease;
}
.share-link svg { width: 18px; height: 18px; }
.share-link:hover {
  border-color: transparent;
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.18);
}
.share-link[title="Partager sur Facebook"]:hover { background: #1877f2; }
.share-link[title="Partager sur X"]:hover { background: #0f1419; }
.share-link[title="Partager sur LinkedIn"]:hover { background: #0a66c2; }
.share-link[title="Partager sur WhatsApp"]:hover { background: #25d366; }
.share-link[title="Partager sur Telegram"]:hover { background: #229ed9; }
.share-link[title="Partager par email"]:hover { background: var(--accent); }

.tools-cta { border-radius: var(--radius); }

/* ---------- PAGINATION ---------- */
.pagination {
  padding: 4px 0 56px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pagination .page-numbers.current { background: var(--text); border-color: var(--text); color: #fff; }
.pagination a.page-numbers:hover { background: var(--bg-alt); border-color: var(--text-muted); }

/* ---------- NEWSLETTER CTA ---------- */
.newsletter-cta {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  margin: 48px 0;
}
.newsletter-cta h3 { font-family: var(--font-headline); font-size: 24px; margin: 0 0 8px; }
.newsletter-cta p { color: #dbe3f8; margin: 0 0 20px; }
.newsletter-cta form { display: flex; gap: 8px; max-width: 420px; margin: 0 auto; }
.newsletter-cta input[type="email"] {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-sm);
  border: none; font-size: 14px; font-family: var(--font-body);
}
.newsletter-cta button {
  background: var(--accent-red); color: #fff; border: none;
  padding: 12px 22px; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer;
}

/* ---------- FOOTER ---------- */
.site-footer {
  background: #101318;
  color: #9aa3af;
  padding: 48px 0 28px;
  font-size: 14px;
  margin-top: 32px;
}
.site-footer .footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  padding-bottom: 28px;
}
.site-footer h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  margin: 0 0 14px;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 9px; }
.site-footer a { color: #9aa3af; transition: color 0.15s ease; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #242b36;
  padding-top: 20px;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .trending-sidebar { order: 2; }
}

@media (max-width: 780px) {
  .container { padding: 0 16px; }
  .topbar { display: none; }

  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: fixed;
    top: 0; right: 0;
    width: min(80vw, 320px);
    height: 100vh;
    background: var(--bg);
    z-index: 210;
    padding: 84px 20px 28px;
    box-shadow: -6px 0 30px rgba(0,0,0,0.15);
    overflow-y: auto;
  }
  .main-nav.is-open { display: block; animation: slideIn 0.25s ease; }
  @keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
  }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .main-nav a { padding: 13px 12px; font-size: 16px; min-height: 46px; border-radius: var(--radius-sm); }
  body.nav-locked { overflow: hidden; }

  .hero { padding: 20px 0 32px; }
  .hero-main { min-height: 260px; }
  .hero-overlay { padding: 20px 16px 16px; }
  .hero-overlay h1 { font-size: 20px; }

  .article-grid { grid-template-columns: 1fr; gap: 20px; }
  .article-card h2 { font-size: 17px; }
  .section-title { font-size: 20px; }

  .single-post { padding: 20px 0 48px; }
  .single-post h1 { font-size: 24px; margin: 12px 0; }
  .post-content { font-size: 16px; }
  .post-content h2 { font-size: 21px; margin: 28px 0 12px; }

  .newsletter-cta { padding: 24px 18px; margin: 32px 0; }
  .newsletter-cta form { flex-direction: column; max-width: 100%; }
  .newsletter-cta input[type="email"], .newsletter-cta button { width: 100%; font-size: 16px; }
  .header-search form { flex-direction: column; }
  .header-search button { width: 100%; }
  .footer-bottom { flex-direction: column; }
}