/*
Theme Name: SOSCode Blog
Theme URI: https://soscode.fr
Description: Thème SOSCode Blog — design system soscode.fr
Version: 1.0
Author: SOSCode
License: GNU General Public License v2 or later
Text Domain: soscode-blog
*/

/* ============================================
   SOSCode Blog Theme — Design System
   Based on soscode.fr design tokens
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- CSS Variables (Design Tokens) --- */
:root {
  /* Brand */
  --blue-deep: #003366;
  --blue-bright: #3399FF;
  --orange: #FF9900;
  --orange-accent: hsl(36 100% 50%);

  /* Tokens - Light Mode */
  --background: hsl(210 20% 98%);
  --foreground: hsl(210 50% 10%);
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(210 50% 10%);
  --border: hsl(210 20% 88%);
  --card-border: hsl(210 20% 92%);
  --primary: hsl(210 100% 50%);
  --primary-foreground: hsl(0 0% 100%);
  --secondary: hsl(210 50% 10%);
  --secondary-foreground: hsl(0 0% 100%);
  --muted: hsl(210 20% 94%);
  --muted-foreground: hsl(210 15% 45%);
  --accent: hsl(36 100% 50%);
  --accent-foreground: hsl(210 50% 10%);
  --destructive: hsl(0 84% 60%);
  --input: hsl(210 20% 85%);
  --ring: hsl(210 100% 50%);
  --popover: hsl(0 0% 100%);

  /* Spacing */
  --radius: 8px;

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Dark mode support */
.dark {
  --background: hsl(210 50% 4%);
  --foreground: hsl(210 20% 95%);
  --card: hsl(210 40% 8%);
  --card-foreground: hsl(210 20% 92%);
  --border: hsl(210 30% 18%);
  --card-border: hsl(210 30% 14%);
  --primary: hsl(210 100% 55%);
  --primary-foreground: hsl(0 0% 100%);
  --secondary: hsl(210 20% 92%);
  --secondary-foreground: hsl(210 50% 8%);
  --muted: hsl(210 30% 15%);
  --muted-foreground: hsl(210 15% 55%);
  --accent: hsl(36 100% 50%);
  --accent-foreground: hsl(210 50% 8%);
  --destructive: hsl(0 72% 51%);
  --input: hsl(210 30% 20%);
  --ring: hsl(210 100% 55%);
  --popover: hsl(210 40% 6%);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.625;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--blue-bright);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

h1 { font-size: clamp(2.25rem, 5vw, 4.2rem); }
h2 { font-size: clamp(1.875rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* --- Layout --- */
.site-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .site-container { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .site-container { padding: 0 2rem; }
}

.site-main {
  min-height: 60vh;
  padding: 3rem 0;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  height: 64px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--foreground);
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 9px;
  font-size: 1.25rem;
  font-weight: 700;
}

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

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--foreground);
}

.site-nav .nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground) !important;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  border-bottom: none !important;
  transition: background 0.2s ease, transform 0.1s ease;
}

.site-nav .nav-cta:hover {
  background: hsl(210 100% 45%);
  transform: translateY(-1px);
}

/* --- Blog Listing --- */
.blog-hero {
  text-align: center;
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.blog-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.75rem;
}

.blog-hero p {
  font-size: 1.125rem;
  color: var(--muted-foreground);
  max-width: 672px;
  margin: 0 auto;
  line-height: 1.7;
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .posts-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- Post Card --- */
.post-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.post-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--muted);
  display: block;
}

.post-card-thumb img,
.post-card-thumb .wp-post-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
}

.post-card-body {
  padding: 1.25rem;
}

.post-card-cat {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.post-card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--card-foreground);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.post-card-title a {
  color: var(--card-foreground);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card-title a:hover {
  color: var(--primary);
}

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-sep {
  opacity: 0.5;
}

.pagination {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.pagination a,
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.625rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--foreground);
  text-decoration: none;
  transition: all 0.2s ease;
}

.pagination a:hover,
.pagination .page-numbers.current {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

.error-404 {
  text-align: center;
  padding: 5rem 0;
}

.error-404 h1 {
  font-size: 5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* --- Single Post --- */
.single-post-header {
  max-width: 896px;
  margin: 0 auto 2rem;
  padding: 3rem 0 1.5rem;
}

.single-post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  margin: 0.75rem 0;
  letter-spacing: -0.025em;
}

.post-featured-img {
  max-width: 896px;
  margin: 0 auto 2rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.post-featured-img img {
  width: 100%;
  height: auto;
  display: block;
}

.post-content {
  max-width: 896px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--foreground);
}

.post-content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  color: var(--foreground);
}

.post-content h3 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
}

.post-content p {
  margin-bottom: 1.25rem;
  color: var(--foreground);
}

.post-content strong {
  font-weight: 600;
  color: var(--foreground);
}

.post-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content ul, .post-content ol {
  margin: 1rem 0 1.25rem 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--muted);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1.5rem 0;
}

/* --- Post Tags --- */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.tag:hover {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* --- CTA Section --- */
.cta-section {
  max-width: 896px;
  margin: 3rem auto 0;
  padding: 2rem;
  background: linear-gradient(135deg, var(--primary), hsl(210 100% 40%));
  border-radius: 12px;
  text-align: center;
  color: var(--primary-foreground);
}

.cta-section h2 {
  color: var(--primary-foreground);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.cta-section p {
  color: hsla(0 0% 100% / 0.85);
  margin-bottom: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--orange-accent);
  color: var(--accent-foreground);
}

.btn-primary:hover {
  background: hsl(36 100% 45%);
  transform: translateY(-1px);
  color: var(--accent-foreground);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background: var(--muted);
}

/* --- Comments --- */
.comments-section {
  max-width: 896px;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.comments-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Comment form */
.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px hsla(210 100% 50% / 0.2);
}

.comment-form textarea {
  min-height: 120px;
  resize: vertical;
}

.comment-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--foreground);
}

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

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .footer-inner { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .footer-inner { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

.footer-brand p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--foreground);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--foreground);
}

.footer-copy {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* --- Utility --- */
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.bg-muted { background: var(--muted); }
.bg-card { background: var(--card); }
.rounded-lg { border-radius: 9px; }
.rounded-xl { border-radius: 12px; }

/* --- Responsive spacing --- */
@media (min-width: 768px) {
  .site-main { padding: 4rem 0; }
  .single-post-header { padding: 4rem 0 2rem; }
}

@media (min-width: 1024px) {
  .site-main { padding: 5rem 0; }
  .blog-hero { padding: 5rem 0 3.5rem; }
}

/* --- Archive Page --- */
.archive-header {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.archive-header h1 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

/* --- Page Navigation (posts) --- */
.posts-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  max-width: 896px;
  margin-left: auto;
  margin-right: auto;
}

.posts-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.posts-nav a:hover {
  text-decoration: underline;
}
