Skip to content

The Open Standard for Generative UI

5.0 KB
Raw Blame
@import "tailwindcss";
@import "fumadocs-ui/css/neutral.css";
@import "fumadocs-ui/css/preset.css";
@import "../shared/design-system/styles/variables/index.css";
@import "@openuidev/react-ui/styles/index.css";
@import "@openuidev/thesys/styles.css";
@import "./docs-theme.css";

body {
  --color-fd-background: var(--openui-background);
  --color-fd-foreground: var(--openui-text-neutral-primary);
  --color-fd-muted: var(--openui-highlight-subtle);
  --color-fd-muted-foreground: var(--openui-text-neutral-secondary);
  --color-fd-popover: var(--openui-popover-background);
  --color-fd-card: var(--openui-foreground);
  --color-fd-secondary: var(--openui-highlight);
  --color-fd-border: var(--openui-border-default);
  --color-fd-accent: var(--openui-highlight);
  --color-fd-accent-foreground: var(--openui-text-neutral-primary);
  --color-fd-ring: var(--openui-border-accent-emphasis);

  --color-doc-surface: var(--openui-foreground);
  --color-doc-surface-raised: var(--openui-popover-background);
  --color-doc-surface-sunken: var(--openui-sunk);
  --color-doc-border: var(--openui-border-default);
  --color-doc-code-bg: var(--openui-sunk-light);
  color: var(--openui-text-neutral-primary);
  background: var(--openui-background);
  font-family: var(--openui-font-body);
}

#nd-docs-layout {
  --color-fd-background: var(--openui-foreground);
  --color-doc-surface: var(--openui-foreground);
  /* 4rem top bar + 0.5rem gap above tabs + ~2.5rem tabs row — keep in sync with `.tabsBar` padding */
  --fd-banner-height: calc(4rem + 0.5rem + 2.5rem) !important;
  --fd-layout-width: 1560px !important;
  width: 100%;
  min-height: calc(100dvh - (4rem + 0.5rem + 2.5rem)) !important;
  padding-top: calc(4rem + 0.5rem + 2.5rem) !important;
  background: var(--openui-foreground);
}

/* Smooth scroll for in-page anchors such as TOC links. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Override Fumadocs `max-w-[900px]` on `<article id="nd-page">` */
#nd-page {
  max-width: 800px !important;
}

#nd-page[data-full="true"],
#nd-page[data-full=""],
#nd-page[data-no-sidebar] {
  max-width: 1168px !important;
}

/*
 * Sidebar width: set on `#nd-docs-layout` so `--fd-sidebar-col` matches.
 *
 * Fumadocs uses `minmax(min-content, 1fr)` for the outer columns. With the sidebar spanning cols 1–2
 * and content aligned with `items-end`, track 1’s min-content can resolve to 0, so the first `1fr`
 * collapses and the last `1fr` takes all free space — the shell looks “stuck left”. Use
 * `minmax(0, 1fr)` for those tracks so left/right gutters stay symmetric and the 1560px shell centers.
 *
 * Must set full `grid-template` (not columns alone) so row/area definitions stay intact.
 */
@media (min-width: 768px) {
  #nd-docs-layout:has([data-sidebar-placeholder]) {
    --fd-sidebar-width: 240px !important;

    grid-template:
      "sidebar sidebar header toc toc"
      "sidebar sidebar toc-popover toc toc"
      "sidebar sidebar main toc toc" 1fr
      /
      minmax(0, 1fr)
      var(--fd-sidebar-col)
      minmax(0, calc(var(--fd-layout-width, 97rem) - var(--fd-sidebar-width) - var(--fd-toc-width)))
      var(--fd-toc-width)
      minmax(0, 1fr) !important;
  }
}

/* Pages with no docs sidebar tree (no placeholder) — keep layout vars consistent */
#nd-docs-layout:not(:has([data-sidebar-placeholder])) {
  --fd-sidebar-width: 0px !important;
}

/* A sidebar-less page can still have a TOC (Integrations); only drop its column when there is none. */
#nd-docs-layout:not(:has([data-sidebar-placeholder])):not(:has(#nd-toc)) {
  --fd-toc-width: 0px !important;
}

#nd-sidebar {
  background-color: transparent !important;
}

#nd-sidebar > .flex.flex-col.gap-3.p-4.pb-2,
#nd-sidebar-mobile > .flex.flex-col.gap-3.p-4.pb-2 {
  padding: 1rem 0 0.5rem 1rem !important;
}

/* Without a banner the desktop sidebar header is empty, so it only adds space above the page tree. */
#nd-sidebar > .flex.flex-col.gap-3.p-4.pb-2:not(:has(> :nth-child(2))) {
  padding-top: 0 !important;
}

/* Sidebar page-tree scroll viewport; the right gutter keeps active rows and dividers off the edge */
#nd-sidebar [data-radix-scroll-area-viewport].p-4,
#nd-sidebar-mobile [data-radix-scroll-area-viewport].p-4 {
  padding: 1rem 12px 1rem 1rem !important;
}

@media (min-width: 1560px) {
  #nd-sidebar > .flex.flex-col.gap-3.p-4.pb-2,
  #nd-sidebar-mobile > .flex.flex-col.gap-3.p-4.pb-2 {
    padding-left: 0 !important;
  }

  #nd-sidebar [data-radix-scroll-area-viewport].p-4,
  #nd-sidebar-mobile [data-radix-scroll-area-viewport].p-4 {
    padding-left: 0 !important;
  }
}

/* External sidebar links: icon after the label (Fumadocs puts it first). */
#nd-sidebar [data-radix-scroll-area-viewport] a[target="_blank"] > svg:first-child,
#nd-sidebar-mobile [data-radix-scroll-area-viewport] a[target="_blank"] > svg:first-child {
  order: 1;
}

@media (max-width: 767px) {
  #nd-docs-layout {
    --fd-banner-height: calc(4rem + 2.5rem) !important;
    min-height: calc(100dvh - (4rem + 2.5rem)) !important;
    padding-top: calc(4rem + 2.5rem) !important;
  }
}