/* =========================================
   BARAK RÉTRO - Mix Moderne + Pixel
   Thème clair avec touches rétro pixelisées
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Press+Start+2P&display=swap');

html {
  scroll-behavior: smooth;
  background-color: #f5f4f0; /* Évite le flash blanc au chargement */
}

/* =========================================
   Barre de progression de lecture
   ========================================= */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--orange-dark) 100%);
  z-index: 1001;
  transition: width 0.1s ease-out;
  box-shadow: 0 1px 3px rgba(232, 160, 53, 0.4);
}

/* Effet pixel sur la barre */
.reading-progress::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 8px;
  height: 4px;
  background: var(--primary);
  box-shadow: 2px 2px 0 var(--orange-dark);
}

:root {
  /* Couleurs du logo */
  --orange: #e8a035;
  --orange-dark: #c4862a;
  --green: #3d9c3d;
  --blue: #3d6bb3;
  --red: #c94444;
  --yellow: #e8d035;
  --gray-tv: #5a5a5a;
  --bg-logo: #1F1B1C;

  /* Accents */
  --primary: var(--orange);
  --primary-dark: var(--orange-dark);

  /* Pixel style */
  --pixel-border: 3px;
  --pixel-shadow: 4px 4px 0;
}

/* =========================================
   Thème Clair (défaut)
   ========================================= */
:root,
[data-theme="light"] {
  --bg: #f5f4f0;
  --bg-alt: #ffffff;
  --bg-dark: #4a4a4a;
  --text: #2d2d2d;
  --text-muted: #6b6b6b;
  --border: #d8d5cc;
  --border-dark: #b8b5ac;
  /* Couleurs des titres - variantes colorées */
  --heading-h3: #3d6bb3; /* bleu */
  --heading-h4: #3d9c3d; /* vert */
}

/* =========================================
   Thème Sombre
   ========================================= */
[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-alt: #252525;
  --bg-dark: #0f0f0f;
  --text: #e8e8e8;
  --text-muted: #a0a0a0;
  --border: #3a3a3a;
  --border-dark: #4a4a4a;
  /* Couleurs des titres - versions plus claires pour dark mode */
  --heading-h3: #6a9fd4; /* bleu clair */
  --heading-h4: #5fbf5f; /* vert clair */
}

/* Ajustements spécifiques dark mode */
[data-theme="dark"] .card-image.placeholder {
  background-color: #333;
}

[data-theme="dark"] .article-body code {
  background: #333;
  border-color: #444;
}

[data-theme="dark"] .search-input::placeholder {
  color: #666;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* =========================================
   Typography
   ========================================= */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Press Start 2P', cursive;
  line-height: 1.5;
  color: var(--text);
}

h1 { font-size: 1.25rem; margin-bottom: 1rem; }
h2 { font-size: 1rem; margin-bottom: 0.75rem; }
h3 { font-size: 0.85rem; margin-bottom: 0.5rem; }

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

a:hover {
  color: var(--primary-dark);
}

/* =========================================
   Layout
   ========================================= */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* =========================================
   Header
   ========================================= */

