/* Docs-specific styles */

/* Handle line breaks properly */
.line-break {
  display: block;
  content: '';
  margin: 0.5rem 0;
}

/* Scoping container */
.docs-page-container {
  width: 100%;
  padding: 0;
  font-feature-settings:
    'rlig' 1,
    'calt' 1;
}

/* Custom scrollbar for sidebar */
.scrollbar-thin {
  scrollbar-width: thin;
}

.scrollbar-thin::-webkit-scrollbar {
  width: 4px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background-color: hsl(var(--border));
  border-radius: 6px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background-color: hsl(var(--muted-foreground));
}

/* Docs layout container - KEEP SIMPLE */
.docs-layout {
  display: flex;
  flex-grow: 1;
  /* NO overflow, NO height here */
}

/* Mobile sidebar toggle functionality */
.docs-sidebar-toggle:checked ~ .docs-sidebar-backdrop {
  display: block;
}

.docs-sidebar-toggle:checked ~ .docs-sidebar {
  transform: translateX(0);
}

/* --- START DESKTOP STICKY STYLES --- */
@media (min-width: 768px) {
  .docs-layout {
    /* No desktop-specific styles needed here */
  }

  .docs-sidebar {
    /* === Core Sticky Properties === */
    position: sticky;
    top: 0; /* Stick to the top */

    /* === Height & Internal Scroll === */
    height: 100vh; /* Full viewport height */
    max-height: 100vh;
    overflow-y: auto; /* Allow sidebar scroll */

    /* === Flexbox Child Properties === */
    flex-shrink: 0;

    /* === Width (Use Tailwind's md:w-64) === */
    /* width: 256px; /* Let Tailwind handle width */

    /* === Z-index (Keep from Tailwind) === */
    /* z-index: 30; /* Let Tailwind handle z-index */

    /* Reset mobile transform */
    transform: none;
  }
}
/* --- END DESKTOP STICKY STYLES --- */

/* Content styling - only applied inside docs content */
.docs-content {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.6;
  color: hsl(var(--foreground));
}

/* Heading styles with flex display to prevent layout shifts */
.docs-content h1,
.docs-content h2,
.docs-content h3,
.docs-content h4,
.docs-content h5,
.docs-content h6 {
  display: block;
  position: relative;
  letter-spacing: -0.02em;
  scroll-margin-top: 100px;
  font-weight: 600;
}

/* Header link wrapper - make only the header text clickable, not the whole line */
.docs-content .header-link-wrapper {
  display: inline;
  color: inherit !important;
  text-decoration: none !important;
  font-weight: inherit !important;
  cursor: pointer;
}

.docs-content .header-link-wrapper:hover {
  color: inherit !important;
  text-decoration: none !important;
}

/* Header link icon - only visible on hover */
.docs-content .header-link-icon {
  opacity: 0;
  margin-left: 0.5rem;
  font-size: 0.7em;
}

.docs-content h1:hover .header-link-icon,
.docs-content h2:hover .header-link-icon,
.docs-content h3:hover .header-link-icon,
.docs-content h4:hover .header-link-icon,
.docs-content h5:hover .header-link-icon,
.docs-content h6:hover .header-link-icon {
  opacity: 0.7;
}

.docs-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1.5rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

/* Margins for headings */
.docs-content h2 {
  font-size: 1.65rem;
  margin-top: 2rem !important;
  margin-bottom: 1.25rem;
  line-height: 1.3;
  padding-bottom: 0.5rem;
}

