/*
Theme Name: Signal AI Premium
Theme URI: https://tekfold.com
Author: Maxscor
Description: Thème éditorial premium avec mode sombre, pour un site d'actualité tech professionnel (v3).
Version: 3.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: signal-ai
*/

:root {
  --bg: #FAF8F5;
  --bg-alt: #F1EDE6;
  --surface: #FFFFFF;
  --text: #1F1B24;
  --text-muted: #5C5560;
  --accent: #C9622D;
  --accent-hover: #B0521F;
  --accent-2: #1F5F52;
  --border: #E6DFD5;
  --radius: 10px;
  --radius-sm: 6px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --max-width: 1180px;
  --shadow: 0 4px 24px rgba(31, 27, 36, 0.06);
  --shadow-hover: 0 12px 32px rgba(31, 27, 36, 0.12);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #16141A;
  --bg-alt: #1E1B23;
  --surface: #221F28;
  --text: #F0EDE8;
  --text-muted: #A79FAA;
  --accent: #E08A52;
  --accent-hover: #EFA06C;
  --accent-2: #4E9B8A;
  --border: #332E3A;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  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: var(--bg);
  overflow: hidden;
  white-space: nowrap;
  padding: 9px 0;
}

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

.breaking-label {
  background: var(--accent);
  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 32s 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: 1px solid var(--border);
  padding: 22px 0;
  background: var(--bg);
}

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

.site-logo {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.main-nav a {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  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); border-color: var(--accent); }

.theme-toggle {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s ease;
}

.theme-toggle:hover { background: var(--border); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.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(0, 0, 0, 0.4);
  z-index: 190;
}
.nav-overlay.is-open { display: block; }

/* ---------- BARRE DE PROGRESSION DE LECTURE ---------- */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--accent);
  width: 0%;
  z-index: 300;
  transition: width 0.1s ease-out;
}

/* ---------- HERO ASYMÉTRIQUE ---------- */
.hero { padding: 40px 0 56px; }

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

.hero-main {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  padding-top: 56.25%;
  background: var(--bg-alt);
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease;
}

.hero-main:hover { box-shadow: var(--shadow-hover); }

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

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

.hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 36px 30px 26px;
  background: linear-gradient(to top, rgba(0,0,0,0.88), rgba(0,0,0,0));
}

.hero-overlay h1 {
  font-family: var(--font-display);
  color: #fff;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.2;
  margin: 0 0 10px;
  font-weight: 600;
}

.tag-featured {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  margin-bottom: 14px;
}

/* ---------- LISTE LATÉRALE "DERNIERS" ---------- */
.side-list h2 {
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--text);
}

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

.side-item .side-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-alt);
}
.side-item .side-thumb img { width: 100%; height: 100%; object-fit: cover; }

.side-item h3 {
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  font-weight: 600;
}
.side-item a:hover h3 { color: var(--accent); }

/* ---------- TENDANCES GITHUB (sidebar accueil) ---------- */
.gh-trending { margin-top: 28px; }
.gh-trending h2 {
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.gh-note {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}
.gh-item {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.gh-item:last-child { border-bottom: none; }
.gh-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.gh-row .trending-number {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.gh-row a {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}
.gh-row a:hover { color: var(--accent); }
.gh-lang {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-alt);
  color: var(--text-muted);
  flex-shrink: 0;
}
.gh-desc {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 2px 0 0 24px;
}

/* ---------- TAGS CATÉGORIE (couleur par catégorie) ---------- */
.tag-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--bg-alt);
  color: var(--text);
  border-left: 3px solid var(--accent-2);
}
.tag-category[data-cat="bons-plans"] { border-left-color: var(--accent); }
.tag-category[data-cat="actualite-generale"] { border-left-color: #7A6FD8; }

/* ---------- GRILLE ARTICLES ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin: 56px 0 26px;
  padding-bottom: 14px;
  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;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.article-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.article-card .thumb {
  position: relative;
  padding-top: 56.25%;
  border-radius: var(--radius-sm);
  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;
  transition: transform 0.4s ease;
}
.article-card:hover .thumb img { transform: scale(1.06); }

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

.card-excerpt {
  font-size: 14px;
  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;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---------- ARTICLE SEUL ---------- */
.single-post { padding: 44px 0 84px; }

.single-post .post-header {
  max-width: 760px;
  margin: 0 auto 30px;
}

.single-post h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.18;
  margin: 18px 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: 36px;
  box-shadow: var(--shadow);
}

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

.post-content h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 25px;
  margin: 40px 0 16px;
}

.post-content p { margin: 0 0 20px; }
.post-content a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }

.video-embed {
  margin: 36px 0;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

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

/* ---------- CTA NEWSLETTER ---------- */
.newsletter-cta {
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  margin: 56px 0;
}

.newsletter-cta h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 10px;
}

.newsletter-cta p { opacity: 0.75; margin: 0 0 22px; }

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

.newsletter-cta button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}
.newsletter-cta button:hover { background: var(--accent-hover); }

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

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

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

.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 9px; }
.site-footer a:hover { color: var(--accent); }

/* ---------- OUTIL (résumeur YouTube) ---------- */
#yt-summarizer {
  background: var(--bg-alt) !important;
  color: var(--text);
}
#yt-summarizer input, #yt-summarizer button { font-family: var(--font-body); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .breaking-bar { padding: 7px 0; }
  .breaking-label { font-size: 10px; padding: 2px 8px; }
  .breaking-ticker { font-size: 12px; gap: 28px; }

  .site-header { padding: 14px 0; }
  .site-logo { font-size: 21px; }
  .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.15);
  }
  .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; }
  body.nav-locked { overflow: hidden; }

  .hero { padding: 20px 0 32px; }
  .hero-overlay { padding: 20px 16px 16px; }
  .hero-overlay h1 { font-size: 22px; }

  .side-list h2 { font-size: 12px; margin-bottom: 12px; }

  .section-title { font-size: 19px; margin: 36px 0 18px; }
  .article-grid { grid-template-columns: 1fr; gap: 20px; padding-bottom: 40px; }
  .article-card h2 { font-size: 18px; }
  .card-excerpt { font-size: 13.5px; }

  .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;
    position: relative;
    padding-top: 75%;
  }
  .featured-image img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .newsletter-cta { padding: 26px 18px; margin: 36px 0; }
  .newsletter-cta h3 { font-size: 20px; }
  .newsletter-cta form { flex-direction: column; max-width: 100%; }
  .newsletter-cta input[type="email"], .newsletter-cta button {
    width: 100%; padding: 13px 14px; font-size: 16px;
  }

  .site-footer { padding: 32px 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

@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, body, .article-card, .hero-main img { transition: none; }
}
