Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

11.7 KB
Raw Blame
/*
 * Stirling design tokens — CSS custom properties.
 *
 * This is the single source of truth for the design tokens. Components
 * reference them via var(--color-...); there is no JS palette to keep in sync.
 * Theme switching flips `data-theme="dark"` on <html> and these variables
 * cascade. (tokens.ts holds only the Tier type, not the palette.)
 *
 * Category accents (insurance, finance, legal, …) are not theme-switched —
 * the document types they label are stable, theme-agnostic concepts.
 */

:root,
[data-theme="light"] {
  /* Text hierarchy */
  /* text-5 was #94a3b8 (≈2.85:1 on white — fails WCAG AA). Bumped to #64748b
     so meta/timestamp copy at small sizes still passes contrast. The visual
     hierarchy now collapses text-4 and text-5 into the same shade — use weight
     or size to differentiate in components instead. */
  --color-text-placeholder: var(--p-gray-400);

  /* Body text colour for use on coloured / gradient backgrounds (blue buttons,
     assistant header, onboarding "done" badges). Theme-stable: even in dark
     mode the underlying surface is the brand gradient, so the text is white. */
  --color-text-on-accent: #ffffff;

  /* Brand / status */
  --color-blue: var(--p-blue-500);
  --color-blue-light: color-mix(in srgb, var(--p-blue-500) 13%, var(--p-white));
  --color-blue-border: color-mix(
    in srgb,
    var(--p-blue-500) 40%,
    var(--p-white)
  );
  --color-blue-dark: var(--p-blue-700);
  --color-purple: var(--p-blue-400);
  --color-purple-light: color-mix(
    in srgb,
    var(--p-blue-400) 13%,
    var(--p-white)
  );
  --color-purple-border: color-mix(
    in srgb,
    var(--p-blue-400) 40%,
    var(--p-white)
  );
  /* The -dark shades are the on-light TEXT colours (accents.css --_text and
     status copy). They have to clear 4.5:1 on the tinted -light surfaces they
     sit on, not just on the page, which is why they sit well below the base
     hue rather than one step under it. */
  --color-purple-dark: var(--p-blue-700);
  --color-green: var(--p-green-500);
  --color-green-light: color-mix(
    in srgb,
    var(--p-green-500) 13%,
    var(--p-white)
  );
  --color-green-border: color-mix(
    in srgb,
    var(--p-green-500) 40%,
    var(--p-white)
  );
  --color-green-dark: var(--p-green-800);
  --color-red: var(--p-red-500);
  --color-red-light: color-mix(in srgb, var(--p-red-500) 13%, var(--p-white));
  --color-red-border: color-mix(in srgb, var(--p-red-500) 40%, var(--p-white));
  --color-red-dark: var(--p-red-700);
  --color-amber: var(--p-amber-500);
  --color-amber-light: color-mix(
    in srgb,
    var(--p-amber-500) 15%,
    var(--p-white)
  );
  --color-amber-border: color-mix(
    in srgb,
    var(--p-amber-500) 42%,
    var(--p-white)
  );
  --color-amber-dark: var(--p-amber-800);
  --color-orange: var(--p-amber-600);
  --color-orange-light: color-mix(
    in srgb,
    var(--p-amber-600) 15%,
    var(--p-white)
  );
  --color-orange-border: color-mix(
    in srgb,
    var(--p-amber-600) 42%,
    var(--p-white)
  );
  --color-orange-dark: var(--p-red-600);

  /* Category accents (theme-stable) */
  --color-cat-insurance: var(--p-blue-500);
  --color-cat-compliance: var(--p-blue-500);
  --color-cat-finance: var(--p-green-500);
  --color-cat-legal: var(--p-blue-500);
  --color-cat-healthcare: var(--p-blue-400);
  --color-cat-government: var(--p-red-600);
  --color-cat-operations: var(--p-red-400);
  --color-cat-hr: var(--p-amber-500);
  --color-cat-realestate: var(--p-green-500);
  --color-cat-energy: var(--p-amber-600);
  --color-cat-extraction: var(--p-blue-500);

  /* Surfaces */
  --color-bg-subtle: var(--c-surface-sunken);
  --color-bg-code: var(--p-gray-100);

  /* Dropdowns / tooltips */
  --color-tooltip-bg: var(--p-gray-800);
  --color-tooltip-text: var(--p-gray-50);

  /* Navigation */
  /* Form/section labels are small uppercase text, so they need a real text
     shade: gray-400 only reaches 2.3:1 on the page background. */
  --color-section-label: var(--p-gray-600);

  /* Header */
  --color-search-border-hover: var(--p-gray-300);
  --color-search-text: var(--p-gray-400);

  /* Sidebar */
  --color-usage-text: var(--p-gray-500);
  --color-usage-value: var(--p-gray-700);

  --color-toggle-off: var(--p-gray-300);
  --color-badge-red: var(--p-red-500);

  /* Shadows */
  --shadow-sm: inset 0 0 0 1px var(--p-gray-250);
  --shadow-md:
    inset 0 0 0 1px var(--p-gray-250),
    0 1px 2px color-mix(in srgb, var(--p-blue-700) 4%, transparent);
  --shadow-lg:
    inset 0 0 0 1px var(--p-gray-250),
    0 4px 12px color-mix(in srgb, var(--p-blue-700) 6%, transparent);

  /* Gradients */
  --grad-blue-btn: linear-gradient(
    180deg,
    var(--p-azure-450) 0%,
    var(--p-azure-550) 50%,
    var(--p-azure-650) 100%
  );
  --grad-purple-btn: linear-gradient(
    180deg,
    var(--p-violet-400) 0%,
    var(--p-violet-500) 50%,
    var(--p-violet-600) 100%
  );
  --grad-green-btn: linear-gradient(
    180deg,
    var(--p-emerald-400) 0%,
    var(--p-emerald-500) 50%,
    var(--p-emerald-600) 100%
  );
  --grad-amber-btn: linear-gradient(
    180deg,
    var(--p-amber-400) 0%,
    var(--p-amber-500) 50%,
    var(--p-amber-600) 100%
  );
  --grad-red-btn: linear-gradient(
    180deg,
    var(--p-red-400) 0%,
    var(--p-red-500) 50%,
    var(--p-red-600) 100%
  );

  /* Code palette — theme-aware: a light GitHub-style box in light mode, the
     dark terminal palette in dark mode. (CodeBlock renders plain text, so only
     the base colours are load-bearing; the syntax slots are kept for future
     Shiki. */
  --code-bg: var(--p-c-f6f8fa);
  --code-bg-alt: var(--p-c-eef1f4);
  --code-bg-header: var(--p-c-eaeef2);
  --code-text: var(--p-c-1f2328);
  /* Both sit on --code-bg-header, the darkest of the code grounds, so they run
     deeper than a plain "dim/muted" pair would on white. */
  --code-dim: var(--p-c-656d76);
  --code-muted: var(--p-c-8c959f);
  --code-keyword: var(--p-c-cf222e);
  --code-string: var(--p-code-string);
  --code-number: var(--p-c-0550ae);
  --code-fn: var(--p-c-8250df);
  --code-type: var(--p-code-type);
  --code-property: var(--p-c-0550ae);
  --code-comment: var(--p-c-6e7781);
  --code-border: var(--p-c-d0d7de);
  /* Window-chrome traffic-light dots in the code-block header. */
  --code-dot: var(--p-c-d0d7de);
}

