/* ==========================================================================
   Design tokens — JetBrains "New UI" Dark + IntelliJ Light
   Values are matched to the shipping IDE themes rather than invented.
   ========================================================================== */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: block;
  src: url('../fonts/jetbrainsmono-var-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: italic;
  font-weight: 100 800;
  font-display: block;
  src: url('../fonts/jetbrainsmono-var-italic-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
  src: url('../fonts/inter-var-latin.woff2') format('woff2');
}

:root {
  /* ---- geometry: JetBrains chrome density ---- */
  --h-menubar: 30px;
  --h-toolbar: 36px;
  --h-navbar: 26px;
  --h-tab: 32px;
  --h-tw-header: 26px;
  --h-status: 24px;
  --w-stripe: 25px;
  --h-stripe: 25px;
  --gutter-pad: 4px;
  --w-marker: 14px;
  --radius-s: 3px;
  --radius-m: 5px;
  --radius-l: 8px;

  --font-ui: 'Inter', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --fs-ui: 12px;
  --fs-ui-s: 11px;
  --fs-editor: 13px;
  --lh-editor: 18px;

  --z-toolwindow: 20;
  --z-float: 400;
  --z-popup: 600;
  --z-modal: 800;
  --z-tooltip: 900;
  --z-balloon: 700;

  --ease: cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ==================== DARK (JetBrains New UI Dark) ==================== */
:root, [data-theme='darcula'] {
  --bg-app: #2b2d30;
  --bg-panel: #2b2d30;
  --bg-editor: #1e1f22;
  --bg-gutter: #1e1f22;
  --bg-toolbar: #2b2d30;
  --bg-stripe: #2b2d30;
  --bg-tab-active: #1e1f22;
  --bg-tab-hover: #393b40;
  --bg-input: #1e1f22;
  --bg-popup: #2b2d30;
  --bg-popup-header: #313438;
  --bg-tooltip: #2b2d30;
  --bg-dialog: #2b2d30;
  --bg-overlay: rgba(0, 0, 0, 0.35);
  --bg-hover: #393b40;
  --bg-pressed: #43454a;
  --bg-sel: #2e436e;
  --bg-sel-inactive: #43454a;
  --bg-sel-soft: #26364f;

  --bd: #1e1f22;
  --bd-soft: #393b40;
  --bd-strong: #4e5157;
  --bd-focus: #3574f0;

  --fg: #dfe1e5;
  --fg-dim: #9da0a8;
  --fg-muted: #6f737a;
  --fg-disabled: #5a5d63;
  --fg-inverse: #1e1f22;

  --accent: #3574f0;
  --accent-hover: #4682fa;
  --accent-press: #2b62d4;
  --accent-fg: #ffffff;
  --accent-soft: #1f3a68;

  --run-green: #5fad65;
  --debug-green: #499c54;
  --stop-red: #db5c5c;

  /* editor decorations */
  --ed-caret: #cdd0d6;
  --ed-caretrow: #26282e;
  --ed-selection: #214283;
  --ed-selection-inactive: #3a3d41;
  --ed-linenum: #4b5059;
  --ed-linenum-active: #adaeb5;
  --ed-indent-guide: #313438;
  --ed-indent-guide-active: #5a5d63;
  --ed-margin-line: #303236;
  --ed-fold-bg: #33383d;
  --ed-fold-fg: #737780;
  --ed-brace-match: #3b514d;
  --ed-usage-read: #344134;
  --ed-usage-write: #40332b;
  --ed-search: #32593d;
  --ed-search-current: #155a2a;
  --ed-search-outline: #5fad65;
  --ed-whitespace: #45484d;
  --ed-breakpoint: #db5c5c;
  --ed-ruler: #303236;

  --sq-error: #f75464;
  --sq-warning: #bd9020;
  --sq-weak: #7c7c7c;
  --sq-typo: #598e4f;
  --sq-info: #4f8ba8;
  --bg-error: rgba(247, 84, 100, 0.09);
  --bg-warning: rgba(189, 144, 32, 0.11);

  --stripe-error: #f75464;
  --stripe-warning: #c9a227;
  --stripe-weak: #7d7d70;
  --stripe-typo: #598e4f;
  --stripe-info: #4f8ba8;
  --stripe-search: #4a8f5b;
  --stripe-caret: #b0b3b8;
  --stripe-bg: #1e1f22;

  --vcs-added: #549159;
  --vcs-modified: #4b7fb3;
  --vcs-deleted: #6f737a;
  --vcs-conflict: #c9704f;
  --vcs-added-bg: rgba(84, 145, 89, 0.16);
  --vcs-deleted-bg: rgba(219, 92, 92, 0.14);
  --vcs-modified-bg: rgba(75, 127, 179, 0.16);
  --vcs-word-add: rgba(84, 145, 89, 0.34);
  --vcs-word-del: rgba(219, 92, 92, 0.30);

  /* syntax */
  --sy-text: #bcbec4;
  --sy-keyword: #cf8e6d;
  --sy-keyword2: #cf8e6d;
  --sy-string: #6aab73;
  --sy-string2: #6aab73;
  --sy-escape: #cf8e6d;
  --sy-number: #2aacb8;
  --sy-comment: #7a7e85;
  --sy-doc: #5f826b;
  --sy-doctag: #67a37c;
  --sy-operator: #bcbec4;
  --sy-punct: #bcbec4;
  --sy-ident: #bcbec4;
  --sy-fn: #56a8f5;
  --sy-fncall: #bcbec4;
  --sy-type: #bcbec4;
  --sy-class: #bcbec4;
  --sy-param: #bcbec4;
  --sy-local: #bcbec4;
  --sy-field: #c77dbb;
  --sy-static: #c77dbb;
  --sy-global: #c77dbb;
  --sy-const: #c77dbb;
  --sy-label: #b3ae60;
  --sy-tag: #e8bf6a;
  --sy-attr: #bcbec4;
  --sy-regexp: #42c3d4;
  --sy-annotation: #b3ae60;
  --sy-template: #bcbec4;
  --sy-invalid: #f75464;
  --sy-heading: #56a8f5;
  --sy-link: #548af7;
  --sy-inline-code: #6aab73;
  --sy-brace0: #bcbec4;
  --sy-brace1: #bcbec4;
  --sy-brace2: #bcbec4;
  --sy-html-text: #a9b7c6;
  --sy-injected-bg: rgba(60, 63, 68, 0.35);

  --scroll-thumb: #4e5157;
  --scroll-thumb-hover: #5f636b;
  --shadow-popup: 0 6px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px #393b40;
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.62), 0 0 0 1px #393b40;
  --shadow-tooltip: 0 4px 14px rgba(0, 0, 0, 0.5);
  --icon-op: 0.86;
}

/* ==================== LIGHT (IntelliJ Light) ==================== */
[data-theme='light'] {
  --bg-app: #f7f8fa;
  --bg-panel: #f7f8fa;
  --bg-editor: #ffffff;
  --bg-gutter: #ffffff;
  --bg-toolbar: #f7f8fa;
  --bg-stripe: #f7f8fa;
  --bg-tab-active: #ffffff;
  --bg-tab-hover: #dfe1e5;
  --bg-input: #ffffff;
  --bg-popup: #ffffff;
  --bg-popup-header: #f7f8fa;
  --bg-tooltip: #ffffff;
  --bg-dialog: #f7f8fa;
  --bg-overlay: rgba(0, 0, 0, 0.18);
  --bg-hover: #dfe1e5;
  --bg-pressed: #d3d5db;
  --bg-sel: #d4e2ff;
  --bg-sel-inactive: #e0e2e6;
  --bg-sel-soft: #edf3ff;

  --bd: #d3d5db;
  --bd-soft: #ebecf0;
  --bd-strong: #a8adbd;
  --bd-focus: #3574f0;

  --fg: #1e1f22;
  --fg-dim: #4a4c50;
  --fg-muted: #818594;
  --fg-disabled: #a8adbd;
  --fg-inverse: #ffffff;

  --accent: #3574f0;
  --accent-hover: #4682fa;
  --accent-press: #2b62d4;
  --accent-fg: #ffffff;
  --accent-soft: #d4e2ff;

  --run-green: #369650;
  --debug-green: #369650;
  --stop-red: #cc4b4b;

  --ed-caret: #000000;
  --ed-caretrow: #fcfaed;
  --ed-selection: #a6d2ff;
  --ed-selection-inactive: #e0e2e6;
  --ed-linenum: #adadad;
  --ed-linenum-active: #4a4c50;
  --ed-indent-guide: #eaeaea;
  --ed-indent-guide-active: #b0b0b0;
  --ed-margin-line: #ededed;
  --ed-fold-bg: #e3e6ec;
  --ed-fold-fg: #7a7e85;
  --ed-brace-match: #93d9d9;
  --ed-usage-read: #d8ecd8;
  --ed-usage-write: #f5e6d8;
  --ed-search: #c3e5c3;
  --ed-search-current: #9fdc9f;
  --ed-search-outline: #369650;
  --ed-whitespace: #d0d0d0;
  --ed-breakpoint: #db5c5c;
  --ed-ruler: #ededed;

  --sq-error: #e2504c;
  --sq-warning: #d4a11a;
  --sq-weak: #a0a0a0;
  --sq-typo: #47845d;
  --sq-info: #3f7fa8;
  --bg-error: rgba(226, 80, 76, 0.07);
  --bg-warning: rgba(212, 161, 26, 0.13);

  --stripe-error: #e2504c;
  --stripe-warning: #d9b03a;
  --stripe-weak: #b7b7a4;
  --stripe-typo: #47845d;
  --stripe-info: #3f7fa8;
  --stripe-search: #7fbb87;
  --stripe-caret: #8c8c8c;
  --stripe-bg: #ffffff;

  --vcs-added: #4a9b52;
  --vcs-modified: #4b7fb3;
  --vcs-deleted: #a0a0a0;
  --vcs-conflict: #c9704f;
  --vcs-added-bg: rgba(74, 155, 82, 0.13);
  --vcs-deleted-bg: rgba(226, 80, 76, 0.11);
  --vcs-modified-bg: rgba(75, 127, 179, 0.12);
  --vcs-word-add: rgba(74, 155, 82, 0.3);
  --vcs-word-del: rgba(226, 80, 76, 0.26);

  --sy-text: #080808;
  --sy-keyword: #0033b3;
  --sy-keyword2: #0033b3;
  --sy-string: #067d17;
  --sy-string2: #067d17;
  --sy-escape: #0037a6;
  --sy-number: #1750eb;
  --sy-comment: #8c8c8c;
  --sy-doc: #7f7f7f;
  --sy-doctag: #3d3d9e;
  --sy-operator: #080808;
  --sy-punct: #080808;
  --sy-ident: #080808;
  --sy-fn: #00627a;
  --sy-fncall: #080808;
  --sy-type: #080808;
  --sy-class: #080808;
  --sy-param: #080808;
  --sy-local: #080808;
  --sy-field: #871094;
  --sy-static: #871094;
  --sy-global: #871094;
  --sy-const: #871094;
  --sy-label: #9e880d;
  --sy-tag: #0033b3;
  --sy-attr: #174ad4;
  --sy-regexp: #0a8281;
  --sy-annotation: #9e880d;
  --sy-template: #080808;
  --sy-invalid: #e2504c;
  --sy-heading: #00627a;
  --sy-link: #1a5fb4;
  --sy-inline-code: #067d17;
  --sy-brace0: #080808;
  --sy-brace1: #080808;
  --sy-brace2: #080808;
  --sy-html-text: #080808;
  --sy-injected-bg: rgba(226, 232, 240, 0.5);

  --scroll-thumb: #c9ccd6;
  --scroll-thumb-hover: #a8adbd;
  --shadow-popup: 0 6px 20px rgba(0, 0, 0, 0.16), 0 0 0 1px #d3d5db;
  --shadow-modal: 0 16px 44px rgba(0, 0, 0, 0.22), 0 0 0 1px #d3d5db;
  --shadow-tooltip: 0 4px 12px rgba(0, 0, 0, 0.14);
  --icon-op: 0.78;
}

/* ==================== HIGH CONTRAST ==================== */
[data-theme='hc'] {
  --bg-app: #000000;
  --bg-panel: #000000;
  --bg-editor: #000000;
  --bg-gutter: #000000;
  --bg-toolbar: #000000;
  --bg-stripe: #000000;
  --bg-tab-active: #000000;
  --bg-tab-hover: #2f2f2f;
  --bg-input: #000000;
  --bg-popup: #0d0d0d;
  --bg-popup-header: #1a1a1a;
  --bg-tooltip: #0d0d0d;
  --bg-dialog: #0d0d0d;
  --bg-hover: #2f2f2f;
  --bg-pressed: #3d3d3d;
  --bg-sel: #1a4f8a;
  --bg-sel-inactive: #3d3d3d;
  --bd: #6a6a6a;
  --bd-soft: #4a4a4a;
  --bd-strong: #8a8a8a;
  --fg: #ffffff;
  --fg-dim: #d0d0d0;
  --fg-muted: #b0b0b0;
  --ed-caretrow: #1a1a1a;
  --ed-selection: #1a4f8a;
  --ed-linenum: #999999;
  --ed-linenum-active: #ffffff;
  --sy-text: #ffffff;
  --sy-keyword: #ffc66d;
  --sy-string: #6aab73;
  --sy-number: #6897bb;
  --sy-comment: #909090;
  --sy-doc: #909090;
  --sy-fn: #ffffff;
  --sy-field: #d38ec9;
  --icon-op: 1;
}

/* Reduced-motion honours the OS setting; the IDE keeps its state changes,
   it just stops animating them. */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
