/* Load InterVariable Font */
@font-face {
  font-family: 'InterVariable';
  src: url('../assets/images/fonts/InterVariable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

/* CSS Custom Properties for Theming */
:root {
  --bg: #121418;
  --dark-blue: #0B1C2B;
  --dark-purple: #1B1035;
  --primary: #7B2EFF;
  --accent: #00C6FF;
  --text: #E0E0E0;
  --text-secondary: #B0B0B0;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --hover-bg: rgba(255, 255, 255, 0.1);
  
  /* Mobile header height variables */
  --header-height: 180px;
  --header-height-mobile: 220px;
  --header-height-small: 200px;
  --header-height-xs: 180px;
  --header-height-xxs: 160px;
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body and HTML */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  background: linear-gradient(145deg, var(--bg) 0%, var(--dark-purple) 100%);
  color: var(--text);
  font-family: 'InterVariable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Layout Container */
body {
  display: grid;
  grid-template-areas: 
    "header header"
    "sidebar main"
    "footer footer";
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  /* Add fixed height to enable sticky scrolling */
  height: 100vh;
  overflow: hidden;
}

/* Header */
#wiki-header {
  grid-area: header;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
  padding: 2rem 2.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  /* Define header height for calculations */
  min-height: 180px;
}

#wiki-header h1 {
  color: var(--primary);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#wiki-header nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

#wiki-header nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
}

#wiki-header nav a:hover {
  color: var(--accent);
  background: var(--hover-bg);
  transform: translateY(-2px);
}

#wiki-header nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

#wiki-header nav a:hover::after {
  width: 80%;
}

/* Header Content Layout */
.header-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.nav-container {
  display: flex;
  gap: 4rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.nav-section-label {
  display: block;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
  opacity: 0.9;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.25rem;
  display: inline-block;
}

.main-nav, .wiki-nav {
  display: flex;
  flex-direction: column;
  min-width: 200px;
}

.main-nav ul, .wiki-nav ul {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

/* External link styling for main site links */
.external-link {
  position: relative;
  background: rgba(0, 198, 255, 0.03);
  border: 1px solid rgba(0, 198, 255, 0.08);
  border-radius: 6px;
}

.external-link::after {
  content: '↗';
  font-size: 0.7rem;
  opacity: 0.6;
  transition: all 0.3s ease;
  margin-left: 0.4rem;
  color: var(--accent);
}

.external-link:hover {
  background: rgba(0, 198, 255, 0.08);
  border-color: rgba(0, 198, 255, 0.2);
  transform: translateY(-1px);
}

.external-link:hover::after {
  opacity: 1;
  transform: translateY(-1px);
}

/* Sidebar */
#wiki-sidebar {
  grid-area: sidebar;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  padding: 2rem 1.5rem;
  overflow-y: auto;
  /* Make sidebar sticky and scrollable */
  position: sticky;
  top: 0;
  height: calc(100vh - var(--header-height, 180px));
  scrollbar-width: thin;
}

#wiki-sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#wiki-sidebar a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  display: block;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

#wiki-sidebar a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(123, 46, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

#wiki-sidebar a:hover::before {
  left: 100%;
}

#wiki-sidebar a:hover {
  color: var(--accent);
  background: var(--hover-bg);
  border-color: var(--card-border);
  transform: translateX(8px);
  box-shadow: 0 4px 20px rgba(123, 46, 255, 0.2);
}

/* Main Content */
#wiki-content, main {
  grid-area: main;
  padding: 2rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  /* Make content area sticky and scrollable */
  overflow-y: auto;
  height: calc(100vh - var(--header-height, 180px));
  position: sticky;
  top: 0;
  scrollbar-width: thin;
}

/* Custom scrollbar for main content */
#wiki-content::-webkit-scrollbar, main::-webkit-scrollbar {
  width: 8px;
}

#wiki-content::-webkit-scrollbar-track, main::-webkit-scrollbar-track {
  background: var(--dark-blue);
  border-radius: 4px;
}

#wiki-content::-webkit-scrollbar-thumb, main::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 4px;
}

/* Typography */
h1 {
  color: var(--primary);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

h2 {
  color: var(--accent);
  font-size: 1.8rem;
  font-weight: 600;
  margin: 2rem 0 1rem 0;
  position: relative;
  padding-left: 1rem;
}

h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}

h3 {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem 0;
}

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

/* Lists */
ul, ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  position: relative;
}

