/* Beevibe docs — built on the landing's design tokens. Reuses --background, --primary, etc. */

.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 200px;
  gap: 56px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

/* Left sidebar */
.docs-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.docs-sidebar-section {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  padding: 0 12px 8px;
  margin-top: 18px;
}
.docs-sidebar-section:first-child { margin-top: 0; }
.docs-sidebar-divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 18px 12px 0;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: hsl(var(--muted-foreground));
  border-left: 2px solid transparent;
  font-size: 14px;
  text-decoration: none;
  border-radius: 0 4px 4px 0;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
.sidebar-item:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--panel) / 0.5);
}
.sidebar-item i { flex-shrink: 0; }
/* Active state, driven by the body's data-page attribute so sidebar markup
 * stays identical across all docs pages. */
body[data-page="overview"]      [data-nav="overview"],
body[data-page="quickstart"]    [data-nav="quickstart"],
body[data-page="concepts"]      [data-nav="concepts"],
body[data-page="architecture"]  [data-nav="architecture"],
body[data-page="pkg-api"]       [data-nav="pkg-api"],
body[data-page="pkg-core"]      [data-nav="pkg-core"],
body[data-page="pkg-daemon"]    [data-nav="pkg-daemon"],
body[data-page="pkg-scheduler"] [data-nav="pkg-scheduler"],
body[data-page="pkg-web"]       [data-nav="pkg-web"] {
  color: hsl(var(--foreground));
  background: hsl(var(--panel-strong));
  border-left-color: hsl(var(--primary));
}

/* Mobile drawer — native <details>, no JS */
.docs-sidebar-mobile { display: none; }

/* Right TOC */
.docs-toc {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  border-left: 1px solid hsl(var(--border));
  padding-left: 18px;
}
.docs-toc-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 12px;
}
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc a {
  display: block;
  padding: 5px 0;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -12px;
  transition: color 160ms ease, border-color 160ms ease;
}
.docs-toc a:hover { color: hsl(var(--foreground)); }
.docs-toc a.is-active {
  color: hsl(var(--primary));
  border-left-color: hsl(var(--primary));
}
.docs-toc a.toc-h3 { padding-left: 22px; font-size: 12px; }

/* Main column */
.docs-main { min-width: 0; max-width: 720px; }
.docs-main h1 {
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}
.docs-main h2 {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 800;
  line-height: 1.2;
  margin: 56px 0 16px;
  scroll-margin-top: 80px;
}
.docs-main h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin: 32px 0 10px;
  scroll-margin-top: 80px;
}
.docs-main p {
  color: hsl(var(--foreground));
  line-height: 1.7;
  margin: 16px 0;
  font-size: 16px;
}
.docs-main p.lede {
  font-size: 19px;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin: 0 0 24px;
}
.docs-main a:not(.button):not(.next-prev-card):not(.next-step-card) {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: hsl(var(--primary) / 0.4);
  transition: text-decoration-color 160ms ease;
}
.docs-main a:not(.button):not(.next-prev-card):not(.next-step-card):hover {
  text-decoration-color: hsl(var(--primary));
}
.docs-main ul, .docs-main ol {
  padding-left: 22px;
  color: hsl(var(--foreground));
}
.docs-main li {
  line-height: 1.7;
  margin: 8px 0;
  font-size: 16px;
}
.docs-main li::marker { color: hsl(var(--muted-foreground)); }
.docs-main strong { color: hsl(var(--foreground)); font-weight: 700; }
.docs-main code:not(pre code) {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.86em;
  background: hsl(var(--panel-strong));
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 1px 6px;
  color: hsl(var(--foreground));
}
.docs-main hr {
  border: 0;
  border-top: 1px solid hsl(var(--border));
  margin: 56px 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  gap: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 18px;
}
.breadcrumb a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 160ms ease;
}
.breadcrumb a:hover { color: hsl(var(--foreground)); }
.breadcrumb .current { color: hsl(var(--foreground)); }
.breadcrumb span[aria-hidden="true"] { opacity: 0.4; }

/* Code block */
.code-block {
  position: relative;
  margin: 24px 0;
  background: hsl(var(--panel-strong));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.65;
  background: transparent;
}
.code-block pre code { background: transparent; padding: 0; border: 0; font-size: inherit; }
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--panel) / 0.85);
  border: 1px solid hsl(var(--border));
  border-radius: 4px;
  padding: 5px 9px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
