/*
  Style « terminal ambre », le même esprit que le portfolio : phosphore ambre
  sur fond presque noir, police à chasse fixe du système, cadres en double
  trait avec le titre posé sur le trait du haut.
  Aucune image ni police externe : la CSP n'autorise que ce domaine.
*/

:root {
  color-scheme: dark;

  /* Contrastes sur --fond : --ambre 10,9:1, --ambre-vif 14:1,
     --ambre-doux 6,9:1 (AA partout). */
  --fond: #0c0903;
  --ambre: #ffb000;
  --ambre-vif: #ffd27a;
  --ambre-doux: #d39a2c;
  /* Traits décoratifs seulement, jamais du texte */
  --ambre-sombre: #6b4a10;
  --lueur: 0 0 4px rgba(255, 176, 0, 0.35);

  --largeur: 980px;
  --gouttiere: 16px;
  --police: "Cascadia Mono", "JetBrains Mono", "IBM Plex Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { background: var(--fond); }

body {
  margin: 0;
  padding: 0 var(--gouttiere);
  background: var(--fond);
  color: var(--ambre);
  font: 16px/1.5 var(--police);
  text-shadow: var(--lueur);
}

a { color: var(--ambre-vif); }
a:hover { background: var(--ambre); color: var(--fond); text-shadow: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ambre-vif);
  outline-offset: 2px;
}

code, pre, var, input, button { font-family: inherit; }
var { font-style: normal; color: var(--ambre-vif); }

::selection { background: var(--ambre); color: var(--fond); text-shadow: none; }

/* --- En-tête --- */

.entete,
main,
.pied {
  max-width: var(--largeur);
  margin: 0 auto;
}

.entete { padding: 32px 0 8px; }

h1 {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1.1;
  color: var(--ambre-vif);
  letter-spacing: 0.1em;
}

.sous-titre { margin: 8px 0 0; color: var(--ambre-doux); }

/* Quatre clignotements puis le curseur reste allumé (WCAG 2.2.2) */
.curseur { animation: clignote 1s steps(1) 4; }
@keyframes clignote { 50% { opacity: 0; } }

/* --- Fenêtres --- */

.fenetre {
  position: relative;
  margin: 32px 0;
  padding: 24px 20px 16px;
  border: 4px double var(--ambre);
}

.fenetre h2 {
  position: absolute;
  top: -0.85em;
  left: 16px;
  margin: 0;
  padding: 0 8px;
  background: var(--fond);
  font-size: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.fenetre h2::before { content: "[ "; }
.fenetre h2::after { content: " ]"; }

.fenetre > :last-child { margin-bottom: 0; }

ul { padding-left: 1.5em; }
li::marker { content: "› "; }

pre {
  overflow-x: auto;
  padding: 12px;
  border: 1px solid var(--ambre-sombre);
}

.invite { color: var(--ambre-doux); user-select: none; }

/* --- Fil d'Ariane --- */

.fil ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.fil li::marker { content: none; }
.fil li + li::before { content: "/"; margin: 0 0.4em; color: var(--ambre-doux); }
.fil li:first-child::before { content: "/"; margin-right: 0.1em; color: var(--ambre-doux); }
.fil [aria-current] { color: var(--ambre-vif); }

/* --- Filtre --- */

.outils {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.outils[hidden] { display: none; }
.outils label { color: var(--ambre-doux); }
.outils label::after { content: " >"; }

input[type="search"] {
  flex: 1 1 16em;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--ambre-sombre);
  border-radius: 0;
  background: transparent;
  color: var(--ambre-vif);
  font-size: 1rem;
  caret-color: var(--ambre);
}
input[type="search"]::placeholder { color: var(--ambre-doux); opacity: 1; }

/* --- Tableau --- */

table {
  width: 100%;
  border-collapse: collapse;
}
table[hidden] { display: none; }

th, td {
  padding: 4px 8px;
  text-align: left;
  vertical-align: baseline;
}

thead th { border-bottom: 1px solid var(--ambre-sombre); }

th button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ambre-doux);
  font-size: 1rem;
  font-weight: bold;
  text-shadow: inherit;
  cursor: pointer;
}
th button:hover { color: var(--ambre-vif); }
th[aria-sort] button { color: var(--ambre-vif); }
th[aria-sort="ascending"] button::after { content: " ↑"; }
th[aria-sort="descending"] button::after { content: " ↓"; }

tbody tr:hover { background: rgba(255, 176, 0, 0.08); }

td.nom { overflow-wrap: anywhere; }
td.nom a { text-decoration: none; }
.fichier td.nom a { color: var(--ambre); }
/* Après les couleurs ci-dessus, sinon le texte disparaît dans le surlignage */
tbody td.nom a:hover, tbody .parent a:hover { background: var(--ambre); color: var(--fond); text-shadow: none; }
.fichier td.nom a::before { content: "  "; white-space: pre; }
.dossier td.nom a, .parent a { color: var(--ambre-vif); font-weight: bold; text-decoration: none; }
.dossier td.nom a::before { content: "▸ "; }

.num, .date { white-space: nowrap; }
.num { text-align: right; }
th.num { text-align: right; }
td.num, td.date { color: var(--ambre-doux); }

.etat { color: var(--ambre-doux); }
.etat[hidden] { display: none; }
.total { margin: 12px 0 0; color: var(--ambre-doux); text-align: right; }
.total:empty { display: none; }

/* Petit écran : la date passe à la trappe, nom et taille suffisent */
@media (max-width: 600px) {
  .date { display: none; }
  .fenetre { padding: 20px 12px 12px; }
  h1 { font-size: 2rem; }
}

/* --- Pied de page --- */

.pied {
  padding: 0 0 32px;
  color: var(--ambre-doux);
  font-size: 0.875rem;
}

/* --- Page d'erreur --- */

main.erreur { padding-top: 15vh; }
main.erreur h1 { font-size: 1.75rem; letter-spacing: 0.04em; }
main.erreur .code { color: var(--ambre); }

/* --- Préférences --- */

@media (prefers-reduced-motion: reduce) {
  .curseur { animation: none; }
}

@media (prefers-contrast: more) {
  :root {
    --ambre-doux: var(--ambre);
    --ambre-sombre: var(--ambre);
    --lueur: none;
  }
}
