/* =============================================
   DOCUMENTATION LAYOUT
   ============================================= */

.docs-layout {
  margin: 0;
  font-family: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
  background: #0d0d0d;
  color: #ccc;
}

.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: #111;
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  z-index: 50;
}

.docs-hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-right: 1rem;
}

.docs-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #ccc;
  border-radius: 1px;
  transition: 0.2s;
}

.docs-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.docs-hamburger.active span:nth-child(2) {
  opacity: 0;
}
.docs-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

.docs-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
}

.docs-logo img {
  display: block;
}

.docs-search-toggle {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
}

.docs-search-toggle:hover {
  color: #fff;
}

.docs-search-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.docs-search-overlay.open {
  display: flex;
}

.docs-search-overlay-inner {
  width: 90%;
  max-width: 680px;
  background: #111;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 2rem;
  position: relative;
}

.docs-search-close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  background: none;
  border: none;
  color: #aaa;
  font-size: 2rem;
  cursor: pointer;
}

#search-input-container {
  --pagefind-ui-scale: 1.1;
  --pagefind-ui-primary: #8ecae6;
  --pagefind-ui-text: #ccc;
  --pagefind-ui-background: #0d0d0d;
  --pagefind-ui-border: #333;
  --pagefind-ui-tag: #333;
  --pagefind-ui-font: inherit;
}

.pagefind-ui__search-input {
  width: 100% !important;
  padding: 0.75rem 1rem 0.75rem 2.8rem !important;
  font-size: 1rem !important;
  background: #1a1a1a !important;
  border: 1px solid #444 !important;
  border-radius: 8px !important;
  color: #fff !important;
}

.pagefind-ui__search-input:focus {
  border-color: #8ecae6 !important;
  outline: none;
}

.pagefind-ui__search-icon {
  opacity: 0.7;
  filter: invert(1);
}

.docs-wrapper {
  display: flex;
  min-height: calc(100vh - 56px);
}

.docs-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #111;
  border-right: 1px solid #222;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 40;
}

.docs-tree, .docs-tree ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-tree ul {
  padding-left: 1.2rem;
}

.docs-tree li {
  margin-bottom: 0.2rem;
}

.docs-tree a {
  display: block;
  padding: 0.3rem 0.6rem;
  color: #aaa;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.docs-tree a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.docs-tree .active a {
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-weight: 600;
}

.dir-name {
  display: block;
  padding: 0.3rem 0.6rem;
  color: #888;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 3rem;
  line-height: 1.7;
}

.docs-content article {
  max-width: 80ch;
  margin: 0 auto;
}

.docs-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 2rem 0;
}

.docs-toc-wrapper {
  margin-bottom: 2rem;
}

.toc-details {
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1rem;
}

.toc-details[open] {
  padding-bottom: 0.5rem;
}

.docs-toc-title {
  font-weight: 600;
  color: #ccc;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  margin-bottom: 0.5rem;
}

.toc-details summary::-webkit-details-marker {
  display: none;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-item {
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.toc-item a {
  color: #aaa;
  text-decoration: none;
  font-size: 0.85rem;
  display: block;
  padding: 0.2rem 0;
  transition: color 0.15s, border-color 0.15s;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.toc-item a:hover {
  color: #fff;
}

.toc-active {
  color: #8ecae6 !important;
  border-left-color: #8ecae6 !important;
}

.toc-level-2 { padding-left: 1rem; }
.toc-level-3 { padding-left: 2rem; }


.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.docs-content th,
.docs-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #333;
}

.docs-content th {
  color: #fff;
  font-weight: 600;
  background: rgba(255,255,255,0.05);
}

.docs-content tr:hover td {
  background: rgba(255,255,255,0.03);
}

.docs-content pre {
  position: relative;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.docs-content code {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: #ccc;
  white-space: pre;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #aaa;
  border-radius: 4px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  opacity: 0;
}

.docs-content pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: #3a3a3a;
  color: #fff;
}

.admonition {
  border-left: 4px solid;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  background: rgba(255,255,255,0.03);
}
.admonition strong {
  display: block;
  margin-bottom: 0.5rem;
}
.admonition.note    { border-color: #3b82f6; background: rgba(59,130,246,0.1); }
.admonition.tip     { border-color: #10b981; background: rgba(16,185,129,0.1); }
.admonition.caution { border-color: #f59e0b; background: rgba(245,158,11,0.1); }
.admonition.danger  { border-color: #ef4444; background: rgba(239,68,68,0.1); }


@media (min-width: 1200px) {
  .docs-content {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 2rem;
  }

  .docs-toc-wrapper {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    margin-bottom: 0;
    margin-top: 0;
  }

  .toc-details {
    border: none;
    padding: 0;
  }
  .toc-details summary {
    pointer-events: none;
    margin-bottom: 1rem;
    list-style: none;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    cursor: default;
  }
  .toc-details[open] {
    display: block;
  }

  .docs-content article {
    flex: 1;
    margin: 0 auto;
    max-width: 80ch;
  }
}

@media (max-width: 1199px) {
  .docs-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    height: calc(100vh - 56px);
    transform: translateX(-100%);
  }
  .docs-sidebar.open {
    transform: translateX(0);
  }
  .docs-content {
    padding: 1.5rem 1.2rem;
  }
  .docs-hamburger {
    display: flex;
  }
}

@media (min-width: 769px) {
  .docs-hamburger {
    display: none;
  }
}

.docs-back-home {
  display: block;
  padding: 0.4rem 0.6rem;
  margin-bottom: 1rem;
  color: #8ecae6;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.docs-back-home:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-decoration: none;
}

.docs-main-site-link {
  margin-left: auto;
  margin-right: 1rem;
  color: #aaa;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.docs-main-site-link:hover {
  color: #fff;
}

.pagefind-ui__results {
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 1rem;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: #444 #1a1a1a;
}

.pagefind-ui__results::-webkit-scrollbar {
  width: 6px;
}
.pagefind-ui__results::-webkit-scrollbar-track {
  background: #1a1a1a;
}
.pagefind-ui__results::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.pagefind-ui__button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.4rem 1.2rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ccc;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pagefind-ui__button:hover {
  background: #3a3a3a;
  border-color: #8ecae6;
  color: #fff;
}

#search-input-container button {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 1.2rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ccc;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#search-input-container button:hover {
  background: #3a3a3a;
  border-color: #8ecae6;
  color: #fff;
}