/* ============================================
   XyberDraw - Visual Effects
   ============================================ */

/* グリッチテキスト効果 (見出しに付与) */
.glitch {
  position: relative;
  display: inline-block;
  color: var(--text-main);
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.glitch::before {
  color: var(--color-cyan);
  animation: glitch-anim-1 4s infinite linear alternate-reverse;
  z-index: -1;
}

.glitch::after {
  color: var(--color-magenta);
  animation: glitch-anim-2 5s infinite linear alternate-reverse;
  z-index: -2;
}

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

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

/* タイトル装飾用：左右の縦バー */
.title-deco {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.title-deco::before,
.title-deco::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--color-cyan);
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.6);
}

/* フェードイン */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in.delay-1 { transition-delay: 0.1s; }
.fade-in.delay-2 { transition-delay: 0.2s; }
.fade-in.delay-3 { transition-delay: 0.3s; }
.fade-in.delay-4 { transition-delay: 0.4s; }

/* テキストグリッチ on hover */
.hover-glitch {
  position: relative;
  transition: text-shadow 0.2s ease;
}

.hover-glitch:hover {
  text-shadow:
    1px 0 var(--color-cyan),
    -1px 0 var(--color-magenta);
  animation: text-jitter 0.15s infinite;
}

@keyframes text-jitter {
  0%, 100% { transform: translate(0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
}

/* 装飾用コーナーフレーム */
.corner-frame {
  position: relative;
  padding: 24px;
}

.corner-frame::before,
.corner-frame::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--color-cyan);
  border-style: solid;
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
}

.corner-frame::before {
  top: 0;
  left: 0;
  border-width: 1px 0 0 1px;
}

.corner-frame::after {
  bottom: 0;
  right: 0;
  border-width: 0 1px 1px 0;
}

/* 微光：見出しのアンダーライン */
.glow-line {
  display: block;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--color-cyan), transparent);
  box-shadow: 0 0 8px var(--color-cyan);
  margin: 12px 0 24px;
}

/* prefers-reduced-motion 対応 */
@media (prefers-reduced-motion: reduce) {
  .glitch::before, .glitch::after,
  .hover-glitch:hover {
    animation: none;
  }
}
