/* Design tokens: colours (light, dark, and the data-theme overrides), radii, fonts, the sidebar's size.
   Everything else reads these custom properties; nothing here styles an element. */

/* F.L.I.K. — on the Skynet Design System (skynet-app SKYNET_UI.md, globals.css): the same lightness
   tiers, radius scale, Panel surface, hairline sections and phone shell. The accent is F.L.I.K.'s pink,
   and it only ever marks what is yours or what needs you: your messages, the send button, live work,
   an approval waiting. Everything else stays quiet so the cat can be the loud thing. */

:root {
  color-scheme: light;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-display: "Sora", "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --background: oklch(0.905 0.004 80);
  --foreground: oklch(0.15 0.004 270);
  --card: oklch(0.975 0.002 80);
  --popover: oklch(0.985 0.002 80);
  --primary: oklch(0.21 0.006 270);
  --primary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.92 0.003 270);
  --muted-foreground: oklch(0.5 0.012 270);
  --border: oklch(0.83 0.006 270);
  --input: oklch(0.85 0.005 270);
  --dot-color: oklch(0.15 0.004 270 / 0.085);

  --panel-bg: color-mix(in oklab, var(--card) 60%, transparent);
  --panel-edge: color-mix(in oklab, var(--border) 60%, transparent);
  --code-bg: color-mix(in oklab, var(--muted) 70%, transparent);
  --mine-bg: color-mix(in oklab, var(--pink) 13%, var(--card));
  --shadow-lg: 0 18px 50px -20px rgb(40 10 30 / 0.35);
  --sidebar: oklch(0.93 0.004 270);
  --sidebar-w: 240px;
  --sidebar-rail: 58px;
  --side-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --tool-accent: light-dark(#0e9f7c, #14c79a);
  --pink: var(--tool-accent);
  --pink-ink: light-dark(color-mix(in oklab, var(--tool-accent) 70%, black), color-mix(in oklab, var(--tool-accent) 72%, white));
  --on-pink: var(--primary-foreground);
  --good: var(--color-emerald-400);
  --warn: var(--color-amber-400);
  --bad: var(--color-red-400);
  --accent-surface: var(--accent);
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 6px;
  --r-xl: 8px;
  --r-2xl: 10px;
  --r-3xl: 12px;
  /* Between a dropdown and what opened it: the view list, the tray, "/", Polish and the backlog card
     all sit this far above their chip (or the bar, while typing hides the chips) */
  --drop-gap: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: oklch(0.145 0.004 245);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.225 0.012 245);
    --popover: oklch(0.262 0.012 245);
    --primary: oklch(1 0 0);
    --primary-foreground: oklch(0.145 0 0);
    --muted: oklch(0.265 0.01 245);
    --muted-foreground: oklch(0.72 0.018 245);
    --accent-surface: oklch(0.285 0.015 245);
    --border: oklch(0.46 0.014 245 / 80%);
    --input: oklch(0.46 0.014 245 / 75%);
    --dot-color: oklch(0.99 0 0 / 0.065);
    --pink-ink: #ff8cc6;
    --good: #34d399;
    --warn: #fbbf24;
    --bad: #f87171;
    --panel-bg: color-mix(in oklab, var(--card) 40%, transparent);
    --code-bg: rgb(0 0 0 / 0.45);
    --mine-bg: color-mix(in oklab, var(--pink) 22%, var(--card));
    --shadow-lg: 0 18px 50px -18px rgb(0 0 0 / 0.7);
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sidebar: oklch(0.2 0.01 245);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.145 0.004 245);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.225 0.012 245);
  --popover: oklch(0.262 0.012 245);
  --primary: oklch(1 0 0);
  --primary-foreground: oklch(0.145 0 0);
  --muted: oklch(0.265 0.01 245);
  --muted-foreground: oklch(0.72 0.018 245);
  --accent-surface: oklch(0.285 0.015 245);
  --border: oklch(0.46 0.014 245 / 80%);
  --input: oklch(0.46 0.014 245 / 75%);
  --dot-color: oklch(0.99 0 0 / 0.065);
  --pink-ink: #ff8cc6;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --panel-bg: color-mix(in oklab, var(--card) 40%, transparent);
  --code-bg: rgb(0 0 0 / 0.45);
  --mine-bg: color-mix(in oklab, var(--pink) 22%, var(--card));
  --shadow-lg: 0 18px 50px -18px rgb(0 0 0 / 0.7);
  --sidebar: oklch(0.2 0.01 245);
}

/* A scheme of its own for one part, whatever the page's: the bars over a previewed app read in the scheme
   of the app's colour under them (preview/room.js). The colours the two differ by (here and skynet.css's),
   and the ones made from them, which :root has already worked out in its own. The accents follow by
   light-dark(). */
