/* Общие стили с mobile-first */
body {
  font-family: 'Rajdhani', 'Arial', sans-serif;
  margin: 0;
  padding: 16px;
  background: #0a0e14;
  color: #d0d0d0;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Сетка + пиксели */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
      linear-gradient(0deg, rgba(255, 32, 121, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0, 230, 255, 0.05) 1px, transparent 1px),
      url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAJUlEQVQYV2NkwA3+//9/QXjPyAJAwcnJSSg2NjZmMDIyMnL8z7QDAJqJD3LMDgAAAABJRU5ErkJggg==') repeat;
  background-size: 20px 20px, 20px 20px, auto;
  opacity: 0.1;
  animation: noiseShift 0.1s infinite linear, gridPulse 5s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

/* Неоновый градиент */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 32, 121, 0.2) 0%, rgba(0, 230, 255, 0.2) 50%, transparent 70%);
  opacity: 0.4;
  animation: neonGlow 6s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

/* Эффект дождя */
.rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.rain span {
  position: absolute;
  width: 2px;
  height: 50px;
  background: linear-gradient(to bottom, transparent, #00e6ff);
  opacity: 0.5;
  animation: rainDrop 1s linear infinite;
}

/* Хедер */
header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

header h1 {
  font-size: 22px;
  font-weight: 600;
  color: #ff2079;
  text-shadow: 0 0 5px rgba(255, 32, 121, 0.8), 0 0 15px rgba(255, 32, 121, 0.5), 0 0 25px rgba(255, 32, 121, 0.3);
  letter-spacing: 2px;
  animation: glitch 2s infinite linear alternate-reverse;
  position: relative;
}

header h1::before,
header h1::after {
  content: 'DevNotes';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  color: #00e6ff;
  opacity: 0.8;
  clip-path: polygon(0 0, 100% 0, 100% 20%, 0 20%);
}

header h1::before {
  animation: glitchTop 1s infinite linear alternate-reverse;
  transform: translate(-2px, -2px);
}

header h1::after {
  animation: glitchBottom 1.5s infinite linear alternate-reverse;
  transform: translate(2px, 2px);
}

/* Поле поиска */
#search {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 1px solid #00e6ff;
  border-radius: 6px;
  background: rgba(10, 14, 20, 0.9);
  color: #d0d0d0;
  box-sizing: border-box;
  box-shadow: 0 0 8px rgba(0, 230, 255, 0.3), inset 0 0 5px rgba(0, 230, 255, 0.2);
  transition: box-shadow 0.3s ease;
}

#search:focus {
  box-shadow: 0 0 15px rgba(0, 230, 255, 0.7), inset 0 0 8px rgba(0, 230, 255, 0.4);
  outline: none;
}

/* Основной контент */
main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Статьи */
article {
  background: rgba(15, 19, 25, 0.9);
  padding: 16px;
  border-radius: 6px;
  border: 1px solid #1a2330;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 32, 121, 0.2);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

article:nth-child(1) { animation-delay: 0.1s; }
article:nth-child(2) { animation-delay: 0.2s; }
article:nth-child(3) { animation-delay: 0.3s; }
article:nth-child(4) { animation-delay: 0.4s; }
article:nth-child(5) { animation-delay: 0.5s; }

article::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  border: 1px solid #ff2079;
  border-radius: 6px;
  opacity: 0.5;
  animation: neonBorder 4s infinite ease-in-out;
  pointer-events: none;
}

article:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 32, 121, 0.5);
}

/* Код */
pre[class*="language-"] {
  background: #0d1117;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 13px;
  color: #00e6ff;
  border: 1px solid #1a2330;
  box-shadow: 0 0 8px rgba(0, 230, 255, 0.2);
  position: relative;
}

pre[class*="language-"]::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00e6ff, transparent);
  animation: scanLine 3s infinite linear;
}

/* Теги с глитч-эффектом */
.tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: #1a2330;
  color: #d0d0d0;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 0 5px rgba(255, 32, 121, 0.2);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
}

.tag.active,
.tag:hover {
  background: #ff2079;
  color: #0a0e14;
  box-shadow: 0 0 12px rgba(255, 32, 121, 0.6);
  transform: scale(1.05);
  animation: tagGlitch 0.3s linear infinite; /* Глитч при наведении */
}

.tag::before,
.tag::after {
  content: attr(data-text); /* Копируем текст тега */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: #00e6ff;
  opacity: 0;
  pointer-events: none;
}

.tag:hover::before {
  opacity: 0.8;
  animation: tagGlitchTop 0.3s infinite linear;
  transform: translate(-2px, -1px);
  clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.tag:hover::after {
  opacity: 0.8;
  animation: tagGlitchBottom 0.3s infinite linear;
  transform: translate(2px, 1px);
  clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}

/* Кнопка копирования */
.copy-btn {
  background: #1a2330;
  color: #d0d0d0;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  margin-top: 8px;
  box-shadow: 0 0 5px rgba(0, 230, 255, 0.2);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.copy-btn:hover {
  background: #00e6ff;
  color: #0a0e14;
  box-shadow: 0 0 12px rgba(0, 230, 255, 0.6);
  transform: scale(1.05);
}

/* Анимации */
@keyframes noiseShift {
  0% { background-position: 0 0; }
  100% { background-position: 10px 10px; }
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.15; }
}

@keyframes neonGlow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(2px, -2px); }
  60% { transform: translate(-1px, 1px); }
  80% { transform: translate(1px, -1px); }
  100% { transform: translate(0); }
}

@keyframes glitchTop {
  0% { clip-path: polygon(0 0, 100% 0, 100% 20%, 0 20%); }
  50% { clip-path: polygon(0 0, 100% 0, 100% 10%, 0 10%); }
  100% { clip-path: polygon(0 0, 100% 0, 100% 25%, 0 25%); }
}

@keyframes glitchBottom {
  0% { clip-path: polygon(0 80%, 100% 80%, 100% 100%, 0 100%); }
  50% { clip-path: polygon(0 90%, 100% 90%, 100% 100%, 0 100%); }
  100% { clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%); }
}

@keyframes tagGlitch {
  0% { transform: translate(0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  60% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 1px); }
  100% { transform: translate(0); }
}

@keyframes tagGlitchTop {
  0% { clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%); }
  50% { clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%); }
  100% { clip-path: polygon(0 0, 100% 0, 100% 60%, 0 60%); }
}

@keyframes tagGlitchBottom {
  0% { clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%); }
  50% { clip-path: polygon(0 70%, 100% 70%, 100% 100%, 0 100%); }
  100% { clip-path: polygon(0 40%, 100% 40%, 100% 100%, 0 100%); }
}

@keyframes neonBorder {
  0%, 100% { opacity: 0.5; border-color: #ff2079; }
  50% { opacity: 0.8; border-color: #00e6ff; }
}

@keyframes scanLine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes rainDrop {
  0% { transform: translateY(-100vh); opacity: 0.5; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* Медиа-запросы для десктопов */
@media (min-width: 768px) {
  body {
    padding: 32px;
  }

  header h1 {
    font-size: 28px;
  }

  article {
    padding: 24px;
  }

  pre[class*="language-"] {
    font-size: 15px;
  }

  .copy-btn {
    padding: 8px 16px;
  }

  .tag {
    font-size: 14px;
  }
}