.code-copy:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--panel-strong));
  border-color: hsl(var(--muted-foreground) / 0.4);
}
.code-copy.is-copied { color: hsl(var(--primary)); border-color: hsl(var(--primary) / 0.5); }
.code-lang {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--primary));
  opacity: 0.6;
  pointer-events: none;
}

/* Prism theme — hand-mapped to Beevibe palette */
.token.comment, .token.prolog, .token.cdata { color: hsl(var(--muted-foreground)); font-style: italic; }
.token.string, .token.attr-value, .token.url { color: hsl(160 60% 65%); }
.token.keyword, .token.builtin, .token.atrule, .token.important { color: hsl(var(--primary)); font-weight: 600; }
.token.function, .token.class-name { color: hsl(var(--accent)); }
.token.number, .token.boolean, .token.constant { color: hsl(14 80% 70%); }
.token.operator, .token.punctuation { color: hsl(var(--foreground) / 0.7); }
.token.property, .token.tag, .token.selector { color: hsl(var(--accent)); }
.token.variable, .token.parameter { color: hsl(var(--foreground)); }
.token.regex, .token.deleted { color: hsl(14 80% 70%); }
.token.inserted { color: hsl(160 60% 65%); }

/* Callout */
.callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 24px 0;
  padding: 16px 18px;
  background: hsl(var(--panel) / 0.6);
  border: 1px solid hsl(var(--border));
  border-left-width: 3px;
  border-radius: var(--radius);
}
.callout-info { border-left-color: hsl(var(--accent)); }
.callout-warn { border-left-color: hsl(var(--primary)); }
.callout-tip { border-left-color: hsl(160 70% 55%); }
.callout-icon { flex-shrink: 0; margin-top: 2px; }
.callout-info .callout-icon { color: hsl(var(--accent)); }
.callout-warn .callout-icon { color: hsl(var(--primary)); }
.callout-tip .callout-icon { color: hsl(160 70% 55%); }
.callout-body { min-width: 0; }
.callout-title {
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 0 0 4px;
  font-size: 14px;
}
.callout-body p {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  line-height: 1.65;
}

/* Concept card */
.concept-card {
  position: relative;
  margin: 28px 0;
  padding: 28px 28px 22px;
  background: linear-gradient(180deg, hsl(var(--panel-strong) / 0.96), hsl(var(--panel) / 0.88));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  scroll-margin-top: 80px;
}
.concept-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.concept-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: hsl(var(--primary));
  letter-spacing: 0.14em;
}
.concept-card h3 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}
.concept-tagline {
  color: hsl(var(--foreground));
  font-size: 17px;
  line-height: 1.5;
  margin: 4px 0 10px;
  font-weight: 500;
}
.concept-card p {
  font-size: 15px;
  color: hsl(var(--muted-foreground));
  line-height: 1.65;
}
.concept-details { margin-top: 12px; }
.concept-details summary {
  cursor: pointer;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  padding: 6px 0;
  list-style: none;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 160ms ease;
}
.concept-details summary::-webkit-details-marker { display: none; }
.concept-details summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 200ms ease;
}
.concept-details[open] summary::before { transform: rotate(90deg); }
.concept-details summary:hover { color: hsl(var(--foreground)); }
.concept-details[open] summary { color: hsl(var(--primary)); }
.concept-details > div {
  margin-top: 8px;
  padding: 12px 14px;
  background: hsl(var(--panel) / 0.4);
  border-left: 2px solid hsl(var(--border));
  border-radius: 0 4px 4px 0;
}
.concept-details > div p { font-size: 13px; line-height: 1.65; margin: 6px 0; }
.concept-details > div p:first-child { margin-top: 0; }
.concept-details > div p:last-child { margin-bottom: 0; }
.concept-details > div code {
  font-size: 0.85em;
  background: hsl(var(--background) / 0.6);
  padding: 1px 5px;
  border-radius: 3px;
  color: hsl(var(--foreground));
}
.concept-see-also {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--accent));
  text-decoration: none;
}
.concept-see-also:hover { color: hsl(var(--foreground)); }

