/* ==========================================================================
   Design tokens (identiques au portfolio florianutiel.fr)
   ========================================================================== */
:root {
  --bg: #0a0e1a;
  --bg-elevated: #0f1526;
  --surface: #141b2e;
  --surface-hover: #1a2338;
  --border: #253148;
  --border-strong: #34445f;

  --text: #e8ecf4;
  --text-muted: #a7b1c4;
  --text-faint: #6b7690;

  --accent: #4fa8f5;
  --accent-strong: #7cc0ff;
  --accent-contrast: #04101f;
  --accent-soft: rgba(79, 168, 245, 0.12);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);

  --container: 1080px;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

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

a {
  color: var(--accent-strong);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 700; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.75em 1.25em;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section { padding: 4.5rem 0; border-top: 1px solid var(--border); }
section:first-of-type { border-top: none; }

/* ==========================================================================
   Header / Nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: var(--container);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}
.nav-links a[aria-current="page"] { color: var(--accent-strong); }

.nav-actions { display: flex; align-items: center; gap: 1rem; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: 5rem 0 4rem;
  border-top: none;
}
.hero-inner { max-width: 720px; }
.hero .eyebrow {
  font-family: var(--font-mono);
  color: var(--ok);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: var(--ok-soft);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
}
.hero .eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin-bottom: 0.75rem;
}
.hero .pitch {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 0;
}

/* ==========================================================================
   Cards / grids
   ========================================================================== */
.grid {
  display: grid;
  gap: 1.25rem;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.card:hover { border-color: var(--border-strong); }

.card-link {
  display: block;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card-link:hover {
  text-decoration: none;
  color: var(--text);
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* ==========================================================================
   Posts grid (accueil du blog)
   ========================================================================== */
.grid-posts { gap: 1.75rem; }

.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.85rem;
  border-top: 3px solid var(--accent);
}
.post-card-image {
  height: 160px;
  margin: -1.85rem -1.85rem 1.25rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--border);
}
.post-card .tag { align-self: flex-start; margin-bottom: 1rem; }
.post-card h3 { font-size: 1.2rem; margin-bottom: 0.6rem; }
.post-card > p { color: var(--text-muted); font-size: 0.95rem; flex-grow: 1; margin-bottom: 1rem; }

.project-meta { margin: 0; }
.project-meta p, .post-card .project-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.meta-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
  margin-right: 0.5rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}
.tag.tag-accent { border-color: rgba(79,168,245,0.4); color: var(--accent-strong); }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.pagination-location {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ==========================================================================
   Article (page / post)
   ========================================================================== */
.post-full { padding: 4rem 0 5rem; }
.post-narrow { max-width: 760px; margin: 0 auto; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--accent-strong); text-decoration: none; }

.detail-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; align-items: center; }

.post-full h1 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); margin-bottom: 1.5rem; }

.post-feature-image {
  width: 100%;
  border-radius: var(--radius-lg);
  margin-bottom: 2.5rem;
  border: 1px solid var(--border);
}

.post-tags { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }

/* Typographie du contenu riche généré par l'éditeur Ghost */
.post-content {
  font-size: 1.08rem;
  color: var(--text);
  display: grid;
  grid-template-columns: 1fr min(760px, 100%) 1fr;
  column-gap: 1.5rem;
}
.post-content > * { grid-column: 2; }
.post-content > * + * { margin-top: 1.4em; }

/* Images larges / pleine largeur (options de l'éditeur Ghost) */
.post-content > .kg-width-wide {
  grid-column: 1 / -1;
  max-width: 1000px;
  width: 100%;
  justify-self: center;
}
.post-content > .kg-width-full {
  grid-column: 1 / -1;
  max-width: none;
  width: 100%;
}
.post-content > .kg-width-wide img,
.post-content > .kg-width-full img {
  width: 100%;
}
.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
  margin-top: 2em;
  margin-bottom: 0.6em;
}
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content p, .post-content li { color: var(--text-muted); line-height: 1.75; }
.post-content a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
.post-content strong { color: var(--text); }
.post-content ul, .post-content ol { padding-left: 1.4rem; }
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li { margin-bottom: 0.4em; }
.post-content blockquote {
  margin: 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-style: italic;
}
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.4em;
}
.post-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
}
.post-content img, .post-content figure img {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.post-content figcaption {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.post-content table { width: 100%; border-collapse: collapse; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 0.6rem 0.8rem; text-align: left; }
.post-content th { background: var(--bg-elevated); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  color: var(--text-faint);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.social-links { display: flex; gap: 1.25rem; }
.social-links a { color: var(--text-muted); font-weight: 500; }
.social-links a:hover { color: var(--accent-strong); }

.footer-legal {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ==========================================================================
   Erreurs
   ========================================================================== */
.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem;
  border-top: none;
}
.error-page .code {
  font-family: var(--font-mono);
  font-size: 4rem;
  color: var(--accent-strong);
  font-weight: 700;
}
.error-page .pitch { max-width: 420px; margin-bottom: 1.5rem; }

/* ==========================================================================
   Back to top
   ========================================================================== */
.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background 0.15s ease;
  box-shadow: var(--shadow-md);
  z-index: 90;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--accent-strong); }

@media (max-width: 640px) {
  .back-to-top { right: 1rem; bottom: 1rem; width: 42px; height: 42px; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem 1.5rem;
    gap: 1rem;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-actions .btn span { display: none; }
}

@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  section { padding: 3rem 0; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .pagination { flex-wrap: wrap; gap: 1rem; }
}