header {
  background: var(--bg-logo);
  border-bottom: var(--pixel-border) solid var(--gray-tv);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  isolation: isolate;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo img {
  height: 56px;
  width: auto;
  image-rendering: pixelated;
}

.logo-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.logo-text {
  font-family: 'Press Start 2P', cursive;
  font-size: 1rem;
  color: var(--orange);
  text-shadow: 2px 2px 0 #333;
}

.logo-baseline {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

nav a,
nav .nav-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  padding: 0.6rem 1rem;
  color: #ccc;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

nav a:hover,
nav .nav-btn:hover {
  color: var(--orange);
  border-color: var(--orange);
  background: rgba(232, 160, 53, 0.15);
}

nav .nav-link-newsletter {
  color: var(--orange);
  border-color: var(--orange);
}

nav .nav-link-newsletter:hover {
  background: var(--orange);
  color: var(--bg-logo);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--orange);
  background: rgba(232, 160, 53, 0.15);
}

.theme-icon {
  display: none;
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
}

/* Soleil pixel art - plus gros et reconnaissable */
.theme-icon-light {
  background:
    /* Centre 6x6 */
    linear-gradient(var(--yellow) 0 0) 6px 6px / 6px 6px,
    /* Rayons horizontaux */
    linear-gradient(var(--yellow) 0 0) 0px 8px / 4px 2px,
    linear-gradient(var(--yellow) 0 0) 14px 8px / 4px 2px,
    /* Rayons verticaux */
    linear-gradient(var(--yellow) 0 0) 8px 0px / 2px 4px,
    linear-gradient(var(--yellow) 0 0) 8px 14px / 2px 4px,
    /* Rayons diagonaux */
    linear-gradient(var(--yellow) 0 0) 2px 2px / 2px 2px,
    linear-gradient(var(--yellow) 0 0) 14px 2px / 2px 2px,
    linear-gradient(var(--yellow) 0 0) 2px 14px / 2px 2px,
    linear-gradient(var(--yellow) 0 0) 14px 14px / 2px 2px;
  background-repeat: no-repeat;
}

/* Lune pixel art - cercle plein */
.theme-icon-dark {
  background:
    /* Row 0 - top */
    linear-gradient(#ccc 0 0) 6px 2px / 6px 2px,
    /* Row 1 */
    linear-gradient(#ccc 0 0) 4px 4px / 10px 2px,
    /* Row 2-5 - full width */
    linear-gradient(#ccc 0 0) 2px 6px / 14px 2px,
    linear-gradient(#ccc 0 0) 2px 8px / 14px 2px,
    linear-gradient(#ccc 0 0) 2px 10px / 14px 2px,
    linear-gradient(#ccc 0 0) 2px 12px / 14px 2px,
    /* Row 6 */
    linear-gradient(#ccc 0 0) 4px 14px / 10px 2px,
    /* Row 7 - bottom */
    linear-gradient(#ccc 0 0) 6px 16px / 6px 2px;
  background-repeat: no-repeat;
}

/* Afficher l'icône selon le thème actuel (montre l'icône du mode opposé) */
[data-theme="light"] .theme-icon-dark {
  display: block;
}

[data-theme="dark"] .theme-icon-light {
  display: block;
}

/* =========================================
   ' (About Page)
   ========================================= */

.page-content {
  padding: 2rem 0 4rem;
}

.page-content .container {
  max-width: 700px;
}

.page-title {
  font-size: 1.3rem;
  margin-bottom: 2.5rem;
  color: var(--primary);
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 3px dashed var(--border);
}

.about-section {
  margin-bottom: 2.5rem;
}

.about-section h2 {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.about-section p {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.about-section p:last-child {
  margin-bottom: 0;
}

/* Support Section */
.support-section {
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border);
  padding: 1.5rem;
  margin-top: 3rem;
}

.btc-donation {
  margin-top: 1rem;
}

.btc-address-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 2px solid var(--border);
  padding: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btc-address-block code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--text);
}

.btc-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
  margin-bottom: 0 !important;
}

/* =========================================
   Main Content
   ========================================= */

main {
  padding: 2.5rem 0;
  min-height: calc(100vh - 180px);
}

/* =========================================
   Page Header
   ========================================= */

.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--gray-tv);
}

.page-header p {
  font-family: 'Inter', sans-serif;
  color: var(--text-muted);
  font-size: 1rem;
}

/* =========================================
   Filters Bar
   ========================================= */

.filters-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: center;
}

.search-box {
  width: 100%;
  max-width: 400px;
}

.search-input {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: var(--pixel-border) solid var(--border-dark);
  background: var(--bg-alt);
  color: var(--text);
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232, 160, 53, 0.2);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.filter-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  color: var(--text-muted);
}

.category-info {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1rem;
  background: var(--bg-alt);
  border: 2px dashed var(--border);
  border-radius: 4px;
}

.category-info h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.category-info p {
  font-family: 'Inter', sans-serif;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
  font-style: italic;
}

/* =========================================
   Cards (Articles)
   ========================================= */

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
  overflow: hidden;
  transition: all 0.15s ease;
  position: relative;
  cursor: pointer;
}

.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--pixel-shadow) var(--border-dark);
  border-color: var(--primary);
}

