/* Custom background from adenyrr.me */

/* ============================================
   FIXED BACKGROUND - Desktop & Mobile Compatible
   Using ::before pseudo-element for mobile support
   (background-attachment: fixed doesn't work on mobile)
   ============================================ */

/* Dark theme background - Desktop */
[data-md-color-scheme="slate"] {
  background: #0a0e14 !important;
}

/* Light theme background - Desktop */
[data-md-color-scheme="default"] {
  background: #f8f9fc !important;
}

/* Fixed background layer using ::before for cross-platform support */
[data-md-color-scheme="slate"]::before,
[data-md-color-scheme="default"]::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}

/* Dark theme gradient */
[data-md-color-scheme="slate"]::before {
  background: #0a0e14;
  background-image:
    /* Subtle grid pattern for tech feel */
    linear-gradient(rgba(139,92,246,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,92,246,0.03) 1px, transparent 1px),
    /* Main gradients - warm tones enhanced */
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(139,92,246,0.18), transparent 50%),
    radial-gradient(ellipse 70% 50% at 20% 40%, rgba(236,72,153,0.10), transparent 50%),
    radial-gradient(ellipse 50% 40% at 0% 70%, rgba(236,72,153,0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(168,85,247,0.08), transparent 50%);
  background-size: 50px 50px, 50px 50px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* Light theme gradient */
[data-md-color-scheme="default"]::before {
  background: #f8f9fc;
  background-image:
    /* Very subtle grid pattern */
    linear-gradient(rgba(99,102,241,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.04) 1px, transparent 1px),
    /* Soft gradients - more visible for light theme */
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99,102,241,0.12), transparent 50%),
    radial-gradient(ellipse 70% 50% at 20% 40%, rgba(139,92,246,0.08), transparent 50%),
    radial-gradient(ellipse 50% 40% at 0% 70%, rgba(167,139,250,0.06), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(124,58,237,0.06), transparent 50%);
  background-size: 50px 50px, 50px 50px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* Ensure body and containers don't override */
body,
.md-container,
.md-main,
.md-content {
  background: transparent !important;
}

/* Make header semi-transparent for glassmorphism effect */
.md-header {
  background-color: rgba(10, 14, 20, 0.85) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

[data-md-color-scheme="default"] .md-header {
  background-color: rgba(248, 249, 252, 0.9) !important;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

/* Make sidebar semi-transparent */
.md-sidebar {
  background: transparent !important;
}

.md-sidebar__scrollwrap {
  background: transparent !important;
}

/* Navigation styling */
.md-nav {
  background: transparent !important;
}

/* Tabs bar */
.md-tabs {
  background: transparent !important;
}

/* Footer transparent with glassmorphism */
.md-footer {
  background: transparent !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(139, 92, 246, 0.15);
}

[data-md-color-scheme="default"] .md-footer {
  background: transparent !important;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
}

.md-footer-meta {
  background: rgba(10, 14, 20, 0.3) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-md-color-scheme="default"] .md-footer-meta {
  background: rgba(248, 249, 252, 0.6) !important;
}

.md-footer-nav {
  background: transparent !important;
}

.md-footer__inner {
  background: transparent !important;
}

/* Ensure html and body take full height */
html {
  min-height: 100%;
}

body {
  min-height: 100vh;
}

/* Light theme text improvements for readability */
[data-md-color-scheme="default"] {
  --md-default-fg-color: #1a1a2e;
  --md-default-fg-color--light: #374151;
  --md-default-fg-color--lighter: #4b5563;
}

/* Content area semi-transparent background for better readability in light mode */
[data-md-color-scheme="default"] .md-content {
  background: rgba(255, 255, 255, 0.7) !important;
  border-radius: 8px;
  margin: 0.5rem;
  padding: 0.5rem;
}

/* Dark theme content area for better readability */
[data-md-color-scheme="slate"] .md-content {
  background: rgba(10, 14, 20, 0.5) !important;
  border-radius: 8px;
  margin: 0.5rem;
  padding: 0.5rem;
  border: 1px solid rgba(139, 92, 246, 0.08);
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

/* Smooth transitions for theme switching and hover effects */
a,
.md-header,
.md-footer,
.md-nav__link,
.md-tabs__link,
.md-typeset a,
.md-button {
  transition: all 0.3s ease;
}

/* Glow effect on links hover */
.md-typeset a:hover,
.md-nav__link:hover,
.md-tabs__link:hover {
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

[data-md-color-scheme="default"] .md-typeset a:hover,
[data-md-color-scheme="default"] .md-nav__link:hover {
  text-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

/* ============================================
   GLASSMORPHISM CODE BLOCKS
   ============================================ */

.md-typeset pre,
.highlight {
  background: rgba(10, 14, 20, 0.6) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-md-color-scheme="default"] .md-typeset pre,
[data-md-color-scheme="default"] .highlight {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */

.md-top {
  background: rgba(139, 92, 246, 0.2) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  transition: all 0.3s ease;
}

.md-top:hover {
  background: rgba(139, 92, 246, 0.4) !important;
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
}

[data-md-color-scheme="default"] .md-top {
  background: rgba(99, 102, 241, 0.15) !important;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

[data-md-color-scheme="default"] .md-top:hover {
  background: rgba(99, 102, 241, 0.3) !important;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* ============================================
   CONTENT AREA WIDTH
   ============================================ */

.md-grid {
  max-width: 1440px;
}

/* ============================================
   NAVIGATION ENHANCEMENTS
   ============================================ */

/* Active nav item glow */
.md-nav__link--active {
  background: rgba(139, 92, 246, 0.1);
  border-radius: 4px;
  padding-left: 8px;
  margin-left: -8px;
}

[data-md-color-scheme="default"] .md-nav__link--active {
  background: rgba(99, 102, 241, 0.1);
}

/* Tab hover effect */
.md-tabs__link:hover {
  background: rgba(139, 92, 246, 0.1);
  border-radius: 4px;
}

/* ============================================
   BUTTONS & INTERACTIVE ELEMENTS
   ============================================ */

.md-button {
  backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  transition: all 0.3s ease;
}

.md-button:hover {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

/* ============================================
   SEARCH BAR
   ============================================ */

.md-search__input {
  background: rgba(10, 14, 20, 0.5) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.md-search__input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

[data-md-color-scheme="default"] .md-search__input {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

[data-md-color-scheme="default"] .md-search__input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

/* ============================================
   ADMONITIONS (NOTES, WARNINGS, ETC.)
   ============================================ */

.md-typeset .admonition,
.md-typeset details {
  backdrop-filter: blur(8px);
  border-radius: 8px;
}

/* ============================================
   PARTICLES CANVAS (for JS)
   ============================================ */

#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

/* Respect reduced motion users: hide complex animation */
@media (prefers-reduced-motion: reduce) {
  #particles-canvas {
    display: none !important;
  }
  /* Reduce motion and transitions for core UI elements to respect user preference */
  a,
  .md-header,
  .md-footer,
  .md-nav__link,
  .md-tabs__link,
  .md-typeset a,
  .md-button,
  #particles-canvas {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
  }
}

/* Accessibility: stronger focus outlines and improved link contrast */
:focus {
  outline: 3px solid rgba(139, 92, 246, 0.6);
  outline-offset: 2px;
}

.md-typeset a {
  color: var(--md-default-fg-color);
}

.md-typeset a:focus,
.md-typeset a:hover {
  text-shadow: none;
  color: #7c3aed; /* clearer purple */
}
