/*
  Theme: Hacknarchist
  Palette: Noir, Rouge, Blanc
  Principes: Sobre, élégant, sans-script, haut contraste.
*/

:root {
  --color-red: #d40000; /* Rouge vif mais pas criard */
  --color-black: #000;
  --color-white: #fff;
  --font-main: system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, monospace;

  /* Thème clair (défaut) */
  --bg: var(--color-white);
  --text: var(--color-black);
  --text-meta: #555;
  --border: #ddd;
  --border-strong: var(--color-black);
  --accent-bg: #f1f1f1;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Thème sombre */
    --bg: var(--color-black);
    --text: #f1f1f1;
    --text-meta: #aaa;
    --border: #444;
    --border-strong: var(--color-white);
    --accent-bg: #1c1c1c;
  }
}

body {
  max-width: 48rem;
  margin: 2rem auto;
  padding: 0 1.5rem;
  font-family: var(--font-main);
  font-size: clamp(1.1rem, 0.95rem + 0.6vw, 1.25rem);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

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


/* Header et logo revisités */

/* --- Header & Logo "Tag" --- */

.main-header {
  text-align: center;
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-container {
  display: inline-flex;
  text-decoration: none !important;
  font-family: var(--font-main);
  font-size: 1.8rem;
  line-height: 1;
  border-radius: 4px;
  overflow: hidden; /* Assure la jointure propre des arrondis */
}

.logo-part-red, 
.logo-part-black {
  padding: 0.5rem 0.9rem;
  color: #fff !important;
  display: block;
}

.logo-part-red {
  background-color: var(--color-red) !important;
  font-weight: 800;
  letter-spacing: -1px;
}

.logo-part-black {
  background-color: var(--color-black) !important;
  font-weight: 500;
}

/* --- Adaptation Mode Sombre pour le Titre --- */

@media (prefers-color-scheme: dark) {
  .logo-part-black {
    /* Gris anthracite pour rester visible sur le fond noir de la page */
    background-color: #1a1a1a !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  }
}

/* --- Gestion des Émojis (Sobriété) --- */

.header-icons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.2rem;
  font-size: 1.2rem;
}

.header-icons a {
  text-decoration: none !important;
  /* Rend l'émoji gris par défaut pour la sobriété */
  filter: grayscale(100%) opacity(0.6);
  transition: filter 0.2s, transform 0.2s;
}

.header-icons a:hover {
  /* Rend ses couleurs d'origine au survol */
  filter: grayscale(0%) opacity(1);
  transform: translateY(-2px);
}

/* LISTE des ARTICLES */

/* --- Structure de la liste d'articles --- */

.list-container {
  margin-top: 2rem;
}

.post-entry {
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border); /* Séparateur discret */
}

.post-entry:last-of-type {
  border-bottom: none; /* Nettoyage sous le dernier article */
}

/* --- Titres et Sous-titres --- */

.entry-title {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.entry-title a {
  color: var(--text);
  text-decoration: none;
}

.entry-title a:hover {
  color: var(--color-red);
}

.entry-subtitle {
  font-size: 1rem;
  color: var(--text-meta);
  margin-bottom: 0.8rem;
}

/* --- Lien "Lire la suite" Minimaliste --- */

.read-more-wrapper {
  margin-top: 0.8rem;
}

.read-more-link {
  display: inline-block;
  font-family: var(--font-mono); /* Style technique */
  font-size: 0.75rem;            /* Très petit et discret */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-red) !important;
  text-decoration: none !important;
  border: 1px solid var(--color-red);
  padding: 0.2rem 0.5rem;       /* Volume minimaliste */
  border-radius: 2px;
  transition: all 0.2s ease;
}

.read-more-link:hover {
  background-color: var(--color-red);
  color: var(--color-white) !important;
}

/* --- Pagination --- */

.pagination-container {
  margin-top: 1rem;
  padding-bottom: 3rem;
}

.pagination {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.pagination a {
  color: var(--text-meta);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 3px;
}

.pagination a:hover {
  border-color: var(--color-red);
  color: var(--color-red);
}

/* --- Style des Tags en liste --- */
.entry-tags {
  margin-top: 1.5rem;
}

.tag-item {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-meta) !important;
  margin-right: 1rem;
}

.tag-item:hover {
  color: var(--color-red) !important;
  text-decoration: underline;
}

/* --- Pagination --- */
.pagination-container {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--color-black);
}