ul li::marker {
  color: var(--accent);
}

/* Code and Pre */
code {
  background: var(--card-bg);
  color: var(--accent);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Fira Code', 'Monaco', 'Menlo', monospace;
  font-size: 0.9em;
}

pre {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  backdrop-filter: blur(10px);
}

pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}

a:hover {
  color: var(--primary);
}

/* Content Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  margin: 1.5rem 0;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(123, 46, 255, 0.15);
  border-color: rgba(123, 46, 255, 0.3);
}

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(123, 46, 255, 0.2);
  border-color: rgba(123, 46, 255, 0.4);
}

.feature-card h3 {
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(123, 46, 255, 0.4);
  color: white;
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: var(--hover-bg);
  border-color: var(--primary);
}

/* Footer */
#wiki-footer, footer {
  grid-area: footer;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--card-border);
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  /* Ensure footer stays at bottom */
  position: relative;
  z-index: 5;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

th {
  background: rgba(123, 46, 255, 0.1);
  color: var(--primary);
  font-weight: 600;
}

td {
  color: var(--text-secondary);
}

tr:hover {
  background: var(--hover-bg);
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--primary);
  background: var(--card-bg);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0 12px 12px 0;
  backdrop-filter: blur(10px);
  position: relative;
}

blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 15px;
  font-size: 3rem;
  color: var(--primary);
  opacity: 0.3;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--dark-blue);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.mobile-nav-toggle:hover {
  background: var(--hover-bg);
  color: var(--accent);
}

.mobile-nav-toggle .hamburger {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 20px;
  height: 15px;
}

.mobile-nav-toggle .hamburger span {
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: all 0.3s ease;
}

.mobile-nav-toggle.active .hamburger span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-nav-toggle.active .hamburger span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle.active .hamburger span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Sidebar */
.mobile-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

.mobile-sidebar.active {
  opacity: 1;
  pointer-events: all;
}

.mobile-sidebar-content {
  position: absolute;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg);
  border-right: 1px solid var(--card-border);
  transition: all 0.3s ease;
  overflow-y: auto;
  padding: 2rem 1.5rem;
}

.mobile-sidebar.active .mobile-sidebar-content {
  left: 0;
}

.mobile-sidebar-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.mobile-sidebar-close:hover {
  background: var(--hover-bg);
  color: var(--accent);
}

/* Mobile sidebar link styling */
.mobile-sidebar a:hover {
  background: var(--hover-bg) !important;
  color: var(--accent) !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
  body {
    grid-template-areas: 
      "header"
      "main"
      "footer";
    grid-template-columns: 1fr;
    /* Adjust for mobile layout */
    height: 100vh;
    overflow: hidden;
  }
  
  #wiki-sidebar {
    display: none;
  }
  
  .mobile-nav-toggle {
    display: block;
  }
  
  .mobile-sidebar {
    display: block;
  }
  
  #wiki-content, main {
    padding: 1rem;
    /* Adjust height calculation for mobile with proper header */
    height: calc(100vh - var(--header-height-mobile, 220px));
  }
  
  #wiki-header {
    padding: 1rem;
    /* Mobile header height - significantly increased to prevent overlap */
    min-height: 220px;
    position: relative;
  }
  
  #wiki-header h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
  }
  
  .header-content {
    gap: 1.2rem;
  }
  
  /* Fix the title and toggle button layout */
  .header-content > div:first-child {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 1rem;
  }
  
  .nav-container {
    flex-direction: column;
    gap: 1.2rem;
  }
  
  .main-nav, .wiki-nav {
    min-width: auto;
  }
  
  .nav-section-label {
    font-size: 0.75rem;
    margin-bottom: 0.6rem;
    display: block;
    clear: both;
  }
  
  .main-nav ul, .wiki-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
    margin-top: 0.3rem;
  }
  
  .main-nav a, .wiki-nav a {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
    display: inline-block;
  }
  
  /* Improve touch targets */
  a, button, .btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  
  /* Better spacing for mobile */
  .card, .feature-card {
    margin: 1rem 0;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px; /* Ensure readable text on mobile */
  }
  
  h1 {
    font-size: 1.8rem;
    line-height: 1.1;
    margin-bottom: 1rem;
  }
  
  h2 {
    font-size: 1.4rem;
    margin: 1.5rem 0 0.8rem 0;
  }
  
  h3 {
    font-size: 1.2rem;
    margin: 1.2rem 0 0.6rem 0;
  }
  
  p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
  }
  
  #wiki-content, main {
    padding: 1rem;
    /* Further adjust for smaller screens with proper header height */
    height: calc(100vh - var(--header-height-small, 200px));
  }
  
  #wiki-header {
    padding: 0.8rem;
    /* Smaller screen header height - increased more to prevent overlap */
    min-height: 200px;
  }
  
  #wiki-header h1 {
    font-size: 1.25rem;
    margin-bottom: 0.8rem;
    line-height: 1.2;
  }
  
  .header-content {
    gap: 1rem;
  }
  
  /* Better mobile header layout */
  .header-content > div:first-child {
    margin-bottom: 0.8rem;
  }
  
  .nav-container {
    gap: 1rem;
  }
  
  .nav-section-label {
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.2rem;
    display: block;
    clear: both;
  }
  
  .main-nav ul, .wiki-nav ul {
    gap: 0.3rem;
    justify-content: flex-start;
    margin-top: 0.2rem;
  }
  
  .main-nav a, .wiki-nav a {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    white-space: nowrap;
    display: inline-block;
  }
  
  .feature-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .card, .feature-card {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 12px;
  }
  
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }
  
  /* Improve table responsiveness */
  table {
    font-size: 0.9rem;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
  
  th, td {
    padding: 0.6rem 0.8rem;
    min-width: 100px;
  }
  
  /* Better code block handling */
  pre {
    padding: 1rem;
    font-size: 0.8rem;
    overflow-x: auto;
  }
  
  code {
    font-size: 0.8rem;
    padding: 0.15rem 0.3rem;
  }
  
  /* Mobile-optimized breadcrumb */
  .breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }
  
  .breadcrumb-separator {
    margin: 0 0.3rem;
  }
}

