/* ---- Font and tweaks ---- */
@font-face {
  font-family: 'Hacked';
  src: url('/fonts/HACKED.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

body, h1, h2, h3 {
  font-family: 'Hacked', monospace, sans-serif;
  margin: 0;
  background: #222;
  color: #fff;
}

/* Wrapper: vertical centered */
.glitch-wrapper {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: #222;
}

/* Main-Glitch */
.glitch {
  position: relative;
  display: inline-block;
  font-size: clamp(48px, 12vw, 80px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 5px;
  z-index: 1;

  /* red metallic gradient */
  background: linear-gradient(100deg, #A60000 0%, #900 50%, #f00 100%);
  background-size: 200% 200%;
  background-clip: text;
  color: transparent; /* for firefox */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shift 4s ease-in-out infinite alternate, shine 5s linear infinite;
}

.glitch::after {
  /* First overlay for shine */
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: linear-gradient(120deg,
      transparent 0%,
      rgba(255,255,255,0.6) 20%,
      rgba(255,255,255,0.8) 40%,
      transparent 60%
  );
  background-clip: text;
  -webkit-background-clip: text;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 2;
  /* shine-Animation */
  animation: shine 3s linear infinite;
}

/* --- Doublelayer glitch text --- */
.glitch::before,
.glitch::after {
  content: attr(data-glitch);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  background-color: transparent;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.glitch::before {
  left: -2px;
  animation: noise-before 3s infinite linear alternate-reverse, text-shadow-glitch-before 3s infinite linear;
  clip: rect(0px, 9999px, 0px, 0px);
}

/* Animation: text-shadow */
@keyframes text-shadow-glitch-before {
  0%, 20%, 100% { text-shadow: -1px 0 #00ffff, 1px 0 #fff; }
  40% { text-shadow: -2px -1px #1ec8ff, 3px 2px #fff; } /* kräftig blau */
  50% { text-shadow: 1px 1px #fff, -3px 0 #00d9ff; }    /* hellblau Glitch */
  60% { text-shadow: 2px -1px #fff, 2px 3px #0ff; }
  70% { text-shadow: -1px 0 #fff; }
  80% { text-shadow: 3px 1px #00baff, 1px -2px #fff; }
}

/* Colorglitch */
.glitch::after {
  left: 2px;
  animation: noise-after 2s infinite linear alternate-reverse, text-shadow-glitch-after 2s infinite linear;
  clip: rect(0px, 9999px, 0px, 0px);
}

@keyframes text-shadow-glitch-after {
  0%, 20%, 100% { text-shadow: 1px 0 #ff00ff, -1px 1px #fff; }
  30% { text-shadow: 3px 1px #214dd9, -2px 2px #fff; }
  50% { text-shadow: 2px 0 #428afe, 3px -1px #fff; }    /* Blautöne */
  65% { text-shadow: 1px 0 #fff, 1px -1px #379eff; }
  80% { text-shadow: 2px 0 #ff00ff, -3px 2px #b5ffff; }
}

/* Shine animation */
@keyframes shine {
  0%   { background-position: 50% 0%; }
  50%  { background-position: 50% 100%; }
  100% { background-position: 50% 0%; }
}

.glitch.small-text {
  font-size: clamp(14px, 2.5vw, 20px);
  letter-spacing: 1px;
  margin-top: 16px;
  line-height: 1.2;
}

@keyframes noise-before {
   0% { clip: rect(61px, 9999px, 52px, 0); }
   5% { clip: rect(33px, 9999px, 144px, 0); }
   10% { clip: rect(121px, 9999px, 115px, 0); }
   15% { clip: rect(144px, 9999px, 162px, 0); }
   20% { clip: rect(62px, 9999px, 180px, 0); }
   25% { clip: rect(34px, 9999px, 42px, 0); }
   30% { clip: rect(147px, 9999px, 179px, 0); }
   35% { clip: rect(99px, 9999px, 63px, 0); }
   40% { clip: rect(188px, 9999px, 122px, 0); }
   45% { clip: rect(154px, 9999px, 14px, 0); }
   50% { clip: rect(63px, 9999px, 37px, 0); }
   55% { clip: rect(161px, 9999px, 147px, 0); }
   60% { clip: rect(109px, 9999px, 175px, 0); }
   65% { clip: rect(157px, 9999px, 88px, 0); }
   70% { clip: rect(173px, 9999px, 131px, 0); }
   75% { clip: rect(62px, 9999px, 70px, 0); }
   80% { clip: rect(24px, 9999px, 153px, 0); }
   85% { clip: rect(138px, 9999px, 40px, 0); }
   90% { clip: rect(79px, 9999px, 136px, 0); }
   95% { clip: rect(25px, 9999px, 34px, 0); }
   100% { clip: rect(173px, 9999px, 166px, 0); }
}

@keyframes noise-after {
   0% { clip: rect(26px, 9999px, 33px, 0); }
   5% { clip: rect(140px, 9999px, 198px, 0); }
   10% { clip: rect(184px, 9999px, 89px, 0); }
   15% { clip: rect(121px, 9999px, 6px, 0); }
   20% { clip: rect(181px, 9999px, 99px, 0); }
   25% { clip: rect(154px, 9999px, 133px, 0); }
   30% { clip: rect(134px, 9999px, 169px, 0); }
   35% { clip: rect(26px, 9999px, 187px, 0); }
   40% { clip: rect(147px, 9999px, 137px, 0); }
   45% { clip: rect(31px, 9999px, 52px, 0); }
   50% { clip: rect(191px, 9999px, 109px, 0); }
   55% { clip: rect(74px, 9999px, 54px, 0); }
   60% { clip: rect(145px, 9999px, 75px, 0); }
   65% { clip: rect(153px, 9999px, 198px, 0); }
   70% { clip: rect(99px, 9999px, 136px, 0); }
   75% { clip: rect(118px, 9999px, 192px, 0); }
   80% { clip: rect(1px, 9999px, 83px, 0); }
   85% { clip: rect(145px, 9999px, 98px, 0); }
   90% { clip: rect(121px, 9999px, 154px, 0); }
   95% { clip: rect(156px, 9999px, 44px, 0); }
   100% { clip: rect(67px, 9999px, 122px, 0); }
}

@keyframes shift {
   0%, 40%, 44%, 58%, 61%, 65%, 69%, 73%, 100% { transform: skewX(0deg); }
   41% { transform: skewX(10deg); }
   42% { transform: skewX(-10deg); }
   59% { transform: skewX(40deg) skewY(10deg); }
   60% { transform: skewX(-40deg) skewY(-10deg); }
   63% { transform: skewX(10deg) skewY(-5deg); }
   70% { transform: skewX(-50deg) skewY(-20deg); }
   71% { transform: skewX(10deg) skewY(-10deg); }
}

/* for small devices */
@media (max-width: 600px) {
  .glitch { font-size: clamp(36px, 14vw, 60px); }
  .glitch.small-text { font-size: clamp(12px, 3.5vw, 16px); margin-top: 12px; }
}

