/*
Theme Name: AffiliSEO
Theme URI: https://ecomstack.fr
Author: AffiliSEO
Description: Thème WordPress moderne et sérieux, optimisé SEO et affiliation. Blocs bien définis, Core Web Vitals optimisés, schema Article intégré.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: GNU General Public License v2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: affiliseo
Tags: blog, custom-colors, custom-logo, custom-menu, featured-images, footer-widgets, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
*/

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:         #ffffff;
  --color-bg-soft:    #f8f9fa;
  --color-bg-dark:    #0f1117;
  --color-text:       #1a1a2e;
  --color-text-muted: #6b7280;
  --color-text-light: #9ca3af;
  --color-accent:     #2563eb;
  --color-accent-dark:#1d4ed8;
  --color-accent-bg:  #eff6ff;
  --color-success:    #16a34a;
  --color-success-bg: #f0fdf4;
  --color-border:     #e5e7eb;
  --color-border-dark:#d1d5db;
  --font-sans:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:        'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm:        4px;
  --radius-md:        8px;
  --radius-lg:        12px;
  --radius-xl:        16px;
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.10);
  --max-width:        720px;
  --sidebar-width:    280px;
  --transition:       0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-dark); }

/* ── TYPOGRAPHY ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); margin: 2.5rem 0 1rem; }
h3 { font-size: clamp(1.1rem, 2vw, 1.25rem); margin: 2rem 0 0.75rem; }
h4 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
p { margin-bottom: 1.25rem; }
ul, ol { margin: 0 0 1.25rem 1.5rem; }
li { margin-bottom: 0.4rem; }
blockquote {
  border-left: 4px solid var(--color-accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--color-accent-bg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-text-muted);
}
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.4em;
}
pre {
  background: var(--color-bg-dark);
  color: #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
pre code { background: none; border: none; padding: 0; color: inherit; font-size: 0.875rem; }

/* ── LAYOUT ───────────────────────────────────────────────── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.site-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar-width); gap: 3rem; max-width: 1120px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.site-layout.no-sidebar { grid-template-columns: 1fr; max-width: var(--max-width); }

/* ── HEADER ───────────────────────────────────────────────── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-logo span {
  display: inline-block;
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  border-radius: var(--radius-sm);
}
.site-logo:hover { color: var(--color-text); }

.main-nav ul { display: flex; list-style: none; margin: 0; padding: 0; gap: 2rem; }
.main-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition);
}
.main-nav a:hover { color: var(--color-text); }
.main-nav .current-menu-item a { color: var(--color-accent); }

/* ── BREADCRUMB ───────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-text-light); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb-sep { color: var(--color-border-dark); }

/* ── ARTICLE HEADER ───────────────────────────────────────── */
.article-header { margin-bottom: 2rem; }

