/* Docs layout */
.docs-layout {
  min-height: 100vh;
}

.docs-progress {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 120;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.03);
}

.docs-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

/* Sidebar */
.docs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  overflow-y: auto;
  background: #0d0d14;
  border-right: 1px solid rgba(16, 185, 129, 0.1);
  padding: 72px 0 32px;
  z-index: 50;
}

.docs-sidebar-search {
  padding: 0 18px 16px;
}

.docs-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 11px 12px;
  color: #e8e4df;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  outline: none;
}

.docs-search-input:focus {
  border-color: rgba(16, 185, 129, 0.35);
}

.docs-search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: #6f7076;
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
}

.docs-search-hint code {
  color: #10b981;
  font-size: 0.72rem;
}

.docs-search-count {
  color: #94959b;
}

.docs-sidebar-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.docs-sidebar-btn {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #bcbcc2;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.2s ease;
}

.docs-sidebar-btn:hover {
  color: #fff;
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.06);
}

.docs-search-empty {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: #999;
  font-size: 0.75rem;
  line-height: 1.5;
}

.docs-search-empty code {
  color: #10b981;
}

.docs-sidebar::-webkit-scrollbar {
  width: 4px;
}

.docs-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.docs-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.sidebar-group {
  margin-bottom: 4px;
}

.sidebar-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #10b981;
  cursor: pointer;
  user-select: none;
}

.sidebar-group-title::after {
  content: '\25BE';
  font-size: 0.6rem;
  transition: transform 0.2s ease;
}

.sidebar-group.collapsed .sidebar-group-title::after {
  transform: rotate(-90deg);
}

.sidebar-group-links {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.3s ease;
}

.sidebar-group.collapsed .sidebar-group-links {
  max-height: 0;
}

.sidebar-link {
  display: block;
  padding: 5px 24px 5px 28px;
  color: #777;
  font-size: 0.85rem;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  color: #e8e4df;
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
}

