/*
 * Chrono Factory theme overlay for the upstream Paperclip UI.
 *
 * Loaded after Paperclip's own stylesheet (injected into index.html by
 * image/patch-ui.mjs), so it overrides Paperclip's CSS custom properties
 * at runtime. No rebuild of the UI bundle is needed.
 * Source of truth: projects/ChronoWise/apps/website/src/styles/tokens.css
 * and docs/BRAND.md.
 */

@font-face {
  font-family: "Geist";
  src: url("/chrono/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ChronoWise brand tokens */
  --cw-navy: #172c4c;
  --cw-slate: #4b5b71;
  --cw-faint: #53647a;
  --cw-cobalt: #2456bf;
  --cw-cobalt-hover: #193f95;
  --cw-cobalt-vivid: #3769d5;
  --cw-ice: #eaf1ff;
  --cw-paper: #f4f7fb;
  --cw-line: #e1e7f0;
  --cw-line-strong: #ccd6e4;
  --cw-danger: #bf2f2f;
  --cw-ok: #12794a;
  --cw-warn: #8a5a00;

  /* Typography: Geist for UI, Palatino serif for headings */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;

  /* Sharp corners: the ladder resolves to sm 2.4px, md 3.2px, lg 4px, xl 5.6px */
  --radius: 0.25rem;

  /* Light theme: shadcn variables mapped to the ChronoWise palette */
  --background: #ffffff;
  --background-alt: var(--cw-paper);
  --foreground: var(--cw-navy);
  --card: #ffffff;
  --card-foreground: var(--cw-navy);
  --popover: #ffffff;
  --popover-foreground: var(--cw-navy);
  --primary: var(--cw-cobalt);
  --primary-foreground: #ffffff;
  --secondary: var(--cw-paper);
  --secondary-foreground: var(--cw-navy);
  --muted: var(--cw-paper);
  --muted-highlight: var(--cw-ice);
  --muted-foreground: var(--cw-slate);
  --accent: var(--cw-ice);
  --accent-foreground: var(--cw-navy);
  --destructive: var(--cw-danger);
  --destructive-foreground: #ffffff;
  --border: var(--cw-line);
  --input: var(--cw-line-strong);
  --ring: var(--cw-cobalt);
  --collection-filter-active: var(--cw-cobalt);
  --collection-filter-badge: var(--cw-cobalt);
  --chart-1: var(--cw-cobalt);
  --chart-2: var(--cw-navy);
  --chart-3: #6f8fd6;
  --chart-4: #9ab8e4;
  --chart-5: var(--cw-slate);
  --sidebar: var(--cw-paper);
  --sidebar-foreground: var(--cw-navy);
  --sidebar-primary: var(--cw-cobalt);
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: var(--cw-ice);
  --sidebar-accent-foreground: var(--cw-navy);
  --sidebar-border: var(--cw-line);
  --sidebar-ring: var(--cw-cobalt);
}

/*
 * Dark theme: a navy "night" variant. The ChronoWise brand itself is
 * light-only; this keeps Paperclip's dark toggle usable without leaving
 * the palette.
 */
.dark {
  --background: #0e1b30;
  --background-alt: #0a1526;
  --foreground: #e8eef8;
  --card: #12233d;
  --card-foreground: #e8eef8;
  --popover: #12233d;
  --popover-foreground: #e8eef8;
  --primary: var(--cw-cobalt-vivid);
  --primary-foreground: #ffffff;
  --secondary: #1a2f4f;
  --secondary-foreground: #e8eef8;
  --muted: #1a2f4f;
  --muted-highlight: #22395e;
  --muted-foreground: #9ab0cf;
  --accent: #1f3a66;
  --accent-foreground: #e8eef8;
  --destructive: #e05252;
  --destructive-foreground: #ffffff;
  --border: rgb(255 255 255 / 10%);
  --input: rgb(255 255 255 / 16%);
  --ring: var(--cw-cobalt-vivid);
  --sidebar: #0a1526;
  --sidebar-foreground: #e8eef8;
  --sidebar-primary: var(--cw-cobalt-vivid);
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #1a2f4f;
  --sidebar-accent-foreground: #e8eef8;
  --sidebar-border: rgb(255 255 255 / 10%);
  --sidebar-ring: var(--cw-cobalt-vivid);
}

/* Serif display headings, following the ChronoWise editorial voice */
h1, h2 {
  font-family: var(--font-heading);
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Brand focus ring: 2px cobalt with a 3px offset */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

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