@media (prefers-color-scheme: dark) {
  .pagination-container {
    border-top-color: var(--border);
  }
}

/* --- Tags en bas d'article --- */

.post-tags {
  margin-top: 2rem;
}

.post-tags a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-meta);
  margin-right: 1rem;
  transition: color 0.2s;
}

.post-tags a:hover {
  color: var(--color-red);
  text-decoration: none;
}




/* --- Typographie et structure --- */

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.5rem; }

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

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

blockquote {
  margin: 2rem 0;
  padding-left: 1.5rem;
  border-left: 3px solid var(--color-red);
  color: var(--text-meta);
  font-style: italic;
}

blockquote cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.9em;
}

blockquote cite::before {
  content: "— ";
}

/* --- Code --- */

code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  color: var(--color-red);
  /* Pas de fond pour le code inline, pour un look plus épuré */
}

pre {
  background-color: var(--accent-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--color-red);
  padding: 1rem;
  margin: 2rem 0;
  overflow-x: auto;
  font-size: 0.9rem;
}

pre code {
  color: inherit; /* Le texte dans un bloc de code reprend la couleur de base */
  font-size: inherit;
  background: none;
  padding: 0;
}

/* --- Header & Logo --- */

.logo {
  display: inline-flex;
  text-decoration: none;
  font-family: var(--font-main);
  font-weight: 900; /* Police plus grasse pour impacter */
  font-size: 1.5rem;
  line-height: 1;
}

.logo-brand {
  background: var(--color-red);
  color: var(--color-white);
  padding: 0.2rem 0.5rem;
}

.logo-suffix {
  background: var(--color-black);
  color: var(--color-white);
  padding: 0.2rem 0.5rem;
}

@media (prefers-color-scheme: dark) {
  .logo-suffix {
    background: #333; /* Gris foncé pour le différencier du fond noir */
  }
}

.header-icons a {
  text-decoration: none;
  color: var(--text);
  opacity: 0.7;
  transition: opacity 0.2s;
}

.header-icons a:hover {
  opacity: 1;
  color: var(--color-red);
}

/* --- Métadonnées des articles --- */

.post-meta {
  font-size: 0.95rem;
  color: var(--text-meta);
  margin-bottom: 2rem;
}

.post-meta a {
  font-weight: bold;
}

.post-tags {
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.post-tags a {
  display: inline-block;
  margin: 0.2rem 0.3rem 0.2rem 0;
  padding: 0.2rem 0.6rem;
  color: var(--text-meta);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.post-tags a:hover {
  background-color: var(--color-red);
  border-color: var(--color-red);
  color: var(--color-white);
}

/* --- Table & Table des matières --- */

table {
  border-collapse: collapse;
  width: 100%;
  margin: 2rem 0;
}

td, th {
  border: 1px solid var(--border-strong);
  text-align: left;
  padding: 8px;
}

th {
  background-color: var(--accent-bg);
  font-weight: bold;
}

.toc-container {
  background-color: var(--accent-bg);
  border-left: 3px solid var(--color-red);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  font-size: 0.9rem;
}

.toc-container #TableOfContents ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-container #TableOfContents li {
  margin: 0.4rem 0;
}

.toc-container #TableOfContents a {
  color: var(--text-meta);
}

.toc-container #TableOfContents a:hover {
  color: var(--color-red);
  text-decoration: underline;
}

/* --- Pagination --- */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 3rem 0;
  font-size: 1rem;
}

.pagination a {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.2s, color 0.2s;
}

.pagination a:hover {
  background-color: var(--color-red);
  color: var(--color-white);
  border-color: var(--color-red);
}

.next { text-align: right; }
.prev { text-align: left; }

/* --- Navigation & Header --- */
.main-header {
  text-align: center;
  margin-bottom: 2rem;
}

.main-nav {
  margin-top: 1rem;
  font-size: 1rem;
  font-weight: 500;
}

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

.main-nav li {
  display: inline;
}

.main-nav li:not(:first-child)::before {
  content: "/";
  color: var(--border);
  margin: 0 0.5rem;
}

.header-icons {
  margin-top: 0.5rem;
  font-size: 1.1rem;
}


/* --- Footer --- */
.main-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-meta);
  text-align: center;
}

/* --- Article & Subtitle --- */
.subtitle {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-meta);
  margin-top: -1rem;
  margin-bottom: 1rem;
}

main > article:not(:last-of-type) {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
}
