:root {
  --bg: #0d0f08;
  --panel: #14170c;
  --ink: #9be34a;
  --muted: #6f9c30;
  --line: #2c3a16;
  --amber: #c8ff66;      /* accent vif (anciennement ambre) */
  --amber-dim: #6f9c30;  /* accent dim */
  --glow: rgba(155, 227, 74, 0.55);
  /* Écart entre la barre et le bord : elle doit rester à l'intérieur
     du cadre CRT, dont l'ombre interne noircit ~60px de bordure. */
  --cmd-gap: 2.6rem;
  /* Respiration entre le dernier post et le cadre de la CLI. */
  --cmd-extra: 2rem;
  /* Place réservée sous le contenu pour qu'il ne passe pas derrière la CLI.
     Valeur de repli : journal.js la remplace par la hauteur mesurée dès
     qu'il tourne, ce qui suit les changements de police, de zoom et de
     largeur d'écran. */
  --cmd-space: 8.5rem;
}

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

/* La page elle-même ne défile pas : c'est .crt-screen, fixé au viewport,
   qui scrolle (voir son bloc plus bas). D'où overflow:hidden ici, sans quoi
   on hériterait d'une seconde barre de défilement, inerte. */
html, body { height: 100%; overflow: hidden; }

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(200,255,102,0.05), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.5;
  text-shadow: 0 0 4px var(--glow);
  -webkit-font-smoothing: antialiased;
}

/* Halo / vignette CRT + scintillement de l'écran */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(120% 120% at 50% 50%, transparent 60%, rgba(0,0,0,0.55) 100%);
  animation: flicker 4.5s steps(60) infinite;
}

/* Lignes de balayage (scanlines) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0.28) 4px
  );
  mix-blend-mode: multiply;
}

/* Cadre/bezel du tube : coins arrondis + remplissage noir hors écran
   + vignette interne marquée pour simuler la courbure du verre. */
.crt-bezel {
  position: fixed;
  inset: 14px;
  border-radius: 30px;
  pointer-events: none;
  z-index: 4;
  box-shadow:
    inset 0 0 70px 14px rgba(0, 0, 0, 0.9),
    inset 0 0 170px 55px rgba(0, 0, 0, 0.55),
    0 0 0 14px #07090e,
    0 0 0 100vmax #020304;
}

/* Reflet de verre + léger renfoncement lumineux au centre (bombé). */
.crt-glass {
  position: fixed;
  inset: 14px;
  border-radius: 30px;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(135% 100% at 50% -15%, rgba(200, 255, 102, 0.07), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 14%);
  mix-blend-mode: screen;
}

/* La dalle du tube.                                                   */
/*                                                                     */
/* Le filtre se calcule sur la boîte de l'élément qui le porte. Tant   */
/* qu'il était sur <main>, cette boîte faisait la hauteur du document  */
/* entier : la courbure ne se voyait qu'aux deux extrémités de la      */
/* page, jamais en bas de la fenêtre, et son intensité changeait selon */
/* la longueur de l'entrée affichée. Ici la boîte est la fenêtre, donc */
/* la déformation porte toujours sur ce que l'utilisateur a sous les   */
/* yeux — et c'est ce conteneur qui défile, plus la page.              */
.crt-screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  padding: 2rem 2rem var(--cmd-space);
  /* Vrai bombé : déformation barrel des pixels via filtre SVG.
     Régler l'intensité avec scale="…" sur #crt-barrel. */
  filter: url(#crt-barrel);
  transform: translateZ(0);
  /* Barre de défilement masquée : native, elle serait à la fois courbée
     par le filtre et avalée par l'ombre interne du bezel. Le défilement
     lui-même reste entier — molette, tactile, et clavier grâce au
     tabindex="0" posé sur l'élément, qui en fait une cible de focus. */
  scrollbar-width: none;
}

.crt-screen::-webkit-scrollbar { width: 0; height: 0; }

main {
  width: 100%;
  max-width: 620px;
  /* margin:auto centre verticalement/horizontalement quand le contenu tient,
     mais laisse scroller (sans tronquer le haut) quand il déborde. */
  margin: auto;
  position: relative;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--amber-dim);
  box-shadow: 0 0 6px var(--glow);
}

h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin-bottom: 1.1rem;
}

h1 .small {
  display: block;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 0.8rem;
}

/* Curseur clignotant */

p.lede {
  color: var(--muted);
  font-size: 1rem;
  max-width: 52ch;
  margin-bottom: 2.4rem;
}

.status {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  padding: 0.9rem 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 0 var(--glow), 0 0 8px var(--glow);
  animation: pulse 2.4s ease-out infinite;
  flex: none;
}

.status b { color: var(--ink); font-weight: 600; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(200,255,102,0.45), 0 0 8px var(--glow); }
  70%  { box-shadow: 0 0 0 10px rgba(200,255,102,0), 0 0 8px var(--glow); }
  100% { box-shadow: 0 0 0 0 rgba(200,255,102,0), 0 0 8px var(--glow); }
}

@keyframes blink {
  0%, 50%   { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* Scintillement léger de luminosité, typique d'un tube cathodique */
@keyframes flicker {
  0%   { opacity: 0.92; }
  3%   { opacity: 0.78; }
  6%   { opacity: 0.93; }
  9%   { opacity: 0.85; }
  12%  { opacity: 0.95; }
  20%  { opacity: 0.9; }
  50%  { opacity: 0.94; }
  52%  { opacity: 0.82; }
  54%  { opacity: 0.93; }
  100% { opacity: 0.92; }
}

article.post {
  margin-top: 2.4rem;
  border-top: 1px solid var(--line);
  padding-top: 1.8rem;
}

article.post .meta {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-dim);
  margin-bottom: 0.7rem;
}

article.post h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 0.7rem;
}

