/* ============================================
   Krystal Dynamics - Modern Enhanced Design
   ============================================ */

/* CSS Variables for Theme */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --accent-primary: #4B9FFF;
  --accent-secondary: #2DC5F8;
  --accent-hover: #3a8fef;
  --border-color: #e0e0e0;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(75, 159, 255, 0.2);
  --gradient-1: linear-gradient(135deg, #4B9FFF 0%, #2DC5F8 100%);
  --gradient-2: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --border-color: #333333;
  --shadow: rgba(0, 0, 0, 0.5);
  --shadow-hover: rgba(45, 197, 248, 0.3);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Typography with Animation */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-secondary);
}

/* Scroll Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-on-scroll {
  opacity: 0;
  animation-fill-mode: both;
}

.animate-on-scroll.animated {
  animation-duration: 0.8s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container & Layout */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header with Modern Effects */
header {
  background-color: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(20px) saturate(180%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0);
}

header.scrolled {
  padding: 1rem 0;
  box-shadow: 0 2px 20px var(--shadow);
  background-color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] header {
  background-color: rgba(10, 10, 10, 0.8);
}

[data-theme="dark"] header.scrolled {
  background-color: rgba(10, 10, 10, 0.95);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

.logo::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-1);
  transition: width 0.3s ease;
}

.logo:hover::after {
  width: 100%;
}

.logo:hover {
  color: var(--accent-primary);
  transform: translateY(-2px);
}

/* Theme Toggle with Animation */
.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--accent-primary);
  opacity: 0.1;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.theme-toggle:hover::before {
  width: 200px;
  height: 200px;
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 5px 20px var(--shadow-hover);
}

.theme-toggle:active {
  transform: translateY(0) scale(0.98);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.theme-toggle:hover .sun-icon,
.theme-toggle:hover .moon-icon {
  transform: rotate(20deg) scale(1.1);
}

[data-theme="light"] .moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

/* Hero Section with Parallax */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 4rem 0;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
  opacity: 0.03;
  animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.03;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.05;
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 2rem;
  animation: fadeInUp 1s ease-out;
}

.hero h1 {
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 0;
  animation: fadeInUp 1s ease-out 0.4s both;
}

/* Enhanced Carousel */
.carousel-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.3;
  overflow: hidden;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1), transform 1.5s ease;
  transform: scale(1.1);
}

.carousel-slide.active {
  opacity: 1;
  transform: scale(1);
}

.carousel-dots {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.7rem;
  z-index: 3;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  border: none;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.carousel-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.carousel-dot:hover::before {
  border-color: rgba(255, 255, 255, 0.5);
}

.carousel-dot.active {
  background-color: var(--accent-primary);
  width: 24px;
  border-radius: 4px;
  box-shadow: 0 2px 10px var(--shadow-hover);
}

/* Plugins Section with Stagger Animation */
.plugins {
  padding: 0;
}

.plugin-list {
  display: flex;
  flex-direction: column;
}

.plugin-item {
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}

.plugin-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(75, 159, 255, 0.05), transparent);
  transition: left 0.8s ease;
}

.plugin-item:hover::before {
  left: 100%;
}

.plugin-item:nth-child(odd) {
  background: var(--bg-primary);
}

.plugin-item:nth-child(even) {
  background: var(--bg-secondary);
}

.plugin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6rem;
  align-items: center;
}

.plugin-grid-reverse .plugin-image {
  order: 2;
}

.plugin-grid-reverse .plugin-content {
  order: 1;
}

/* Enhanced Plugin Image */
.plugin-image {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px var(--shadow);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.plugin-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 1;
  mix-blend-mode: overlay;
}

.plugin-item:hover .plugin-image {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 60px var(--shadow-hover);
}

.plugin-item:hover .plugin-image::before {
  opacity: 0.1;
}

.plugin-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.plugin-item:hover .plugin-image img {
  transform: scale(1.05);
}

/* Plugin Content */
.plugin-content h3 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  margin-bottom: 1rem;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.plugin-content h3::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--gradient-1);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.plugin-item:hover .plugin-content h3::after {
  width: 100%;
}

.plugin-content p {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.plugin-specs {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.plugin-specs li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  background-color: var(--bg-secondary);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.plugin-specs li::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-1);
  opacity: 0.1;
  transition: left 0.3s ease;
}

.plugin-specs li:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px var(--shadow-hover);
}

.plugin-specs li:hover::before {
  left: 0;
}

