/* =============================================================================
   pro5-visual.css — Phong cách AI Engineer: Neural Canvas, Typewriter,
   Spotlight Cards, Scroll Progress, CLI Terminal
   Version: 20261114c
   ============================================================================= */

/* ─── SCROLL PROGRESS BAR ──────────────────────────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, #ffd700 0%, #ffe57f 60%, #ffd700 100%);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  pointer-events: none;
  transition: width 80ms linear;
}

/* ─── NEURAL CANVAS ────────────────────────────────────────────────────── */
#neural-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  display: block;
  width: 100%;
  height: 100%;
}

/* Đảm bảo hero section là relative để canvas định vị đúng */
#home {
  position: relative;
  overflow: hidden;
}

/* Đẩy hero nội dung lên trên canvas */
#home > *:not(#neural-bg) {
  position: relative;
  z-index: 1;
}

/* ─── TYPEWRITER CURSOR ────────────────────────────────────────────────── */
.tw-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent, #ffd700);
  margin-left: 2px;
  vertical-align: middle;
  border-radius: 1px;
  animation: tw-blink 0.9s step-end infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .tw-cursor { animation: none; opacity: 1; }
}

/* ─── SPOTLIGHT HOVER & 3D TILT CHO PROJECT CARDS ─────────────────────── */
.portfolio-project {
  --mouse-x: 50%;
  --mouse-y: 50%;
  position: relative;
  transition: transform 180ms ease, box-shadow 220ms ease;
  will-change: transform;
}

.portfolio-project::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    circle 220px at var(--mouse-x) var(--mouse-y),
    rgba(255, 215, 0, 0.065) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 350ms ease;
}

.portfolio-project:hover::before {
  opacity: 1;
}

/* Đảm bảo nội dung bên trong luôn nằm trên spotlight overlay */
.portfolio-project > * {
  position: relative;
  z-index: 1;
}

/* ─── CLI OPEN BUTTON (Header) ─────────────────────────────────────────── */
.cli-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition:
    border-color 180ms var(--ease),
    color 180ms var(--ease),
    background 180ms var(--ease);
  white-space: nowrap;
}

.cli-open-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 215, 0, 0.06);
}

/* ─── TERMINAL MODAL OVERLAY ───────────────────────────────────────────── */
.cli-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease);
}

.cli-modal[hidden] {
  display: flex !important; /* keep flex for transitions */
  visibility: hidden;
}

.cli-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

/* ─── TERMINAL INNER BOX ────────────────────────────────────────────────── */
.cli-inner {
  width: min(760px, 100%);
  max-height: min(540px, 85svh);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 10px;
  background: rgba(7, 9, 12, 0.97);
  box-shadow:
    0 0 0 1px rgba(255, 215, 0, 0.1),
    0 24px 60px rgba(0, 0, 0, 0.75),
    0 0 80px rgba(255, 215, 0, 0.06);
  overflow: hidden;
  transform: translateY(18px) scale(0.97);
  transition: transform 240ms var(--ease);
}

.cli-modal.is-open .cli-inner {
  transform: translateY(0) scale(1);
}

/* ─── TERMINAL TITLE BAR ────────────────────────────────────────────────── */
.cli-titlebar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
  background: rgba(14, 18, 23, 0.9);
  flex-shrink: 0;
}

.cli-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.cli-dot-red    { background: #ff5f56; }
.cli-dot-yellow { background: #ffbd2e; }
.cli-dot-green  { background: #27c93f; }

.cli-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255, 215, 0, 0.6);
  letter-spacing: 0.05em;
}

.cli-blink {
  animation: tw-blink 1s step-end infinite;
  color: var(--accent);
}

.cli-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  transition: color 150ms, background 150ms;
}

.cli-close:hover { color: #ff5f56; background: rgba(255, 95, 86, 0.12); }

/* ─── TERMINAL OUTPUT ───────────────────────────────────────────────────── */
.cli-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: #c8d6e0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 215, 0, 0.2) transparent;
}

.cli-line { margin-bottom: 0.15rem; white-space: pre-wrap; word-break: break-word; }

.cli-gold   { color: #ffd700; }
.cli-muted  { color: #6c7986; }
.cli-green  { color: #27c93f; }
.cli-red    { color: #ff5f56; }
.cli-link   { color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ─── TERMINAL INPUT ROW ────────────────────────────────────────────────── */
.cli-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid rgba(255, 215, 0, 0.1);
  background: rgba(14, 18, 23, 0.6);
  flex-shrink: 0;
}

.cli-prompt-sign {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.cli-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  caret-color: var(--accent);
  min-width: 0;
}

.cli-input::placeholder { color: rgba(166, 177, 187, 0.4); }

/* ─── RESPONSIVE ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .cli-open-btn { display: none; }
  .cli-modal { padding: 0.75rem; align-items: flex-end; }
  .cli-inner { max-height: 72svh; border-radius: 10px 10px 0 0; }
}

@media (max-width: 768px) {
  .cli-open-btn span:not([aria-hidden]) { display: none; }
}

/* ─── REDUCED MOTION ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cli-inner  { transform: none; transition: none; }
  .cli-modal  { transition: none; }
  #scroll-progress { transition: none; }
}
