/*
Theme Name: Signal AI
Theme URI: https://tondomaine.com
Author: Maxscor
Description: Thème éditorial clair, style site d'actualité tech professionnel (v2 - refonte complète).
Version: 2.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: signal-ai
*/

:root {
  --bg: #FFFFFF;
  --bg-alt: #F5F6F8;
  --text: #14181F;
  --text-muted: #5B6472;
  --accent-red: #E63946;
  --accent-gold: #F4A623;
  --border: #E4E7EC;
  --radius: 6px;
  --font-headline: "Source Serif 4", Georgia, serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --max-width: 1160px;
}

* { box-sizing: border-box; }

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

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

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

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

/* ---------- BANDEAU DERNIÈRES ACTUS ---------- */
.breaking-bar {
  background: var(--text);
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  padding: 8px 0;
}

.breaking-bar .container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.breaking-label {
  background: var(--accent-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.breaking-ticker {
  display: flex;
  gap: 40px;
  animation: ticker 30s linear infinite;
  font-size: 13px;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .breaking-ticker { animation: none; overflow-x: auto; }
}

/* ---------- HEADER ---------- */
.site-header {
  border-bottom: 2px solid var(--text);
  padding: 20px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-logo {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.main-nav a {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.main-nav a:hover { color: var(--accent-red); border-color: var(--accent-red); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  z-index: 210;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  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); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 31, 0.4);
  z-index: 190;
}

.nav-overlay.is-open { display: block; }

/* ---------- HERO / À LA UNE ---------- */
.hero {
  padding: 32px 0 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

.hero-main {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  padding-top: 56.25%; /* ratio 16:9 - technique compatible tous navigateurs mobiles */
  background: var(--bg-alt);
}

.hero-main img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
}

.hero-main:hover img { transform: scale(1.04); }

.hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 32px 28px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
}

.hero-overlay h1 {
  font-family: var(--font-headline);
  color: #fff;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
  margin: 0 0 8px;
}

.hero-overlay .tag-featured { margin-bottom: 12px; }

/* ---------- SIDEBAR TENDANCES ---------- */
.trending-sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-red);
  margin: 0 0 16px;
  border-bottom: 2px solid var(--text);
  padding-bottom: 8px;
}

.trending-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.trending-item:last-child { border-bottom: none; }

.trending-number {
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  color: var(--border);
  line-height: 1;
}

.trending-item h4 {
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
}

.trending-item a:hover { color: var(--accent-red); }

/* ---------- TAGS / BADGES ---------- */
.tag-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--bg-alt);
  color: var(--text);
}

.tag-featured {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--accent-gold);
  color: #1a1a1a;
}

/* ---------- ARTICLE GRID / CARDS ---------- */
.section-title {
  font-family: var(--font-headline);
  font-size: 22px;
  margin: 48px 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
  padding-bottom: 56px;
}

.article-card { display: flex; flex-direction: column; }

.article-card .thumb {
  position: relative;
  padding-top: 56.25%; /* ratio 16:9 - technique compatible tous navigateurs mobiles */
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  background: var(--bg-alt);
  margin-bottom: 14px;
}

.article-card .thumb img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.article-card:hover .thumb img { transform: scale(1.06); }

.article-card h2 {
  font-family: var(--font-headline);
  font-size: 19px;
  line-height: 1.35;
  margin: 0 0 8px;
  transition: color 0.15s ease;
}

.article-card:hover h2 { color: var(--accent-red); }

.card-excerpt {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 12px;
  flex-grow: 1;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- SINGLE POST ---------- */
.single-post { padding: 40px 0 80px; }

.single-post .post-header {
  max-width: 760px;
  margin: 0 auto 28px;
  text-align: left;
}

.single-post h1 {
  font-family: var(--font-headline);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  margin: 16px 0;
}

.post-meta-row {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.featured-image {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}

.post-content {
  max-width: 720px;
  margin: 0 auto;
  font-size: 18px;
}

.post-content h2 {
  font-family: var(--font-headline);
  font-size: 24px;
  margin: 36px 0 14px;
}

.post-content p { margin: 0 0 20px; }

.video-embed {
  margin: 32px 0;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.source-credit {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 16px 20px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- CTA NEWSLETTER (accroche conversion) ---------- */
.newsletter-cta {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  padding: 32px;
  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: #C4C9D2; margin: 0 0 20px; }

.newsletter-cta form {
  display: flex;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}

.newsletter-cta input[type="email"] {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
}

.newsletter-cta button {
  background: var(--accent-red);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}

/* ---------- FOOTER ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.site-footer .footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.site-footer h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 0 0 12px;
}

.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 8px; }

/* ============================================================
   RESPONSIVE — mobile-first refinements
   ============================================================ */

/* Tablette et en dessous */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .trending-sidebar { order: 2; }
}

/* Mobile */
@media (max-width: 720px) {
  .container { padding: 0 16px; }

  /* Bandeau dernières actus: plus compact */
  .breaking-bar { padding: 6px 0; }
  .breaking-label { font-size: 10px; padding: 2px 8px; }
  .breaking-ticker { font-size: 12px; gap: 28px; }

  /* Header compact avec vrai menu plein écran */
  .site-header { padding: 14px 0; }
  .site-logo { font-size: 22px; }
  .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: 200;
    padding: 90px 28px 28px;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  }

  .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: 4px;
  }

  .main-nav a {
    display: block;
    padding: 14px 4px;
    font-size: 16px;
    border-bottom: 1px solid var(--border);
    min-height: 44px; /* cible tactile confortable */
  }

  body.nav-locked { overflow: hidden; }

  /* Hero: overlay et titres resserrés */
  .hero { padding: 20px 0 32px; }
  .hero-overlay { padding: 20px 16px 16px; }
  .hero-overlay h1 { font-size: 22px; }

  .trending-sidebar h3 { font-size: 12px; margin-bottom: 12px; }
  .trending-number { font-size: 22px; }
  .trending-item { padding: 11px 0; gap: 10px; }
  .trending-item h4 { font-size: 13px; }

  /* Grille articles: une seule colonne, cartes plus respirantes */
  .section-title { font-size: 19px; margin: 32px 0 18px; }
  .article-grid { grid-template-columns: 1fr; gap: 24px; padding-bottom: 40px; }
  .article-card h2 { font-size: 18px; }
  .card-excerpt { font-size: 13.5px; }

  /* Article seul: lisibilité mobile */
  .single-post { padding: 24px 0 56px; }
  .single-post h1 { font-size: 24px; margin: 12px 0; }
  .post-content { font-size: 16.5px; }
  .post-content h2 { font-size: 20px; margin: 28px 0 12px; }
  .featured-image { margin-bottom: 20px; }

  /* Newsletter: champs empilés, boutons pleine largeur (cible tactile) */
  .newsletter-cta { padding: 24px 18px; margin: 32px 0; }
  .newsletter-cta h3 { font-size: 19px; }
  .newsletter-cta form { flex-direction: column; max-width: 100%; }
  .newsletter-cta input[type="email"],
  .newsletter-cta button {
    width: 100%;
    padding: 13px 14px; /* cible tactile confortable */
    font-size: 16px; /* évite le zoom automatique iOS sur focus input */
  }

  /* Footer: une colonne, plus lisible */
  .site-footer { padding: 28px 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* Très petits écrans */
@media (max-width: 380px) {
  .site-logo { font-size: 19px; }
  .hero-overlay h1 { font-size: 19px; }
  .single-post h1 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .main-nav.is-open { animation: none; }
  .nav-toggle span { transition: none; }
}