@media (max-width: 480px) {
  #wiki-content, main {
    padding: 0.8rem;
    /* Smallest screen adjustment with proper header height */
    height: calc(100vh - var(--header-height-xs, 180px));
  }
  
  #wiki-header {
    padding: 0.6rem;
    min-height: 180px;
  }
  
  #wiki-header h1 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    line-height: 1.1;
  }
  
  h1 {
    font-size: 1.6rem;
    line-height: 1.1;
  }
  
  h2 {
    font-size: 1.3rem;
    margin: 1.2rem 0 0.6rem 0;
    padding-left: 0.8rem;
  }
  
  h2::before {
    width: 3px;
    height: 60%;
  }
  
  h3 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem 0;
  }
  
  p {
    font-size: 0.95rem;
    line-height: 1.5;
  }
  
  .header-content {
    gap: 0.8rem;
  }
  
  /* Better mobile header layout for very small screens */
  .header-content > div:first-child {
    margin-bottom: 0.6rem;
  }
  
  .nav-container {
    gap: 0.8rem;
  }
  
  .nav-section-label {
    font-size: 0.65rem;
    margin-bottom: 0.4rem;
    letter-spacing: 1px;
    display: block;
    clear: both;
  }
  
  .main-nav ul, .wiki-nav ul {
    gap: 0.25rem;
    justify-content: flex-start;
    margin-top: 0.2rem;
  }
  
  .main-nav a, .wiki-nav a {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    display: inline-block;
  }
  
  .card, .feature-card {
    padding: 0.8rem;
    margin: 0.8rem 0;
    border-radius: 10px;
  }
  
  .feature-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
    min-height: 40px;
  }
  
  /* Ultra-mobile table handling */
  table {
    font-size: 0.8rem;
    border-radius: 8px;
  }
  
  th, td {
    padding: 0.4rem 0.6rem;
    min-width: 80px;
  }
  
  /* Compact code blocks */
  pre {
    padding: 0.8rem;
    font-size: 0.75rem;
    border-radius: 8px;
    margin: 1rem 0;
  }
  
  code {
    font-size: 0.75rem;
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
  }
  
  /* Ultra-compact breadcrumb */
  .breadcrumb {
    font-size: 0.75rem;
    margin-bottom: 0.8rem;
  }
  
  .breadcrumb-separator {
    margin: 0 0.2rem;
  }
  
  /* Improved list spacing */
  ul, ol {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
  }
  
  li {
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
  }
  
  /* Compact blockquotes */
  blockquote {
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
  }
  
  blockquote::before {
    font-size: 2rem;
    top: -5px;
    left: 10px;
  }
  
  /* Mobile footer optimization */
  #wiki-footer, footer {
    padding: 1.2rem;
    font-size: 0.8rem;
  }
}

