body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

html {
  transition: background-color 0.3s ease;
  scroll-behavior: smooth;
}

/* Dark mode specific fixes */
[data-bs-theme="dark"] {
  --bs-body-bg: #1a1a1a;
  --bs-body-color: #f5f5f7;
  --bs-border-color: #38383a;
}

[data-bs-theme="dark"] .navbar {
  background-color: rgba(26, 26, 26, 0.8) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-bs-theme="dark"] footer {
  background-color: #1a1a1a;
  border-color: #38383a !important;
}

[data-bs-theme="dark"] .btn-theme {
  background-color: #f5f5f7;
  color: #1a1a1a;
}

[data-bs-theme="dark"] .btn-theme:hover {
  background-color: #e5e5e7;
  color: #1a1a1a;
}

/* Loading screen */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bs-body-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bs-border-color);
  border-top-color: var(--bs-body-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.navbar-brand {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.navbar-brand:hover {
  opacity: 0.7;
  transform: scale(1.02);
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition:
    width 0.3s ease,
    left 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
  left: 0;
}

.nav-link:hover {
  opacity: 0.8;
}

.display-1 {
  font-size: clamp(3rem, 10vw, 5rem);
  letter-spacing: -0.04em;
  animation: fadeInUp 0.8s ease-out;
}

.lead {
  font-size: 1.25rem;
  font-weight: 400;
  max-width: 480px;
  line-height: 1.5;
  animation: fadeInUp 0.8s ease-out 0.1s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-dark {
  border: none;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.btn-dark:hover {
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-dark:active {
  transform: scale(0.98);
}

/* Theme-adaptive button */
.btn-theme {
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  background-color: var(--bs-body-color);
  color: var(--bs-body-bg);
  border: none;
  animation: fadeInUp 0.8s ease-out 0.2s both;
  position: relative;
  overflow: hidden;
}

.btn-theme::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition:
    width 0.6s ease,
    height 0.6s ease;
}

.btn-theme:hover::before {
  width: 300px;
  height: 300px;
}

.btn-theme:hover {
  background-color: var(--bs-body-color);
  color: var(--bs-body-bg);
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-theme:active {
  transform: scale(0.98);
}

.social-link {
  display: inline-flex;
  transition:
    opacity 0.2s ease,
    transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.social-link:hover {
  opacity: 0.7;
  transform: translateY(-3px) scale(1.1);
}

.navbar-toggler:focus {
  box-shadow: none;
}

#theme-toggle {
  background: none;
  transition: transform 0.3s ease;
}

#theme-toggle:hover {
  transform: rotate(20deg) scale(1.1);
}

footer {
  transition: background-color 0.3s ease;
  animation: fadeIn 0.6s ease-out 0.3s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: 2px;
}

/* Text selection */
::selection {
  background-color: rgba(10, 132, 255, 0.3);
}
