/* Charte commune Locost : sobre, noir, façon site caché. Le vert terminal ne sert que d'accent. Toutes les expériences du site l'importent. */
:root {
  --bg: #050505;
  --bg-2: #0b0b0b;
  --fg: #cfcfcf;
  --fg-dim: #7a7a7a;
  --fg-faint: #3a3a3a;
  --line: #1c1c1c;
  --green: #00ff41;
  --green-dim: rgba(0, 255, 65, 0.25);
  --red: #ff2a4f;
  --cyan: #00e5ff;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 var(--mono);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--fg); }
a:focus-visible, button:focus-visible { outline: 1px solid var(--green); outline-offset: 3px; }
::selection { background: var(--green); color: #000; }

/* Lignes de balayage très discrètes */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 3px);
  z-index: 100;
}

/* Barre d'état en haut de page */
.barre {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
}
.barre span { overflow: hidden; text-overflow: ellipsis; }
.point { color: var(--green); }
.point::before { content: "● "; }

.wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 40px);
  min-height: calc(100svh - 40px);
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 56px;
  text-align: center;
}

.eyebrow {
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
}

/* Titre : sobre, avec un dérèglement rare et bref */
.glitch {
  position: relative;
  display: inline-block;
  margin: 0.3em 0 0.4em;
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #e6e6e6;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0 0 100% 0);
}
.glitch::before { color: var(--red); animation: glitch-a 7s infinite steps(1); }
.glitch::after  { color: var(--cyan); animation: glitch-b 9s infinite steps(1); }

@keyframes glitch-a {
  0%, 96%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
  97% { transform: translate(-3px, 0); clip-path: inset(15% 0 60% 0); }
  98.5% { transform: translate(2px, 0); clip-path: inset(55% 0 20% 0); }
}
@keyframes glitch-b {
  0%, 94%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
  95% { transform: translate(3px, 0); clip-path: inset(60% 0 10% 0); }
  96.5% { transform: translate(-2px, 0); clip-path: inset(25% 0 50% 0); }
}

.terminal {
  color: var(--fg-dim);
  min-height: 3.3em;
  max-width: 60ch;
  margin: 0 auto;
  font-size: 0.9rem;
}
.terminal::before { content: "> "; color: var(--fg-faint); }
.terminal::after { content: "_"; color: var(--green); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Fond de l'accueil : télé qui bug, discrète */
.fond {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.fond .bruit { opacity: 0.045; }
.fond::before {
  /* bande claire qui défile lentement, comme une image mal synchronisée */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 140px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.035), transparent);
  animation: defilement 9s linear infinite;
}
.fond::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.85) 100%);
}
@keyframes defilement { from { transform: translateY(-160px); } to { transform: translateY(100vh); } }
.barre, .wrap { position: relative; z-index: 1; }
.fond .filigrane { --filigrane: 0.07; top: 50%; width: min(620px, 115vw); }