[data-theme="dark"] {
  /* Bumped from #475569 (fails AA) — see light-theme note. */
  --color-text-placeholder: var(--p-gray-600);

  --color-blue: var(--p-blue-500);
  --color-blue-light: var(--p-zinc-750);
  --color-blue-border: var(--p-zinc-600);
  --color-blue-dark: var(--p-blue-400);
  --color-purple: var(--p-blue-400);
  --color-purple-light: var(--p-zinc-750);
  --color-purple-border: var(--p-zinc-600);
  --color-purple-dark: var(--p-blue-400);
  --color-green: var(--p-green-500);
  --color-green-light: color-mix(
    in srgb,
    var(--p-green-500) 20%,
    var(--p-zinc-900)
  );
  --color-green-border: var(--p-green-700);
  --color-green-dark: var(--p-green-500);
  --color-red: var(--p-red-400);
  --color-red-light: var(--p-zinc-800);
  --color-red-border: var(--p-red-600);
  /* The -dark shades are this theme's TEXT colours. On the dark card and
     raised surfaces red-500 only reaches ~3.9:1, so error copy runs a step
     lighter than the base hue. */
  --color-red-dark: var(--p-red-400);
  --color-amber: var(--p-amber-400);
  --color-amber-light: color-mix(
    in srgb,
    var(--p-amber-500) 20%,
    var(--p-zinc-900)
  );
  --color-amber-border: var(--p-amber-600);
  /* Deeper than the base so it stays distinct (hover shade + amber text on
     dark surfaces). ~7.4:1 on --color-amber-light, passes WCAG AA. Was
     #fbbf24 — identical to the base — which left Mantine's amber hover a
     no-op in dark mode. */
  --color-amber-dark: var(--p-amber-500);
  --color-orange: var(--p-amber-500);
  --color-orange-light: color-mix(
    in srgb,
    var(--p-amber-600) 30%,
    var(--p-zinc-900)
  );
  --color-orange-border: var(--p-red-600);
  --color-orange-dark: var(--p-amber-400);

  --color-bg-subtle: var(--c-surface-sunken);
  --color-bg-code: var(--p-zinc-900);

  --color-tooltip-bg: var(--p-gray-250);
  --color-tooltip-text: var(--p-blue-700);

  /* Uppercase 12px label text: the light theme's grey only reaches 2.3:1
     on the dark surfaces, so this theme takes a real on-dark shade. */
  --color-section-label: var(--p-zinc-200);

  --color-search-border-hover: var(--p-gray-600);
  --color-search-text: var(--p-gray-500);

  --color-usage-text: var(--p-gray-500);
  --color-usage-value: var(--p-gray-400);

  --color-toggle-off: var(--p-gray-600);

  /* Segmented control — blue-toned dark to match app surface colors */

  --shadow-sm: inset 0 0 0 1px var(--p-zinc-600);
  --shadow-md: inset 0 0 0 1px var(--p-zinc-600), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: inset 0 0 0 1px var(--p-zinc-600), 0 8px 24px rgba(0, 0, 0, 0.4);

  --grad-blue-btn: linear-gradient(
    180deg,
    var(--p-blue-500) 0%,
    var(--p-blue-600) 50%,
    var(--p-blue-700) 100%
  );

  /* Code palette */
  --code-bg: var(--p-c-0f172a);
  --code-bg-alt: var(--p-c-1e293b);
  --code-bg-header: var(--p-c-1a2332);
  --code-text: var(--p-gray-250);
  /* Sits on the code header, the lightest of the dark code grounds, where
     the mid-slate only reaches 3.3:1. */
  --code-dim: var(--p-c-8b9bb4);
  --code-muted: var(--p-c-94a3b8);
  --code-keyword: var(--p-blue-400);
  --code-string: var(--p-amber-400);
  --code-number: var(--p-c-c084fc);
  --code-fn: var(--p-emerald-400);
  --code-type: var(--p-c-f472b6);
  --code-property: var(--p-blue-200);
  --code-comment: var(--p-c-475569);
  --code-border: var(--p-c-1e293b);
  --code-dot: var(--p-c-475569);
}

/* Radii / typography / motion / spacing / z-index — theme-stable */
:root {
  /* Home hero strip navy. Theme-stable by design — the white hero CTA keeps
     this deep navy text in both light and dark (branded surface). The hero
     background itself is accent-responsive (see EditorStatusCard/WelcomeBanner). */
  --color-hero-navy: var(--p-navy-700);

  /* 4-px grid spacing scale (rem so it tracks font-size changes). Use these
     in layout primitives + component CSS instead of bare 0.5rem / 0.75rem. */
  --space-0_5: 0.125rem;
  --space-1_5: 0.375rem;

  /* Z-index hierarchy. Pick the highest tier that still puts you below the
     thing that's supposed to win. Modals beat drawers beat dropdowns. */
}

/* Keyframes used across the app. */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(0.375rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

/* Default transition set (avoids text-colour transitions); not !important so components can override. */
*,
*::before,
*::after {
  transition-property:
    background, background-color, border, border-color, box-shadow, opacity,
    transform, fill, stroke, outline-color;
}

/* Visually-hidden utility for content meant only for screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}