.article-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  background: var(--color-accent-bg);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.article-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.article-meta-item { display: flex; align-items: center; gap: 5px; }
.article-meta svg { width: 13px; height: 13px; opacity: 0.6; }
.article-meta-sep { color: var(--color-border-dark); }
.article-meta .affiliate-notice {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef9c3;
  color: #854d0e;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

/* ── FEATURED IMAGE ───────────────────────────────────────── */
.article-featured-image {
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/7;
  background: var(--color-bg-soft);
}
.article-featured-image img { width: 100%; height: 100%; object-fit: cover; }

/* ── ARTICLE CONTENT ──────────────────────────────────────── */
.article-content { font-size: 1rem; line-height: 1.8; }
.article-content h2 { padding-top: 0.5rem; border-top: 2px solid var(--color-border); }
.article-content h2:first-child { border-top: none; padding-top: 0; }

/* Intro block */
.intro-block {
  background: var(--color-accent-bg);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 1.05rem;
  color: #1e3a6e;
  line-height: 1.7;
}

/* ── COMPARE TABLE ────────────────────────────────────────── */
.compare-table-wrap { overflow-x: auto; margin: 1.5rem 0 2rem; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.compare-table thead th {
  background: var(--color-bg-dark);
  color: #e2e8f0;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.compare-table thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.compare-table thead th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
.compare-table tbody tr { border-bottom: 1px solid var(--color-border); transition: background var(--transition); }
.compare-table tbody tr:last-child { border-bottom: none; }
.compare-table tbody tr:hover { background: var(--color-bg-soft); }
.compare-table tbody tr.winner { background: var(--color-success-bg); }
.compare-table tbody td { padding: 12px 16px; color: var(--color-text-muted); vertical-align: middle; }
.compare-table .tool-name { font-weight: 600; color: var(--color-text); }
.badge-winner { background: #dcfce7; color: #15803d; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-good { background: var(--color-bg-soft); color: var(--color-text-muted); font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.stars { color: #f59e0b; font-size: 0.8rem; letter-spacing: 1px; }

/* ── PROS CONS ────────────────────────────────────────────── */
.pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}
.pros-block, .cons-block {
  border-radius: var(--radius-md);
  padding: 1.25rem;
}
.pros-block { background: var(--color-success-bg); border: 1px solid #bbf7d0; }
.cons-block { background: #fef2f2; border: 1px solid #fecaca; }
.pros-cons-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pros-block .pros-cons-title { color: #15803d; }
.cons-block .pros-cons-title { color: #dc2626; }
.pros-cons-list { list-style: none; margin: 0; padding: 0; }
.pros-cons-list li { font-size: 0.875rem; color: var(--color-text); padding: 4px 0; display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.pros-cons-list li::before { flex-shrink: 0; margin-top: 4px; width: 6px; height: 6px; border-radius: 50%; content: ''; display: block; }
.pros-block .pros-cons-list li::before { background: #16a34a; }
.cons-block .pros-cons-list li::before { background: #dc2626; }

/* ── CTA AFFILIATE BLOCK ──────────────────────────────────── */
.affil-cta-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--color-success-bg);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.affil-cta-block.blue {
  background: var(--color-accent-bg);
  border-color: #bfdbfe;
}
.affil-cta-content { flex: 1; }
.affil-cta-title { font-size: 0.9rem; font-weight: 700; color: var(--color-text); margin-bottom: 4px; }
.affil-cta-desc { font-size: 0.8rem; color: var(--color-text-muted); line-height: 1.4; }
.affil-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-success);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.affil-cta-btn:hover { background: #15803d; color: #fff; transform: translateY(-1px); }
.affil-cta-block.blue .affil-cta-btn { background: var(--color-accent); }
.affil-cta-block.blue .affil-cta-btn:hover { background: var(--color-accent-dark); }
.affil-cta-arrow { font-size: 0.9rem; }

/* ── VERDICT BLOCK ────────────────────────────────────────── */
.verdict-block {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}
.verdict-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #92400e;
  margin-bottom: 0.5rem;
}
.verdict-text { font-size: 0.9rem; color: #78350f; line-height: 1.7; }

/* ── ARTICLE TAGS ─────────────────────────────────────────── */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.article-tag-item {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 4px 12px;
  transition: all var(--transition);
}
.article-tag-item:hover {
  background: var(--color-accent-bg);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-widget {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.sidebar-widget-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

/* Recent posts */
.recent-post { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.recent-post:last-child { border-bottom: none; padding-bottom: 0; }
.recent-post-thumb { width: 56px; height: 48px; background: var(--color-bg-soft); border-radius: var(--radius-sm); flex-shrink: 0; overflow: hidden; }
.recent-post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-post-title { font-size: 0.8rem; font-weight: 600; color: var(--color-text); line-height: 1.4; }
.recent-post-date { font-size: 0.72rem; color: var(--color-text-light); margin-top: 3px; }

/* ── BLOG INDEX ───────────────────────────────────────────── */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.post-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.post-card-thumb { aspect-ratio: 16/9; background: var(--color-bg-soft); overflow: hidden; }
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.post-card:hover .post-card-thumb img { transform: scale(1.03); }
.post-card-body { padding: 1.25rem; }
.post-card-category { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-accent); margin-bottom: 0.5rem; }
.post-card-title { font-size: 1rem; font-weight: 700; color: var(--color-text); line-height: 1.35; margin-bottom: 0.5rem; }
.post-card-excerpt { font-size: 0.82rem; color: var(--color-text-muted); line-height: 1.6; margin-bottom: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { font-size: 0.75rem; color: var(--color-text-light); display: flex; align-items: center; gap: 8px; }
.post-card-readmore {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-top: 0.75rem;
}
.post-card-readmore:hover { gap: 8px; }

/* ── FOOTER ───────────────────────────────────────────────── */
.site-footer {
  background: var(--color-bg-dark);
  color: #9ca3af;
  margin-top: 4rem;
}
.site-footer .container { padding-top: 3rem; padding-bottom: 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; margin-bottom: 2.5rem; }
.footer-brand .site-logo { color: #fff; margin-bottom: 0.75rem; }
.footer-brand p { font-size: 0.85rem; line-height: 1.7; }
.footer-col-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #e5e7eb; margin-bottom: 1rem; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a { font-size: 0.85rem; color: #9ca3af; transition: color var(--transition); }
.footer-links a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #1f2937;
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}
.footer-disclaimer { font-size: 0.75rem; color: #6b7280; max-width: 600px; line-height: 1.6; }

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 3rem 0;
}
.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  transition: all var(--transition);
}
.page-numbers:hover, .page-numbers.current {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .site-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .site-header .container { height: 52px; }
  .pros-cons-grid { grid-template-columns: 1fr; }
  .affil-cta-block { flex-direction: column; align-items: flex-start; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.75rem; text-align: center; }
}

/* ── UTILITIES ────────────────────────────────────────────── */
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.aligncenter { display: block; margin: 1.5rem auto; }
.alignleft { float: left; margin: 0.5rem 1.5rem 1rem 0; }
.alignright { float: right; margin: 0.5rem 0 1rem 1.5rem; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 0.8rem; color: var(--color-text-light); text-align: center; margin-top: 6px; }

/* ── MENU HAMBURGER MOBILE ───────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none;
  cursor: pointer; padding: 0;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--color-text); border-radius: 2px;
  margin: 0 auto; transition: all 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); }

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.1));
    padding: 0.5rem 0;
  }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav li { padding: 0 1.5rem; }
  .main-nav a { display: block; padding: 0.85rem 0; border-bottom: 1px solid var(--color-border); }
}

/* ── LISTE D'ARTICLES : petite image à gauche + texte ────────── */
.posts-list {
  display: flex;
  flex-direction: column;
}
.post-list-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
}
.post-list-item:first-child { padding-top: 0; }
.post-list-item:last-child { border-bottom: none; }

.post-list-thumb {
  flex: 0 0 140px;
  width: 140px;
  height: 90px;
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background: var(--color-bg-soft);
  display: block;
}
.post-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.post-list-item:hover .post-list-thumb img { transform: scale(1.05); }
.post-list-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-list-body {
  flex: 1 1 auto;
  min-width: 0;
}
.post-list-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 0.35rem;
  text-decoration: none;
}
.post-list-category:hover { text-decoration: underline; }
.post-list-title {
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}
.post-list-title a {
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition, 0.15s ease);
}
.post-list-title a:hover { color: var(--color-accent); }
.post-list-excerpt {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin: 0 0 0.45rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-list-meta {
  font-size: 0.75rem;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  gap: 7px;
}

@media (max-width: 640px) {
  .post-list-thumb {
    flex-basis: 90px;
    width: 90px;
    height: 68px;
  }
  .post-list-title { font-size: 1rem; }
  .post-list-excerpt { display: none; }
}
