/*
 * logique404.eu, feuille de style (style « Pétrole et sable »).
 * Fidèle à docs/maquette/ : on reprend le rendu, pas la syntaxe de la maquette.
 * Tout le style est ici (aucun style inline : la CSP l'interdit).
 * Pas de mode clair en v1 ; les variables sont prêtes pour prefers-color-scheme.
 */

/* Polices auto-hébergées. Déposer les woff2 dans assets/fonts/ (voir fonts/README.md).
   Tant qu'ils sont absents, la pile de repli système s'applique sans rien casser. */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Manrope'), url('/assets/fonts/manrope-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: local('Manrope'), url('/assets/fonts/manrope-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: local('Manrope'), url('/assets/fonts/manrope-800.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('IBM Plex Mono'), url('/assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: local('IBM Plex Mono'), url('/assets/fonts/ibm-plex-mono-600.woff2') format('woff2');
}

:root {
  --bg: #0F2E33;
  --surface: #163C42;
  --border: #24515A;
  --deep: #0A2226;
  --text: #E8EFEE;
  --body: #DCE5E4;
  --text-2: #C9D6D5;
  --muted: #A9BDBC;
  --accent: #E9C46A;
  --on-accent: #0F2E33;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --page: 1120px;
  --lecture: 720px;

  --font-text: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-text);
  font-size: 19px;
  line-height: 1.7;
}

a { color: var(--text); }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.accent { color: var(--accent); }

/* Motif de remplacement pour une image absente. */
.ph {
  background: repeating-linear-gradient(135deg, #163C42 0 10px, #1B444B 10px 20px);
}

/* Lien d'évitement clavier. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: var(--radius-s);
}
.skip-link:focus { left: 8px; top: 8px; z-index: 10; }

/* En-tête et navigation. */
.site-header { border-bottom: 1px solid var(--border); }
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
}
.logo {
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 22px;
}
.logo-accent { color: var(--accent); }
.logo-muted { color: var(--muted); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  font-size: 15px;
  font-weight: 600;
}
.site-nav a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.nav-rss { color: var(--accent); }

/* Sections génériques. */
.section {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 24px 64px;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 28px;
}
.section-title { margin: 0; font-size: 24px; font-weight: 800; color: var(--text); }
.section-link { font-size: 15px; font-weight: 600; color: var(--accent); }
.section-intro { margin: 0 0 24px; font-size: 16px; line-height: 1.55; color: var(--text-2); }

