/* ============================================
   Bastion — Custom Styles & Animations
   ============================================ */

/* ---------- Base ---------- */
:root {
  --bg-primary: #0c0a12;
  --bg-secondary: #16121e;
  --bg-tertiary: #1e1a2a;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --cyan-400: #22d3ee;
  --text-primary: #f1f0f5;
  --text-secondary: #a09cb2;
  --text-muted: #6b6681;
  --glass-bg: rgba(22, 18, 30, 0.8);
  --glass-border: rgba(139, 92, 246, 0.15);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

::selection {
  background: rgba(139, 92, 246, 0.4);
  color: #fff;
}

/* ---------- Glass morphism ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--glass-border);
}

.glass-card {
  background: rgba(30, 26, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.1);
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.1);
}

/* ---------- Navigation ---------- */
.nav-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.nav-scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-link {
  position: relative;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--violet-500), var(--cyan-400));
  transition: width 0.3s ease;
  border-radius: 1px;
}

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

/* ---------- Hero ---------- */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(139, 92, 246, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 30% 60%, rgba(34, 211, 238, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 70% 30%, rgba(124, 58, 237, 0.1) 0%, transparent 60%);
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, var(--bg-primary) 100%);
}

/* Animated grid background */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 30%, transparent 70%);
}

/* Floating orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: rgba(139, 92, 246, 0.3);
  top: 10%;
  left: 20%;
  animation-delay: 0s;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: rgba(34, 211, 238, 0.2);
  top: 50%;
  right: 15%;
  animation-delay: -7s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: rgba(124, 58, 237, 0.25);
  bottom: 20%;
  left: 40%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -20px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 10px) scale(1.02); }
}

/* Shield glow */
.shield-glow {
  position: relative;
  display: inline-block;
}

.shield-glow::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  animation: pulse-glow 4s ease-in-out infinite;
  z-index: -1;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--violet-600), var(--violet-500));
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--violet-500), #9333ea);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.35);
}

.btn-primary span {
  position: relative;
  z-index: 1;
}

.btn-outline {
  color: var(--text-primary);
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: transparent;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.btn-outline:hover {
  border-color: var(--violet-500);
  background: rgba(139, 92, 246, 0.1);
  transform: translateY(-1px);
}

/* ---------- Feature Cards ---------- */
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(139, 92, 246, 0.15);
  flex-shrink: 0;
}

.feature-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--violet-400);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Screenshot Gallery ---------- */
.screenshot-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.screenshot-container img {
  width: 100%;
  display: block;
}

/* Browser frame */
.browser-frame {
  background: var(--bg-tertiary);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.15);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.browser-frame-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(12, 10, 18, 0.8);
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.browser-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

.browser-dot:nth-child(1) { background: #ff5f57; }
.browser-dot:nth-child(2) { background: #febc2e; }
.browser-dot:nth-child(3) { background: #28c840; }

.browser-url {
  flex: 1;
  margin-left: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: 'Inter', monospace;
}

/* Phone frame */
.phone-frame {
  background: var(--bg-tertiary);
  border-radius: 32px;
  padding: 12px;
  border: 2px solid rgba(139, 92, 246, 0.2);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
  max-width: 300px;
  margin: 0 auto;
}

.phone-frame-inner {
  border-radius: 22px;
  overflow: hidden;
  position: relative;
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 0 0 16px 16px;
  z-index: 2;
}

/* ---------- Code Block ---------- */
.code-block {
  background: rgba(12, 10, 18, 0.9);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 12px;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(30, 26, 42, 0.5);
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-copy {
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.code-copy:hover {
  color: var(--violet-400);
  background: rgba(139, 92, 246, 0.1);
}

.code-content {
  padding: 20px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.code-content .keyword { color: #c792ea; }
.code-content .string { color: #c3e88d; }
.code-content .comment { color: #546e7a; }
.code-content .property { color: #82aaff; }

/* ---------- Downloads ---------- */
.download-card {
  text-align: center;
  padding: 2rem;
  transition: all 0.3s ease;
}

.download-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.download-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--violet-400);
  fill: none;
  stroke-width: 1.5;
}

/* ---------- FAQ Accordion ---------- */
.faq-item {
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s ease;
  background: rgba(30, 26, 42, 0.3);
}

.faq-item:hover {
  border-color: rgba(139, 92, 246, 0.25);
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.faq-question:hover {
  color: var(--violet-400);
}

.faq-chevron {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  transition: transform 0.3s ease, stroke 0.3s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item.active .faq-chevron {
  transform: rotate(180deg);
  stroke: var(--violet-400);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
}

.faq-item.active .faq-answer {
  max-height: 500px;
}

.faq-answer-inner {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.95rem;
}

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

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

.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; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ---------- Section Divider ---------- */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.2), transparent);
  margin: 0 auto;
  max-width: 80%;
}

/* ---------- Gradient Text ---------- */
.gradient-text {
  background: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 50%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* ---------- Mobile Menu ---------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(12, 10, 18, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-menu.active {
  opacity: 1;
  pointer-events: all;
}

.mobile-menu a {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.mobile-menu a:hover {
  color: var(--violet-400);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 51;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
  border-radius: 1px;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

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

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

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}

/* ---------- Misc ---------- */
.text-balance {
  text-wrap: balance;
}

/* Platform badge */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: var(--violet-400);
}

/* Stat counter */
.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Screenshot placeholder for when images aren't available */
.screenshot-placeholder {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ---------- Docs-specific ---------- */
.docs-sidebar a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.docs-sidebar a:hover,
.docs-sidebar a.active {
  color: var(--violet-400);
  border-left-color: var(--violet-500);
  background: rgba(139, 92, 246, 0.05);
}

.docs-content h2 {
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(139, 92, 246, 0.1);
}

.docs-content h2:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Inline code */
.docs-content code:not(.code-content code) {
  background: rgba(139, 92, 246, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--violet-400);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Table styling for docs */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.docs-content th,
.docs-content td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.docs-content th {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs-content td {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
