/* ============================================================
   Parrot-OS Visual FX  —  parrot-fx.css
   Complete rewrite:  CLI terminal name, HUD corners, page sweep,
   matrix rain canvas, section scan, glitch, cert pulse, pills.
   Respects prefers-reduced-motion throughout.
   No ::before/::after conflicts with motion.css glow layers.
   ============================================================ */

/* ----------------------------------------------------------
   0.  Shared Parrot colour tokens
   ---------------------------------------------------------- */
:root {
  --parrot-green:      #50fa7b;
  --parrot-cyan:       #8be9fd;
  --parrot-green-glow: rgba(80, 250, 123, 0.55);
  --parrot-cyan-glow:  rgba(139, 233, 253, 0.45);
  --parrot-dim:        rgba(80, 250, 123, 0.22);
  --cli-bg:            rgba(2, 7, 14, 0.97);
  --cli-border:        rgba(80, 250, 123, 0.22);
}

/* ----------------------------------------------------------
   1.  Matrix Rain Canvas
   ---------------------------------------------------------- */
#parrot-rain {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.4s ease;
}
#parrot-rain.is-ready { opacity: 0.09; }

/* ----------------------------------------------------------
   2.  CLI Terminal  —  the hero name animation centerpiece
   ---------------------------------------------------------- */

