/*
  Design tokens for pages built in the PyScript Builder. The look comes from an established design
  system, imported, not picked by hand: Web Awesome's default theme (webawesome.com), which sets
  the surfaces, text, brand and status colors, type, space, radius, shadows, and motion, with
  contrast built in, in light and dark. The --ds-* names below are short aliases for its tokens.

  Charts are the exception: Web Awesome has no chart palette, so the series, sequential, and
  diverging colors are a palette validated for color-blind readers. Keep the series order.

  Dark mode: the page adds Web Awesome's wa-dark class to <html> when the system is dark, unless
  <html data-theme="light"> says otherwise. wiki("design") says how to use all of this.
*/
@import url("https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3.15.0/dist-cdn/styles/themes/default.css");

:root,
.wa-light,
.wa-dark {
  /* Neutrals: most of the page. */
  --ds-page: var(--wa-color-surface-lowered);
  --ds-surface: var(--wa-color-surface-default);
  --ds-surface-raised: var(--wa-color-surface-raised);
  --ds-surface-2: var(--wa-color-neutral-fill-quiet);
  --ds-border: var(--wa-color-surface-border);
  --ds-border-strong: var(--wa-color-neutral-border-normal);
  --ds-text: var(--wa-color-text-normal);
  --ds-text-2: var(--wa-color-text-quiet);

  /* One accent, the brand color: what the user can act on, and what's selected. */
  --ds-accent: var(--wa-color-brand-fill-loud);
  --ds-on-accent: var(--wa-color-brand-on-loud);
  --ds-accent-text: var(--wa-color-text-link);
  --ds-accent-soft: var(--wa-color-brand-fill-quiet);

  /* Status: only for state. Always with an icon or a word, never color alone. */
  --ds-good: var(--wa-color-success-fill-loud);
  --ds-good-soft: var(--wa-color-success-fill-quiet);
  --ds-good-text: var(--wa-color-success-on-quiet);
  --ds-warning: var(--wa-color-warning-fill-loud);
  --ds-warning-soft: var(--wa-color-warning-fill-quiet);
  --ds-warning-text: var(--wa-color-warning-on-quiet);
  --ds-critical: var(--wa-color-danger-fill-loud);
  --ds-critical-soft: var(--wa-color-danger-fill-quiet);
  --ds-critical-text: var(--wa-color-danger-on-quiet);
  --ds-simulated-bg: var(--wa-color-warning-fill-quiet);
  --ds-simulated-text: var(--wa-color-warning-on-quiet);

  /* Type, space, shape, and motion: Web Awesome's scales. */
  --ds-font: var(--wa-font-family-body);
  --ds-font-mono: var(--wa-font-family-code);
  --ds-text-xs: var(--wa-font-size-xs);
  --ds-text-sm: var(--wa-font-size-s);
  --ds-text-md: var(--wa-font-size-m);
  --ds-text-lg: var(--wa-font-size-l);
  --ds-text-xl: var(--wa-font-size-xl);
  --ds-text-2xl: var(--wa-font-size-2xl);
  --ds-text-3xl: var(--wa-font-size-3xl);
  --ds-weight: 400;
  --ds-weight-strong: 600;
  --ds-leading: 1.5;
  --ds-leading-tight: 1.15;
  --ds-space-1: var(--wa-space-3xs);
  --ds-space-2: var(--wa-space-2xs);
  --ds-space-3: var(--wa-space-xs);
  --ds-space-4: var(--wa-space-s);
  --ds-space-5: var(--wa-space-m);
  --ds-space-6: var(--wa-space-l);
  --ds-space-7: var(--wa-space-xl);
  --ds-space-8: var(--wa-space-2xl);
  --ds-radius-sm: var(--wa-border-radius-s);
  --ds-radius: var(--wa-border-radius-m);
  --ds-radius-lg: var(--wa-border-radius-l);
  --ds-shadow: var(--wa-shadow-s);
  --ds-shadow-raised: var(--wa-shadow-m);
  --ds-fast: var(--wa-transition-fast);
  --ds-slow: var(--wa-transition-normal);
  --ds-ease: var(--wa-transition-easing);
}