/* Lien principal qui couvre toute la carte */
.card-link {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Les éléments interactifs au-dessus du lien principal */
.card .tag {
  position: relative;
  z-index: 2;
}

.card-image-link {
  display: block;
}

.card-image-wrapper {
  position: relative;
  overflow: hidden;
}

/* Effet CRT scanlines sur les cards */
.card-image-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.1) 2px,
    rgba(0, 0, 0, 0.1) 4px
  );
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.article-card:hover .card-image-wrapper::after {
  opacity: 0.4;
}

.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-bottom: var(--pixel-border) solid var(--border-dark);
  transition: transform 0.3s ease;
}

.article-card:hover .card-image {
  transform: scale(1.05);
}

.card-image.placeholder {
  background:
    linear-gradient(45deg, var(--bg) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg) 75%);
  background-size: 16px 16px;
  background-color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image.placeholder::after {
  content: "🎮";
  font-size: 2.5rem;
}

.card-content {
  padding: 1.25rem;
}

.card-category {
  display: inline-block;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.75rem;
  border: 2px solid currentColor;
}

.card-title {
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.card-title a {
  color: inherit;
}

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

.card-excerpt {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.card-meta {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* Badge "Déjà lu" sur les cartes */
.card.is-read::before,
.related-card.is-read::before {
  content: "✓ Lu";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.4rem;
  background: var(--green);
  color: #fff;
  padding: 0.3rem 0.5rem;
  z-index: 10;
  border: 2px solid rgba(255,255,255,0.3);
}

.card.is-read,
.related-card.is-read {
  position: relative;
}

/* Légère opacité sur les articles déjà lus */
.card.is-read .card-image,
.card.is-read .card-image-wrapper img,
.related-card.is-read .related-image {
  opacity: 0.7;
}

.card.is-read:hover .card-image,
.card.is-read:hover .card-image-wrapper img,
.related-card.is-read:hover .related-image {
  opacity: 1;
}

/* =========================================
   Buttons
   ========================================= */

.btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.55rem;
  padding: 0.75rem 1.25rem;
  border: var(--pixel-border) solid var(--border-dark);
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--border-dark);
  border-color: var(--primary);
  color: var(--primary);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 3px 3px 0 var(--primary-dark);
  color: white;
}

.btn-danger {
  background: var(--red);
  border-color: #a83939;
  color: white;
}

.btn-danger:hover {
  background: #a83939;
  box-shadow: 3px 3px 0 #8b2e2e;
  color: white;
}

.btn-small {
  font-size: 0.5rem;
  padding: 0.5rem 0.75rem;
}

/* =========================================
   Categories
   ========================================= */

.categories-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.category-tag {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  padding: 0.5rem 0.85rem;
  border: 2px solid var(--border-dark);
  background: var(--bg-alt);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.category-tag:hover {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--border-dark);
  border-color: var(--cat-color, var(--primary));
  color: var(--cat-color, var(--primary));
}

.category-tag.active {
  background: var(--cat-color, var(--primary));
  border-color: var(--cat-color, var(--primary));
  color: white;
}

.category-tag.active:hover {
  transform: none;
  box-shadow: none;
}

/* =========================================
   Tags
   ========================================= */

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tag {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.4rem;
  padding: 0.3rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.tag::before {
  content: '#';
}

.tag:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(232, 160, 53, 0.1);
}

.tag.active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: white;
}

.tag-large {
  font-size: 0.7rem;
  padding: 0.5rem 0.8rem;
}

/* =========================================
   Article Page
   ========================================= */

.article-page {
  padding-bottom: 2rem;
  margin-top: -2.5rem; /* Annuler le padding du main pour coller au header */
}

.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.article-hero {
  background: var(--bg-alt);
  border-bottom: var(--pixel-border) solid var(--border-dark);
  padding: 3rem 1.5rem;
  text-align: center;
  margin-bottom: 2.5rem;
}

/* Hero avec image de couverture */
.article-hero.has-cover {
  position: relative;
  background-image: var(--cover-image);
  background-size: cover;
  background-position: center;
  padding: 0;
  min-height: 400px;
  display: flex;
  align-items: flex-end;
  border-bottom: none;
}

/* Overlay sombre + gradient */
.article-hero.has-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.4) 100%);
}

/* Effet CRT scanlines */
.article-hero.has-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
}

