/* ==========================================================================
   Kordixa Digital Solutions - Custom Stylesheet & Design System
   ========================================================================== */

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #0284c7;
}

/* Dark Mode Scrollbar */
html.dark ::-webkit-scrollbar-track {
  background: #070b14;
}

html.dark ::-webkit-scrollbar-thumb {
  background: #1e293b;
}

html.dark ::-webkit-scrollbar-thumb:hover {
  background: #0284c7;
}

/* --- Smooth Scroll Offset for Sticky Header --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

/* --- Theme Transition Helper --- */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *:before,
html.theme-transitioning *:after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, fill 0.3s ease, stroke 0.3s ease, box-shadow 0.3s ease !important;
  transition-delay: 0s !important;
}

/* --- Tech Grid Pattern Background --- */
.tech-grid-bg {
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, rgba(2, 132, 199, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(2, 132, 199, 0.05) 1px, transparent 1px);
}

html.dark .tech-grid-bg {
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
}

/* --- Modern Glassmorphism Cards --- */
.glass-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #e2e8f0;
}

html.dark .glass-card {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(51, 65, 85, 0.6);
}

/* Interactive Card Elevation & Micro-Interaction */
.interactive-card {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.interactive-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px -10px rgba(2, 132, 199, 0.15);
}

html.dark .interactive-card:hover {
  box-shadow: 0 20px 35px -10px rgba(56, 189, 248, 0.2), 0 0 15px rgba(56, 189, 248, 0.08);
}

/* --- Circuit SVG Glow Effect --- */
.circuit-glow {
  filter: drop-shadow(0 2px 6px rgba(2, 132, 199, 0.35));
}

html.dark .circuit-glow {
  filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.65));
}

/* --- Sticky Header Active Blur State --- */
.header-scrolled {
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08) !important;
}

html.dark .header-scrolled {
  background: rgba(7, 11, 20, 0.94) !important;
  border-color: rgba(30, 41, 59, 0.9) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5) !important;
}

/* --- Theme Toggle Button Micro-Animation --- */
.theme-toggle-btn {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle-btn:hover {
  transform: scale(1.08);
}

.theme-toggle-icon {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle-btn:hover .theme-toggle-icon {
  transform: rotate(20deg);
}

/* --- Floating Keyframe Animation for Background Accents --- */
@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-15px) scale(1.03);
  }
}

.animate-float {
  animation: floatSlow 8s ease-in-out infinite;
}

/* --- Creative Scroll Reveal Animations --- */
.reveal-init {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-visible {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

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

/* Terminal Cursor Blink */
.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: #38bdf8;
  margin-right: 4px;
  animation: cursorBlink 1s infinite;
  vertical-align: middle;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Interactive Toast Notification --- */
#toast-notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 1rem 1.75rem;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid #38bdf8;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

#toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   XO with AI Mini-Game Styling & Animations
   ========================================================================== */
.xo-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  user-select: none;
}

@media (min-width: 640px) {
  .xo-board {
    max-width: 350px;
    gap: 1rem;
  }
}

.xo-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.75);
  border: 2px solid rgba(51, 65, 85, 0.7);
  border-radius: 1.25rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  font-family: 'Outfit', sans-serif, system-ui;
  font-weight: 900;
  font-size: 2.25rem;
  touch-action: manipulation;
}

@media (min-width: 640px) {
  .xo-cell {
    font-size: 2.75rem;
  }
}

.xo-cell:not(.disabled):hover {
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 0.9);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 20px -4px rgba(56, 189, 248, 0.35);
}

.xo-cell:active:not(.disabled) {
  transform: scale(0.96);
}

.xo-cell.disabled {
  cursor: default;
}

.xo-cell.winner {
  animation: winCellGlow 1.2s ease-in-out infinite alternate;
  border-color: #38bdf8 !important;
  background: rgba(14, 165, 233, 0.15) !important;
}

@keyframes winCellGlow {
  0% {
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3), inset 0 0 10px rgba(56, 189, 248, 0.2);
    transform: scale(1);
  }

  100% {
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.7), inset 0 0 15px rgba(56, 189, 248, 0.4);
    transform: scale(1.04);
  }
}

/* Marker Typography & Glow */
.mark-x {
  color: #38bdf8;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.65), 0 0 30px rgba(2, 132, 199, 0.4);
  animation: markPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mark-o {
  color: #34d399;
  text-shadow: 0 0 16px rgba(52, 211, 153, 0.65), 0 0 30px rgba(5, 150, 105, 0.4);
  animation: markPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes markPop {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-15deg);
  }

  70% {
    transform: scale(1.15) rotate(3deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* AI Thinking Pulse */
.ai-thinking-pulse {
  animation: aiThink 1s infinite alternate ease-in-out;
}

@keyframes aiThink {
  0% {
    opacity: 0.6;
    transform: scale(0.98);
  }

  100% {
    opacity: 1;
    transform: scale(1.02);
  }
}