:root {
  /* Chart series, in this order, never cycled. Past 8, fold into "Other". */
  --ds-series-1: #257de0;
  --ds-series-2: #f47230;
  --ds-series-3: #00b894;
  --ds-series-4: #f2a600;
  --ds-series-5: #ee7fac;
  --ds-series-6: #008a17;
  --ds-series-7: #6a4ce2;
  --ds-series-8: #ec4647;

  /* Sequential (one hue, light to dark) for magnitude. Diverging: --ds-series-1 to --ds-series-8, through --ds-midpoint. */
  --ds-seq-100: #cce3fd;
  --ds-seq-200: #9dc8f7;
  --ds-seq-300: #6aabf1;
  --ds-seq-400: #338ced;
  --ds-seq-500: #2370cd;
  --ds-seq-600: #1757ac;
  --ds-seq-700: #0e3d7e;
  --ds-midpoint: #efefef;

  /* Chart chrome: recessive. */
  --ds-grid: #e7e7e7;
  --ds-axis: #c2c2c2;
}
.wa-dark {
    --ds-series-1: #338ced; --ds-series-2: #e76624; --ds-series-3: #00a888; --ds-series-4: #d28e05;
    --ds-series-5: #e24d8b; --ds-series-6: #0aac23; --ds-series-7: #9887ef; --ds-series-8: #eb6263;
    --ds-midpoint: #383838; --ds-grid: #303030; --ds-axis: #474747;
}

@media (prefers-reduced-motion: reduce) {
  :root { --ds-fast: 0ms; --ds-slow: 0ms; }
}

/* A few ready parts, built from the tokens. Use them, or copy their pattern. */
.ds-card {
  background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-radius);
  padding: var(--ds-space-4); box-shadow: var(--ds-shadow); color: var(--ds-text);
}
/* Glass: a translucent, blurred card, for readings over a background. */
.ds-glass {
  background: color-mix(in oklab, var(--ds-surface) 72%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid color-mix(in oklab, var(--ds-text) 10%, transparent); border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-5); box-shadow: var(--ds-shadow-raised); color: var(--ds-text);
}
.ds-label { font-size: var(--ds-text-sm); color: var(--ds-text-2); }
.ds-value {
  font-size: var(--ds-text-2xl); font-weight: var(--ds-weight-strong); line-height: var(--ds-leading-tight);
  color: var(--ds-text);
}
.ds-units { font-size: var(--ds-text-sm); color: var(--ds-text-2); }
.ds-badge {
  display: inline-flex; align-items: center; gap: var(--ds-space-1); padding: 2px var(--ds-space-2);
  border-radius: 999px; font-size: var(--ds-text-xs); font-weight: var(--ds-weight-strong);
  background: var(--ds-surface-2); color: var(--ds-text-2);
}
.ds-badge.simulated { background: var(--ds-simulated-bg); color: var(--ds-simulated-text); }
.ds-badge.good { color: var(--ds-good-text); }
.ds-badge.warning { color: var(--ds-warning-text); }
.ds-badge.critical { color: var(--ds-critical-text); }
.ds-button {
  font: inherit; font-size: var(--ds-text-md); padding: var(--ds-space-2) var(--ds-space-4);
  border-radius: var(--ds-radius-sm); border: 1px solid transparent; cursor: pointer;
  background: var(--ds-accent); color: var(--ds-on-accent);
  transition: filter var(--ds-fast) var(--ds-ease);
}
.ds-button:hover { filter: brightness(1.08); }
.ds-button.quiet { background: transparent; color: var(--ds-accent-text); border-color: var(--ds-border-strong); }
.ds-button:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