/* Next-step cards (overview page) */
.next-step-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: hsl(var(--border));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  margin: 32px 0;
}
.next-step-card {
  display: block;
  padding: 24px;
  background: hsl(var(--panel));
  text-decoration: none;
  color: inherit;
  transition: background 220ms ease, transform 220ms ease;
  min-height: 180px;
}
.next-step-card:hover {
  background: hsl(var(--panel-strong));
  transform: translateY(-3px);
}
.next-step-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
  margin-bottom: 14px;
}
.next-step-card h3 {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 6px;
  color: hsl(var(--foreground));
}
.next-step-card p {
  font-size: 14px;
  color: hsl(var(--muted-foreground));
  line-height: 1.55;
  margin: 0;
}
.next-step-card-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--primary));
}

/* Tech stack table (architecture page) */
.tech-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: hsl(var(--border));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0;
}
.tech-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: hsl(var(--panel));
  font-size: 14px;
  color: hsl(var(--muted-foreground));
}
.tech-row strong { color: hsl(var(--foreground)); font-weight: 700; }

/* Process list (architecture page) */
.process-list {
  display: grid;
  gap: 1px;
  background: hsl(var(--border));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0;
}
.process-item {
  padding: 18px 20px;
  background: hsl(var(--panel));
}
.process-item h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  color: hsl(var(--foreground));
}
.process-item h4 .process-where {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  margin-left: 10px;
}
.process-item p {
  margin: 0;
  font-size: 14px;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
}

/* ASCII diagram */
.ascii-diagram {
  margin: 24px 0;
  padding: 20px 22px;
  background: hsl(var(--panel-strong));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  color: hsl(var(--foreground) / 0.85);
  white-space: pre;
}

/* Next / Prev nav */
.next-prev {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 64px 0 0;
}
.next-prev-card {
  display: block;
  padding: 16px 20px;
  background: linear-gradient(180deg, hsl(var(--panel-strong) / 0.96), hsl(var(--panel) / 0.88));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background 220ms ease, transform 220ms ease;
}
.next-prev-card:hover {
  background: hsl(var(--panel-strong));
  transform: translateY(-3px);
}
.next-prev-card-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 6px;
}
.next-prev-card-title {
  font-size: 16px;
  font-weight: 700;
  color: hsl(var(--foreground));
}
.next-prev-prev { text-align: left; }
.next-prev-next { text-align: right; }
.next-prev-next .next-prev-card-label { justify-content: flex-end; }
.next-prev-empty { background: transparent; border: 1px dashed hsl(var(--border) / 0.5); }
.next-prev-empty:hover { background: transparent; transform: none; }

/* Responsive */
@media (max-width: 1200px) {
  .docs-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px;
  }
  .docs-toc { display: none; }
}

@media (max-width: 980px) {
  .docs-layout {
    display: block;
    padding: 32px 18px 72px;
  }
  .docs-sidebar { display: none; }
  .docs-sidebar-mobile {
    display: block;
    margin-bottom: 28px;
  }
  .docs-sidebar-mobile summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 12px 16px;
    background: hsl(var(--panel-strong));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: hsl(var(--foreground));
    user-select: none;
    list-style: none;
  }
  .docs-sidebar-mobile summary::-webkit-details-marker { display: none; }
  .docs-sidebar-mobile summary::after {
    content: "▾";
    font-size: 11px;
    color: hsl(var(--muted-foreground));
    transition: transform 200ms ease;
  }
  .docs-sidebar-mobile[open] summary::after { transform: rotate(180deg); }
  .docs-sidebar-mobile .sidebar-nav {
    margin-top: 8px;
    padding: 6px 0;
    background: hsl(var(--panel) / 0.5);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
  }
  .docs-sidebar-mobile .docs-sidebar-divider { margin: 6px 12px; }
  .docs-sidebar-mobile .docs-sidebar-section { padding: 12px 12px 6px; margin: 0; }
  .docs-main { max-width: none; }
  .next-step-grid { grid-template-columns: 1fr; }
  .tech-table { grid-template-columns: 1fr; }
  .next-prev { grid-template-columns: 1fr; }
  .next-prev-next, .next-prev-prev { text-align: left; }
  .next-prev-next .next-prev-card-label { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .docs-layout { padding: 24px 14px 56px; }
  .docs-main h1 { font-size: 32px; }
  .docs-main h2 { margin-top: 44px; }
  .concept-card { padding: 22px 20px 18px; }
  .code-block pre { padding: 16px 14px; font-size: 12.5px; }
}
