/* The theme contract: `theme-*` utilities over the `--theme-*` tokens, which
 * src/theme generates from a scheme of three choices (base, accent, contrast).
 * Hosts set the tokens at runtime with applyTheme; the defaults below are the
 * default theme's light and dark schemes, for standalone use and for any token
 * a host leaves unset, with display-p3 values for wide-gamut screens. Each pairs
 * its modes with light-dark(), so it follows the CSS color-scheme a host sets.
 *
 * Sidebar tokens (--theme-sidebar-*) are part of the contract but have no
 * defaults here: hosts supply per-site fallbacks at the use sites, and a global
 * default would override them. */

/* generated:start (src/theme/derive.test.ts checks this; UPDATE_THEME_CSS=1 rewrites it) */
:root {
  --theme-app-bg: light-dark(#f3f4f6, #111418);
  --theme-panel-bg: light-dark(#fcfeff, #151c25);
  --theme-panel-hover: light-dark(#f2f5f9, #1e262e);
  --theme-muted-panel-bg: light-dark(#e7eaee, #1c242c);
  --theme-hover: light-dark(#e3e5e9, #323a43);
  --theme-input-bg: light-dark(#fafcfe, #182028);
  --theme-input-disabled-bg: light-dark(#ebeef1, #131a22);
  --theme-app: light-dark(#0a101b, #e9f1fa);
  --theme-muted-text-color: light-dark(#4e5664, #c8d1d9);
  --theme-placeholder: light-dark(#7e8796, #9da5ad);
  --theme-link: light-dark(#06354f, #9dd7ff);
  --theme-border: light-dark(#cacdd0, #30363d);
  --theme-border-field: light-dark(#bdc0c3, #3a4148);
  --theme-border-strong: light-dark(#848689, #676e76);
  --theme-accent: light-dark(#06354f, #5b9ccf);
  --theme-accent-text: light-dark(#ffffff, #000000);
  --theme-accent-hover: light-dark(#002841, #6aace0);
  --theme-accent-subtle: light-dark(#d3ebfc, #0f2638);
  --theme-focus: light-dark(#06354f, #5b9ccf);
  --theme-focus-ring: light-dark(rgba(6, 53, 79, 0.25), rgba(91, 156, 207, 0.35));
  --theme-success: light-dark(#00973d, #00bf54);
  --theme-success-text: light-dark(#006226, #6be88c);
  --theme-success-solid: #00873c;
  --theme-success-muted: light-dark(rgba(0, 151, 61, 0.1), rgba(0, 191, 84, 0.15));
  --theme-error: light-dark(#ea4841, #ff6056);
  --theme-error-text: light-dark(#a11a1b, #ffc1b8);
  --theme-error-solid: #db3934;
  --theme-error-muted: light-dark(rgba(234, 72, 65, 0.1), rgba(255, 96, 86, 0.15));
  --theme-warning: light-dark(#bd7100, #dd8900);
  --theme-warning-text: light-dark(#7b4a00, #ffc672);
  --theme-warning-solid: #a76900;
  --theme-warning-muted: light-dark(rgba(189, 113, 0, 0.1), rgba(221, 137, 0, 0.15));
  --theme-info: light-dark(#0681f8, #499fff);
  --theme-info-text: light-dark(#0050af, #abd4ff);
  --theme-info-solid: light-dark(#0073e8, #0073e9);
  --theme-info-muted: light-dark(rgba(6, 129, 248, 0.1), rgba(73, 159, 255, 0.15));
  --theme-favorite: light-dark(#e7457a, #fe5c8e);
  --theme-favorite-text: light-dark(#9e174b, #ffbecd);
  --theme-favorite-solid: #d7366e;
  --theme-favorite-muted: light-dark(rgba(231, 69, 122, 0.1), rgba(254, 92, 142, 0.15));
  --theme-shadow-sm: 0 1px 2px light-dark(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.35));
  --theme-shadow:
    0 4px 6px -1px light-dark(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.35)),
    0 2px 4px -2px light-dark(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.35));
  --theme-shadow-lg:
    0 10px 15px -3px light-dark(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.35)),
    0 4px 6px -4px light-dark(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.35));
  --theme-shadow-xl:
    0 25px 80px -20px light-dark(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6)),
    0 10px 30px -10px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4));
  --theme-backdrop: light-dark(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.65));
  --theme-code-bg: light-dark(#e7eaee, #1c242c);
  --theme-code-text: light-dark(#1c2330, #e1e9f2);
  --theme-code-comment: light-dark(#555d6c, #c0c8d1);
  --theme-code-keyword: light-dark(#36617d, #8cceff);
  --theme-code-string: light-dark(#196a24, #8bd98d);
  --theme-code-number: light-dark(#944500, #ffb882);
  --theme-code-function: light-dark(#6c4b9e, #d3bcff);
  --theme-code-type: light-dark(#006565, #31dbdb);
  --theme-code-property: light-dark(#5a51a5, #31dbdb);
  --theme-ansi-black: light-dark(#1c2330, #c0c8d1);
  --theme-ansi-red: light-dark(#a3322d, #ffb5ab);
  --theme-ansi-green: light-dark(#006a12, #7fdb83);
  --theme-ansi-yellow: light-dark(#755800, #edc23e);
  --theme-ansi-blue: light-dark(#0b5aae, #9ecbff);
  --theme-ansi-magenta: light-dark(#8d3a88, #ffaafe);
  --theme-ansi-cyan: light-dark(#00666c, #00dbe5);
  --theme-ansi-white: light-dark(#555d6c, #e1e9f2);
  --theme-category-1: light-dark(#ffcfce, #593030);
  --theme-category-1-text: light-dark(#6e3537, #fed2d0);
  --theme-category-2: light-dark(#f7d6b8, #533618);
  --theme-category-2-text: light-dark(#673f12, #f6d8bc);
  --theme-category-3: light-dark(#dfe1b7, #3f4017);
  --theme-category-3-text: light-dark(#4e4e11, #dfe2bc);
  --theme-category-4: light-dark(#c1e8cd, #20462f);
  --theme-category-4-text: light-dark(#1f5636, #c5e8d0);
  --theme-category-5: light-dark(#b3e9eb, #034649);
  --theme-category-5-text: light-dark(#00555a, #b8e9eb);
  --theme-category-6: light-dark(#c0e2ff, #1f405b);
  --theme-category-6-text: light-dark(#1f4e73, #c3e2fe);
  --theme-category-7: light-dark(#dcd8ff, #3d375a);
  --theme-category-7-text: light-dark(#4a4273, #ddd9fe);
  --theme-category-8: light-dark(#f5d0ec, #50314a);
  --theme-category-8-text: light-dark(#63385a, #f4d2eb);
}

@media (color-gamut: p3) {
  :root {
    --theme-success: light-dark(color(display-p3 0.1559 0.5942 0.2459), #00bf54);
    --theme-success-solid: color(display-p3 0.0738 0.5422 0.1959);
    --theme-success-muted: light-dark(
      color(display-p3 0.1559 0.5942 0.2459 / 0.1),
      rgba(0, 191, 84, 0.15)
    );
    --theme-warning: light-dark(#bd7100, color(display-p3 0.8343 0.5429 0));
    --theme-warning-solid: light-dark(
      color(display-p3 0.6474 0.4089 0),
      color(display-p3 0.6478 0.4092 0)
    );
    --theme-warning-muted: light-dark(
      rgba(189, 113, 0, 0.1),
      color(display-p3 0.8343 0.5429 0 / 0.15)
    );
    --theme-code-number: light-dark(#944500, color(display-p3 1 0.7209 0.5024));
    --theme-ansi-red: light-dark(#a3322d, color(display-p3 1 0.7032 0.6565));
    --theme-ansi-cyan: light-dark(color(display-p3 0 0.4024 0.4329), #00dbe5);
  }
}
/* generated:end */

/* A status lamp's light: a vivid top fading to a pale bottom, so it looks lit from inside.
   The same in light and dark; a theme may set its own. The status's words beside it carry its
   meaning in the text tones, so the lamp needn't hold a contrast of its own. */
:root {
  --lamp-success-from: #13fb04;
  --lamp-success-to: #aded99;
  --lamp-error-from: #fb131b;
  --lamp-error-to: #edad99;
  --lamp-warning-from: #f9a004;
  --lamp-warning-to: #ead698;
  --lamp-info-from: #045ef9;
  --lamp-info-to: #036efb;
  --lamp-muted-from: #8a939e;
  --lamp-muted-to: #d3d8de;
  --lamp-accent-from: var(--theme-accent);
  --lamp-accent-to: color-mix(in oklch, var(--theme-accent), white 55%);
  --lamp-default-from: var(--theme-app);
  --lamp-default-to: color-mix(in oklch, var(--theme-app), white 55%);
}

@utility theme-accent {
  background-color: var(--theme-accent, #06354f);
  color: var(--theme-accent-text, #ffffff);
}

@utility theme-app {
  background-color: var(--theme-app-bg, #ffffff);
  color: var(--theme-app, #000000);
}

@utility theme-panel {
  background-color: var(--theme-panel-bg, #fff);
  color: var(--theme-app, #000);
}

/* The bordered panel graphs and settings cards sit in; graph circles hide connectors with its color. */
@utility panel {
  @apply border-solid rounded-xl border border-(--theme-border) theme-panel;
}

@utility theme-muted-panel {
  background-color: var(--theme-muted-panel-bg, #f8f9fa);
  color: var(--theme-muted-text-color, #5f6b76);
}

@utility theme-muted-text {
  color: var(--theme-muted-text-color, #5f6b76);
}

@utility theme-text {
  color: var(--theme-app, #000000);
}

/* Utility for theme-aware hover states */
@utility theme-hover {
  transition:
    background-color 0.15s ease-in-out,
    color 0.15s ease-in-out;
  background-color: var(--theme-hover, #f3f4f6);
  color: var(--theme-app, #000000);
}

/* Utility for theme-aware borders */
.theme-border {
  border-color: var(--theme-border, #d1d5db);
}

.theme-hover-text {
  color: var(--theme-app);
}

.tooltip {
  color: var(--theme-muted-text-color, #5f6b76);
}
.tooltip:hover {
  color: var(--theme-app, #000000);
}

.config-tips .multi-line {
  /* biome-ignore lint/complexity/noImportantStyles: must win over the tooltip library's own alignment */
  text-align: left !important;
}

/* Base UI hides the native scrollbar of a select or scroll area with this
 * class, and would inject the rule as an inline <style>, which a same-origin
 * style policy blocks. UIProvider turns that off, so the rule ships here. */
.base-ui-disable-scrollbar {
  scrollbar-width: none;
}

.base-ui-disable-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Theme-aware scrollbars */
.theme-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--theme-border, #d1d5db) var(--theme-panel-bg, #ffffff);
}

.theme-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.theme-scrollbar::-webkit-scrollbar-track {
  background: var(--theme-panel-bg, #ffffff);
  border-radius: 4px;
}

.theme-scrollbar::-webkit-scrollbar-thumb {
  background: var(--theme-border, #d1d5db);
  border-radius: 4px;
  border: 1px solid var(--theme-panel-bg, #ffffff);
}

.theme-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--theme-accent, #3b82f6);
}

.theme-scrollbar::-webkit-scrollbar-corner {
  background: var(--theme-panel-bg, #ffffff);
}

/* Small theme-aware scrollbars */
.theme-scrollbar-small {
  scrollbar-width: thin;
  scrollbar-color: var(--theme-border, #d1d5db) var(--theme-panel-bg, #ffffff);
}

.theme-scrollbar-small::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.theme-scrollbar-small::-webkit-scrollbar-track {
  background: var(--theme-panel-bg, #ffffff);
  border-radius: 2px;
}

.theme-scrollbar-small::-webkit-scrollbar-thumb {
  background: var(--theme-border, #d1d5db);
  border-radius: 2px;
}

.theme-scrollbar-small::-webkit-scrollbar-thumb:hover {
  background: var(--theme-accent, #3b82f6);
}

.theme-scrollbar-small::-webkit-scrollbar-corner {
  background: var(--theme-panel-bg, #ffffff);
}

@keyframes logo-loader-ripple {
  0%,
  100% {
    opacity: 0.18;
  }
  30% {
    opacity: 1;
  }
}

.logo-loader-ring {
  animation: logo-loader-ripple 2.2s ease-in-out infinite backwards;
}

@media (prefers-reduced-motion: reduce) {
  .logo-loader-ring {
    animation: none;
    opacity: 1;
  }
}

/* ErrorPage: the status code in the theme's gradient over two slowly drifting
 * glows and a faint grid. A theme that sets --gradient-start and --gradient-mid
 * picks the two colors; otherwise they are its link color, kept vivid, and that color turned toward
 * violet, which read on the page in either scheme. */
@utility error-page-code {
  background: linear-gradient(
    135deg,
    var(--gradient-start, oklch(from var(--theme-link) l max(c, 0.14) h)) 0%,
    var(--gradient-mid, oklch(from var(--theme-link) l max(c, 0.14) calc(h + 45))) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.error-page-glow {
  position: absolute;
  border-radius: 9999px;
  filter: blur(120px);
  animation: error-page-float 8s ease-in-out infinite;
}

/* Stronger in the dark, where a faint glow on a dark page disappears. */
.error-page-glow-start {
  background-color: light-dark(
    color-mix(
      in oklab,
      var(--gradient-start, oklch(from var(--theme-link) l max(c, 0.14) h)) 12%,
      transparent
    ),
    color-mix(
      in oklab,
      var(--gradient-start, oklch(from var(--theme-link) l max(c, 0.14) h)) 20%,
      transparent
    )
  );
}

.error-page-glow-mid {
  background-color: light-dark(
    color-mix(
      in oklab,
      var(--gradient-mid, oklch(from var(--theme-link) l max(c, 0.14) calc(h + 45))) 12%,
      transparent
    ),
    color-mix(
      in oklab,
      var(--gradient-mid, oklch(from var(--theme-link) l max(c, 0.14) calc(h + 45))) 20%,
      transparent
    )
  );
}

.error-page-grid {
  background-image:
    linear-gradient(var(--theme-app) 1px, transparent 1px),
    linear-gradient(90deg, var(--theme-app) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.03;
}

.error-page-content {
  animation: error-page-in 0.5s ease-out both;
}

@keyframes error-page-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes error-page-float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(24px, -24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .error-page-glow,
  .error-page-content {
    animation: none;
  }
}

/* Geist itself loads from fonts.css; without it these fall back to system-ui. */
@theme {
  --font-geist-sans: "Geist Sans";
  --font-geist-mono: "Geist Mono";
  --font-sans: var(--font-geist-sans), system-ui, sans-serif;
  --font-mono:
    var(--font-geist-mono), ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas,
    monospace;
}
