/* ============================================
   CINEMATIC.CSS
   Dark / futuristic / 3D intro experience cho trang chủ VPBot
   Áp dụng độc lập với theme sáng/tối hiện có (namespace .cine-*)
   ============================================ */

:root {
  --cine-bg: #05060d;
  --cine-bg-alt: #090b16;
  --cine-blue: #3b82f6;
  --cine-blue-2: #60a5fa;
  --cine-purple: #7c3aed;
  --cine-cyan: #22d3ee;
  --cine-text: #e6ecff;
  --cine-text-muted: #8b93b8;
  --cine-glass: rgba(255, 255, 255, 0.05);
  --cine-glass-border: rgba(255, 255, 255, 0.09);
}

/* ---------- Custom cursor (chỉ desktop, pointer chính xác) ---------- */
.cine-cursor { position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none; z-index: 9999; }
.cine-cursor-dot, .cine-cursor-ring {
  position: fixed; top: 0; left: 0; border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none;
}
.cine-cursor-dot { width: 6px; height: 6px; background: var(--cine-cyan); box-shadow: 0 0 10px var(--cine-cyan); z-index: 9999; }
.cine-cursor-ring {
  width: 34px; height: 34px; border: 1px solid rgba(96, 165, 250, 0.6);
  transition: transform 0.15s ease-out, opacity 0.2s, border-color 0.2s;
  z-index: 9998;
}
.cine-cursor-ring.is-active { transform: translate(-50%, -50%) scale(1.7); border-color: var(--cine-cyan); }
@media (hover: none), (pointer: coarse) {
  .cine-cursor { display: none; }
}
body.cine-cursor-on, body.cine-cursor-on a, body.cine-cursor-on button, body.cine-cursor-on input {
  cursor: none;
}

/* ---------- Shared cinematic section base ---------- */
[class^="cine-"] { box-sizing: border-box; }
.cine-hero, .cine-core-section, .cine-features, .cine-terminal-section, .cine-finale {
  position: relative;
  background: var(--cine-bg);
  color: var(--cine-text);
  overflow: hidden;
}
.cine-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; z-index: 0;
}
.cine-eyebrow {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--cine-cyan); margin-bottom: 12px;
}
.cine-title {
  font-size: clamp(28px, 4vw, 44px); font-weight: 800; line-height: 1.2;
  color: #fff; margin: 0 0 16px;
}
.cine-lead { color: var(--cine-text-muted); font-size: 17px; max-width: 620px; margin: 0 auto 8px; }

/* ---------- Reveal animation base states (GSAP toggles .is-in) ---------- */
[data-reveal] { opacity: 0; will-change: transform, filter, opacity; }
[data-reveal="fade-up"] { transform: translateY(30px); }
[data-reveal="blur"] { filter: blur(14px); transform: translateY(10px) scale(0.98); }
[data-reveal="scale"] { transform: scale(0.85); }
[data-reveal="chars"] { opacity: 1; transform: none; filter: none; }
[data-reveal].is-in {
  opacity: 1; transform: none; filter: blur(0);
  transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1), transform 0.9s cubic-bezier(0.16,1,0.3,1), filter 0.9s cubic-bezier(0.16,1,0.3,1);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; }
}

