@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap");

:root {
  --surface: #ffffff;
  --surface-border: #e2e8f0;
  --muted: #6b7280;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

body[data-theme="dark"] {
  --surface: #0f172a;
  --surface-border: #1f2937;
  --muted: #cbd5e1;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  background: var(--secondary);
  color: var(--primary);
  transition: background 0.3s ease, color 0.3s ease;
}

.blog-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  background: var(--secondary);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 6%;
}

.blog-nav .header h1 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--primary);
}

.blog-nav .header small {
  color: var(--muted);
}

.name-link {
  color: inherit;
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-right .back {
  font-size: 0.95rem;
}

.page {
  max-width: 1040px;
  margin: 0 auto 80px auto;
  padding: 0 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--main), #4a90ff);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.back:hover {
  color: var(--main);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--main);
  box-shadow: 0 10px 20px rgba(40, 109, 199, 0.18);
}

.theme-toggle img {
  width: 18px;
  height: 18px;
}

.hero {
  margin: 12px 0 16px;
  padding: 18px 20px;
  background: linear-gradient(120deg, rgba(40, 109, 199, 0.12), rgba(40, 109, 199, 0.03));
  border: 1px solid var(--surface-border);
  border-radius: 18px;
}

.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  color: var(--main);
  margin: 0 0 8px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 2.1rem;
  color: var(--primary);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 760px;
}

.articles-list {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.article-card {
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.article-card:hover {
  border-color: var(--main);
}

.article-card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: var(--primary);
}

.meta {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0 0 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meta .date {
  font-weight: 600;
  color: var(--primary);
}

.description {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.6;
}

.tag {
  display: inline-block;
  background: rgba(40, 109, 199, 0.12);
  color: var(--main);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 6px;
  margin-bottom: 6px;
}

.post-hero {
  margin: 12px 0 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-hero h1 {
  margin: 6px 0 10px;
  color: var(--primary);
}

.post {
  background: none;
  color: inherit;
  padding: 15px;
  border: none;
}

.post .description {
  margin-bottom: 0;
}

.content {
  line-height: 1.7;
  color: var(--primary);
}

/* ── Espacements du contenu article ─────────────────────────── */
.content p {
    margin-bottom: 1.2em;
    line-height: 1.8;
}

.content h1, .content h2, .content h3, .content h4 {
    margin-top: 2em;
    margin-bottom: 0.7em;
}

.content ul, .content ol {
    margin-bottom: 1.2em;
    padding-left: 1.5em;
}

.content li {
    margin-bottom: 0.5em;
    line-height: 1.7;
}

.content pre {
    margin-top: 1em;
    margin-bottom: 1.5em;
    padding: 1em 1.2em;
    border-radius: 6px;
    overflow-x: auto;
}

.content code {
    font-size: 0.88em;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5em;
}

.content th, .content td {
    padding: 0.6em 1em;
    border: 1px solid #ddd;
    text-align: left;
}

.content th {
    background: #f0f4f8;
    font-weight: bold;
}

.content figure.article-figure {
    margin: 1.8em 0;
    text-align: center;
}

.content figure.article-figure figcaption {
    font-size: 0.85em;
    color: #888;
    margin-top: 0.5em;
    font-style: italic;
}

/* Lignes vides intentionnelles (&nbsp; paragraphes) */
.content p:empty,
.content p:has(> br:only-child) {
    margin: 0.8em 0;
    height: 0.8em;
}

@media (max-width: 640px) {
  .page {
    padding: 0 18px 32px;
  }

  .articles-list {
    grid-template-columns: 1fr;
  }
}

/* Override global portfolio section min-height */
section.hero,
section.post-hero {
  min-height: auto;
}