/* sr-only the original h1 when CLI mode is active */
.parrot-cli-mode .hero-name {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Terminal window */
.parrot-cli-terminal {
  width: min(600px, 100%);
  margin-bottom: 0.55rem;
  border-radius: 9px;
  overflow: hidden;
  background: var(--cli-bg);
  border: 1px solid var(--cli-border);
  box-shadow:
    0 0 0 1px rgba(80, 250, 123, 0.05),
    0 32px 90px rgba(0, 0, 0, 0.88),
    0 0 48px rgba(80, 250, 123, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Courier New', monospace;
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}
.parrot-cli-terminal.is-visible {
  opacity: 1;
  transform: none;
}

/* Title bar */
.parrot-cli-header {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.5rem 0.85rem;
  background: rgba(6, 14, 24, 0.98);
  border-bottom: 1px solid rgba(80, 250, 123, 0.07);
  user-select: none;
}
.parrot-cli-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.parrot-cli-dot--red    { background: #ff5f56; box-shadow: 0 0 5px rgba(255,95,86,0.45); }
.parrot-cli-dot--yellow { background: #ffbd2e; box-shadow: 0 0 5px rgba(255,189,46,0.45); }
.parrot-cli-dot--green  { background: #27c93f; box-shadow: 0 0 5px rgba(39,201,63,0.5); }
.parrot-cli-title {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.06em;
}

/* Body */
.parrot-cli-body {
  padding: 0.9rem 1.1rem 1rem;
  line-height: 1.65;
  font-size: clamp(0.74rem, 1.3vw, 0.86rem);
}

/* Parrot two-line prompt  ┌──(root㉿parrot)-[~/portfolio]  └─# */
.parrot-cli-ps1 {
  display: block;
  color: var(--parrot-green);
  font-weight: 600;
  white-space: pre;
  line-height: 1.45;
  font-size: 0.82em;
  letter-spacing: 0.01em;
}

/* Command text being typed */
.parrot-cli-cmd-row {
  display: flex;
  align-items: baseline;
  margin-top: -0.18rem;
  min-height: 1.4em;
}
.parrot-cli-cmd-text {
  color: #f8f8f2;
  font-size: 0.9em;
}

/* Block cursor */
.parrot-cli-cursor {
  display: inline-block;
  width: 0.52em;
  height: 1.05em;
  background: var(--parrot-green);
  vertical-align: text-bottom;
  margin-left: 1px;
  box-shadow: 0 0 7px var(--parrot-green-glow);
  flex-shrink: 0;
}
@keyframes cliCursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.parrot-cli-cursor.is-blinking {
  animation: cliCursorBlink 0.92s step-end infinite;
}

/* The big name output line */
.parrot-cli-name-output {
  display: block;
  font-size: clamp(2.1rem, 5.8vw, 3.4rem);
  font-weight: 800;
  color: #f6fcff;
  letter-spacing: -0.03em;
  padding: 0.12em 0 0.14em;
  line-height: 1.1;
  text-shadow:
    0 0 14px rgba(80, 250, 180, 0.65),
    0 0 32px rgba(80, 250, 180, 0.32),
    0 0 60px rgba(139, 233, 253, 0.18),
    0 4px 22px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.38s ease, transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.parrot-cli-name-output.is-shown {
  opacity: 1;
  transform: none;
}

/* Scan sweep through the name */
@keyframes cliNameScan {
  0%   { left: -80%; opacity: 0; }
  6%   { opacity: 1; }
  94%  { opacity: 0.7; }
  100% { left: 110%; opacity: 0; }
}
.parrot-cli-name-output::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -80%;
  width: 55%;
  background: linear-gradient(
    90deg,
    transparent           0%,
    rgba(80,250,180,0.08) 18%,
    rgba(255,255,255,0.28) 42%,
    rgba(139,233,253,0.20) 58%,
    rgba(80,250,180,0.08)  82%,
    transparent           100%
  );
  pointer-events: none;
  z-index: 1;
}
.parrot-cli-name-output.scan-active::after {
  animation: cliNameScan 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Second idle prompt row */
.parrot-cli-idle-row {
  display: flex;
  align-items: baseline;
  margin-top: 0.1rem;
}

/* ----------------------------------------------------------
   3.  Page HUD  —  fixed corner brackets + sweep line
   ---------------------------------------------------------- */
.parrot-hud-corners {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.parrot-hud-corner {
  position: absolute;
  width: 24px;
  height: 24px;
}
.parrot-hud-corner--tl { top: 14px;  left: 14px;  border-top:    1.5px solid var(--parrot-green); border-left:  1.5px solid var(--parrot-green); }
.parrot-hud-corner--tr { top: 14px;  right: 14px; border-top:    1.5px solid var(--parrot-green); border-right: 1.5px solid var(--parrot-green); }
.parrot-hud-corner--bl { bottom: 14px; left: 14px;  border-bottom: 1.5px solid var(--parrot-green); border-left:  1.5px solid var(--parrot-green); }
.parrot-hud-corner--br { bottom: 14px; right: 14px; border-bottom: 1.5px solid var(--parrot-green); border-right: 1.5px solid var(--parrot-green); }

@keyframes parrotCornerPulse {
  0%, 100% { opacity: 0.28; box-shadow: none; }
  50%       { opacity: 0.62; box-shadow: 0 0 8px var(--parrot-dim); }
}
.parrot-hud-corner { animation: parrotCornerPulse 4.5s ease-in-out infinite; }
.parrot-hud-corner--tr { animation-delay: -1.1s; }
.parrot-hud-corner--bl { animation-delay: -2.3s; }
.parrot-hud-corner--br { animation-delay: -3.4s; }

/* Page-wide horizontal sweep line */
.parrot-page-scan {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent                0%,
    rgba(80,250,123,0.07)       4%,
    rgba(139,233,253,0.75)      24%,
    rgba(80,250,180,0.98)       50%,
    rgba(139,233,253,0.75)      76%,
    rgba(80,250,123,0.07)       96%,
    transparent                100%
  );
  box-shadow:
    0 0 6px var(--parrot-green-glow),
    0 0 14px rgba(139,233,253,0.22);
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}
@keyframes parrotPageSweep {
  0%   { top: -2px;   opacity: 0; }
  3%   { opacity: 0.95; }
  93%  { opacity: 0.65; }
  100% { top: 100vh;  opacity: 0; }
}
.parrot-page-scan.is-sweeping {
  animation: parrotPageSweep 5.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ----------------------------------------------------------
   4.  Card entry scan  (injected <span>, no ::before conflict)
   ---------------------------------------------------------- */
.parrot-scanline {
  position: absolute;
  left: 0;
  top: -3px;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent              0%,
    rgba(80,250,180,0.10)    7%,
    rgba(139,233,253,0.80)   28%,
    rgba(80,250,123,0.65)    50%,
    rgba(139,233,253,0.80)   72%,
    rgba(80,250,180,0.10)    93%,
    transparent              100%
  );
  filter: blur(0.4px);
  pointer-events: none;
  z-index: 12;
  opacity: 0;
}
@keyframes parrotScanDown {
  0%   { top: -3px;            opacity: 0; }
  4%   { opacity: 1; }
  88%  { opacity: 0.72; }
  100% { top: calc(100% + 3px); opacity: 0; }
}
.parrot-scanline.is-scanning {
  animation: parrotScanDown 1.6s cubic-bezier(0.4, 0, 0.55, 1) forwards;
}

/* ----------------------------------------------------------
   5.  Section h2 glitch on scroll reveal
   ---------------------------------------------------------- */
@keyframes parrotGlitchColor {
  0%    { text-shadow: 3px 0 rgba(255,0,80,0.7),  -3px 0 rgba(0,255,180,0.7); }
  22%   { text-shadow: -3px 0 rgba(255,0,80,0.5),   3px 0 rgba(0,255,180,0.5); }
  44%   { text-shadow:  2px 0 rgba(255,80,0,0.35), -2px 0 rgba(0,180,255,0.35); }
  66%   { text-shadow: 0 0 transparent; }
  100%  { text-shadow: 0 0 transparent; }
}
@keyframes parrotGlitchShift {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-5px); }
  30%  { transform: translateX(5px); }
  45%  { transform: translateX(-2px); }
  60%  { transform: translateX(2px); }
  75%  { transform: translateX(0); }
  100% { transform: translateX(0); }
}
@keyframes parrotGlitchClip {
  0%   { clip-path: inset(0 0 96% 0); opacity: 0.8; }
  12%  { clip-path: inset(28% 0 54% 0); }
  24%  { clip-path: inset(64% 0 16% 0); }
  36%  { clip-path: inset(10% 0 78% 0); }
  48%  { clip-path: inset(46% 0 38% 0); }
  60%  { clip-path: inset(80% 0 4%  0); }
  72%  { clip-path: inset(20% 0 60% 0); }
  84%  { clip-path: inset(0  0 0   0); opacity: 1; }
  100% { clip-path: inset(0  0 0   0); opacity: 1; }
}

.motion-ok .section-h2 {
  position: relative;
  display: inline-block;
}
.motion-ok .section-h2.glitch-active {
  animation:
    parrotGlitchColor  0.65s ease            forwards,
    parrotGlitchShift  0.44s steps(4)        forwards;
}
.motion-ok .section-h2.glitch-active::before {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  color: inherit;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
  animation: parrotGlitchClip 0.65s steps(5) forwards;
}

/* ----------------------------------------------------------
   6.  Terminal cursor on tagline
   ---------------------------------------------------------- */
@keyframes parrotCursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
.hero-tagline-cursor {
  display: inline-block;
  color: var(--parrot-green);
  margin-left: 2px;
  font-size: 0.88em;
  animation: parrotCursorBlink 1.1s step-end infinite;
  user-select: none;
}

/* ----------------------------------------------------------
   7.  Skill pill stagger cascade
   ---------------------------------------------------------- */
.motion-ok .skill-pill {
  opacity: 0;
  transform: translateY(6px) scale(0.93);
  transition:
    opacity  0.26s ease,
    transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--pill-i, 0) * 46ms + 55ms);
}
.motion-ok .skill-section.is-visible .skill-pill {
  opacity: 1;
  transform: none;
}

/* ----------------------------------------------------------
   8.  Cert badge neon pulse
   ---------------------------------------------------------- */
@keyframes parrotNeonPulse {
  0%, 100% { box-shadow: 0 0 4px  rgba(139,233,253,0.2); }
  50%       { box-shadow: 0 0 12px rgba(139,233,253,0.65),
                          0 0 22px rgba(80,250,180,0.2); }
}
.cert-status--progress {
  animation: parrotNeonPulse 2.6s ease-in-out infinite;
}

/* ----------------------------------------------------------
   9.  Prefers-reduced-motion: kill everything cleanly
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #parrot-rain,
  .parrot-page-scan,
  .parrot-hud-corners                          { display: none !important; }

  .parrot-cli-terminal                         { opacity: 1 !important; transform: none !important; transition: none !important; }
  .parrot-cli-name-output                      { opacity: 1 !important; transform: none !important; transition: none !important; }
  .parrot-cli-name-output::after               { display: none !important; }
  .parrot-cli-cursor.is-blinking               { animation: none !important; }
  .hero-tagline-cursor                         { animation: none !important; }

  .parrot-hud-corner                           { animation: none !important; }
  .parrot-scanline                             { display: none !important; }

  .motion-ok .section-h2.glitch-active         { animation: none !important; }
  .motion-ok .section-h2.glitch-active::before { display: none !important; }

  .motion-ok .skill-pill                       { opacity: 1 !important; transform: none !important; transition: none !important; }
  .cert-status--progress                       { animation: none !important; }
}