/* ---------- HERO ---------- */
.cine-hero {
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 100px 20px 60px;
}
.cine-hero::before {
  content: ''; position: absolute; inset: -20% -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 28% at 22% 30%, rgba(59,130,246,0.16), transparent 70%),
    radial-gradient(32% 24% at 78% 68%, rgba(124,58,237,0.14), transparent 70%),
    radial-gradient(26% 30% at 65% 20%, rgba(34,211,238,0.1), transparent 70%);
  animation: cine-aurora-drift 16s ease-in-out infinite alternate;
}
@keyframes cine-aurora-drift {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); }
  100% { transform: translate3d(2%, 2%, 0) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .cine-hero::before { animation: none; }
}
.cine-reduced-fx .cine-hero::before,
.cine-reduced-fx .cine-core-glow,
.cine-reduced-fx .cine-finale-glow { animation: none; }
.cine-vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(5,6,13,0.85) 100%);
}
.cine-hero-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.cine-logo-wrap {
  display: flex; align-items: flex-end; gap: 12px; margin-bottom: 22px;
  opacity: 0; transform: scale(0.6);
  position: relative;
}
.cine-logo-icon {
  width: clamp(34px, 5vw, 54px); height: clamp(34px, 5vw, 54px);
  object-fit: contain; flex-shrink: 0; margin-bottom: 4px;
  filter: drop-shadow(0 0 22px rgba(59,130,246,0.85)) drop-shadow(0 0 46px rgba(124,58,237,0.5));
  animation: cine-dino-idle 2.6s ease-in-out 1.3s infinite;
}
@keyframes cine-dino-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(-6deg); }
}
.cine-logo-wrap::after {
  content: ''; position: absolute; left: clamp(34px, 5vw, 54px); top: 50%; width: 60px; height: 60px;
  margin-left: -30px; border-radius: 50%; border: 2px solid var(--cine-cyan);
  transform: translateY(-50%) scale(0.3); opacity: 0; pointer-events: none;
  animation: cine-logo-burst 0.9s ease-out 1s 1;
}
@keyframes cine-logo-burst {
  0% { opacity: 0.85; transform: translateY(-50%) scale(0.3); }
  100% { opacity: 0; transform: translateY(-50%) scale(2.4); }
}
@keyframes cine-logo-pop {
  0% { opacity: 0; transform: scale(0.4) rotate(-10deg); }
  60% { opacity: 1; transform: scale(1.12) rotate(3deg); }
  80% { transform: scale(0.96) rotate(-1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
.cine-logo-wrap.cine-pop { animation: cine-logo-pop 0.9s cubic-bezier(0.34,1.56,0.64,1) forwards; }
.cine-logo-text {
  font-size: clamp(38px, 7vw, 64px); font-weight: 900; letter-spacing: 1px; color: #fff;
  line-height: 1;
  text-shadow: 0 0 28px rgba(59,130,246,0.6);
}
.cine-logo-text span { color: var(--cine-cyan); }
@media (prefers-reduced-motion: reduce) {
  .cine-logo-icon { animation: none; }
  .cine-logo-wrap::after { display: none; }
}
.cine-tagline { font-size: clamp(15px, 2vw, 19px); color: var(--cine-text-muted); max-width: 560px; margin: 0 0 28px; }
.cine-cta-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

.btn-cine {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 30px; border-radius: 999px; font-weight: 700; font-size: 15px;
  text-decoration: none; transition: transform 0.25s ease, box-shadow 0.25s ease; isolation: isolate;
}
.btn-cine-primary {
  background: linear-gradient(135deg, var(--cine-blue), var(--cine-purple)); color: #fff;
  box-shadow: 0 8px 30px rgba(59,130,246,0.45);
}
.btn-cine-primary:hover { box-shadow: 0 10px 40px rgba(124,58,237,0.65); }
.btn-cine-ghost {
  color: #fff; border: 1px solid var(--cine-glass-border); background: var(--cine-glass);
  backdrop-filter: blur(8px);
}
.btn-cine-ghost:hover { border-color: var(--cine-cyan); }

.cine-scroll-cue {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 1px; color: var(--cine-text-muted);
}
.cine-scroll-cue span {
  width: 20px; height: 32px; border: 1px solid rgba(255,255,255,0.3); border-radius: 20px; position: relative;
}
.cine-scroll-cue span::after {
  content: ''; position: absolute; top: 6px; left: 50%; width: 4px; height: 8px; background: var(--cine-cyan);
  border-radius: 4px; transform: translateX(-50%); animation: cine-scroll-dot 1.6s ease-in-out infinite;
}
@keyframes cine-scroll-dot { 0%,100% { top: 6px; opacity: 1; } 60% { top: 16px; opacity: 0.3; } }

/* ---------- CORE (About) ---------- */
.cine-core-section { min-height: 90vh; display: flex; align-items: center; padding: 100px 20px; }
.cine-core-glow {
  position: absolute; top: 50%; left: 50%; width: 60vmax; height: 60vmax; z-index: 0;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(59,130,246,0.18) 0%, rgba(124,58,237,0.08) 40%, transparent 70%);
  animation: cine-core-pulse 5s ease-in-out infinite;
}
@keyframes cine-core-pulse {
  0%, 100% { opacity: 0.75; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .cine-core-glow { animation: none; }
}
.cine-core-content { position: relative; z-index: 2; max-width: 640px; margin: 0 auto; text-align: center; }

/* ---------- FEATURES (3D tilt cards) ---------- */
.cine-features { padding: 100px 20px; }
.cine-features .section-head { text-align: center; margin-bottom: 48px; }
.cine-grid-4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; perspective: 1000px;
}
@media (max-width: 900px) { .cine-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cine-grid-4 { grid-template-columns: 1fr; } }

.tilt-card { transform-style: preserve-3d; }
.tilt-card-inner {
  position: relative; background: var(--cine-glass); border: 1px solid var(--cine-glass-border);
  border-radius: 18px; padding: 30px 22px; height: 100%; backdrop-filter: blur(10px);
  transform-style: preserve-3d; transition: border-color 0.3s ease, background 0.3s ease;
  will-change: transform;
}
.tilt-card:hover .tilt-card-inner { border-color: rgba(96,165,250,0.5); background: rgba(255,255,255,0.07); }
.tilt-glow {
  position: absolute; inset: -1px; border-radius: 18px; opacity: 0; pointer-events: none;
  background: radial-gradient(220px circle at var(--mx,50%) var(--my,50%), rgba(59,130,246,0.35), transparent 60%);
  transition: opacity 0.3s ease; z-index: 0;
}
.tilt-card:hover .tilt-glow { opacity: 1; }
.tilt-card-inner > * { position: relative; z-index: 1; transform: translateZ(20px); }
.cine-features .icon-wrap {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(124,58,237,0.2)); color: var(--cine-cyan);
  margin-bottom: 18px;
}
.cine-features .icon-wrap svg { width: 24px; height: 24px; }
.cine-features h5 { color: #fff; font-size: 17px; margin: 0 0 8px; }
.cine-features p { color: var(--cine-text-muted); font-size: 14px; line-height: 1.6; margin: 0; }

/* ---------- TERMINAL / COMMANDS ---------- */
.cine-terminal-section { padding: 100px 20px; background: var(--cine-bg-alt); }
.cine-terminal-section .section-head { text-align: center; margin-bottom: 44px; }
.cine-terminal-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: stretch; }
@media (max-width: 860px) { .cine-terminal-grid { grid-template-columns: 1fr; } }

.cine-terminal {
  background: #0a0e1a; border: 1px solid var(--cine-glass-border); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}
.cine-terminal-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: #0d1220;
  color: var(--cine-text-muted); font-size: 12px; border-bottom: 1px solid var(--cine-glass-border);
}
.cine-terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; }
.cine-terminal-bar span:nth-child(2) { background: #f59e0b; }
.cine-terminal-bar span:nth-child(3) { background: #22c55e; }
.cine-terminal-body {
  flex: 1; padding: 16px; min-height: 220px; max-height: 320px; overflow-y: auto;
  font-size: 13px; line-height: 1.8; color: #9be9a8;
}
.cine-term-line { white-space: pre-wrap; word-break: break-word; }
.cine-term-line.cmd { color: var(--cine-cyan); }
.cine-term-line.muted { color: var(--cine-text-muted); }
.cine-terminal-input-row {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--cine-glass-border);
}
.cine-term-prompt { color: var(--cine-cyan); font-family: inherit; }
.cine-term-input {
  flex: 1; background: transparent; border: none; outline: none; color: #fff;
  font-family: inherit; font-size: 13px;
}
.cine-dashboard {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.cine-stat {
  background: var(--cine-glass); border: 1px solid var(--cine-glass-border); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 6px; justify-content: center;
}
.cine-stat-num { font-size: 24px; font-weight: 800; color: #fff; }
.cine-stat-label { font-size: 12px; color: var(--cine-text-muted); }

/* ---------- FINALE (System Core) ---------- */
.cine-finale {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 100px 20px;
}
.cine-finale-glow {
  position: absolute; top: 50%; left: 50%; width: 80vmax; height: 80vmax; z-index: 0;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(34,211,238,0.16) 0%, rgba(59,130,246,0.08) 45%, transparent 72%);
  animation: cine-core-pulse 4.5s ease-in-out infinite;
}
.cine-finale-content { position: relative; z-index: 2; }
.cine-glitch {
  font-size: clamp(24px, 5vw, 46px); font-weight: 900; color: #fff; letter-spacing: 2px;
  position: relative; margin: 0 0 16px;
}
.cine-glitch::before, .cine-glitch::after {
  content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%;
  clip-path: inset(0 0 0 0);
}
.cine-glitch::before { color: var(--cine-cyan); animation: cine-glitch-1 3.2s infinite linear; }
.cine-glitch::after { color: var(--cine-purple); animation: cine-glitch-2 3.6s infinite linear; }
@keyframes cine-glitch-1 {
  0%, 92%, 100% { clip-path: inset(0 0 0 0); transform: translate(0,0); opacity: 0; }
  93% { clip-path: inset(10% 0 60% 0); transform: translate(-3px,0); opacity: 0.8; }
  95% { clip-path: inset(60% 0 5% 0); transform: translate(3px,0); opacity: 0.8; }
  97% { clip-path: inset(30% 0 40% 0); transform: translate(-2px,0); opacity: 0.6; }
}
@keyframes cine-glitch-2 {
  0%, 90%, 100% { clip-path: inset(0 0 0 0); transform: translate(0,0); opacity: 0; }
  91% { clip-path: inset(70% 0 5% 0); transform: translate(3px,0); opacity: 0.7; }
  94% { clip-path: inset(15% 0 55% 0); transform: translate(-3px,0); opacity: 0.7; }
  98% { clip-path: inset(45% 0 25% 0); transform: translate(2px,0); opacity: 0.5; }
}
.cine-finale-sub { color: var(--cine-text-muted); margin: 0 0 28px; }

/* ---------- Magnetic buttons ---------- */
.magnetic { will-change: transform; }

/* ---------- Click energy ripple ---------- */
.cine-ripple {
  position: fixed; top: 0; left: 0; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid rgba(96,165,250,0.9); pointer-events: none; z-index: 9997;
  transform: translate(-50%, -50%) scale(0.3); opacity: 0.9;
  box-shadow: 0 0 18px rgba(59,130,246,0.6), inset 0 0 12px rgba(34,211,238,0.5);
}

/* ---------- Tilt card -> expanded panel (morph) ---------- */
.tilt-card { cursor: pointer; }
.cine-panel-overlay {
  position: fixed; inset: 0; z-index: 9500; display: flex; visibility: hidden; opacity: 0;
  background: rgba(5,6,13,0.72); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 24px;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.cine-panel-overlay.is-open { visibility: visible; opacity: 1; }
.cine-panel {
  position: relative; width: min(560px, 100%); max-height: 82vh; overflow-y: auto;
  background: linear-gradient(160deg, #0d1220, #090b16); border: 1px solid var(--cine-glass-border);
  border-radius: 22px; padding: 40px 34px; box-shadow: 0 30px 90px rgba(0,0,0,0.6), 0 0 60px rgba(59,130,246,0.15);
  transform-origin: center;
}
.cine-panel .icon-wrap { width: 60px; height: 60px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(124,58,237,0.25)); color: var(--cine-cyan); margin-bottom: 20px; }
.cine-panel .icon-wrap svg { width: 28px; height: 28px; }
.cine-panel h3 { color: #fff; font-size: 24px; margin: 0 0 12px; }
.cine-panel p { color: var(--cine-text-muted); font-size: 15px; line-height: 1.7; margin: 0 0 10px; }
.cine-panel-close {
  position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 1px solid var(--cine-glass-border); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.cine-panel-close:hover { background: rgba(255,255,255,0.14); transform: rotate(90deg); }

/* ---------- Scroll-linked depth parallax ---------- */
.cine-hero-content, .cine-core-content { will-change: transform, opacity; }

/* ---------- Scanline overlay (terminal) ---------- */
.cine-terminal { position: relative; }
.cine-terminal::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0px, rgba(255,255,255,0.025) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: overlay;
}
.cine-term-line.cine-term-in { animation: cine-term-appear 0.25s ease-out; }
@keyframes cine-term-appear {
  0% { opacity: 0; transform: translateX(-4px); filter: blur(2px); }
  100% { opacity: 1; transform: translateX(0); filter: blur(0); }
}

/* ---------- Global flash (finale convergence) ---------- */
.cine-global-flash {
  position: fixed; inset: 0; z-index: 9800; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(96,165,250,0.4) 45%, transparent 75%);
  opacity: 0;
}

/* ---------- Cursor light trail ---------- */
.cine-trail-dot {
  position: fixed; top: 0; left: 0; width: 4px; height: 4px; border-radius: 50%;
  background: var(--cine-cyan); pointer-events: none; z-index: 9996;
  box-shadow: 0 0 8px rgba(34,211,238,0.9);
  transform: translate(-50%, -50%);
}

/* ---------- Split-text chars ---------- */
.cine-char { display: inline-block; will-change: transform, opacity, filter; }

/* ---------- Chromatic aberration flicker (one-shot on reveal) ---------- */
.cine-chroma-hit { position: relative; }
.cine-chroma-hit::before, .cine-chroma-hit::after {
  content: attr(data-chroma-text); position: absolute; top: 0; left: 0; width: 100%;
  opacity: 0; pointer-events: none;
}
.cine-chroma-hit.cine-chroma-run::before {
  color: var(--cine-cyan); animation: cine-chroma-l 0.5s steps(2, end) 1;
}
.cine-chroma-hit.cine-chroma-run::after {
  color: #ff4d6d; animation: cine-chroma-r 0.5s steps(2, end) 1;
}
@keyframes cine-chroma-l {
  0% { opacity: 0.8; transform: translate(-3px, 0); }
  50% { opacity: 0.5; transform: translate(-1px, 0); }
  100% { opacity: 0; transform: translate(0, 0); }
}
@keyframes cine-chroma-r {
  0% { opacity: 0.8; transform: translate(3px, 0); }
  50% { opacity: 0.5; transform: translate(1px, 0); }
  100% { opacity: 0; transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .cine-ripple { display: none; }
}

@media (max-width: 640px) {
  .cine-hero, .cine-core-section, .cine-finale { min-height: 100vh; }
}