/* Additional Mobile Optimizations */
@media (max-width: 360px) {
  /* Ultra-small screens (older phones) */
  #wiki-content, main {
    padding: 0.6rem;
    height: calc(100vh - var(--header-height-xxs, 160px));
  }
  
  #wiki-header {
    padding: 0.5rem;
    min-height: 160px;
  }
  
  #wiki-header h1 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
  }
  
  h1 {
    font-size: 1.4rem;
  }
  
  h2 {
    font-size: 1.2rem;
  }
  
  .card, .feature-card {
    padding: 0.6rem;
  }
  
  .nav-container {
    gap: 0.6rem;
  }
  
  .nav-section-label {
    font-size: 0.6rem;
    margin-bottom: 0.3rem;
  }
  
  .main-nav a, .wiki-nav a {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
  }
}

/* Touch-friendly improvements for all mobile devices */
@media (max-width: 1024px) and (pointer: coarse) {
  /* Ensure all interactive elements are touch-friendly */
  a, button, .btn, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Increase tap target spacing */
  .main-nav ul, .wiki-nav ul {
    gap: 0.8rem;
  }
  
  /* Better hover states for touch */
  .card:hover, .feature-card:hover {
    transform: none; /* Disable transform on touch devices */
  }
  
  /* Improve scroll behavior on mobile */
  #wiki-content, main, #wiki-sidebar {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Prevent zoom on form inputs */
  input, select, textarea {
    font-size: 16px;
  }
}

/* Landscape orientation adjustments */
@media (max-width: 1024px) and (orientation: landscape) {
  #wiki-header {
    min-height: 80px;
    padding: 0.5rem 1rem;
  }
  
  #wiki-header h1 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
  }
  
  #wiki-content, main {
    height: calc(100vh - 80px);
    padding: 1rem;
  }
  
  .nav-container {
    flex-direction: row;
    gap: 1rem;
  }
  
  .main-nav ul, .wiki-nav ul {
    flex-direction: row;
    gap: 0.5rem;
  }
}

/* Print styles for mobile printing */
@media print {
  #wiki-header, #wiki-sidebar, #wiki-footer, footer {
    display: none !important;
  }
  
  #wiki-content, main {
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  body {
    grid-template-areas: "main";
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  
  .card, .feature-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --card-border: rgba(255, 255, 255, 0.3);
    --text-secondary: #D0D0D0;
  }
  
  .card, .feature-card {
    border-width: 2px;
  }
  
  a {
    text-decoration: underline;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .card:hover, .feature-card:hover {
    transform: none;
  }
}

/* Dark mode optimizations for mobile */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0A0A;
    --card-bg: rgba(255, 255, 255, 0.03);
  }
  
  body {
    background: linear-gradient(145deg, var(--bg) 0%, #0F0F1A 100%);
  }
}

/* Mobile-specific focus styles for accessibility */
@media (max-width: 1024px) {
  *:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  
  /* Remove default focus styles that don't work well on mobile */
  button:focus,
  a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
  }
  
  /* Improve mobile link spacing */
  .main-nav a:focus,
  .wiki-nav a:focus,
  #wiki-sidebar a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-in {
  animation: slideIn 0.6s ease-out;
}

/* Special Effects */
.glow {
  box-shadow: 0 0 20px rgba(123, 46, 255, 0.3);
}

.highlight {
  background: linear-gradient(135deg, rgba(123, 46, 255, 0.1), rgba(0, 198, 255, 0.1));
  border-radius: 8px;
  padding: 0.2rem 0.5rem;
}

/* Navigation Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--accent);
}

.breadcrumb-separator {
  margin: 0 0.5rem;
  opacity: 0.5;
  color: var(--text-secondary);
}

/* Page-specific body classes for custom styling if needed */
.page-index .breadcrumb,
.page-features .breadcrumb,
.page-customization .breadcrumb,
.page-contributing .breadcrumb {
  /* Breadcrumb styles can be customized per page if needed */
  transition: all 0.3s ease;
}

/* Enhanced smooth scrolling for content areas */
#wiki-content, main, #wiki-sidebar {
  scroll-behavior: smooth;
}

/* Add subtle scroll indicators */
#wiki-content::before, main::before {
  content: '';
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#wiki-content.scrolled::before, main.scrolled::before {
  opacity: 1;
}