article.post h2::before {
  content: "> ";
  color: var(--amber-dim);
}

article.post p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 54ch;
}

article.post p + p {
  margin-top: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
  body::before { animation: none; opacity: 0.92; }
}

/* ------------------------------------------------------------------ */
/* Navigation : barre d'outils, pagination, entrées voisines           */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

a {
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

a:hover,
a:focus-visible {
  color: var(--bg);
  background: var(--amber);
  border-bottom-color: var(--amber);
}

.toolbar {
  display: flex;
  gap: 1.2rem;
  margin-top: 1.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pagination,
.postnav {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  margin-top: 2.4rem;
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
  font-size: 0.8rem;
}

.postnav {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

.pagination-pos {
  color: var(--amber-dim);
  letter-spacing: 0.18em;
}

/* ------------------------------------------------------------------ */
/* Titres de liste et d'entrée isolée                                  */

.listing-title,
.post-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 0.7rem;
}

.listing-title::before,
.post-title::before {
  content: "> ";
  color: var(--amber-dim);
}

.listing-title {
  margin-top: 1.4rem;
}

article.post h2 a {
  color: inherit;
  border-bottom: none;
}

article.post h2 a:hover,
article.post h2 a:focus-visible {
  color: var(--bg);
  background: var(--amber);
}

article.post--solo {
  border-top: none;
  margin-top: 1.4rem;
  padding-top: 0;
}

/* ------------------------------------------------------------------ */
/* Tags                                                                */

.tags {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.taglist {
  list-style: none;
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.taglist .count {
  color: var(--amber-dim);
  font-size: 0.75rem;
}

/* ------------------------------------------------------------------ */
/* Ligne de commande fixée en bas                                      */
/*                                                                     */
/* Trois contraintes dictent ce bloc :                                 */
/*  - elle est sœur de .crt-screen, jamais dedans : l'écran porte      */
/*    filter:url(#crt-barrel), et un filter crée un bloc conteneur     */
/*    pour les descendants en position:fixed, qui se fixeraient alors  */
/*    par rapport à l'écran au lieu de la fenêtre — et défileraient    */
/*    avec lui ;                                                       */
/*  - z-index 1, donc SOUS les scanlines (3), le cadre (4) et le       */
/*    reflet (5) : elle doit avoir l'air d'être dans l'écran, pas      */
/*    posée dessus ;                                                   */
/*  - décollée du bas, sinon l'ombre interne de .crt-bezel (70px de    */
/*    flou très noir) l'avale.                                         */

.cmdline {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0 2rem calc(var(--cmd-gap) + env(safe-area-inset-bottom, 0px));
  /* On laisse cliquer à travers la zone vide autour de la barre. */
  pointer-events: none;
}

.cmdline > * {
  pointer-events: auto;
  width: 100%;
  max-width: 620px;
}

.cmdline-bar {
  display: flex;
  align-items: baseline;
  gap: 0.6ch;
  background: var(--panel);
  /* Cadre toujours vif : en var(--line) la barre se perdait dans le fond. */
  border: 1px solid var(--amber);
  padding: 0.55rem 0.8rem;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.75);
}

/* Le cadre ne signale plus le focus puisqu'il est allumé en permanence :
   un halo prend le relais, pour que la saisie au clavier reste repérable. */
.cmdline-bar:focus-within {
  box-shadow:
    0 0 24px rgba(0, 0, 0, 0.75),
    0 0 14px var(--glow);
}

.cmd-prompt {
  color: var(--amber);
  font-size: 0.9rem;
  white-space: nowrap;
  flex: none;
  user-select: none;
}

.cmdline input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  padding: 0;
  text-shadow: inherit;
  caret-color: var(--amber);
}

.cmdline input:focus-visible {
  outline: none;
}

/* Chrome ajoute une croix d'effacement qui casse le look terminal. */
.cmdline input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* Curseur bloc façon shell au repos : il s'efface dès qu'on saisit,
   la vraie caret du champ prend alors le relais. */
.cmd-cursor {
  display: inline-block;
  width: 0.62ch;
  height: 1.05em;
  background: var(--amber);
  box-shadow: 0 0 8px var(--glow);
  animation: blink 1.1s steps(1) infinite;
  flex: none;
  margin-left: -0.3ch;
}

.cmdline-bar:focus-within .cmd-cursor,
.cmdline-bar:has(input:not(:placeholder-shown)) .cmd-cursor {
  display: none;
}

.cmd-hint {
  color: var(--amber-dim);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  flex: none;
  user-select: none;
  transition: opacity 0.18s;
}

.cmdline-bar:focus-within .cmd-hint,
.cmdline-bar:has(input:not(:placeholder-shown)) .cmd-hint {
  opacity: 0;
}

/* ------------------------------------------------------------------ */
/* Sortie de la recherche, empilée au-dessus de la barre               */

.results {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.8rem 1rem;
  max-height: min(46vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.75);
}

.results[hidden] {
  display: none;
}

.results-count,
.results-empty {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-dim);
}

.results ul {
  list-style: none;
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.results li {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  font-size: 0.9rem;
}

.results-date {
  color: var(--amber-dim);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .cmdline {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }

  .cmd-hint {
    display: none;
  }

  .cmd-prompt {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cmd-cursor { animation: none; }
  .cmd-hint { transition: none; }
}
