/* ================================================================
   C64 CMS — thème Commodore 64
   Palette inspirée de la palette "Pepto" du VIC-II.
   ================================================================ */

/* Police C64 optionnelle : dépose le fichier "C64_Pro_Mono-STYLE.woff2"
   (ou .woff / .ttf) dans assets/fonts/ — voir README. */
@font-face {
  font-family: "C64";
  src: url("fonts/C64_Pro_Mono-STYLE.woff2") format("woff2"),
       url("fonts/C64_Pro_Mono-STYLE.woff") format("woff"),
       url("fonts/C64_Pro_Mono-STYLE.ttf") format("truetype");
  font-display: swap;
}

:root {
  --c64-black:      #000000;
  --c64-white:      #ffffff;
  --c64-red:        #68372b;
  --c64-cyan:       #70a4b2;
  --c64-yellow:     #b8c76f;
  --c64-blue:       #352879;   /* fond de l'écran */
  --c64-lightblue:  #6c5eb5;   /* bordure */
  --c64-text:       #a49df0;   /* texte (bleu clair éclairci pour la lisibilité) */
  --c64-lightred:   #9a6759;
  --c64-dim:        #8a80dc;   /* texte secondaire */

  --font: "C64", "Courier New", Courier, monospace;
  --size: clamp(13px, 1.6vw, 18px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--c64-lightblue);
}

body {
  font-family: var(--font);
  font-size: var(--size);
  line-height: 1.5;
  color: var(--c64-text);
  text-transform: uppercase;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

/* ---------- Bordure + écran ---------- */
.border {
  min-height: 100vh;
  padding: clamp(16px, 5vw, 64px) clamp(12px, 6vw, 96px);
}

.screen {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  min-height: calc(100vh - 2 * clamp(16px, 5vw, 64px));
  background: var(--c64-blue);
  padding: 1.5em 2ch 2em;
  overflow: hidden;
}

/* Lignes de balayage CRT, très discrètes */
.screen::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom,
              rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px,
              rgba(0,0,0,.12) 3px, rgba(0,0,0,0) 4px);
}

p { margin: 0; }
.center { text-align: center; }

/* ---------- En-tête de démarrage ---------- */
.boot { margin-bottom: 1.5em; }
.boot p:nth-child(2) { margin-bottom: 1.5em; }
.site-title {
  color: var(--c64-white);
  text-decoration: none;
}
.site-title:hover { background: var(--c64-text); color: var(--c64-blue); }

/* ---------- Menu ---------- */
.menu {
  display: flex;
  flex-wrap: wrap;
  gap: .5em 2ch;
  margin-bottom: 1.5em;
  padding-bottom: 1em;
  border-bottom: 2px dashed var(--c64-lightblue);
}
.menu a {
  color: var(--c64-text);
  text-decoration: none;
  padding: 0 .5ch;
}
.menu a .fkey {
  background: var(--c64-text);
  color: var(--c64-blue);
  padding: 0 .5ch;
  margin-right: .5ch;
}
.menu a:hover,
.menu a:focus-visible,
.menu a.active {
  background: var(--c64-text);
  color: var(--c64-blue);
  outline: none;
}
.menu a:hover .fkey,
.menu a.active .fkey,
.menu a:focus-visible .fkey {
  background: var(--c64-blue);
  color: var(--c64-text);
}

/* ---------- Invite de commandes ---------- */
.cmd { color: var(--c64-white); }
.prompt, .cmd { margin-top: .2em; }
.error { color: var(--c64-white); margin: 1em 0; }

/* Curseur clignotant */
.cursor {
  display: inline-block;
  width: 1ch;
  background: var(--c64-text);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { background: transparent; } }

/* ---------- Catalogue (LOAD"$",8) ---------- */
.dir { margin: 1em 0; }
.dir-head { margin-bottom: .3em; }
.rev { background: var(--c64-text); color: var(--c64-blue); white-space: pre; }

.dir-row {
  display: grid;
  grid-template-columns: 5ch minmax(0, 1fr) 4ch auto;
  gap: 0 1ch;
  color: var(--c64-text);
  text-decoration: none;
  white-space: pre;
}
.dir-row .name { white-space: normal; }
.dir-row .date { color: var(--c64-dim); }
.dir-row:hover, .dir-row:focus-visible {
  background: var(--c64-text);
  color: var(--c64-blue);
  outline: none;
}
.dir-row:hover .date, .dir-row:focus-visible .date { color: var(--c64-blue); }
.summary {
  padding-left: 6ch;
  color: var(--c64-dim);
  margin-bottom: .4em;
  text-transform: none;
}

.pager { display: flex; gap: 3ch; margin: 1em 0; }
.pager a { color: var(--c64-white); }

/* ---------- Articles ---------- */
.content {
  margin: 1.5em 0;
  text-transform: none;   /* minuscules autorisées pour la lecture */
}
.content h1, .content h2, .content h3,
.content h4, .content h5, .content h6 {
  color: var(--c64-white);
  font-size: 1em;
  font-weight: normal;
  text-transform: uppercase;
  margin: 1.5em 0 .5em;
}
.content h1 {
  display: inline-block;
  background: var(--c64-text);
  color: var(--c64-blue);
  padding: 0 1ch;
  margin-top: 0;
}
.content h2::before { content: "== "; }
.content h3::before { content: "-- "; }
.content .meta { color: var(--c64-dim); text-transform: uppercase; margin-bottom: 1.5em; }
.content p { margin: 0 0 1em; }
.content a { color: var(--c64-white); }
.content a:hover { background: var(--c64-white); color: var(--c64-blue); text-decoration: none; }
.content strong { color: var(--c64-white); font-weight: normal; }
.content em { font-style: normal; color: var(--c64-yellow); }
.content ul, .content ol { margin: 0 0 1em; padding-left: 3ch; }
.content ul { list-style: none; }
.content ul li::before { content: "* "; margin-left: -2ch; color: var(--c64-white); }
.content code {
  background: var(--c64-black);
  color: var(--c64-cyan);
  padding: 0 .5ch;
  font-family: var(--font);
}
.content pre {
  background: var(--c64-black);
  color: var(--c64-cyan);
  padding: 1em 2ch;
  overflow-x: auto;
  margin: 0 0 1em;
}
.content pre code { padding: 0; background: none; }
.content blockquote {
  margin: 0 0 1em;
  padding-left: 2ch;
  border-left: 1ch solid var(--c64-lightblue);
  color: var(--c64-cyan);
}
.content hr {
  border: 0;
  border-top: 2px dashed var(--c64-lightblue);
  margin: 1.5em 0;
}
.content img {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 4px solid var(--c64-lightblue);
}
.back a { color: var(--c64-white); }

/* ---------- Effet de chargement ---------- */
.loading-fx .reveal > * { visibility: hidden; }
.loading-fx .reveal > .shown { visibility: visible; }

/* Ecran de chargement façon bandes de couleur dans la bordure */
.border.tape {
  background: repeating-linear-gradient(to bottom,
              var(--c64-lightblue) 0 7px, var(--c64-yellow) 7px 11px,
              var(--c64-red) 11px 16px, var(--c64-cyan) 16px 21px);
  animation: tape .12s steps(3) infinite;
}
@keyframes tape { to { background-position: 0 21px; } }

@media (prefers-reduced-motion: reduce) {
  .cursor, .border.tape { animation: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .dir-row { grid-template-columns: 4ch minmax(0, 1fr) 4ch; }
  .dir-row .date { display: none; }
  .summary { padding-left: 5ch; }
}