.article-hero-content {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

.article-hero.has-cover .article-hero-content {
  position: relative;
  z-index: 1;
  padding: 3rem 1.5rem;
}

.article-hero.has-cover .article-title {
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.article-hero.has-cover .article-meta {
  color: rgba(255,255,255,0.8);
}

.article-hero.has-cover .article-category {
  background: rgba(0,0,0,0.4);
  border-color: var(--cat-color, var(--primary));
  color: var(--cat-color, var(--primary));
}

.article-hero.has-cover .article-category:hover {
  background: var(--cat-color, var(--primary));
  color: white;
}

.article-hero.has-cover .tag {
  background: rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.9);
}

.article-hero.has-cover .tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.article-category {
  display: inline-block;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  padding: 0.4rem 0.75rem;
  margin-bottom: 1rem;
  border: 2px solid var(--cat-color, var(--primary));
  color: var(--cat-color, var(--primary));
  transition: all 0.15s ease;
}

.article-category:hover {
  background: var(--cat-color, var(--primary));
  color: white;
}

.article-title {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  color: var(--text);
}

.article-meta {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.copy-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  padding: 0.25rem 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: 0.5rem;
  opacity: 0.7;
  transition: all 0.15s ease;
  vertical-align: middle;
}

.copy-link-btn:hover {
  opacity: 1;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.article-hero.has-cover .copy-link-btn {
  border-color: rgba(255,255,255,0.6);
  color: rgba(255,255,255,0.8);
}

.article-hero.has-cover .copy-link-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.article-tags {
  justify-content: center;
  margin-top: 1rem;
}

.article-body {
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
  padding: 3rem 4rem;
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--text);
}

/* Les titres Markdown sont décalés d'un niveau (# → h2, ## → h3) pour le SEO */
/* Offset pour les ancres (compense la hauteur de la topbar sticky) */
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  scroll-margin-top: 80px;
}

.article-body h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--border);
  color: var(--primary);
}

/* Pas de séparateur sur le premier h2 */
.article-body h2:first-child,
.article-body > h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.article-body h3 {
  font-size: 1.15rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--heading-h3);
}

.article-body h4 {
  font-size: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--heading-h4);
}

.article-body h5 {
  font-size: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-weight: 700;
}

