:root {
  color-scheme: dark;

  /* Core surfaces - Richer darks */
  --color-surface-0: #050507;
  --color-surface-1: #0f111a;
  --color-surface-2: #161b2e;
  --color-surface-3: #1f253e;

  /* Text tokens */
  --color-text-primary: #f8f9fc;
  --color-text-muted: #949ab0;
  --color-text-soft: #c0c4d6;

  /* Accent tokens - Vibrant & Premium */
  --color-accent-primary: #8b5cf6; /* Violet */
  --color-accent-secondary: #10b981; /* Emerald */
  --color-accent-tertiary: #3b82f6; /* Blue */
  --color-accent-contrast: #ffffff;

  /* Decorative layers */
  --gradient-accent: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-tertiary));
  --gradient-surface: 
    radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05), transparent 25%);

  /* Shadow + borders */
  --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 30px -4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px -4px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --glass-border: 1px solid rgba(255, 255, 255, 0.05);

  /* Focus */
  --focus-ring-color: rgba(139, 92, 246, 0.5);
  --focus-ring-outline: 2px solid var(--color-accent-primary);

  /* Legacy aliases for existing pages */
  --surface: var(--color-surface-0);
  --surface-alt: var(--color-surface-1);
  --surface-card: var(--color-surface-2);
  --text-primary: var(--color-text-primary);
  --text-muted: var(--color-text-muted);
  --accent-start: var(--color-accent-primary);
  --accent-end: var(--color-accent-secondary);
  --accent-dark: #6d28d9;
  --bg: var(--color-surface-0);
  --background-color: var(--color-surface-0);
  --card: var(--color-surface-2);
  --muted: var(--color-text-muted);
  --text: var(--color-text-primary);
  --text-light: var(--color-text-muted);
  --accent: var(--color-accent-primary);
  --accent-2: var(--color-accent-secondary);
  --primary: var(--color-accent-primary);
  --primary-color: var(--color-accent-primary);
  --primary-color-dark: #10b981;
  --gradient-primary: var(--gradient-accent);

  /* Bootstrap variable bridge */
  --bs-body-bg: var(--color-surface-0);
  --bs-body-color: var(--color-text-primary);
  --bs-emphasis-color: var(--color-text-primary);
  --bs-link-color: var(--color-accent-primary);
  --bs-link-hover-color: var(--color-accent-tertiary);
  --bs-border-color: var(--border-subtle);
  --bs-card-bg: var(--color-surface-2);
  --bs-card-color: var(--color-text-primary);
  --bs-card-border-color: var(--border-subtle);
  --bs-accordion-bg: var(--color-surface-2);
  --bs-accordion-color: var(--color-text-primary);
  --bs-accordion-border-color: var(--border-subtle);
  --bs-accordion-btn-bg: var(--color-surface-1);
  --bs-accordion-btn-color: var(--color-text-primary);
  --bs-table-bg: var(--color-surface-1);
  --bs-table-color: var(--color-text-primary);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-list-group-bg: var(--color-surface-1);
  --bs-list-group-color: var(--color-text-primary);
  --bs-list-group-border-color: var(--border-subtle);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background-color: var(--color-surface-0);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background-color: var(--color-surface-0);
  background-image: var(--gradient-surface);
  background-attachment: fixed;
  background-size: cover;
  color: var(--color-text-primary);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  min-height: 100vh;
  background-color: var(--color-surface-0);
  padding-block-end: calc(2.5rem + env(safe-area-inset-bottom));
}

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

a {
  color: var(--bs-link-color);
  text-decoration: none;
  transition: color 160ms ease;
}

a:hover,
a:focus {
  color: var(--bs-link-hover-color);
}

a:focus-visible {
  outline: var(--focus-ring-outline);
  outline-offset: 2px;
}

.text-muted {
  color: var(--color-text-muted) !important;
}

.btn-primary {
  --bs-btn-color: var(--color-accent-contrast);
  --bs-btn-bg: var(--color-accent-primary);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--color-accent-tertiary);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 139, 92, 246;
  --bs-btn-active-bg: var(--color-accent-tertiary);
  --bs-btn-active-border-color: transparent;
  background-image: var(--gradient-accent);
  background-color: var(--color-accent-primary);
  border: none;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-soft);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-primary:hover,