[data-theme="dark"] .plugin-item:nth-child(even) .plugin-specs li {
  background-color: var(--bg-primary);
}

/* Enhanced Buttons */
.btn {
  display: inline-block;
  padding: 0.9rem 2.5rem;
  border-radius: 50px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  font-size: 1rem;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  transition: width 0.4s ease;
  z-index: -1;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 4px 15px var(--shadow-hover);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--shadow-hover);
  color: white;
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
}

.btn-secondary::before {
  background: var(--accent-primary);
}

.btn-secondary:hover {
  color: white;
  border-color: var(--accent-primary);
}

.btn-secondary:hover::before {
  width: 100%;
}

/* Footer */
footer {
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 2px;
  background: var(--gradient-1);
}

footer p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
  animation: fadeInUp 0.8s ease-out;
}

/* Plugin Detail Page */
.plugin-detail {
  padding: 4rem 0;
}

.plugin-detail .container {
  max-width: 1200px;
}

.plugin-detail h2 {
  text-align: center;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease-out;
}

.plugin-detail-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  margin: 0 auto 3rem;
  display: block;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px var(--shadow);
  transition: all 0.4s ease;
  animation: scaleIn 0.8s ease-out 0.2s both;
}

.plugin-detail-image:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 80px var(--shadow-hover);
}

.plugin-detail-content {
  max-width: 100%;
  margin: 0 auto;
}

.plugin-detail-content h3 {
  color: var(--accent-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  position: relative;
  padding-left: 1.5rem;
}

.plugin-detail-content h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: var(--gradient-1);
  border-radius: 2px;
}

.plugin-detail-content ul {
  margin: 1rem 0;
  padding-left: 2rem;
}

.plugin-detail-content ul li {
  margin-bottom: 0.8rem;
  color: var(--text-secondary);
  position: relative;
  padding-left: 1.5rem;
  transition: all 0.3s ease;
}

.plugin-detail-content ul li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-weight: bold;
  transition: transform 0.3s ease;
}

.plugin-detail-content ul li:hover {
  color: var(--text-primary);
  transform: translateX(5px);
}

.plugin-detail-content ul li:hover::before {
  transform: translateX(3px);
}

.plugin-detail-content p {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Specs List */
.specs {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem 2rem;
  margin: 1.5rem 0;
  padding: 2rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.specs:hover {
  box-shadow: 0 10px 30px var(--shadow);
  transform: translateY(-2px);
}

.specs dt {
  font-weight: 600;
  color: var(--text-primary);
}

.specs dd {
  color: var(--text-secondary);
}

/* Download Section */
.download-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 2rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.download-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-1);
}

.download-section:hover {
  box-shadow: 0 10px 30px var(--shadow);
  transform: translateY(-2px);
}

.download-section p {
  margin-bottom: 1rem;
}

.download-section p:first-child {
  margin-top: 0;
}

.download-section a {
  display: inline-block;
  padding: 0.9rem 2.5rem;
  background: var(--gradient-1);
  color: white;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 0.5rem;
  box-shadow: 0 4px 15px var(--shadow-hover);
}

.download-section a:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--shadow-hover);
  color: white;
}

/* Back Link */
.back-link {
  margin-top: 3rem;
  text-align: center;
}

.back-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--accent-primary);
  font-weight: 500;
  padding: 0.9rem 2rem;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.back-link a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--accent-primary);
  transition: left 0.3s ease;
  z-index: -1;
}

.back-link a:hover {
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-3px);
  box-shadow: 0 5px 20px var(--shadow-hover);
}

.back-link a:hover::before {
  left: 0;
}

/* Loading Animation */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading {
  background: linear-gradient(90deg, var(--bg-secondary) 0%, var(--bg-primary) 50%, var(--bg-secondary) 100%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Responsive Design */
@media (max-width: 968px) {
  .plugin-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .plugin-grid-reverse .plugin-image {
    order: 1;
  }

  .plugin-grid-reverse .plugin-content {
    order: 2;
  }

  .specs {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .hero {
    min-height: 50vh;
    padding: 3rem 0;
  }

  .hero-content {
    padding: 1rem;
  }

  .plugins {
    padding: 0;
  }

  .plugin-item {
    padding: 3rem 0;
  }

  .plugin-grid {
    gap: 2rem;
  }

  .carousel-dots {
    bottom: 1rem;
  }

  .btn {
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.hidden {
  display: none;
}

/* Smooth Transitions for Theme Switch */
* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}