.article-body h6 {
  font-size: 0.75rem;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body img {
  max-width: 100%;
  border: var(--pixel-border) solid var(--border-dark);
  margin: 1.5rem 0;
}

/* =========================================
   Classes utilitaires pour images
   ========================================= */

/* Largeurs */
.img-25 { width: 25%; }
.img-33 { width: 33.333%; }
.img-50 { width: 50%; }
.img-75 { width: 75%; }
.img-100 { width: 100%; }

/* Alignements */
.img-left {
  float: left;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
}

.img-right {
  float: right;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.img-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Bordures */
.img-no-border {
  border: none;
}

.img-border-accent {
  border-color: var(--primary);
}

.img-border-thick {
  border-width: 5px;
}

.img-shadow {
  box-shadow: var(--pixel-shadow) var(--border-dark);
}

/* Figure et légendes */
.article-body figure {
  margin: 1.5rem 0;
  padding: 0;
}

.article-body figure img {
  margin: 0;
}

.article-body figure.img-left {
  float: left;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
}

.article-body figure.img-right {
  float: right;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.article-body figure.img-center {
  display: table;
  margin-left: auto;
  margin-right: auto;
}

.article-body figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.25rem;
  font-style: italic;
}

/* Grilles d'images */
.img-grid {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.img-grid figure {
  margin: 0;
}

.img-grid img {
  width: 100%;
  margin: 0;
}

.img-grid-2 > figure,
.img-grid-2 > img {
  flex: 1 1 calc(50% - 0.5rem);
  max-width: calc(50% - 0.5rem);
}

.img-grid-3 > figure,
.img-grid-3 > img {
  flex: 1 1 calc(33.333% - 0.67rem);
  max-width: calc(33.333% - 0.67rem);
}

/* Clear pour les floats */
.clear {
  clear: both;
}

/* Responsive */
@media (max-width: 768px) {
  .img-25, .img-33, .img-50 {
    width: 100%;
  }

  .img-left, .img-right,
  .article-body figure.img-left,
  .article-body figure.img-right {
    float: none;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }

  .img-grid-2 > figure,
  .img-grid-2 > img,
  .img-grid-3 > figure,
  .img-grid-3 > img {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

.article-body code {
  font-family: 'SF Mono', Monaco, monospace;
  background: var(--bg);
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  font-size: 0.9em;
}

.article-body pre {
  background: var(--bg-dark);
  color: #f8f8f2;
  padding: 1.25rem;
  border: var(--pixel-border) solid var(--gray-tv);
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-body pre code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
}

.article-body blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-muted);
}

.article-body ul,
.article-body ol {
  margin: 1rem 0 1rem 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

/* Spoilers */
.article-body .spoiler {
  background: linear-gradient(135deg, var(--primary) 0%, var(--orange-dark) 100%);
  color: transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 0.25em 0.6em;
  transition: all 0.3s ease;
  user-select: none;
  display: inline-block;
  border: 2px solid var(--orange-dark);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

/* Texte masqué : on cache le vrai texte et on montre le placeholder */
.article-body .spoiler:not(.revealed) {
  font-size: 0;
}

.article-body .spoiler:not(.revealed)::before {
  content: '\1F512  Spoiler : cliquez pour r\00e9v\00e9ler';
  font-size: 1rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  padding: 0 0.4em;
}

.article-body .spoiler:hover:not(.revealed) {
  transform: translateY(-1px);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

/* Light theme : renforcer le contraste */
[data-theme="light"] .article-body .spoiler:not(.revealed) {
  border-color: #b07520;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}

.article-body .spoiler.revealed {
  background: var(--bg-alt);
  color: inherit;
  font-size: inherit;
  cursor: default;
  user-select: auto;
  border-color: var(--border);
  box-shadow: none;
}

.article-body .spoiler.revealed::before {
  content: '\1F513  ';
  font-size: inherit;
}

/* Placeholder avant chargement JS */
.article-body .spoiler:empty::after {
  content: '\2593\2593\2593\2593\2593\2593';
  color: #fff;
  font-size: 1rem;
}

/* =========================================
   Articles Connexes
   ========================================= */

.related-articles {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 3px dashed var(--border);
}

.related-articles h2 {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
  text-align: center;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.related-card {
  display: flex;
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
  overflow: hidden;
  transition: all 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.related-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--border-dark);
  border-color: var(--primary);
}

.related-image {
  width: 100px;
  min-height: 100px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border-right: 2px solid var(--border-dark);
}

.related-image.placeholder {
  background:
    linear-gradient(45deg, var(--bg) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg) 75%);
  background-size: 12px 12px;
  background-color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-image.placeholder::after {
  content: "🎮";
  font-size: 1.5rem;
}

.related-content {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.related-category {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.4rem;
  color: var(--cat-color, var(--primary));
  margin-bottom: 0.4rem;
}

.related-content h3 {
  font-size: 0.65rem;
  line-height: 1.5;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.related-card:hover .related-content h3 {
  color: var(--primary);
}

.related-meta {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

  .related-card {
    flex-direction: column;
  }

  .related-image {
    width: 100%;
    height: 120px;
    border-right: none;
    border-bottom: 2px solid var(--border-dark);
  }
}

.article-footer {
  max-width: 900px;
  margin: 2rem auto 0;
  text-align: center;
}

/* =========================================
   Temps de lecture
   ========================================= */

.reading-time {
  color: var(--text-muted);
  font-size: 0.85em;
}

.card-meta .reading-time::before {
  content: '·';
  margin: 0 0.5rem;
}

/* =========================================
   Table des matières
   ========================================= */

.table-of-contents {
  margin: 0 0 1.5rem 0;
}

.table-of-contents details {
  display: inline-block;
  border: 2px solid var(--border);
  background: var(--bg-alt);
}

.table-of-contents summary {
  padding: 0.5rem 0.75rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.55rem;
  color: var(--primary);
  cursor: pointer;
  background: var(--bg-alt);
  list-style: none;
}

.table-of-contents summary::-webkit-details-marker {
  display: none;
}

.table-of-contents summary::before {
  content: '+ ';
}

.table-of-contents details[open] summary::before {
  content: '- ';
}

.table-of-contents ul {
  list-style: none;
  padding: 0.5rem 0.75rem;
  margin: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.table-of-contents li {
  margin-bottom: 0.25rem;
  padding-left: 0.25rem;
}

.table-of-contents li:last-child {
  margin-bottom: 0;
}

.table-of-contents li.toc-level-1 {
  font-weight: 600;
}

.table-of-contents li.toc-level-1 a {
  color: var(--primary);
}

.table-of-contents li.toc-level-2 {
  padding-left: 1rem;
  font-size: 0.8em;
}

.table-of-contents li.toc-level-2::before {
  content: '└ ';
  color: var(--border-dark);
}

.table-of-contents li.toc-level-3 {
  padding-left: 2rem;
  font-size: 0.75em;
}

.table-of-contents li.toc-level-3::before {
  content: '└ ';
  color: var(--border-dark);
}

.table-of-contents li.toc-level-4 {
  padding-left: 3rem;
  font-size: 0.7em;
}

.table-of-contents li.toc-level-4::before {
  content: '└ ';
  color: var(--border-dark);
}

.table-of-contents a {
  color: var(--text);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
}

.table-of-contents a:hover {
  color: var(--primary);
}

/* =========================================
   Empty State
   ========================================= */

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
}

.empty-state h2 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.empty-state p {
  font-family: 'Inter', sans-serif;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* =========================================
   Contact Form
   ========================================= */

.contact-form-wrapper {
  max-width: 600px;
  margin: 0 auto;
}

.contact-form {
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
  padding: 2rem;
}

.contact-form .form-group {
  margin-bottom: 1.5rem;
}

.contact-form .form-group:last-of-type {
  margin-bottom: 2rem;
}

.contact-form textarea {
  min-height: 150px;
  resize: vertical;
}

/* =========================================
   Footer
   ========================================= */

footer {
  background: var(--bg-logo);
  border-top: var(--pixel-border) solid var(--gray-tv);
  padding: 1.5rem 0;
  text-align: center;
  margin-top: 2.5rem;
}

footer .logo-small {
  height: 48px;
  margin-bottom: 0.75rem;
  image-rendering: pixelated;
}

footer p {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.45rem;
  color: #aaa;
}

.footer-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.footer-social span {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.45rem;
  color: #aaa;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gray-tv);
  border: 2px solid #777;
  color: #fff;
  transition: all 0.15s ease;
}

.social-link:hover {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
}

/* Footer Newsletter */
.footer-newsletter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px dashed var(--gray-tv);
}

.newsletter-content {
  text-align: center;
}

.footer-newsletter h3 {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.65rem;
  color: var(--primary);
  margin: 0 0 0.5rem 0;
}

.footer-newsletter p {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.85rem !important;
  color: #aaa;
  margin: 0;
}

.newsletter-form {
  display: flex;
  gap: 0.5rem;
}

.newsletter-form input[type="email"] {
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  border: 2px solid var(--gray-tv);
  background: var(--bg-alt);
  color: var(--text);
  min-width: 200px;
}

.newsletter-form input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
}

.newsletter-form .btn {
  font-size: 0.5rem;
  padding: 0.6rem 1rem;
  white-space: nowrap;
}

.newsletter-message {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  margin: 0;
  min-height: 1.2em;
}

.newsletter-message:empty {
  display: none;
}

.newsletter-message.success {
  color: var(--success);
}

.newsletter-message.error {
  color: var(--danger);
}

.footer-bottom {
  padding-top: 1rem;
}

@media (max-width: 600px) {
  .footer-newsletter {
    flex-direction: column;
    gap: 1rem;
  }

  .newsletter-form {
    flex-direction: column;
    width: 100%;
  }

  .newsletter-form input[type="email"] {
    min-width: auto;
    width: 100%;
  }
}

/* =========================================
   Admin Styles
   ========================================= */

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.login-box {
  max-width: 400px;
  margin: 3rem auto;
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
  padding: 2rem;
}

.login-box h1 {
  text-align: center;
  font-size: 1rem;
  margin-bottom: 2rem;
  color: var(--primary);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.55rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  min-height: 200px;
  resize: vertical;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary);
}

.checkbox-group label {
  margin-bottom: 0;
}

/* Related articles picker */
.related-picker {
  border: 2px solid var(--border);
  background: var(--bg-alt);
}

.related-mode-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.related-mode-indicator .mode-label {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  padding: 0.25rem 0.5rem;
  border: 2px solid;
}

.related-mode-indicator.auto .mode-label {
  background: #f0fdf4;
  border-color: var(--green);
  color: var(--green);
}

.related-mode-indicator.manual .mode-label {
  background: #fef3c7;
  border-color: var(--orange);
  color: var(--orange-dark);
}

.related-mode-indicator .mode-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.related-search {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.related-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  background: var(--bg);
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
}

.related-search input:focus {
  outline: none;
  border-color: var(--primary);
}

.related-checkboxes {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
}

.related-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin: 0;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.related-checkbox-item:hover {
  background: var(--bg);
  border-color: var(--border);
}

.related-checkbox-item input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.related-checkbox-item .checkbox-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  line-height: 1.4;
  font-weight: 400;
}

.related-checkbox-item:has(input:checked) {
  background: #fef3c7;
  border-color: var(--orange);
}

.related-checkbox-item.hidden {
  display: none;
}

/* Helper images dans l'éditeur */
.image-helper {
  margin-bottom: 1rem;
  border: 2px solid var(--border);
  background: var(--bg-alt);
}

.image-helper summary {
  padding: 0.75rem 1rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  color: var(--primary);
  cursor: pointer;
  background: var(--bg);
}

.image-helper summary:hover {
  background: var(--border);
}

.image-helper[open] summary {
  border-bottom: 2px solid var(--border);
}

.helper-content {
  padding: 1rem;
  font-size: 0.85rem;
}

.helper-content h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem 0;
  color: var(--text);
}

.helper-content h4:first-child {
  margin-top: 0;
}

.helper-content pre {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.75rem;
  overflow-x: auto;
  margin: 0 0 0.5rem 0;
}

.helper-content code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.75rem;
  color: var(--text);
}

.helper-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.helper-table th,
.helper-table td {
  padding: 0.5rem;
  border: 1px solid var(--border);
  text-align: left;
}

.helper-table th {
  background: var(--bg);
  font-weight: 600;
  width: 80px;
}

.helper-table code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  margin-right: 0.25rem;
}

.error-message {
  background: #fef2f2;
  border: 2px solid var(--red);
  color: var(--red);
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  text-align: center;
}

.success-message {
  background: #f0fdf4;
  border: 2px solid var(--green);
  color: var(--green);
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  text-align: center;
}

/* Admin Dashboard */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.articles-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
}

.articles-table th,
.articles-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-family: 'Inter', sans-serif;
}

.articles-table th {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  color: var(--text-muted);
  background: var(--bg);
}

.articles-table tr:last-child td {
  border-bottom: none;
}

.articles-table tr:hover td {
  background: var(--bg);
}

.status-badge {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.45rem;
  padding: 0.35rem 0.6rem;
  border: 2px solid;
}

.status-badge.published {
  color: var(--green);
  border-color: var(--green);
  background: #f0fdf4;
}

.status-badge.draft {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--bg);
}