.docs-content h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem !important;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.docs-content h4 {
  font-size: 1.1rem;
  margin-top: 1.25rem !important;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.docs-content h5,
.docs-content h6 {
  font-size: 0.95rem;
  margin-top: 1rem !important;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

/* Custom test class to make it easier to experiment with in devtools */
.docs-content .spacing-test {
  margin-top: 5rem !important;
  background-color: rgba(
    255,
    0,
    0,
    0.05
  ); /* Slight highlight to see where it applies */
  padding-top: 2rem !important;
}

/* Anchor link styles - invisible by default */
.docs-content .anchor-link {
  opacity: 0.3;
  color: inherit;
  font-weight: normal;
  margin-left: 0.6rem;
  text-decoration: none !important;
  font-size: 0.7em;
}

.docs-content h1:hover .anchor-link,
.docs-content h2:hover .anchor-link,
.docs-content h3:hover .anchor-link,
.docs-content h4:hover .anchor-link,
.docs-content h5:hover .anchor-link,
.docs-content h6:hover .anchor-link {
  opacity: 0.7;
}

/* Link styles - better URL styling for documentation */
.docs-content a {
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 500;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.docs-content a:hover {
  color: hsl(var(--primary) / 0.8);
}

/* Lists and paragraphs */
.docs-content ul,
.docs-content ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
  line-height: 1.5;
}

.docs-content li {
  margin-bottom: 0.4rem;
}

.docs-content li:last-child {
  margin-bottom: 0;
}

.docs-content p {
  margin: 1rem 0;
  line-height: 1.6;
}

/* Add bottom spacing to paragraphs and other elements before headings */
.docs-content p:last-of-type,
.docs-content ul:last-of-type,
.docs-content ol:last-of-type,
.docs-content pre:last-of-type,
.docs-content table:last-of-type,
.docs-content blockquote:last-of-type {
  margin-bottom: 0.5rem;
}

/* Bottom spacing for specific sections */
.docs-content p + h2,
.docs-content ul + h2,
.docs-content ol + h2,
.docs-content pre + h2,
.docs-content table + h2,
.docs-content blockquote + h2 {
  margin-top: 2.5rem;
}

.docs-content p + h3,
.docs-content ul + h3,
.docs-content ol + h3,
.docs-content pre + h3,
.docs-content table + h3,
.docs-content blockquote + h3 {
  margin-top: 2rem;
}

.docs-content p + h4,
.docs-content ul + h4,
.docs-content ol + h4,
.docs-content pre + h4,
.docs-content table + h4,
.docs-content blockquote + h4,
.docs-content p + h5,
.docs-content p + h6 {
  margin-top: 1.75rem;
}

/* Section spacing */
.docs-content section {
  margin-bottom: 2.5rem;
}

.docs-content section + section,
.docs-content h2 + p,
.docs-content h3 + p {
  margin-top: 1rem;
}

/* Improve spacing between sequential headings */
.docs-content h2 + h3 {
  margin-top: 1.5rem;
}

.docs-content h3 + h4 {
  margin-top: 1.25rem;
}

/* Better spacing for lists after headings */
.docs-content h2 + ul,
.docs-content h2 + ol,
.docs-content h3 + ul,
.docs-content h3 + ol {
  margin-top: 1rem;
}

/* Table styles for docs (not affecting markdown-renderer) */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95em;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  overflow: hidden;
}

.docs-content th {
  background-color: hsl(var(--muted));
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.docs-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  vertical-align: top;
}

.docs-content tr:last-child td {
  border-bottom: none;
}

.docs-content tr:nth-child(even) {
  background-color: hsl(var(--muted) / 0.3);
}

/* Style table links specially for GitHub URLs */
.docs-content td a[href*='github.com'] {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background-color: hsl(var(--muted));
  border-radius: 0.25rem;
  font-size: 0.9em;
  text-align: center;
  white-space: nowrap;
}

.docs-content td a[href*='github.com']:hover {
  background-color: hsl(var(--muted) / 0.7);
}

/* Code blocks */
.docs-content pre {
  padding: 1.25rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  background-color: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  margin: 1.5rem 0;
}

.docs-content code {
  font-family:
    ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

/* Code blocks in the markdown content */
.docs-content pre code {
  padding: 0;
  background-color: transparent;
  border-radius: 0;
  color: hsl(var(--foreground));
  line-height: 1.5;
}

/* Syntax highlighting classes */
.docs-content .text-shiki-light,
.docs-content .text-shiki-dark {
  font-family:
    ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;
}

/* Inline code inside paragraphs and lists */
.docs-content p code,
.docs-content li code {
  background-color: hsl(var(--muted) / 0.5);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

/* Blockquote styles */
.docs-content blockquote {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid hsl(var(--primary) / 0.5);
  background-color: hsl(var(--muted) / 0.5);
  border-radius: 0.25rem;
  font-style: italic;
}

.docs-content blockquote p {
  margin: 0.5rem 0;
}

/* Horizontal rule */
.docs-content hr {
  margin: 2.5rem 0;
  border: none;
  height: 1px;
  background-color: hsl(var(--border));
}

/* Attempt to hide potentially problematic empty spans within code blocks generated by syntax highlighters */
pre code span:empty {
  display: none !important; /* Use !important to increase specificity if needed */
}

/* Optional: If whitespace-only spans are causing issues (unlikely but possible) */
/* 
pre code span:not(:has(*)) { 
  /* Add rules here if needed, e.g., affect margin/padding if they only contain whitespace */
/* } 
*/
