/* ==========================================================================
   Kywal Puzzle - Modern Responsive Landing Page Stylesheet
   Design System: Pastel Glassmorphism, Responsive Grid, Smooth Animations
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
  /* Color Palette - Light Mode (Soft Pastel & Relaxing Theme) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  
  --text-primary: #1e1b4b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent-purple: #8b5cf6;
  --accent-purple-light: #ddd6fe;
  --accent-pink: #ec4899;
  --accent-blue: #3b82f6;
  --accent-teal: #14b8a6;
  --accent-amber: #f59e0b;
  
  --gradient-hero: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 50%, #fce7f3 100%);
  --gradient-btn: linear-gradient(135deg, #7c3aed 0%, #c084fc 100%);
  --gradient-btn-hover: linear-gradient(135deg, #6d28d9 0%, #a855f7 100%);
  --gradient-accent: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  
  --border-color: rgba(226, 232, 240, 0.8);
  --border-focus: #8b5cf6;
  
  --shadow-sm: 0 2px 8px rgba(139, 92, 246, 0.06);
  --shadow-md: 0 10px 25px -5px rgba(139, 92, 246, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 35px -10px rgba(124, 58, 237, 0.15);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.3);
  
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --radius-full: 9999px;

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-height: 80px;
}

/* --- Dark Theme Palette Overrides --- */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.85);
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #2e1065 50%, #3b0764 100%);
  --border-color: rgba(51, 65, 85, 0.8);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.5);
}

/* --- CSS Reset & Global Layout --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Reusable Component Styles & Container --- */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-padding {
  padding: 6rem 0;
}

.text-gradient {
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--accent-purple);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 4rem auto;
}

.section-header h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 1rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.9rem 2rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--gradient-btn);
  color: #ffffff;
  box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  background: var(--gradient-btn-hover);
  transform: translateY(-3px);
  box-shadow: 0 15px 25px -5px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* --- Header & Sticky Navigation --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  z-index: 1000;
  transition: all var(--transition-normal);
}

.navbar.scrolled {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.nav-brand img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-link {
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-purple);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient-btn);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

.nav-link.active::after,
.nav-link:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  transform: rotate(15deg);
  border-color: var(--accent-purple);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 6px;
}

.hamburger span {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 3px;
  transition: all var(--transition-fast);
}

/* Hamburger Open Animation */
.hamburger.is-active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.hamburger.is-active span:nth-child(2) {
  opacity: 0;
}
.hamburger.is-active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* --- Hero Section --- */
.hero {
  position: relative;
  padding-top: calc(var(--nav-height) + 4rem);
  padding-bottom: 6rem;
  background: var(--gradient-hero);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: rgba(139, 92, 246, 0.15);
  filter: blur(100px);
  border-radius: 50%;
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 4rem;
  align-items: center;
}

.hero-content h1 {
  font-size: clamp(2.75rem, 5vw, 4.25rem);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--accent-purple);
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2.25rem;
  max-width: 540px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.hero-mockup-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}

.phone-frame {
  position: relative;
  width: 290px;
  height: 590px;
  background: #0f172a;
  border-radius: 48px;
  padding: 12px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border: 4px solid rgba(255, 255, 255, 0.2);
  transition: transform var(--transition-bounce);
}

.phone-frame:hover {
  transform: translateY(-8px) rotate(1deg);
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 36px;
  overflow: hidden;
  background: #000;
}

.phone-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Floating Decorative Elements */
.floating-card {
  position: absolute;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: float 4s ease-in-out infinite alternate;
}

.floating-card.card-top {
  top: 10%;
  left: -20px;
}

.floating-card.card-bottom {
  bottom: 12%;
  right: -20px;
  animation-delay: 2s;
}

.floating-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
}

@keyframes float {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-15px); }
}

/* --- Features Section --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.75rem;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-btn);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon-box {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  transition: transform var(--transition-bounce);
}

.feature-card:hover .feature-icon-box {
  transform: scale(1.1) rotate(5deg);
  background: var(--gradient-btn);
  color: #ffffff;
}

.feature-card h3 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.975rem;
}

/* --- Why Choose Section --- */
.why-choose {
  background: var(--bg-secondary);
  position: relative;
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
}

.why-item {
  display: flex;
  gap: 1.5rem;
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: transform var(--transition-fast);
}

.why-item:hover {
  transform: translateX(6px);
}

.why-number {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-purple-light);
  line-height: 1;
}

.why-content h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.why-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* --- Screenshots Section --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  aspect-ratio: 9 / 16;
  background: var(--bg-secondary);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124, 58, 237, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.gallery-overlay svg {
  width: 48px;
  height: 48px;
  color: #fff;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  max-width: 450px;
  max-height: 85vh;
  position: relative;
}

.lightbox-content img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.lightbox-close {
  position: absolute;
  top: -45px;
  right: 0;
  background: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- FAQ Section --- */
.faq-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item.active {
  border-color: var(--accent-purple);
}

.faq-question {
  width: 100%;
  padding: 1.5rem 1.75rem;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
  background: var(--gradient-btn);
  color: #fff;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal) ease-in-out;
}

.faq-answer-content {
  padding: 0 1.75rem 1.5rem 1.75rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

/* --- Footer --- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 5rem 0 2rem 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 4rem;
}

.footer-brand p {
  margin-top: 1rem;
  color: var(--text-muted);
  max-width: 320px;
}

.footer-column h4 {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.footer-links a:hover {
  color: var(--accent-purple);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-btn);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-4px);
}

/* --- Scroll Reveal Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-description {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-buttons {
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: var(--nav-height);
    right: -100%;
    width: 100%;
    height: calc(100vh - var(--nav-height));
    background: var(--bg-secondary);
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    transition: right var(--transition-normal);
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.is-active {
    right: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}