.status-badge.ready {
  color: #b45309;
  border-color: #f59e0b;
  background: #fef3c7;
}

/* Miniature image dans le tableau */
.article-thumbnail {
  width: 70px;
  padding: 0.25rem !important;
}

.article-thumbnail img {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.article-thumbnail .no-image {
  display: block;
  width: 60px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 4px;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

/* Admin Preview Ribbon */
.admin-preview-ribbon {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  text-align: center;
  padding: 0.75rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Badge statut sur les cards en mode preview */
.card-status-badge {
  display: inline-block;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.4rem;
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.5rem;
  border: 2px solid;
}

.card-status-badge.draft {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--bg);
}

.card-status-badge.ready {
  color: #b45309;
  border-color: #f59e0b;
  background: #fef3c7;
}

/* Preview Panel */
.preview-panel {
  margin-top: 3rem;
  border: var(--pixel-border) solid var(--primary);
  background: var(--bg-alt);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--primary);
}

.preview-header h2 {
  font-size: 0.7rem;
  color: white;
  margin: 0;
}

.preview-content {
  padding: 0;
  max-height: 700px;
  overflow-y: auto;
}

.preview-content .preview-hero {
  margin-bottom: 0;
  border-bottom: var(--pixel-border) solid var(--border-dark);
}

.preview-content .preview-hero.has-cover {
  min-height: 300px;
}

.preview-content .article-body {
  border: none;
  padding: 2rem;
}

/* Dans la preview, les niveaux markdown ne sont pas décalés comme côté serveur
   Donc # génère h1 au lieu de h2, et ## génère h2 au lieu de h3
   On applique les mêmes styles que les vrais h2/h3 */
.preview-content .article-body h1 {
  font-size: 1.1rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--border);
  color: var(--primary);
}