/* Les boutons des expériences : même style que le bouton Entrer du chargement */
.boutons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-top: 32px;
}
.bouton {
  display: block;
  padding: 14px 22px;
  border: 1px solid var(--fg-faint);
  background: rgba(0, 0, 0, 0.35);
  color: var(--fg);
  font: 600 0.85rem var(--mono);
  letter-spacing: 0.25em;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
a.bouton:hover, a.bouton:focus-visible { border-color: var(--fg-dim); color: #fff; outline: none; animation: tressaille 0.3s steps(2) 1; }
@keyframes tressaille {
  0% { transform: translateX(-2px); text-shadow: 2px 0 var(--red), -2px 0 var(--cyan); }
  50% { transform: translateX(1px); text-shadow: -1px 0 var(--red), 1px 0 var(--cyan); }
  100% { transform: none; text-shadow: none; }
}

/* Bouton censuré : nom masqué par une bande, qui se trahit par instants */
.bouton.censure {
  border-color: var(--line);
  cursor: not-allowed;
  transition: transform 0.18s ease-out, border-color 0.2s;
}
.bouton.censure.refuse { border-color: rgba(255, 42, 79, 0.5); color: var(--red); animation: tressaille 0.3s steps(2) 1; }

/* Visage qui surgit en négatif, une fraction de seconde */
.visage {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background-repeat: no-repeat;
  /* tête du croco (≈ 77 % / 33 % de l'image) ramenée au centre de l'écran */
  background-size: 225vmin auto;
  background-position: calc(50vw - 173vmin) calc(50vh - 50vmin);
  filter: invert(1) contrast(1.6) grayscale(1);
  mix-blend-mode: screen;
  opacity: 0;
}
.visage.surgit { opacity: 0.55; }
.masque {
  display: inline;
  padding: 0 2px;
  background: #1d1d1d;
  color: transparent;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  user-select: none;
}
.masque.trahi { color: var(--fg-dim); background: #141414; }


.retour {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 50;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg-dim);
  font: 0.75rem var(--mono);
  text-decoration: none;
}
.retour:hover { color: var(--fg); border-color: var(--fg-faint); }

/* ---------- Écran de démarrage (accueil) ---------- */
.boot { display: none; }
.js .boot {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #000;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  text-align: center;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
  overflow: hidden;
  transition: opacity 0.6s;
}
.js.sans-boot .boot { display: none; }
.boot.fini { opacity: 0; pointer-events: none; }
.js:not(.sans-boot) body { overflow: hidden; }

.bruit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.09;
  image-rendering: pixelated;
}

/* Logo en filigrane, qui se dérègle par à-coups */
.filigrane {
  --filigrane: 0.15;
  position: absolute;
  top: 38%;
  left: 50%;
  width: min(420px, 80vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: center / contain no-repeat;
  opacity: var(--filigrane);
  animation: logo-saut 5s infinite steps(1);
}
.filigrane::before, .filigrane::after {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  clip-path: inset(0 0 100% 0);
}
.filigrane::before { animation: logo-a 2.7s infinite steps(1); }
.filigrane::after { animation: logo-b 3.9s infinite steps(1); }
@keyframes logo-saut {
  0%, 90%, 100% { opacity: var(--filigrane); }
  91% { opacity: calc(var(--filigrane) * 1.6); transform: translate(-51%, -50%) skewX(-4deg); }
  93% { opacity: calc(var(--filigrane) * 0.3); }
}
@keyframes logo-a {
  0%, 80%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  82% { clip-path: inset(20% 0 65% 0); transform: translateX(-14px); }
  86% { clip-path: inset(48% 0 40% 0); transform: translateX(10px); }
}
@keyframes logo-b {
  0%, 70%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  72% { clip-path: inset(66% 0 18% 0); transform: translateX(18px); }
  75% { clip-path: inset(8% 0 82% 0); transform: translateX(-8px); }
}

.boot-console {
  /* la roue et le bouton occupent la même place : l'un s'efface, l'autre apparaît */
  position: absolute;
  top: calc(38% + min(150px, 28vw));
  left: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  min-height: 120px;
}
.boot-console > * { grid-area: 1 / 1; }
/* Attente sobre : roue en pointillés et un seul mot */
.boot-attente {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--fg-dim);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.4s, visibility 0.4s;
}
.roue {
  width: 34px;
  height: 34px;
  border: 2px dotted var(--fg-dim);
  border-radius: 50%;
  animation: tourne 1.8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.boot-console.pret .boot-attente { opacity: 0; visibility: hidden; }

/* Accès par mot de passe : apparaît à la place de la roue */
.boot-acces {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}
.boot-console.pret .boot-acces { opacity: 1; visibility: visible; }
.boot-mdp {
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--fg-faint);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: 16px var(--mono); /* 16px : évite le zoom automatique sur iPhone */
  letter-spacing: 0.2em;
  text-align: center;
  caret-color: var(--fg);
  -webkit-appearance: none;
  appearance: none;
}
.boot-mdp::placeholder { color: var(--fg-faint); letter-spacing: 0.25em; text-transform: uppercase; font-size: 0.75rem; }
.boot-mdp:focus { outline: none; border-bottom-color: var(--fg-dim); }
.boot-entrer {
  padding: 14px 22px;
  width: 100%;
  border: 1px solid var(--fg-faint);
  background: transparent;
  color: var(--fg);
  font: 600 0.85rem var(--mono);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.boot-entrer:hover, .boot-entrer:focus-visible { border-color: var(--fg-dim); color: #fff; outline: none; }
/* Mauvais mot de passe : le bouton reste rouge « Recommencer », et bugue à chaque essai raté */
.boot-acces.echec .boot-mdp { border-bottom-color: rgba(255, 42, 79, 0.6); }
.boot-acces.echec .boot-entrer { border-color: rgba(255, 42, 79, 0.6); color: var(--red); }
.boot-acces.bug .boot-mdp { animation: tremble 0.35s steps(4) 1; }
.boot-acces.bug .boot-entrer { animation: bug 0.5s steps(1) 1; }
@keyframes tremble {
  0%, 100% { transform: none; }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
@keyframes bug {
  0% { transform: translateX(-4px) skewX(-8deg); text-shadow: 3px 0 var(--red), -3px 0 var(--cyan); clip-path: inset(0 0 45% 0); }
  15% { transform: translateX(5px); text-shadow: -3px 0 var(--red), 3px 0 var(--cyan); clip-path: inset(40% 0 0 0); }
  30% { transform: translateX(-2px) skewX(6deg); text-shadow: 2px 0 var(--red), -2px 0 var(--cyan); clip-path: none; filter: invert(1); }
  45% { transform: translateX(3px); text-shadow: -1px 0 var(--red), 1px 0 var(--cyan); filter: none; }
  60% { transform: none; text-shadow: 1px 0 var(--red), -1px 0 var(--cyan); }
  100% { transform: none; text-shadow: none; }
}

/* Bon mot de passe : l'accès s'efface, l'écran de démarrage se fond dans le menu */
.boot-console.part { opacity: 0; transition: opacity 0.2s; }

@media (prefers-reduced-motion: reduce) {
  .glitch::before, .glitch::after, .filigrane::before, .filigrane::after, .fond::before { display: none; }
  .filigrane, a.bouton:hover, .bouton.censure.refuse, .boot-acces.bug .boot-mdp, .boot-acces.bug .boot-entrer { animation: none; }
  .roue { animation-duration: 6s; }
  .visage { display: none; }
}
