/* =====================================================================
   PEBBLE – design tokens
   Soft neumorphism: every surface shares the page colour, depth comes
   only from a pair of shadows (light from the top-left).
   Themes are CSS variables on [data-theme] ("light" | "dark"), on <html>
   or on any container. Light is the default.
   ===================================================================== */

/* ---------- colours: light (default) ---------- */
:root,
[data-theme="light"] {
  color-scheme: light;

  --pb-bg: #e4e9f0; /* page = every surface */
  --pb-bg-2: #d8dfe8; /* slightly recessed tint */
  --pb-line: rgba(110, 124, 146, 0.22); /* hairline dividers */

  --pb-text: #26303c;
  --pb-mute: #525d6b;
  --pb-faint: #6b7380; /* placeholders, disabled text */

  --pb-accent: #3554d6;
  --pb-accent-hover: #2c48c0;
  --pb-on-accent: #ffffff;
  --pb-accent-soft: rgba(53, 84, 214, 0.1);
  --pb-accent-press: rgba(10, 20, 80, 0.45); /* inner shadow of a pressed primary button */

  --pb-ok: #137a42;
  --pb-warn: #a35500;
  --pb-bad: #b8322a;
  --pb-bad-hover: #9e2922;
  --pb-bad-text: #a3261f;
  --pb-bad-text-hover: #8a1c16;
  --pb-on-bad: #ffffff;

  --pb-dark: #b3bdca; /* shadow, bottom-right */
  --pb-light: #ffffff; /* highlight, top-left */
  --pb-elev: rgba(179, 189, 202, 0.45); /* soft drop shadow of the bars */
  --pb-float: rgba(38, 48, 60, 0.22); /* sheets */
  --pb-overlay: rgba(17, 20, 24, 0.4); /* modal backdrop */

  --pb-toast-bg: #26303c;
  --pb-toast-text: #ffffff;
  --pb-icon-tile: #eef1f5; /* behind program icons on flat surfaces */
}

/* ---------- colours: dark ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --pb-bg: #232a34;
  --pb-bg-2: #1c222b;
  --pb-line: rgba(160, 175, 200, 0.14);

  --pb-text: #e6ebf2;
  --pb-mute: #a3adbb;
  --pb-faint: #7d8896;

  --pb-accent: #7f98ff;
  --pb-accent-hover: #9aaeff;
  --pb-on-accent: #0b1440;
  --pb-accent-soft: rgba(127, 152, 255, 0.14);
  --pb-accent-press: rgba(5, 10, 40, 0.55);

  --pb-ok: #4ade80;
  --pb-warn: #f5b942;
  --pb-bad: #f87171;
  --pb-bad-hover: #fa8f8f;
  --pb-bad-text: #fca5a5;
  --pb-bad-text-hover: #fecaca;
  --pb-on-bad: #2a0b0d;

  --pb-dark: #151a21;
  --pb-light: #303846;
  --pb-elev: rgba(0, 0, 0, 0.35);
  --pb-float: rgba(0, 0, 0, 0.5);
  --pb-overlay: rgba(3, 6, 10, 0.66);

  --pb-toast-bg: #e6ebf2;
  --pb-toast-text: #11161d;
  --pb-icon-tile: #2c3440;
}

/* ---------- depth: recomputed on every themed element so nested themes get their own shadows ---------- */
:root,
[data-theme] {
  --pb-raise:
    calc(7px * var(--pb-depth)) calc(7px * var(--pb-depth)) calc(16px * var(--pb-depth)) var(--pb-dark),
    calc(-7px * var(--pb-depth)) calc(-7px * var(--pb-depth)) calc(16px * var(--pb-depth)) var(--pb-light);
  --pb-raise-sm:
    calc(4px * var(--pb-depth)) calc(4px * var(--pb-depth)) calc(9px * var(--pb-depth)) var(--pb-dark),
    calc(-4px * var(--pb-depth)) calc(-4px * var(--pb-depth)) calc(9px * var(--pb-depth)) var(--pb-light);
  --pb-raise-xs:
    2px 2px 4px var(--pb-dark),
    -2px -2px 4px var(--pb-light);
  --pb-inset:
    inset calc(4px * var(--pb-depth)) calc(4px * var(--pb-depth)) calc(9px * var(--pb-depth)) var(--pb-dark),
    inset calc(-4px * var(--pb-depth)) calc(-4px * var(--pb-depth)) calc(9px * var(--pb-depth)) var(--pb-light);
  --pb-inset-sm:
    inset 2px 2px 3px var(--pb-dark),
    inset -2px -2px 3px var(--pb-light);
}

/* ---------- shape, type, spacing, motion ---------- */
:root {
  --pb-depth: 1; /* scales every shadow */

  --pb-font-display: "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --pb-font: "Nunito Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --pb-font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;

  --pb-fs-xs: 13px;
  --pb-fs-sm: 14px;
  --pb-fs-md: 16px;
  --pb-fs-lg: 20px;
  --pb-fs-xl: 26px;

  --pb-s1: 4px;
  --pb-s2: 8px;
  --pb-s3: 12px;
  --pb-s4: 16px;
  --pb-s5: 24px;
  --pb-s6: 32px;
  --pb-s7: 48px;

  --pb-r1: 14px; /* buttons, inputs, keys */
  --pb-r2: 22px; /* cards, lists, rows */
  --pb-r3: 30px; /* sheets */
  --pb-r-pill: 999px;

  --pb-tap: 44px; /* minimum touch target */
  --pb-nav-w: 232px; /* desktop side menu */
  --pb-max-w: 1200px; /* content column */

  --pb-t-fast: 160ms;
  --pb-t-med: 240ms;
  --pb-ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
  --pb-ease-in: cubic-bezier(0.5, 0, 0.8, 0.4);
}

/* Phones: lighter shadows so small surfaces don't look muddy */
@media (max-width: 600px) {
  :root {
    --pb-depth: 0.75;
  }
}