/* Hero d'accueil. */
.hero { padding-top: 64px; padding-bottom: 48px; }
.hero-prompt {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}
.hero-title {
  margin: 0 0 18px;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.08;
  font-weight: 800;
  max-width: 820px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.hero-lead {
  margin: 0;
  max-width: 680px;
  font-size: 20px;
  line-height: 1.55;
  color: var(--text-2);
}

/* Étiquettes mono. */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--radius-s);
  background: var(--accent);
  color: var(--on-accent);
}
.meta-mono { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* Dossier à la une. */
.featured {
  display: flex;
  flex-wrap: wrap;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  overflow: hidden;
}
.featured-media {
  flex: 1 1 480px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.featured-media img { border-radius: 0; width: 100%; height: 100%; object-fit: cover; }
.featured-body {
  flex: 1 1 400px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.featured-tags { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.featured-title { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; font-weight: 800; }
.featured-lead { margin: 0; font-size: 18px; line-height: 1.55; color: var(--text-2); }
.featured-cta { margin: 6px 0 0; font-weight: 800; font-size: 15px; color: var(--accent); }

/* Grilles de cartes. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}
.card {
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-media {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-m);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-m); }
.card-tag { margin: 0; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent); }
.card-title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 800; }
.card-lead { margin: 0; font-size: 16px; line-height: 1.55; color: var(--text-2); }

/* Boîte à outils. */
.outils-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.card-outil {
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.outil-cat { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; }
.outil-nom { font-size: 19px; font-weight: 800; }
.outil-desc { font-size: 15px; line-height: 1.5; color: var(--text-2); }
.outil-domain { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.outils-cat-titre { margin: 32px 0 16px; font-size: 18px; font-weight: 800; color: var(--text); }

/* Puces de thèmes. */
.section-title + .theme-chips { margin-top: 16px; }
.theme-chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip {
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 12px 18px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

/* En-tête de page de liste. */
.page-head {
  max-width: var(--page);
  margin: 0 auto;
  padding: 56px 24px 24px;
}
.page-title { margin: 0 0 12px; font-size: clamp(30px, 5vw, 42px); font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.page-intro { margin: 0; font-size: 18px; color: var(--text-2); max-width: 680px; }

/* Pagination. */
.pager {
  max-width: var(--page);
  margin: 0 auto;
  padding: 8px 24px 72px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 14px;
}
.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  text-decoration: none;
}
.pager .pager-current { background: var(--surface); color: var(--muted); }

/* Article (billet, dossier). */
.article { max-width: var(--lecture); margin: 0 auto; padding: 56px 24px 72px; }
.article-title { margin: 18px 0 20px; font-size: clamp(30px, 6vw, 46px); line-height: 1.1; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
}
.statut-ouvert { color: var(--accent); font-weight: 600; }
.statut-corrige { color: #9ED6A6; font-weight: 600; }
.statut-wontfix { color: var(--muted); font-weight: 600; }

.enbref {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 26px;
  margin-bottom: 40px;
}
.enbref-label { margin: 0 0 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; color: var(--accent); }
.enbref p { margin: 0; font-size: 19px; line-height: 1.6; color: var(--body); }

.article-cover { margin: 0 0 40px; }
.article-cover figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); line-height: 1.5; }

/* Corps rédactionnel (HTML produit par le parseur). */
.corps { font-size: 19px; line-height: 1.7; color: var(--body); }
.corps > * + * { margin-top: 20px; }
.corps h2 { font-size: 24px; font-weight: 800; color: var(--text); margin-top: 40px; }
.corps h3 { font-size: 20px; font-weight: 800; color: var(--text); margin-top: 32px; }
.corps h4 { font-size: 17px; font-weight: 800; color: var(--text); margin-top: 28px; }
.corps a { color: var(--accent); }
.corps strong { font-weight: 800; }
.corps ul, .corps ol { padding-left: 22px; }
.corps li { margin-top: 8px; }
.corps img { border-radius: var(--radius-m); }
.corps figure { margin: 0; }
.corps figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }

.corps code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--deep);
  padding: 2px 6px;
  border-radius: var(--radius-s);
}
.corps pre {
  margin: 0;
  background: var(--deep);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  padding: 18px 20px;
  border-radius: var(--radius-m);
  overflow-x: auto;
}
.corps pre code { background: none; padding: 0; font-size: inherit; }

.corps blockquote {
  margin: 0;
  border-left: 3px solid var(--border);
  padding-left: 16px;
  color: var(--text-2);
}

/* Callouts. */
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
}
.callout-label { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; color: var(--accent); text-transform: uppercase; }
.callout p { margin: 0; }
.callout p + p { margin-top: 12px; }
.callout-attention { border-color: var(--accent); }

/* Tableaux (conteneur défilant sur mobile). */
.table-wrap { overflow-x: auto; }
.corps table { border-collapse: collapse; width: 100%; font-size: 16px; }
.corps th, .corps td { border: 1px solid var(--border); padding: 8px 12px; }
.corps th { background: var(--surface); text-align: left; }
.ta-left { text-align: left; }
.ta-center { text-align: center; }
.ta-right { text-align: right; }

/* Encadré outils liés. */
.outils-lies {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 48px 0;
}
.outils-lies .enbref-label { margin-bottom: 10px; }
.outils-lies ul { margin: 0; padding-left: 20px; font-size: 16px; line-height: 1.8; }

/* Glossaire. */
.glossaire { max-width: var(--lecture); margin: 0 auto; padding: 8px 24px 72px; }
.glossaire dt { font-weight: 800; color: var(--text); margin-top: 24px; font-size: 20px; }
.glossaire dd { margin: 6px 0 0; color: var(--text-2); }
.terme { text-decoration: none; }
.terme abbr { text-decoration: underline dotted var(--accent); text-underline-offset: 3px; cursor: help; }

/* Recherche. */
.search-form { display: flex; flex-wrap: wrap; gap: 12px; max-width: var(--lecture); margin: 0 auto 8px; padding: 0 24px; }
.search-input {
  flex: 1 1 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text);
  font: inherit;
  padding: 10px 14px;
  min-height: 44px;
}
.search-button {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: var(--radius-s);
  font-weight: 800;
  padding: 0 20px;
  min-height: 44px;
  cursor: pointer;
}
.search-results { max-width: var(--lecture); margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.search-result a { text-decoration: none; }
.search-result h2 { margin: 0 0 6px; font-size: 20px; }
.search-mark { background: rgba(233, 196, 106, 0.28); color: var(--text); border-radius: 3px; padding: 0 2px; }

/* Page d'erreur. */
.erreur { padding-top: 80px; padding-bottom: 96px; max-width: var(--lecture); }
.erreur-code { margin: 0; font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.2em; color: var(--accent); }
.erreur-titre { margin: 8px 0 18px; font-size: clamp(32px, 6vw, 46px); line-height: 1.1; font-weight: 800; color: var(--text); }
.erreur-texte { margin: 0 0 24px; color: var(--text-2); }

/* Pied de page. */
.site-footer { background: var(--deep); color: var(--text-2); font-size: 14px; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding-top: 32px;
  padding-bottom: 32px;
}
.footer-note { font-family: var(--font-mono); }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { color: var(--text-2); }