.sidebar-link.active {
  color: #10b981;
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

/* Content */
.docs-content {
  margin-left: 260px;
  max-width: 1100px;
  padding: 88px 48px 80px;
}

/* Sections */
.doc-section {
  margin-bottom: 72px;
  scroll-margin-top: 132px;
}

.doc-section h2 {
  font-size: 1.8rem;
  margin-bottom: 16px;
  padding-top: 24px;
  text-align: left;
}

.doc-section h2 .anchor {
  color: rgba(16, 185, 129, 0.3);
  text-decoration: none;
  margin-left: 8px;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.doc-section h2:hover .anchor {
  opacity: 1;
}

.doc-section h3 {
  font-size: 1.25rem;
  margin-top: 40px;
  margin-bottom: 12px;
  color: #e8e4df;
}

.doc-section p {
  color: #bbb;
  line-height: 1.75;
  margin-bottom: 16px;
}

.doc-section > p:first-of-type {
  font-size: 1.05rem;
  color: #ccc;
}

/* ===== Example Cards ===== */
/* Individual expression example - scannable and clean */
.ex {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #12121c;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 12px 0;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  overflow-x: auto;
}

.ex + .ex {
  margin-top: 8px;
}

/* Context / input data - shown ABOVE the expression as a subtle hint */
.ex .ctx {
  order: -1;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 5px;
  color: #666;
  font-size: 0.75rem;
  line-height: 1.5;
}

.ex .ctx::before {
  content: none;
}

/* Annotation-only context - shown below result as a subtle note */
.ex .ctx.is-note {
  order: unset;
  margin-bottom: 0;
  margin-top: 6px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: #555;
  font-size: 0.75rem;
}

.ex .ctx.is-note::before {
  content: none;
}

/* The expression itself */
.ex .expr {
  color: #e8e4df;
  white-space: pre;
}

/* Result line - visually distinct */
.ex .out {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  color: #61afef;
  font-size: 0.82rem;
}

.ex .out::before {
  content: '→ ';
  color: #10b981;
  font-weight: 600;
}

/* Syntax highlighting inside examples */
.ex .s { color: #98c379; }  /* string */
.ex .k { color: #c678dd; }  /* keyword */
.ex .o { color: #10b981; }  /* operator */
.ex .c { color: #555; }     /* comment */
.ex .n { color: #d19a66; }  /* number */
.ex .f { color: #e5c07b; }  /* function */

/* Example group - related examples with shared background */
.ex-group {
  background: #10101a;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 8px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ex-group .ex {
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 14px 20px;
}

.ex-group .ex:hover {
  background: rgba(255, 255, 255, 0.02);
}

.ex-group .ex .out {
  border-top: none;
  margin-top: 4px;
  padding-top: 0;
}

/* ===== Code blocks (for JS/config snippets, not expressions) ===== */
.doc-code {
  position: relative;
  background: #14141f;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  color: #e8e4df;
}

.doc-code .comment { color: #555; }
.doc-code .result { color: #61afef; }
.doc-code .string { color: #98c379; }
.doc-code .keyword { color: #c678dd; }
.doc-code .operator { color: #10b981; }
.doc-code .fn { color: #e5c07b; }

/* Try it button */
.try-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  z-index: 1;
}

.try-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  text-decoration: none;
}

/* Tip / note boxes */
.doc-tip {
  background: rgba(16, 185, 129, 0.05);
  border-left: 3px solid #10b981;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin: 20px 0;
  font-size: 0.9rem;
  color: #ccc;
  line-height: 1.6;
}

.doc-tip strong {
  color: #10b981;
}

/* Tables in docs */
.doc-section table {
  margin: 16px 0;
  width: 100%;
}

.docs-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  padding-bottom: 4px;
}

.docs-table-wrap table {
  margin: 0;
  min-width: 640px;
}

.docs-table-wrap::-webkit-scrollbar {
  height: 6px;
}

.docs-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.doc-section table th {
  text-align: left;
}

.doc-section table td code {
  font-size: 0.82rem;
}

/* Install box in docs */
.doc-install {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #14141f;
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  padding: 12px 20px;
  margin: 12px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: #e8e4df;
  width: fit-content;
}

.doc-install .prompt {
  color: #10b981;
  user-select: none;
}

/* Benchmark table */
.bench-table {
  border-collapse: collapse;
  margin: 20px 0;
}

.bench-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  padding: 8px 16px 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bench-table td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #bbb;
  font-size: 0.88rem;
}

.bench-table tr:last-child td {
  border-bottom: none;
}

.bench-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.bench-num {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  text-align: right !important;
  color: #61afef;
  font-variant-numeric: tabular-nums;
}

.bench-table th:nth-child(2),
.bench-table th:nth-child(3) {
  text-align: right;
}

.bench-note {
  color: #666;
  font-size: 0.82rem;
  margin-top: 12px;
}

.bench-note code {
  color: #10b981;
  font-size: 0.8rem;
}

/* Section divider */
.doc-section + .doc-section {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 16px;
}

/* Docs welcome hero */
.docs-hero {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.02) 100%);
  border: 1px solid rgba(16, 185, 129, 0.1);
  border-radius: 16px;
  padding: 40px 36px;
  margin-bottom: 48px;
}

.docs-hero h1 {
  font-size: 1.6rem;
  margin-bottom: 12px;
  color: #e8e4df;
}

.docs-hero p {
  color: #999;
  line-height: 1.7;
  margin-bottom: 20px;
  max-width: 540px;
}

.docs-hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.docs-track-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.docs-track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.docs-track strong {
  color: #fff;
  font-size: 0.95rem;
}

.docs-track span {
  color: #999;
  font-size: 0.84rem;
  line-height: 1.55;
}

.docs-track code {
  color: #10b981;
}

.docs-track:hover {
  border-color: rgba(16, 185, 129, 0.25);
  text-decoration: none;
}

.docs-task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.docs-task-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  transition: all 0.2s ease;
}

.docs-task-card:hover {
  text-decoration: none;
  border-color: rgba(16, 185, 129, 0.26);
  background: rgba(16, 185, 129, 0.04);
}

.docs-task-label {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.docs-task-card h3 {
  margin: 0;
  color: #fff;
  font-size: 1rem;
}

.docs-task-card p {
  margin: 0;
  color: #a7a7b0;
  font-size: 0.9rem;
  line-height: 1.65;
}

.docs-task-code {
  display: block;
  margin-top: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #61afef;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.docs-principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.docs-principle {
  padding: 20px;
  border-radius: 14px;
  background: #12121c;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.docs-principle h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1rem;
}

.docs-principle p {
  margin-bottom: 12px;
  color: #a7a7b0;
  font-size: 0.92rem;
  line-height: 1.65;
}

.docs-principle-code {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #10b981;
  font-size: 0.78rem;
  line-height: 1.55;
  font-family: 'JetBrains Mono', monospace;
  white-space: pre-wrap;
}

.docs-hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.docs-hero-link.primary {
  background: #10b981;
  color: #0a0a0f;
}

.docs-hero-link.primary:hover {
  background: #34d399;
  text-decoration: none;
}

.docs-hero-link.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-hero-link.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e8e4df;
  text-decoration: none;
}

.docs-quick-nav {
  position: sticky;
  top: 0px;
  z-index: 40;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: -6px -48px 28px;
  padding: 76px 48px 14px;
  background: #0a0a0f;
}

.docs-quick-nav::-webkit-scrollbar {
  height: 4px;
}

.docs-quick-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.docs-quick-link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 13, 20, 0.88);
  color: #a6a6aa;
  text-decoration: none;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.docs-quick-link:hover {
  color: #fff;
  border-color: rgba(16, 185, 129, 0.28);
  text-decoration: none;
}

.docs-quick-link.active {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

/* Collapsible "more" sections */
.more-examples summary {
  color: #777;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 20px;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.more-examples summary::before {
  content: '\203A';
  font-size: 1rem;
  line-height: 1;
  color: #10b981;
  transition: transform 0.2s ease;
}

.more-examples[open] summary::before {
  transform: rotate(90deg);
}

.more-examples summary:hover {
  color: #bbb;
}

/* Section subtitle */
.section-why {
  color: #888;
  font-size: 0.9rem;
  font-style: italic;
  margin-bottom: 20px;
  padding-left: 12px;
  border-left: 2px solid rgba(16, 185, 129, 0.2);
}

/* Hamburger button */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: #14141f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  color: #e8e4df;
  font-size: 1.2rem;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
}

.docs-backtotop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  border: 1px solid rgba(16, 185, 129, 0.22);
  background: rgba(13, 13, 20, 0.92);
  color: #10b981;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.docs-backtotop.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.docs-backtotop:hover {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

/* Mobile */
@media (max-width: 768px) {
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-content {
    margin-left: 0;
    padding: 80px 20px 48px;
  }

  .docs-progress {
    top: 58px;
  }

  .docs-sidebar-actions {
    flex-direction: column;
  }

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

  .docs-task-grid,
  .docs-principles {
    grid-template-columns: 1fr;
  }

  .docs-quick-nav {
    top: 0px;
    margin: -6px -20px 22px;
    padding: 68px 20px 12px;
  }

  .docs-quick-link {
    font-size: 0.74rem;
    padding: 8px 12px;
  }

  .hamburger-btn {
    display: none;
  }

  .nav-links.open {
    display: none;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    cursor: pointer;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .docs-backtotop {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 640px) {
  .docs-content {
    padding: 72px 16px 40px;
  }

  .docs-quick-nav {
    margin: -6px -16px 18px;
    padding: 64px 16px 10px;
  }

  .docs-hero {
    padding: 24px 20px;
    margin-bottom: 32px;
  }

  .docs-hero h1 {
    font-size: 1.3rem;
  }

  .docs-hero p {
    font-size: 0.88rem;
  }

  .docs-hero-link {
    padding: 7px 14px;
    font-size: 0.8rem;
  }

  .doc-section h2 {
    font-size: 1.4rem;
  }

  .doc-section h3 {
    font-size: 1.1rem;
  }

  .doc-section p {
    font-size: 0.9rem;
  }

  .doc-section > p:first-of-type {
    font-size: 0.95rem;
  }

  .ex {
    padding: 14px 16px;
    font-size: 0.8rem;
  }

  .doc-code {
    padding: 14px 16px;
    font-size: 0.78rem;
  }

  .doc-code .try-btn,
  .ex .try-btn {
    position: static;
    float: right;
    margin: -4px -4px 8px 8px;
  }

  .doc-install {
    font-size: 0.78rem;
    padding: 10px 14px;
  }

  .docs-task-card {
    padding: 16px;
  }

  .docs-task-card h3 {
    font-size: 0.9rem;
  }

  .docs-task-card p {
    font-size: 0.82rem;
  }

  .doc-tip {
    font-size: 0.85rem;
    padding: 10px 14px;
  }

  /* Stack tables into cards on mobile */
  .doc-section table,
  .doc-section table thead,
  .doc-section table tbody,
  .doc-section table tr,
  .doc-section table th,
  .doc-section table td {
    display: block;
  }

  .doc-section table thead {
    display: none;
  }

  .doc-section table tr {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }

  .doc-section table tr:last-child {
    border-bottom: none;
  }

  .doc-section table td {
    padding: 3px 0;
    font-size: 0.85rem;
  }

  .doc-section table td:before {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    margin-bottom: 2px;
  }

  .doc-section table td code {
    font-size: 0.78rem;
  }

  /* Scrollable table wraps still scroll */
  .docs-table-wrap table,
  .docs-table-wrap table thead,
  .docs-table-wrap table tbody,
  .docs-table-wrap table tr,
  .docs-table-wrap table th,
  .docs-table-wrap table td {
    display: revert;
  }

  .docs-table-wrap table thead {
    display: revert;
  }
}
