/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: #1e293b;
  background-color: #f8fafc;
  margin: 0;
  padding: 0;
  line-height: 1.7;
}

/* === Header === */
.site-header {
  background-color: #1e293b;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.site-logo {
  color: white;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.site-logo span {
  color: #f59e0b;
}

.site-logo-icon {
  width: 34px;
  height: 34px;
  vertical-align: middle;
  margin-right: 0.5rem;
  position: relative;
  top: -2px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.site-nav a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.site-nav a:hover {
  color: #f59e0b;
}

/* === Main === */
.site-main {
  min-height: calc(100vh - 60px - 110px);
}

/* === Home page === */
.home-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 1.1rem;
  color: #64748b;
  margin: 0;
}

.subjects h2,
.recent-posts h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #f59e0b;
  display: inline-block;
}

/* === Subject cards === */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 1rem 0 3rem;
}

.subject-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #f59e0b;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}

.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.subject-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.75rem;
}

.subject-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

.subject-card p {
  margin: 0;
  color: #64748b;
  font-size: 0.88rem;
}

/* === Post list === */
.post-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.post-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.post-item:last-child { border-bottom: none; }

.post-link {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  text-decoration: none;
}

.post-link:hover { color: #f59e0b; }

.post-meta {
  margin-top: 0.2rem;
  font-size: 0.83rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-category {
  background: #fef3c7;
  color: #92400e;
  padding: 0.1em 0.5em;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.post-excerpt {
  margin: 0.5rem 0 0;
  color: #475569;
  font-size: 0.88rem;
}

/* === Post layout with sidebar === */
.post-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
}

/* === Sidebar === */
.sidebar {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  position: sticky;
  top: 80px;
}

.sidebar h3 {
  margin: 0 0 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar ul li { margin-bottom: 0.2rem; }

.sidebar ul li a {
  color: #475569;
  text-decoration: none;
  font-size: 0.88rem;
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

.sidebar ul li em {
  color: #94a3b8;
  font-size: 0.88rem;
  padding: 0.35rem 0.6rem;
  display: block;
}

/* === Article / content card === */
.post-content {
  background: white;
  border-radius: 10px;
  padding: 2.5rem;
  border: 1px solid #e2e8f0;
  min-width: 0;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.post-header h1 {
  margin: 0 0 0.75rem;
  font-size: 1.85rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Article content typography */
.post-content h1 { font-size: 1.7rem; color: #1e293b; margin-top: 2.5rem; font-weight: 800; letter-spacing: -0.02em; }
.post-content h2 { font-size: 1.35rem; color: #1e293b; margin-top: 2rem; font-weight: 700; border-bottom: 1px solid #f1f5f9; padding-bottom: 0.4rem; }
.post-content h3 { font-size: 1.1rem; color: #334155; margin-top: 1.5rem; font-weight: 700; }
.post-content h4 { font-size: 1rem; color: #334155; margin-top: 1.25rem; font-weight: 700; }

.post-content a { color: #2563eb; text-decoration: underline; text-underline-offset: 2px; }
.post-content a:hover { color: #1d4ed8; }

.post-content code {
  background: #f1f5f9;
  color: #be123c;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.post-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.85rem;
  border-radius: 0;
}

.post-content blockquote {
  border-left: 4px solid #f59e0b;
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: #fffbeb;
  border-radius: 0 8px 8px 0;
  color: #78350f;
}

.post-content blockquote p { margin: 0; }

.post-content ul, .post-content ol { padding-left: 1.5rem; }
.post-content li { margin: 0.3rem 0; }

.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

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

.post-content th {
  background: #f8fafc;
  font-weight: 700;
}

/* === Rouge syntax highlighting === */
.highlight pre { margin: 0; }
.highlight .c, .highlight .cm, .highlight .c1 { color: #64748b; font-style: italic; } /* commentaires */
.highlight .nt  { color: #7dd3fc; }  /* balises */
.highlight .na  { color: #fbbf24; }  /* attributs */
.highlight .s, .highlight .s1, .highlight .s2 { color: #86efac; } /* chaînes */
.highlight .nv, .highlight .cp { color: #f9a8d4; } /* variables, processing instructions */

/* === Tags === */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.tag {
  background: #f1f5f9;
  color: #475569;
  padding: 0.2em 0.55em;
  border-radius: 4px;
  font-size: 0.78rem;
}

/* === Footer === */
.site-footer {
  background: #1e293b;
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 2rem 1.5rem;
  margin-top: 3rem;
}

.footer-inner p {
  margin: 0.35rem 0;
  font-size: 0.9rem;
}

.site-footer a {
  color: #f59e0b;
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover { text-decoration: underline; }

.footer-copy { font-size: 0.8rem; opacity: 0.5; }

/* === Responsive === */
@media (max-width: 800px) {
  .post-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    order: -1;
  }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 1.8rem; }
  .subject-grid { grid-template-columns: 1fr 1fr; }

  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 0.75rem 1.25rem;
    gap: 0.5rem;
  }

  .site-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
  .site-nav a { margin-left: 0; padding: 0.25rem 0.5rem; font-size: 0.85rem; }
  .post-content { padding: 1.5rem; }
}

@media (max-width: 400px) {
  .subject-grid { grid-template-columns: 1fr; }
}