.scheme-light {
  color-scheme: light;
  --background: oklch(0.905 0.004 80);
  --foreground: oklch(0.15 0.004 270);
  --card: oklch(0.975 0.002 80);
  --card-foreground: oklch(0.15 0.004 270);
  --popover: oklch(0.985 0.002 80);
  --popover-foreground: oklch(0.15 0.004 270);
  --primary: oklch(0.21 0.006 270);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.91 0.004 270);
  --secondary-foreground: oklch(0.205 0.004 270);
  --muted: oklch(0.92 0.003 270);
  --muted-foreground: oklch(0.5 0.012 270);
  --accent: oklch(0.9 0.007 250);
  --accent-foreground: oklch(0.205 0.004 270);
  --accent-surface: var(--accent);
  --destructive: oklch(0.61 0.205 25);
  --border: oklch(0.83 0.006 270);
  --input: oklch(0.85 0.005 270);
  --ring: oklch(0.62 0.13 235);
  --dot-color: oklch(0.15 0.004 270 / 0.085);
  --pink-ink: light-dark(color-mix(in oklab, var(--tool-accent) 70%, black), color-mix(in oklab, var(--tool-accent) 72%, white));
  --good: var(--color-emerald-400);
  --warn: var(--color-amber-400);
  --bad: var(--color-red-400);
  --panel-bg: color-mix(in oklab, var(--card) 60%, transparent);
  --panel-edge: color-mix(in oklab, var(--border) 60%, transparent);
  --code-bg: color-mix(in oklab, var(--muted) 70%, transparent);
  --mine-bg: color-mix(in oklab, var(--pink) 13%, var(--card));
  --shadow-lg: 0 18px 50px -20px rgb(40 10 30 / 0.35);
  --sidebar: oklch(0.93 0.004 270);
}
.scheme-dark {
  color-scheme: dark;
  --background: oklch(0.145 0.004 245);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.225 0.012 245);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.262 0.012 245);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(1 0 0);
  --primary-foreground: oklch(0.145 0 0);
  --secondary: oklch(0.295 0.02 245);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.265 0.01 245);
  --muted-foreground: oklch(0.72 0.018 245);
  --accent: oklch(0.285 0.015 245);
  --accent-foreground: oklch(0.985 0 0);
  --accent-surface: oklch(0.285 0.015 245);
  --destructive: oklch(0.66 0.19 25);
  --border: oklch(0.46 0.014 245 / 80%);
  --input: oklch(0.46 0.014 245 / 75%);
  --ring: oklch(0.74 0.12 230);
  --dot-color: oklch(0.99 0 0 / 0.065);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --panel-bg: color-mix(in oklab, var(--card) 40%, transparent);
  --panel-edge: color-mix(in oklab, var(--border) 60%, transparent);
  --code-bg: rgb(0 0 0 / 0.45);
  --mine-bg: color-mix(in oklab, var(--pink) 22%, var(--card));
  --shadow-lg: 0 18px 50px -18px rgb(0 0 0 / 0.7);
  --sidebar: oklch(0.2 0.01 245);
}

/* The theme (Settings → General, set early by theme.js): an accent of its own instead of the default
   pink, the notch app's palettes. */
:root[data-accent="pink"] {
  --tool-accent: light-dark(#db2777, #fe48a5);
}
:root[data-accent="blue"] {
  --tool-accent: light-dark(#2f62e0, #3772ff);
}
:root[data-accent="fuchsia"] {
  --tool-accent: light-dark(#c026d3, #d946ef);
}
:root[data-accent="violet"] {
  --tool-accent: light-dark(#6d28d9, #8b5cf6);
}
:root[data-accent="mint"] {
  --tool-accent: light-dark(#0e9f7c, #14c79a);
}
:root[data-accent="sunset"] {
  --tool-accent: light-dark(#e2541b, #ff7a3d);
}
:root[data-accent="custom"] {
  --tool-accent: light-dark(color-mix(in oklab, var(--custom-accent) 85%, black), var(--custom-accent));
}
:root[data-accent="pink"]:is(.dark, [data-theme="dark"]) {
  --pink-ink: #ff8cc6;
}
:root[data-accent="blue"]:is(.dark, [data-theme="dark"]) {
  --pink-ink: #8fb0ff;
}
:root[data-accent="fuchsia"]:is(.dark, [data-theme="dark"]) {
  --pink-ink: #f0abfc;
}
:root[data-accent="violet"]:is(.dark, [data-theme="dark"]) {
  --pink-ink: #b794ff;
}
:root[data-accent="mint"]:is(.dark, [data-theme="dark"]) {
  --pink-ink: #6ee7c8;
}
:root[data-accent="sunset"]:is(.dark, [data-theme="dark"]) {
  --pink-ink: #ffaa70;
}
:root[data-accent="custom"]:is(.dark, [data-theme="dark"]) {
  --pink-ink: color-mix(in oklab, var(--custom-accent) 60%, white);
}

/* 1 · The accent is Skynet's --tool-accent, a light-dark() pair; ink is Skynet's --color-tool-ink formula;
       state colours are Skynet's re-pointed 400 steps (skynet.css). */
.dark {
  --on-pink: var(--primary-foreground);
}

/* Where content may start at the top: the status bar's safe area. In the installed iPhone app, iOS
   draws its own soft blur a little past the status bar, over whatever sits there, so headers start
   below that too. The status-bar band (base.css) stays on the real safe area. */
:root {
  --safe-top: env(safe-area-inset-top);
}
@media (display-mode: standalone) {
  @supports (-webkit-touch-callout: none) {
    :root {
      --safe-top: calc(env(safe-area-inset-top) + 18px);
    }
  }
}
