/*
 * Polotno — Blueprint look theme (optional override).
 *
 * Import AFTER `polotno/ui.css` to make the editor look close to the original
 * Blueprint/Polotno chrome. This is a SMALL CSS-variables override: it only
 * re-points the public `--pn-*` hooks (tier 1 of the ui.css fallback chain), so
 * it composes cleanly on top of the shadcn-default theme and is overridable by a
 * consumer's own `--pn-*` / `--X` tokens.
 *
 * Scoped to `.polotno-ui` so it themes the editor only, never the host app.
 *
 * Palette derived from Blueprint:
 *   primary  #2d72d2  (Blueprint blue)      -> oklch(0.55 0.18 257)
 *   fg       #1c2127  (dark slate)          -> oklch(0.24 0.02 256)
 *   muted-fg #5f6b7c  (slate)               -> oklch(0.52 0.03 256)
 *   surface  #f6f7f9  (light grey)          -> oklch(0.97 0.003 247)
 *   border   rgba(17,20,24,0.15)
 */
.polotno-ui {
  /* Blueprint's tight corners. The shadcn scale is md = --pn-radius - 2px, so
     0.25rem (4px) yields ~2px on `rounded-md` controls (buttons/inputs/cards),
     matching Blueprint (sm -> 0, lg -> 4px). */
  --pn-radius: 0.25rem;

  /* Surfaces — Blueprint light grey instead of pure white. */
  --pn-background: oklch(1 0 0);
  --pn-foreground: oklch(0.24 0.02 256);
  --pn-card: oklch(1 0 0);
  --pn-card-foreground: oklch(0.24 0.02 256);
  --pn-popover: oklch(1 0 0);
  --pn-popover-foreground: oklch(0.24 0.02 256);

  /* Primary — Blueprint blue (#2d72d2). */
  --pn-primary: oklch(0.55 0.18 257);
  --pn-primary-foreground: oklch(1 0 0);

  /* Secondary / muted / accent — Blueprint light-grey fills + slate text. */
  --pn-secondary: oklch(0.97 0.003 247);
  --pn-secondary-foreground: oklch(0.24 0.02 256);
  --pn-muted: oklch(0.97 0.003 247);
  --pn-muted-foreground: oklch(0.52 0.03 256);
  --pn-accent: oklch(0.93 0.006 247);
  --pn-accent-foreground: oklch(0.24 0.02 256);

  /* Destructive — Blueprint red (#cd4246). */
  --pn-destructive: oklch(0.55 0.18 27);
  --pn-destructive-foreground: oklch(1 0 0);

  /* Lines / fields / focus ring. */
  --pn-border: rgba(17, 20, 24, 0.15);
  --pn-input: rgba(17, 20, 24, 0.15);
  --pn-ring: oklch(0.55 0.18 257);

  /* Sidebar mirrors the main surfaces. */
  --pn-sidebar: oklch(0.97 0.003 247);
  --pn-sidebar-foreground: oklch(0.24 0.02 256);
  --pn-sidebar-primary: oklch(0.55 0.18 257);
  --pn-sidebar-primary-foreground: oklch(1 0 0);
  --pn-sidebar-accent: oklch(0.93 0.006 247);
  --pn-sidebar-accent-foreground: oklch(0.24 0.02 256);
  --pn-sidebar-border: rgba(17, 20, 24, 0.15);
  --pn-sidebar-ring: oklch(0.55 0.18 257);
}

/*
 * Blueprint dark — the original Blueprint dark uses #2f343c surfaces over a
 * #1c2127 app background, lighter slate text, and a brighter blue. Mirror that
 * here. Triggers on the same dark surfaces ui.css recognizes.
 */
.polotno-ui.dark,
.dark .polotno-ui,
[data-polotno-theme='dark'] {
  --pn-background: oklch(0.24 0.02 256);
  --pn-foreground: oklch(0.95 0.005 247);
  --pn-card: oklch(0.28 0.02 256);
  --pn-card-foreground: oklch(0.95 0.005 247);
  --pn-popover: oklch(0.28 0.02 256);
  --pn-popover-foreground: oklch(0.95 0.005 247);

  --pn-primary: oklch(0.62 0.17 252);
  --pn-primary-foreground: oklch(1 0 0);

  --pn-secondary: oklch(0.31 0.02 256);
  --pn-secondary-foreground: oklch(0.95 0.005 247);
  --pn-muted: oklch(0.31 0.02 256);
  --pn-muted-foreground: oklch(0.72 0.02 256);
  --pn-accent: oklch(0.35 0.02 256);
  --pn-accent-foreground: oklch(0.95 0.005 247);

  --pn-destructive: oklch(0.62 0.18 27);
  --pn-destructive-foreground: oklch(1 0 0);

  --pn-border: rgba(255, 255, 255, 0.15);
  --pn-input: rgba(255, 255, 255, 0.15);
  --pn-ring: oklch(0.62 0.17 252);

  --pn-sidebar: oklch(0.28 0.02 256);
  --pn-sidebar-foreground: oklch(0.95 0.005 247);
  --pn-sidebar-primary: oklch(0.62 0.17 252);
  --pn-sidebar-primary-foreground: oklch(1 0 0);
  --pn-sidebar-accent: oklch(0.35 0.02 256);
  --pn-sidebar-accent-foreground: oklch(0.95 0.005 247);
  --pn-sidebar-border: rgba(255, 255, 255, 0.15);
  --pn-sidebar-ring: oklch(0.62 0.17 252);
}
