Skip to content

CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.

7.5 KB
Raw Blame
@tailwind base;
@tailwind components;
@tailwind utilities;

/* ---------------------------------------------------------------------------
   Design tokens.

   Everything visual resolves through these variables. Components must never
   hardcode a colour: a literal hex bypasses this layer, and that is exactly
   why dark mode used to be half-broken. If a shade is missing here, add it
   here rather than inlining it at the call site.
   --------------------------------------------------------------------------- */

@layer base {
  :root {
    /* Warm ivory ground with white cards floating on top of it. */
    --background: 48 33% 97%;
    --foreground: 30 4% 10%;

    --card: 0 0% 100%;
    --card-foreground: 30 4% 10%;

    --popover: 0 0% 100%;
    --popover-foreground: 30 4% 10%;

    /* Clay — the one saturated colour in the system. Used sparingly.

       Two values, because clay does two jobs. `--primary` is a fill, judged
       against the near-white text sitting on it. As body text on a light
       ground it only reaches 3.07:1, under AA, so anything clay-coloured and
       small uses `--primary-strong` instead (5.6:1). */
    --primary: 15 63% 60%;
    --primary-foreground: 48 33% 98%;
    --primary-strong: 15 58% 42%;

    --secondary: 45 20% 93%;
    --secondary-foreground: 30 6% 20%;

    --muted: 45 20% 94%;
    --muted-foreground: 35 6% 42%;

    --accent: 45 24% 91%;
    --accent-foreground: 30 6% 18%;

    --destructive: 5 58% 50%;
    --destructive-foreground: 48 33% 98%;

    /* Status colours. Clay is the accent, not a status, so "added" and
       "warning" need their own hues -- folding them into the accent would
       lose the meaning. Both are pulled well down in chroma to sit beside it. */
    --success: 145 30% 34%;
    --success-foreground: 48 33% 98%;

    --warning: 38 58% 40%;
    --warning-foreground: 48 33% 98%;

    --border: 42 15% 88%;
    --input: 42 15% 86%;
    --ring: 15 63% 60%;

    /* Surfaces beyond shadcn's set. */
    --elevated: 0 0% 100%;
    --sunken: 45 24% 95%;
    --overlay: 30 8% 8%;

    /* Warm shadow base. The old shadows were cool slate-blue, which reads as
       grey haze against an ivory ground. */
    --shadow-hue: 30 20% 12%;

    --radius: 0.75rem;

    /* Motion. Shared by CSS utilities and the JS motion system so a tween
       written in either place lands on the same curve. */
    --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out-soft: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast: 150ms;
    --dur-base: 220ms;
    --dur-slow: 340ms;
  }

  .dark {
    --background: 30 3% 12%;
    --foreground: 45 15% 92%;

    --card: 60 3% 15%;
    --card-foreground: 45 15% 92%;

    --popover: 50 3% 17%;
    --popover-foreground: 45 15% 92%;

    --primary: 15 63% 62%;
    --primary-foreground: 30 5% 10%;
    /* On the dark ground the fill value already clears AA as text (5.2:1). */
    --primary-strong: 15 63% 62%;

    --secondary: 48 3% 21%;
    --secondary-foreground: 45 12% 90%;

    --muted: 48 3% 20%;
    --muted-foreground: 42 8% 62%;

    --accent: 48 4% 24%;
    --accent-foreground: 45 12% 92%;

    --destructive: 5 52% 52%;
    --destructive-foreground: 45 15% 94%;

    --success: 145 32% 55%;
    --success-foreground: 30 5% 10%;

    --warning: 38 60% 58%;
    --warning-foreground: 30 5% 10%;

    --border: 45 4% 24%;
    --input: 45 4% 26%;
    --ring: 15 63% 62%;

    --elevated: 50 3% 18%;
    --sunken: 30 3% 10%;
    --overlay: 30 6% 4%;

    --shadow-hue: 30 30% 2%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Headings keep the UI stack and only tighten their tracking.

     The display serif has no CJK glyphs, so a Chinese heading fell through to
     a system serif (SimSun) while everything around it stayed on the sans --
     visibly two typefaces in one interface, and it hit generated markdown
     headings too, not just chrome. One family, one texture. */
  h1, h2, h3 {
    letter-spacing: -0.015em;
  }

  /* Scrollbars.

     Every scrolling surface in the app was drawing the platform's default bar
     -- on Windows a 17px light-grey trough with square arrows, which is both
     the widest and the oldest-looking element on the page, and does not follow
     the theme into dark mode. `scrollbar-width`/`scrollbar-color` cover Firefox
     and Chromium 121+; the `::-webkit-` rules cover the rest. Colours are
     tokens, so the bar flips with everything else.

     Not applied to `*`: the draw.io and PPT editor iframes own their chrome. */
  html {
    scrollbar-color: hsl(var(--foreground) / 0.22) transparent;
  }

  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-track,
  ::-webkit-scrollbar-corner {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background-color: hsl(var(--foreground) / 0.18);
    border: 3px solid transparent;
    border-radius: 9999px;
    /* Padding-box keeps the transparent border as breathing room rather than
       letting the thumb paint into it. */
    background-clip: padding-box;
  }

  ::-webkit-scrollbar-thumb:hover {
    background-color: hsl(var(--foreground) / 0.32);
  }

  ::-webkit-scrollbar-button {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Reduced motion.

   One global gate rather than per-component checks. Transforms still resolve
   to their final position — animations collapse to ~0 rather than being
   cancelled, so nothing gets stranded mid-tween.
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@layer utilities {
  /* Warm, layered shadows. Three stops so the falloff reads as depth rather
     than a single grey band. */
  .shadow-soft {
    box-shadow:
      0 1px 2px hsl(var(--shadow-hue) / 0.04),
      0 4px 12px hsl(var(--shadow-hue) / 0.06),
      0 8px 24px hsl(var(--shadow-hue) / 0.05);
  }

  .shadow-soft-lg {
    box-shadow:
      0 2px 4px hsl(var(--shadow-hue) / 0.05),
      0 8px 20px hsl(var(--shadow-hue) / 0.08),
      0 16px 40px hsl(var(--shadow-hue) / 0.07);
  }

  .shadow-soft-xl {
    box-shadow:
      0 4px 8px hsl(var(--shadow-hue) / 0.06),
      0 16px 36px hsl(var(--shadow-hue) / 0.10),
      0 32px 72px hsl(var(--shadow-hue) / 0.09);
  }

  /* Hairline that survives both themes without going invisible. */
  .ring-hairline {
    box-shadow: inset 0 0 0 1px hsl(var(--border) / 0.7);
  }

  /* Used by six code blocks, and until now defined by nobody: it is a
     `tailwind-scrollbar` class and that plugin is not installed. */
  .scrollbar-thin {
    scrollbar-width: thin;
  }

  .scrollbar-thin::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  .scrollbar-thin::-webkit-scrollbar-thumb {
    border-width: 2px;
  }

  /* Wide tables scroll inside the message instead of stretching the panel. */
  .prose-scroll-x {
    overflow-x: auto;
    max-width: 100%;
  }

  /* Paper grain for the landing ground. Cheap: one repeating gradient pair,
     no image request. */
  .bg-paper {
    background-image:
      radial-gradient(circle at 1px 1px, hsl(var(--foreground) / 0.035) 1px, transparent 0);
    background-size: 22px 22px;
  }
}