/* MINOUPIX — parking glitché. Tout est local (CSP script-src/style-src 'self'). */

:root {
  --fond: #05060e;
  --encre: #e8ecf6;
  --cyan: #4ef3e0;
  --magenta: #ff3d8b;
  --jaune: #ffe45c;
  --violet: #8a7bff;
}

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

html, body { height: 100%; }

body {
  background: var(--fond);
  color: var(--encre);
  font-family: "DejaVu Sans Mono", "Cascadia Mono", "SF Mono", Consolas, monospace;
  overflow: hidden;
}

.crt {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 120% 90% at 50% 30%, #101433 0%, var(--fond) 60%),
    var(--fond);
  animation: flicker 4s infinite steps(1);
}

/* ——— couches d'ambiance ——— */

.noise {
  position: absolute; inset: -50%;
  pointer-events: none;
  opacity: .06;
  background-image:
    repeating-radial-gradient(circle at 17% 31%, #fff 0 .5px, transparent .5px 2px),
    repeating-radial-gradient(circle at 73% 67%, #fff 0 .5px, transparent .5px 3px);
  background-size: 11px 11px, 7px 7px;
  animation: noise-jump .35s infinite steps(3);
}

.scanlines {
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, .28) 2px 4px
  );
  mix-blend-mode: multiply;
}

.scanband {
  position: absolute; left: 0; right: 0; height: 22vh;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(140, 190, 255, .045) 40%,
    rgba(140, 190, 255, .09) 50%,
    rgba(140, 190, 255, .045) 60%,
    transparent
  );
  animation: scanband 7s linear infinite;
}

.vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 95% 90% at 50% 50%, transparent 55%, rgba(0, 0, 5, .75) 100%);
}

/* ——— scène ——— */

.stage {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  animation: stage-shake 9s infinite steps(1);
}

/* ——— le minou, en triple exposition RVB ——— */

.cat-wrap {
  position: relative;
  width: min(46vmin, 300px);
  height: min(46vmin, 300px);
  margin: 0 auto 2.6rem;
  filter: drop-shadow(0 0 24px rgba(78, 243, 224, .25));
}

/* coins de visée HUD : la capture du spécimen est assumée */
.cat-wrap::before,
.cat-wrap::after {
  content: '';
  position: absolute;
  width: 28px; height: 28px;
  z-index: 3;
}

.cat-wrap::before {
  top: -12px; left: -12px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
}

.cat-wrap::after {
  bottom: -12px; right: -12px;
  border-bottom: 2px solid var(--magenta);
  border-right: 2px solid var(--magenta);
}

.tag {
  position: absolute;
  bottom: -12px; left: -12px;
  transform: translateY(100%);
  padding-top: .55rem;
  font-size: clamp(.6rem, 1.8vw, .75rem);
  letter-spacing: .22em;
  color: rgba(78, 243, 224, .75);
  white-space: nowrap;
}

.cat {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.cat-main { animation: cat-jitter 6s infinite steps(1); }

.cat-r, .cat-b { opacity: .55; mix-blend-mode: screen; }

.cat-r {
  filter: sepia(1) saturate(8) hue-rotate(-50deg);
  animation: split-r 3.1s infinite steps(1);
}

.cat-b {
  filter: sepia(1) saturate(8) hue-rotate(160deg);
  animation: split-b 2.7s infinite steps(1);
}

/* tranches horizontales qui balaient le chat */
.cat-slices {
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 12%,
    rgba(5, 6, 14, .85) 12% 13.5%,
    transparent 13.5% 31%,
    rgba(5, 6, 14, .85) 31% 32%,
    transparent 32% 100%
  );
  opacity: 0;
  animation: slices 5s infinite steps(1);
}

/* ——— titre glitch RVB ——— */

.glitch {
  position: relative;
  font-size: clamp(2.6rem, 11vw, 6.5rem);
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  color: var(--encre);
  text-shadow: 0 0 32px rgba(138, 123, 255, .5);
  animation: title-jitter 4s infinite steps(1);
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  overflow: hidden;
}

.glitch::before {
  color: var(--magenta);
  z-index: -1;
  animation: glitch-a 2.9s infinite linear alternate-reverse;
}

.glitch::after {
  color: var(--cyan);
  z-index: -2;
  animation: glitch-b 3.7s infinite linear alternate-reverse;
}

/* ——— sous-titre ——— */

.sub {
  position: relative;
  margin-top: 1rem;
  font-size: clamp(.85rem, 3vw, 1.35rem);
  letter-spacing: .55em;
  text-indent: .55em;
  color: var(--jaune);
  text-shadow: 0 0 18px rgba(255, 228, 92, .45);
  animation: sub-blink 5s infinite steps(1);
}

/* ——— ligne terminal ——— */

.term {
  margin-top: 2.2rem;
  font-size: clamp(.8rem, 2.6vw, 1.05rem);
  color: var(--cyan);
  min-height: 1.6em;
}

.prompt { color: var(--violet); }

.cursor { animation: cursor-blink 1s infinite steps(1); }

.hint {
  margin-top: .9rem;
  font-size: clamp(.7rem, 2.2vw, .9rem);
  color: rgba(232, 236, 246, .45);
  letter-spacing: .18em;
}

