/* =================
   styles.css
   Kết hợp: effects từ v3 + một số style từ blog
   Source: v3.html (effects) + blog.html (layout). See file citations in README.
   ================= */

/* ---------- Reset / base ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html.dark {
    color-scheme: dark;
}

body.dark-mode {
    background: #0d0d0f !important;
    color: #e5e7eb !important;
}

/* Navbar */
.dark nav {
    background-color: rgba(0,0,0,0.6) !important;
}

.dark .text-gray-800 {
    color: #e5e7eb !important;
}

.dark .text-gray-600 {
    color: #cbd5e1 !important;
}

.dark .bg-white {
    background-color: #1f1f24 !important;
}

.dark .bg-gray-50 {
    background-color: #121216 !important;
}

.dark .card-hover {
    background-color: #1e1e23 !important;
    color: #e5e7eb !important;
}

.name-modern {
    font-family: 'Great Vibes', cursive;
    font-size: 48px;
    color: #000;

    text-shadow: 0 1px 2px rgba(0,0,0,0.05);

    transition: transform 0.25s ease;
}
.name-modern:hover {
    transform: scale(1.02);
}



/* ===== Pull Switch Theme Toggle ===== */

.pull-switch {
    position: fixed;
    top: 20px;
    right: 30px;
    width: 40px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 9999;
}

.pull-knob {
    width: 32px;
    height: 32px;
    background: #f0f0f0;
    border-radius: 50%;
    margin-top: 4px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s, transform 0.2s;
}

/* khi kéo */
.pull-knob.pull-down {
    transform: translateY(20px);
}

/* dark mode */
.dark .pull-string {
    background: #ddd;
}

.dark .pull-knob {
    background: #444;
    color: #fff;
}

/* rung nhẹ khi bật */
.pull-knob.shake {
    animation: shake 0.3s ease;
}

@keyframes shake {
    0% { transform: translateY(20px) rotate(0deg); }
    25% { transform: translateY(20px) rotate(5deg); }
    50% { transform: translateY(20px) rotate(-5deg); }
    75% { transform: translateY(20px) rotate(3deg); }
    100% { transform: translateY(20px) rotate(0deg); }
}


/* ---------- Global canvases / overlays ---------- */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg...%3E");
  /* from v3 noise */
  opacity: 0.03;
  pointer-events: none;
  z-index: 9998;
  animation: noiseMove 0.2s steps(10) infinite;
}

@keyframes noiseMove {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(5%, 0);
  }
}

.particles-canvas,
.pixel-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}

/* Cinematic Preloader */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0f;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2rem;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-circle {
  width: 80px;
  height: 80px;
  border: 3px solid rgba(147, 51, 234, 0.2);
  border-top-color: #9333ea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

.loader-progress {
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.loader-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #9333ea, #3b82f6);
  width: 0%;
  transition: width 0.3s ease;
}


/* ---------- HERO PARALLAX layers (v3) ---------- */
.hero-parallax {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at center, #0d0d17 0%, #05050a 100%);
  color: #fff;
}

.parallax-container {
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
}

.parallax-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  will-change: transform;
  transition: transform 100ms ease-out;
}

.parallax-layer-1 {
  background: radial-gradient(circle at 30% 40%, rgba(255, 0, 128, 0.15), transparent 60%);
  filter: blur(40px);
}

.parallax-layer-2 {
  background: radial-gradient(circle at 70% 60%, rgba(0, 191, 255, 0.15), transparent 50%);
  filter: blur(30px);
}

.parallax-layer-3 {
  background: radial-gradient(circle at 50% 50%, rgba(138, 43, 226, 0.2), transparent 70%);
  filter: blur(20px);
}

.parallax-layer-4 {
  background: radial-gradient(circle at 40% 70%, rgba(255, 215, 0, 0.1), transparent 60%);
  filter: blur(25px);
}

.parallax-layer-5 {
  background: radial-gradient(circle at 60% 30%, rgba(0, 255, 127, 0.12), transparent 50%);
  filter: blur(35px);
}

/* ---------- Glitch text (v3) ---------- */
.glitch-text {
  font-size: 3.25rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  position: relative;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  animation: glitchAnim 3s infinite;
}

@keyframes glitchAnim {

  0%,
  92%,
  100% {
    transform: none;
  }

  93% {
    transform: translate(-3px, 3px);
  }

  94% {
    transform: translate(3px, -3px);
  }
}

/* pseudo layers for glitch */
.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch-text::before {
  text-shadow: 2px 0 #ff00ff;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  animation: glitchBefore 3s infinite;
}

.glitch-text::after {
  text-shadow: -2px 0 #00ffff;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  animation: glitchAfter 3s infinite;
}

/* ---------- Hero subtitle sweep ---------- */
.hero-subtitle {
  font-size: 1.125rem;
  font-weight: 300;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  margin-top: 1rem;
  opacity: .85;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.9) 50%, transparent 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: lightBeam 4s linear infinite;
}

@keyframes lightBeam {
  0% {
    background-position: -200% 0
  }

  100% {
    background-position: 200% 0
  }
}

/* ---------- Liquid grid & cards (v3) ---------- */
.liquid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  max-width: 1400px;
  padding: 2rem;
  margin: 0 auto;
}

.liquid-item {
  aspect-ratio: 4/3;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}

.liquid-item:hover {
  transform: scale(1.03);
}

.liquid-canvas {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform .6s cubic-bezier(.34, 1.56, .64, 1);
}

.liquid-item:hover .liquid-canvas {
  transform: scale(1.12);
}

/* ---------- Magnetic buttons ---------- */
.magnetic-btn {
  padding: 1rem 2rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: transform .15s ease-out;
  box-shadow: 0 10px 40px rgba(102, 126, 234, .3);
}

/* ---------- Particles & cursor trail ---------- */
.fluid-cursor {
  position: fixed;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(102, 126, 234, 0.9);
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  transition: transform 150ms cubic-bezier(.34, 1.56, .64, 1);
  opacity: 0.8;
}

.fluid-trail {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.4), transparent);
  filter: blur(8px);
}

/* ---------- Smooth reveal sections ---------- */
.smooth-section {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 1000ms cubic-bezier(.77, 0, .175, 1), transform 1000ms cubic-bezier(.77, 0, .175, 1);
}

.smooth-section.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Small helpers from blog ---------- */
.card-hover {
  transition: transform .3s ease, box-shadow .3s ease;
}

.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 25px rgba(0, 0, 0, .08);
}

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp .6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Responsive tweaks ---------- */
@media (max-width:1024px) {
  .glitch-text {
    font-size: 2.6rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }
}

@media (max-width:768px) {
  .glitch-text {
    font-size: 1.8rem;
  }

  .parallax-container {
    display: none;
  }
}

.mouse-dot {
  position: fixed;
  width: 6px;
  height: 6px;
  background: rgba(140, 150, 255, 0.8);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  animation: dotFade 0.6s ease-out forwards;
}

@keyframes dotFade {
  0% {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%);
  }

  100% {
    opacity: 0;
    transform: scale(0.2) translate(-50%, -50%);
  }
}