.btn-primary:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

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

.btn-primary:focus-visible {
  outline: var(--focus-ring-outline);
  outline-offset: 2px;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-soft);
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 2rem;
  border-radius: 1rem;
  font-weight: 600;
  text-decoration: none;
  background-image: var(--gradient-accent);
  background-color: var(--color-accent-primary);
  color: var(--color-accent-contrast);
  box-shadow: var(--shadow-md);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.cta-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cta-button:hover,
.cta-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
  outline: none;
  color: var(--color-accent-contrast);
}

.cta-button:hover::before {
  opacity: 1;
}

.cta-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-soft);
}

.cta-button[disabled],
.cta-button[aria-disabled="true"] {
  opacity: 0.6;
  pointer-events: none;
  filter: grayscale(0.5);
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  background-image: var(--gradient-accent);
  background-color: var(--color-accent-primary);
  color: var(--color-accent-contrast);
  transform: translateY(-200%);
  transition: transform 160ms ease;
  z-index: 1050;
}

.skip-link:focus {
  transform: translateY(0);
}

.main-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 1030;
  background: rgba(5, 7, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.main-header .navbar {
  padding-block: 0.85rem;
  background: transparent;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.navbar-brand .logo-icon {
  display: grid;
  place-items: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, rgba(167, 124, 255, 0.45), rgba(99, 245, 212, 0.3));
  box-shadow: inset 0 1px 8px rgba(255, 255, 255, 0.12);
  font-size: 1.25rem;
}

.navbar-brand .logo-text {
  font-size: 1rem;
  color: var(--color-text-primary);
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.74);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  position: relative;
  transition: color 160ms ease, background-color 160ms ease;
}

.navbar-dark .navbar-nav .nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(167, 124, 255, 0.2), rgba(99, 245, 212, 0.18));
  opacity: 0;
  transform: translateY(6px) scale(0.92);
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: -1;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-nav .nav-link.active {
  color: #fff;
}

.navbar-dark .navbar-nav .nav-link:hover::before,
.navbar-dark .navbar-nav .nav-link:focus::before,
.navbar-dark .navbar-nav .nav-link.active::before {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.navbar-divider {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.navbar-toggler {
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.4rem 0.65rem;
  border-radius: 0.85rem;
  background: rgba(10, 13, 22, 0.75);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(99, 245, 212, 0.25);
}

/* Mobile navbar styling */
.navbar-collapse:not(.show) {
  display: none;
}

.navbar-collapse.collapsing {
  display: block;
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(8, 10, 18, 0.96);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 1rem 2rem rgba(4, 6, 12, 0.6);
    margin-top: 1rem;
    border-radius: 1.25rem;
    padding: 1.5rem;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }

  .navbar-collapse-inner {
    padding: 1.5rem 1rem;
  }

  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
  }

  .navbar-nav .nav-item {
    width: 100%;
  }

  .navbar {
    position: relative;
  }
}

.dropdown-menu {
  border-radius: 0.85rem;
  padding: 0.5rem;
  background: rgba(7, 9, 15, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.dropdown-item {
  border-radius: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(167, 124, 255, 0.2);
  color: #fff;
}

.main-footer {
  background: var(--color-surface-1);
  padding-block: clamp(3rem, 8vw, 4.5rem);
  border-top: 1px solid var(--border-subtle);
  margin-top: clamp(3rem, 6vw, 4.5rem);
  position: relative;
  overflow: hidden;
}

.main-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 1px;
  background: radial-gradient(circle, var(--color-accent-primary) 0%, transparent 70%);
  opacity: 0.5;
}

.footer-content {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin-block-end: 2.5rem;
}

.footer-section h4 {
  font-weight: 600;
  margin-bottom: 1rem;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.footer-logo .logo-icon {
  display: grid;
  place-items: center;
  inline-size: 2.25rem;
  block-size: 2.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgba(167, 124, 255, 0.38), rgba(99, 245, 212, 0.24));
}

.footer-description {
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 52ch;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.footer-links a {
  color: var(--color-text-primary);
}

.footer-links a:hover,
.footer-links a:focus {
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.disclaimer {
  font-size: 0.9rem;
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
