/* Reset et base */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-light: #666666;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-border: #e5e5e5;
  --color-code-bg: #f5f5f5;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --max-width: 720px;
  --spacing: 1.5rem;
}

html {
  font-size: 18px;
  line-height: 1.6;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--color-accent);
}

/* Main */
.site-main {
  flex: 1;
  padding: 3rem 0;
}

/* Hero (page d'accueil) */
.hero {
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  margin: 0 0 1rem 0;
}

.hero p {
  font-size: 1.1rem;
  color: var(--color-text-light);
}

.hero .cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.hero .cta-links a {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--color-accent);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
}

.hero .cta-links a:hover {
  background: var(--color-accent-hover);
}

.hero .cta-links a.secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.hero .cta-links a.secondary:hover {
  background: var(--color-accent);
  color: white;
}

/* Articles */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.article-header h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 0.5rem 0;
}

.article-header .subtitle {
  font-size: 1.2rem;
  color: var(--color-text-light);
  margin: 0 0 0.5rem 0;
}

.article-header time {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.article-content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.article-content h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-content p {
  margin: 1rem 0;
}

.article-content ul,
.article-content ol {
  padding-left: 1.5rem;
}

.article-content li {
  margin: 0.5rem 0;
}

/* Images */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
}

/* Code */
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.article-content pre {
  background: var(--color-code-bg);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-content pre code {
  background: none;
  padding: 0;
}

/* Tables */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.article-content th,
.article-content td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.article-content th {
  font-weight: 600;
  background: var(--color-code-bg);
}

/* Liste d'articles */
.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-list li {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.article-list li:last-child {
  border-bottom: none;
}

.article-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  text-decoration: none;
  color: var(--color-text);
  gap: 1rem;
}

.article-list a:hover .title {
  color: var(--color-accent);
}

.article-list .title {
  font-weight: 500;
}

.article-list time {
  font-size: 0.85rem;
  color: var(--color-text-light);
  white-space: nowrap;
}

.article-list .summary {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin: 0.5rem 0 0 0;
}

.see-all {
  display: inline-block;
  margin-top: 1rem;
  color: var(--color-accent);
  text-decoration: none;
}

.see-all:hover {
  text-decoration: underline;
}

/* Recent articles section */
.recent-articles {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.recent-articles h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  margin-top: auto;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-links a {
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 0.9rem;
}

.social-links a:hover {
  color: var(--color-accent);
}

/* Article with TOC - wider layout */
.single.has-toc {
  max-width: calc(var(--max-width) + 320px + 3rem);
  margin: 0 auto;
  padding: 0 var(--spacing);
}

.single.has-toc .article-header {
  max-width: var(--max-width);
}

.article-wrapper {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.single.has-toc .article-content {
  flex: 1;
  min-width: 0;
  max-width: var(--max-width);
}

/* TOC Sidebar - floating */
.toc-sidebar {
  width: 320px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 2rem;
}

/* Table of Contents */
.toc {
  background: var(--color-code-bg);
  padding: 1.5rem;
  border-radius: 6px;
}

.toc h2 {
  font-size: 0.85rem;
  margin: 0 0 1rem 0;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toc nav > ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.toc ul {
  padding-left: 1rem;
  list-style: none;
}

.toc li {
  margin: 0.4rem 0;
}

.toc a {
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 0.85rem;
  display: block;
  padding: 0.2rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  margin-left: -0.75rem;
}

/* Smaller TOC font on desktop sidebar */
.toc-sidebar .toc li {
  margin: 0.3rem 0;
}

.toc-sidebar .toc a {
  font-size: 0.75rem;
  padding: 0.15rem 0;
}

.toc a:hover {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
}

/* Responsive */
@media (max-width: 1000px) {
  .article-wrapper {
    flex-direction: column;
  }

  .toc-sidebar {
    width: 100%;
    order: -1;
    position: static;
    margin-bottom: 2rem;
  }

  .single.has-toc {
    max-width: var(--max-width);
    padding: 0 1.5rem;
  }

  .single.has-toc .article-content {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .article-list a {
    flex-direction: column;
    gap: 0.25rem;
  }

  .site-footer .container {
    flex-direction: column;
    text-align: center;
  }
}
