/* eitri design system: tokens, type, and the few components every page shares.
   Dark engineering theme by default; [data-theme="light"] on <html> switches to light.
   One accent (signal orange) used sparingly: primary actions, the active tool, focus, the wordmark.
   Status colours are separate from it: green = check passes, red = check fails, amber = warning.
   Fonts and icons are bundled (assets/fonts, assets/icons.svg): nothing is fetched from the internet. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/jetbrains-mono-500.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  /* surfaces, from the page back to the most raised */
  --bg: #0d1015;
  --bg-2: #11151b;
  --panel: #151a21;
  --raised: #1b212a;
  --raised-2: #222935;
  --line: #262d38;
  --line-2: #323b48;
  /* text */
  --fg: #e6e9ee;
  --fg-2: #c3c9d2;
  --muted: #8b95a3;
  --faint: #5c6675;
  /* the one accent */
  --accent: #ff8a3d;
  --accent-2: #ffa766;
  --accent-ink: #1a0f06;
  --accent-soft: rgba(255, 138, 61, .14);
  /* status */
  --ok: #3fb950;   --ok-soft: rgba(63, 185, 80, .13);
  --bad: #f85149;  --bad-soft: rgba(248, 81, 73, .13);
  --warn: #d29922; --warn-soft: rgba(210, 153, 34, .14);
  --info: #6cb6ff;
  --sel: #ff9f1a;
  /* type */
  --font-ui: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --t-xs: 11px; --t-sm: 12px; --t-md: 13px; --t-lg: 15px; --t-xl: 20px; --t-2xl: 28px;
  /* spacing (4 px scale), radii, depth, motion */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r1: 6px; --r2: 10px; --r3: 14px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .38), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --fast: .12s; --med: .22s;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7; --bg-2: #eef0f3; --panel: #ffffff; --raised: #ffffff; --raised-2: #f6f7f9;
  --line: #e1e4e8; --line-2: #cfd4db;
  --fg: #1f2328; --fg-2: #39404a; --muted: #636c78; --faint: #9aa2ad;
  --accent: #e8661a; --accent-2: #d45a12; --accent-ink: #ffffff; --accent-soft: rgba(232, 102, 26, .1);
  --ok: #1f8a4c; --ok-soft: rgba(31, 138, 76, .1); --bad: #c0392b; --bad-soft: rgba(192, 57, 43, .09);
  --warn: #a8710a; --warn-soft: rgba(168, 113, 10, .1); --info: #2f6fb0;
  --shadow-2: 0 6px 20px rgba(20, 30, 45, .12), 0 1px 3px rgba(20, 30, 45, .08);
  --shadow-3: 0 20px 56px rgba(20, 30, 45, .2), 0 2px 8px rgba(20, 30, 45, .1);
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--t-md)/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; } a:hover { color: var(--accent-2); }
code, kbd, pre, .mono { font-family: var(--font-mono); }
::selection { background: var(--accent-soft); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r1); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* icons: <svg class="i"><use href="assets/icons.svg#i-name"/></svg> */
.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.i.sm { width: 14px; height: 14px; } .i.lg { width: 20px; height: 20px; } .i.xl { width: 28px; height: 28px; stroke-width: 1.5; }

/* ---------------------------------------------------------------- wordmark */
.wordmark { display: inline-flex; align-items: center; gap: 9px; font: 600 16px/1 var(--font-ui); letter-spacing: -.01em; color: var(--fg); }
.wordmark .mark { width: 22px; height: 22px; }
.wordmark b { font-weight: 600; color: var(--accent); }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r1); background: var(--raised); color: var(--fg);
  font: 500 var(--t-md)/1 var(--font-ui); cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast); }
.btn:hover { background: var(--raised-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--raised); color: var(--fg); }
.btn.danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.sm { height: 26px; padding: 0 9px; font-size: var(--t-sm); gap: 5px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: var(--t-lg); }
.btn.icon { width: 32px; padding: 0; } .btn.icon.sm { width: 26px; }

.input, .select, .textarea { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r1);
  background: var(--bg-2); color: var(--fg); font: 400 var(--t-md)/1.4 var(--font-ui); transition: border-color var(--fast), box-shadow var(--fast); }
.textarea { height: auto; padding: 9px 10px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.mono { font-family: var(--font-mono); font-size: var(--t-sm); }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); }
.card.hover { transition: border-color var(--med) var(--ease), transform var(--med) var(--ease), box-shadow var(--med) var(--ease); }
.card.hover:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.eyebrow { font: 600 var(--t-xs)/1.2 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--line); color: var(--fg-2); font: 500 var(--t-sm)/1 var(--font-ui); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font: 600 var(--t-xs)/1 var(--font-ui); letter-spacing: .02em; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.neutral { background: var(--raised-2); color: var(--fg-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); } .dot.live { background: var(--accent); animation: cc-pulse 1.4s ease-in-out infinite; }
kbd { display: inline-block; min-width: 18px; padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px;
  background: var(--raised); color: var(--fg-2); font: 500 10.5px/1.4 var(--font-mono); text-align: center; }

/* ---------------------------------------------------------------- loading */
.skeleton { position: relative; overflow: hidden; background: var(--raised); border-radius: var(--r1); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent); animation: cc-shimmer 1.4s infinite; }
:root[data-theme="light"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .04), transparent); }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  display: inline-block; animation: cc-spin .75s linear infinite; flex: none; }
.progress { height: 4px; background: var(--raised-2); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width var(--med) var(--ease); }
.progress.indeterminate > i { width: 35%; animation: cc-indeterminate 1.3s var(--ease) infinite; }

/* ---------------------------------------------------------------- dialog */
.scrim { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--s5);
  background: rgba(5, 7, 10, .62); backdrop-filter: blur(4px); animation: cc-fade var(--med) var(--ease); }
.dialog { width: min(1080px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r3); box-shadow: var(--shadow-3); animation: cc-rise var(--med) var(--ease); }
.dialog > header { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.dialog > footer { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--line); background: var(--bg-2); }
.dialog h2 { margin: 0; font: 600 var(--t-lg)/1.3 var(--font-ui); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r2); background: var(--raised-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-2);
  color: var(--fg); font-size: var(--t-md); animation: cc-rise var(--med) var(--ease); }

/* ---------------------------------------------------------------- motion */
@keyframes cc-spin { to { transform: rotate(360deg); } }
@keyframes cc-pulse { 50% { opacity: .35; } }
@keyframes cc-shimmer { to { transform: translateX(100%); } }
@keyframes cc-fade { from { opacity: 0; } }
@keyframes cc-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes cc-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes cc-flash-ok { 0% { background: var(--ok-soft); box-shadow: 0 0 0 1px var(--ok); } 100% { box-shadow: 0 0 0 1px transparent; } }
@keyframes cc-flash-bad { 0% { background: var(--bad-soft); box-shadow: 0 0 0 1px var(--bad); } 100% { box-shadow: 0 0 0 1px transparent; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
