/* ==========================================================================
   Documentation Stylesheet — Augie's AI Image Browser
   Tokens match styles.css; only loaded by docs pages.
   ========================================================================== */

/* Page Wrapper override for documentation */
.docs-page-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* Two-column documentation layout */
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  width: 100%;
}

/* Left Sidebar (Desktop) */
.docs-sidebar {
  width: 100%;
}

.docs-desktop-nav {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.docs-sidebar-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.docs-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.docs-nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.docs-nav-link:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.docs-nav-link[aria-current="page"] {
  color: var(--text-primary);
  background-color: var(--bg-badge);
  border-color: var(--border-badge);
  font-weight: 600;
}

/* Mobile Collapsible <details> Docs Menu */
.docs-mobile-nav {
  display: none;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.docs-mobile-nav-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.docs-mobile-nav-summary::-webkit-details-marker {
  display: none;
}

.docs-mobile-nav-summary::after {
  content: "▾";
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.docs-mobile-nav[open] .docs-mobile-nav-summary::after {
  transform: rotate(180deg);
}

.docs-mobile-nav-summary:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: -2px;
}

.docs-sidebar-menu {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Article Area */
.docs-main {
  width: 100%;
  min-width: 0;
}

.docs-article {
  max-width: 72ch;
  width: 100%;
}

.docs-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-card);
}

.docs-title {
  font-size: 2.25rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.docs-lead {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Content Headings & Scale */
.docs-content h1,
.docs-content h2,
.docs-content h3,
.docs-content h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: 2rem;
}

.docs-content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.docs-content h3 {
  font-size: 1.25rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.docs-content h4 {
  font-size: 1.05rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

/* Typography & Flow */
.docs-content p {
  margin-bottom: 1.25rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.docs-content ul,
.docs-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  line-height: 1.7;
  color: var(--text-primary);
}

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

.docs-content a {
  color: #a78bfa;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.docs-content a:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

/* "On this page" Mini Table of Contents */
.docs-toc {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.docs-toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.docs-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.docs-toc-item.docs-toc-h3 {
  padding-left: 1rem;
}

.docs-toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: color 0.15s ease;
}

.docs-toc-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Code and Code Blocks */
.docs-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--bg-code);
  border: 1px solid var(--border-code);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  color: #e2e8f0;
}

.docs-content pre {
  background-color: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Tables styled like site cards */
.docs-content table {
  width: 100%;
  margin: 1.75rem 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
}

.docs-content th {
  padding: 0.75rem 1rem;
  background-color: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-card);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
}

.docs-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

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

/* Figures & Missing Screenshot Placeholders */
.docs-figure {
  margin: 1.75rem 0;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg-card);
}

.docs-figure img,
.docs-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  margin: 0 auto;
  image-rendering: auto;
}

.docs-figcaption {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.docs-shot-missing {
  border: 2px dashed var(--border-card);
  background-color: rgba(21, 29, 42, 0.4);
  padding: 2rem 1.5rem;
  text-align: center;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.docs-shot-caption {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-style: italic;
  border-top: none;
  padding: 0;
}

/* Prev / Next Pagination */
.docs-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-card);
}

.docs-pagination-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.docs-pagination-link:hover {
  border-color: var(--accent-primary);
  background-color: rgba(91, 43, 181, 0.1);
  text-decoration: none;
}

.docs-pagination-next {
  text-align: right;
  margin-left: auto;
  width: 100%;
}

.docs-pagination-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.docs-pagination-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.docs-pagination-placeholder {
  visibility: hidden;
}

/* Footer in docs main container */
.docs-main .site-footer {
  margin-top: 4rem;
  max-width: 72ch;
  width: 100%;
}

/* Focus Styles */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 859px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .docs-desktop-nav {
    display: none;
  }

  .docs-mobile-nav {
    display: block;
  }

  .docs-title {
    font-size: 1.85rem;
  }

  .docs-pagination {
    grid-template-columns: 1fr;
  }

  .docs-pagination-next {
    text-align: left;
  }
}