.preview-content .article-body h1:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.preview-content .article-body h2 {
  font-size: 0.95rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--heading-h3);
}

.preview-content .article-body h3 {
  font-size: 0.85rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--heading-h4);
}

.preview-content .article-body h4 {
  font-size: 0.75rem;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* =========================================
   404 / Error Pages
   ========================================= */

.error-page {
  text-align: center;
  padding: 4rem 1rem;
}

.error-page h1 {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 1rem;
  text-shadow: 4px 4px 0 var(--border-dark);
}

.error-page h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.error-page p {
  font-family: 'Inter', sans-serif;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* =========================================
   EasyMDE Customization
   ========================================= */

.EasyMDEContainer .CodeMirror {
  background: #ffffff;
  color: #1a1a2e;
  border: 2px solid var(--border);
  font-family: 'Inter', sans-serif;
}

.EasyMDEContainer .editor-toolbar {
  background: var(--bg);
  border: 2px solid var(--border);
  border-bottom: none;
}

.EasyMDEContainer .editor-toolbar button {
  color: var(--text) !important;
}

.EasyMDEContainer .editor-toolbar button:hover {
  background: var(--border);
}

.EasyMDEContainer .editor-preview {
  background: var(--bg-alt);
  font-family: 'Inter', sans-serif;
}

/* =========================================
   Preview Ribbon
   ========================================= */

.article-hero.preview-mode .article-hero-content {
  position: relative;
  overflow: hidden;
}

.preview-ribbon {
  position: absolute;
  top: 50px;
  left: -55px;
  background: var(--primary);
  color: var(--bg-logo);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.45rem;
  padding: 0.5rem 4rem;
  transform: rotate(-45deg);
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 768px) {
  .logo img {
    height: 44px;
  }

  .logo-text {
    font-size: 0.8rem;
  }

  header .container {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
  }

  nav {
    width: 100%;
    justify-content: center;
  }

  nav a,
  nav .nav-btn {
    font-size: 0.45rem;
    padding: 0.5rem 0.6rem;
  }

  h1 {
    font-size: 1rem;
  }

  .page-header h1 {
    font-size: 1.1rem;
  }

  .article-title {
    font-size: 1.1rem;
  }

  .article-body {
    padding: 1.5rem;
    font-size: 1rem;
  }

  .article-hero {
    padding: 1.5rem 1rem;
  }

  .article-hero.has-cover {
    min-height: 300px;
  }

  .article-hero.has-cover .article-hero-content {
    padding: 2rem 1rem;
  }

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

  .articles-table {
    font-size: 0.85rem;
  }

  .articles-table th,
  .articles-table td {
    padding: 0.75rem 0.5rem;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    font-size: 0.5rem;
    padding: 0.6rem 1rem;
  }

  .contact-form {
    padding: 1.5rem;
  }
}

/* =========================================
   Statistics Page
   ========================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-alt);
  border: var(--pixel-border) solid var(--border-dark);
  box-shadow: var(--pixel-shadow) var(--border);
  padding: 1.5rem;
  text-align: center;
}

.stat-value {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stats-section {
  margin-bottom: 2rem;
}

.stats-section h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed var(--border);
}

.visitors-table {
  max-width: 400px;
}

.views-count {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem;
  color: var(--primary);
  text-align: center;
}

.admin-header-actions {
  display: flex;
  gap: 0.75rem;
}

.text-muted {
  color: var(--text-muted);
}