/* ——— rafales : le JS pose .burst sur <body> ——— */

.burst .crt { animation: burst-shift .12s infinite steps(2); }
.burst .cat-r { opacity: .9; transform: translate(-8px, 3px) skewX(4deg); }
.burst .cat-b { opacity: .9; transform: translate(9px, -4px) skewX(-4deg); }
.burst .cat-slices { opacity: 1; }
.burst .glitch::before { animation-duration: .3s; transform: translate(-6px, 2px); }
.burst .glitch::after { animation-duration: .25s; transform: translate(6px, -2px); }
.burst .sub { transform: skewX(-8deg) translateX(4px); color: var(--magenta); }

/* ——— keyframes ——— */

@keyframes flicker {
  0%, 100% { opacity: 1; }
  3% { opacity: .86; }
  3.4% { opacity: 1; }
  47% { opacity: 1; }
  47.3% { opacity: .78; }
  47.8% { opacity: 1; }
  81% { opacity: .93; }
  81.5% { opacity: 1; }
}

@keyframes noise-jump {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-9px, 6px); }
  66% { transform: translate(7px, -8px); }
  100% { transform: translate(0, 0); }
}

@keyframes scanband {
  0% { top: -25%; }
  100% { top: 110%; }
}

@keyframes stage-shake {
  0%, 100% { transform: translate(0, 0); }
  22% { transform: translate(0, 0); }
  22.2% { transform: translate(-3px, 1px); }
  22.5% { transform: translate(0, 0); }
  61% { transform: translate(0, 0); }
  61.2% { transform: translate(4px, -2px) skewX(-1deg); }
  61.6% { transform: translate(0, 0); }
}

@keyframes cat-jitter {
  0%, 100% { transform: translate(0, 0); filter: none; }
  34% { transform: translate(0, 0); }
  34.3% { transform: translate(-5px, 0) scaleX(1.03); filter: hue-rotate(40deg); }
  34.9% { transform: translate(0, 0); filter: none; }
  73% { transform: translate(0, 0); }
  73.3% { transform: translate(4px, -3px); filter: invert(1) hue-rotate(180deg); }
  73.7% { transform: translate(0, 0); filter: none; }
}

@keyframes split-r {
  0%, 100% { transform: translate(-2px, 1px); }
  25% { transform: translate(-4px, 2px); }
  50% { transform: translate(-1px, 0); }
  75% { transform: translate(-6px, 1px); }
}

@keyframes split-b {
  0%, 100% { transform: translate(2px, -1px); }
  25% { transform: translate(5px, 0); }
  50% { transform: translate(1px, -2px); }
  75% { transform: translate(3px, 2px); }
}

@keyframes slices {
  0%, 100% { opacity: 0; }
  18% { opacity: 0; }
  18.2% { opacity: 1; transform: translateY(0); }
  18.8% { opacity: 0; }
  57% { opacity: 0; }
  57.2% { opacity: 1; transform: translateY(30%); }
  57.9% { opacity: 0; }
}

@keyframes title-jitter {
  0%, 100% { transform: none; }
  12% { transform: none; }
  12.2% { transform: skewX(6deg); }
  12.5% { transform: none; }
  55% { transform: none; }
  55.2% { transform: skewX(-8deg) translateX(3px); }
  55.6% { transform: none; }
}

@keyframes glitch-a {
  0% { clip-path: inset(12% 0 82% 0); transform: translate(-4px, -1px); }
  20% { clip-path: inset(54% 0 34% 0); transform: translate(-6px, 1px); }
  40% { clip-path: inset(80% 0 6% 0); transform: translate(-2px, 0); }
  60% { clip-path: inset(30% 0 58% 0); transform: translate(-7px, 2px); }
  80% { clip-path: inset(66% 0 22% 0); transform: translate(-3px, -2px); }
  100% { clip-path: inset(4% 0 90% 0); transform: translate(-5px, 1px); }
}

@keyframes glitch-b {
  0% { clip-path: inset(78% 0 10% 0); transform: translate(5px, 1px); }
  20% { clip-path: inset(24% 0 66% 0); transform: translate(3px, -1px); }
  40% { clip-path: inset(48% 0 44% 0); transform: translate(7px, 2px); }
  60% { clip-path: inset(8% 0 84% 0); transform: translate(2px, 0); }
  80% { clip-path: inset(60% 0 30% 0); transform: translate(6px, -2px); }
  100% { clip-path: inset(36% 0 52% 0); transform: translate(4px, 1px); }
}

@keyframes sub-blink {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; }
  41.2% { opacity: .2; }
  41.5% { opacity: 1; }
  42% { opacity: .5; }
  42.3% { opacity: 1; }
}

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

@keyframes burst-shift {
  0% { transform: translate(-5px, 2px); }
  50% { transform: translate(6px, -3px); }
  100% { transform: translate(-2px, 0); }
}

/* ——— droite-à-gauche (arabe) : l'espacement des lettres latines se resserre ——— */

[dir="rtl"] .sub { letter-spacing: .12em; text-indent: 0; }
[dir="rtl"] .hint { letter-spacing: .06em; }

/* ——— accessibilité : on calme tout ——— */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .cat-r, .cat-b, .cat-slices, .noise { display: none; }
}
