@import "tailwindcss";
@import "fumadocs-ui/css/shadcn.css";
@import "fumadocs-ui/css/preset.css";

@plugin "tailwindcss-motion";

@source '../node_modules/fumadocs-ui/dist/**/*.js';

@custom-variant dark (&:is(.dark *));

:root {
  --fd-layout-width: 1400px;
  
  --background: oklch(1 0 0);
  --foreground: oklch(0.165 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.165 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.165 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --radius: 0.625rem;
  --selection: oklch(0.165 0 0);
  --selection-foreground: oklch(1 0 0);
}

.dark {
  --background: oklch(0.165 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --selection: oklch(0.922 0 0);
  --selection-foreground: oklch(0.205 0 0);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar-background);
  --color-selection: var(--selection);
  --color-selection-foreground: var(--selection-foreground);
  --animate-accordion-down: accordion-down 0.2s ease-out;
  --animate-accordion-up: accordion-up 0.2s ease-out;
  --animate-fade-down: fade-down 0.5s;
  --animate-fade-up: fade-up 0.5s;
  --animate-stroke-dashoffset: stroke-dashoffset 0.2s linear forwards;
  --animate-expand-width: expand-width forwards;
  --animate-expand-height: expand-height forwards;
  --animate-skeleton-shimmer: skeleton-shimmer 2s infinite ease-out;
  --animate-skeleton-gradient: skeleton-gradient 2s infinite ease-out;
  --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);

  @keyframes fade-down {
    0% {
      opacity: 0;
      transform: translateY(-10px);
    }
    80% {
      opacity: 0.6;
    }
    100% {
      opacity: 1;
      transform: translateY(0px);
    }
  }
  @keyframes fade-up {
    0% {
      opacity: 0;
      transform: translateY(10px);
    }
    80% {
      opacity: 0.6;
    }
    100% {
      opacity: 1;
      transform: translateY(0px);
    }
  }
  @keyframes accordion-down {
    from {
      height: 0;
    }
    to {
      height: var(--radix-accordion-content-height);
    }
  }
  @keyframes accordion-up {
    from {
      height: var(--radix-accordion-content-height);
    }
    to {
      height: 0;
    }
  }
  @keyframes stroke-dashoffset {
    0% {
      stroke-dashoffset: 100%;
    }
    100% {
      stroke-dashoffset: 0;
    }
  }
  @keyframes expand-width {
    0% {
      border-color: var(--color-foreground);
      width: 0;
    }
    100% {
      width: 100%;
    }
  }
  @keyframes expand-height {
    0% {
      border-color: var(--color-foreground);
      height: 0;
    }
    100% {
      height: 100%;
    }
  }
  @keyframes skeleton-shimmer {
    0% {
      transform: translateX(-100%);
    }
    100% {
      transform: translateX(200%);
    }
  }
  @keyframes skeleton-gradient {
    0%,
    100% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
  }
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  ::selection {
    @apply bg-selection text-selection-foreground;
  }
  body {
    @apply bg-background text-foreground;
  }

  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }

  /**
   * @see https://github.com/shadcn-ui/ui/blob/main/apps/www/styles/globals.css#L95
   */
  ::-webkit-scrollbar {
    width: 5px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
  }
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
}

@utility component-block {
  & pre {
    @apply max-h-[432.4px] px-4 font-mono;
  }

  & code {
    @apply font-mono;
  }

  [data-rehype-pretty-code-figure] figure {
    @apply my-4! rounded-none!;
  }
}

@utility preview-block {
  & kbd {
    @apply border-none! shadow-none!;
  }
}

@utility mdx {
  & table {
    @apply rounded-md;
  }

  & table tr {
    @apply bg-transparent hover:bg-transparent;
  }

  & table th {
    @apply bg-accent/50;
  }
}

@utility auto-type-table {
  & table {
    @apply rounded-md;
  }

  & table tr {
    @apply bg-transparent hover:bg-transparent;
  }

  & table th {
    @apply bg-accent/50;
  }

  & table td {
    @apply align-top whitespace-pre-wrap;
  }

  & table td:nth-child(2) {
    @apply w-full;
  }
}

@layer components {
  [data-rehype-pretty-code-figure] figure {
    @apply bg-secondary/50! border-none;
  }

  [data-line] span {
    @apply text-[var(--shiki-light)] dark:text-[var(--shiki-dark)];
  }

  .component-preview h1,
  .component-preview h2,
  .component-preview h3,
  .component-preview h4,
  .component-preview h5,
  .component-preview h6,
  .component-preview p,
  .component-preview img {
    @apply !m-0;
  }

  pre {
    @apply space-y-1 font-mono;
  }

  code {
    @apply space-y-1 font-mono;
  }
}
