/*
  Field Kit: the shared look for every page on the site (home + all tools).
  Loaded by index.html (React pages) and by each standalone tool page.

  - Dark by default, light when the device prefers it, or when the visitor picks it
    (fieldkit.js stores the choice and sets <html data-theme="light|dark">).
  - Each tool has one color, chosen with <html data-tool="session|supervision|notebook|protocol|token">.
    The tool colors are only used as fills with dark text on top, so they work in both themes;
    use --fk-accent-text when the color itself is text.
*/
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --fk-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fk-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  /* the five tool colors */
  --fk-c-session: #ffd23f;
  --fk-c-supervision: #4fd1e8;
  --fk-c-notebook: #7be495;
  --fk-c-protocol: #ff9a3c;
  --fk-c-token: #ff7eb3;
  --fk-c-supersync: #b9a2ff; /* external site, home page card only */
  --fk-on-accent: #121211;

  /* dark (default) */
  --fk-bg: #121211;
  --fk-panel: #1a1a19;
  --fk-panel-2: #222220;
  --fk-sunk: #0e0e0d;
  --fk-ink: #efede6;
  --fk-strong: #ffffff;
  --fk-mute: #a3a198;
  --fk-dim: #85837b;
  --fk-line: #efede6;
  --fk-line-soft: #3a3935;
  --fk-ruled: #2a2926;
  --fk-bar: #0a0a0a;
  --fk-bar-ink: #efede6;
  --fk-danger: #ff7a6b;
  --fk-warn: #ffd23f;
  --fk-ok: #7be495;
  --fk-accent-text: var(--fk-accent);

  /* neutral scale used by the React pages (Tailwind "slate" is mapped onto it) */
  --fk-s-50: #fbfaf6;
  --fk-s-100: #efede6;
  --fk-s-200: #e2e0d8;
  --fk-s-300: #cfcdc5;
  --fk-s-400: #a3a198;
  --fk-s-500: #85837b;
  --fk-s-600: #5f5e57;
  --fk-s-700: #3a3935;
  --fk-s-800: #2a2926;
  --fk-s-900: #1a1a19;
  --fk-s-950: #121211;

  --fk-accent: var(--fk-c-session);
  color-scheme: dark;
}

/* light: same layout and tool colors; the neutral scale is flipped */
:root[data-theme='light'] {
  --fk-bg: #f2f2ef;
  --fk-panel: #ffffff;
  --fk-panel-2: #ffffff;
  --fk-sunk: #f7f7f4;
  --fk-ink: #111111;
  --fk-strong: #000000;
  --fk-mute: #4f4e49;
  --fk-dim: #6b6a63;
  --fk-line: #111111;
  --fk-line-soft: #c4c2ba;
  --fk-ruled: #e4e3dd;
  --fk-danger: #b42318;
  --fk-warn: #8a5a00;
  --fk-ok: #1f7a3d;
  --fk-accent-text: #111111;
  --fk-s-50: #000000;
  --fk-s-100: #111111;
  --fk-s-200: #222222;
  --fk-s-300: #33322e;
  --fk-s-400: #4f4e49;
  --fk-s-500: #6b6a63;
  --fk-s-600: #8f8d86;
  --fk-s-700: #c4c2ba;
  --fk-s-800: #e6e5df;
  --fk-s-900: #ffffff;
  --fk-s-950: #f2f2ef;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --fk-bg: #f2f2ef;
    --fk-panel: #ffffff;
    --fk-panel-2: #ffffff;
    --fk-sunk: #f7f7f4;
    --fk-ink: #111111;
    --fk-strong: #000000;
    --fk-mute: #4f4e49;
    --fk-dim: #6b6a63;
    --fk-line: #111111;
    --fk-line-soft: #c4c2ba;
    --fk-ruled: #e4e3dd;
    --fk-danger: #b42318;
    --fk-warn: #8a5a00;
    --fk-ok: #1f7a3d;
    --fk-accent-text: #111111;
    --fk-s-50: #000000;
    --fk-s-100: #111111;
    --fk-s-200: #222222;
    --fk-s-300: #33322e;
    --fk-s-400: #4f4e49;
    --fk-s-500: #6b6a63;
    --fk-s-600: #8f8d86;
    --fk-s-700: #c4c2ba;
    --fk-s-800: #e6e5df;
    --fk-s-900: #ffffff;
    --fk-s-950: #f2f2ef;
    color-scheme: light;
  }
}

:root[data-tool='session'] { --fk-accent: var(--fk-c-session); }
:root[data-tool='supervision'] { --fk-accent: var(--fk-c-supervision); }
:root[data-tool='notebook'] { --fk-accent: var(--fk-c-notebook); }
:root[data-tool='protocol'] { --fk-accent: var(--fk-c-protocol); }
:root[data-tool='token'] { --fk-accent: var(--fk-c-token); }

/* ---- small shared pieces ---- */

/* Theme switch button (any element with data-fk-theme-toggle; fieldkit.js sets its text). */
.fk-theme-btn {
  font-family: var(--fk-mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: transparent;
  color: inherit;
  border: 1.5px solid currentColor;
  border-radius: 0;
  padding: 5px 9px;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0.85;
}
.fk-theme-btn:hover { opacity: 1; }
.fk-theme-btn:focus-visible { outline: 2px solid var(--fk-accent); outline-offset: 2px; }

/* The five-color stripe used under the home page header. */
.fk-stripe-all {
  background: linear-gradient(90deg,
    var(--fk-c-session) 0 20%, var(--fk-c-supervision) 20% 40%, var(--fk-c-notebook) 40% 60%,
    var(--fk-c-protocol) 60% 80%, var(--fk-c-token) 80% 100%);
}
.fk-stripe-all.six {
  background: linear-gradient(90deg,
    var(--fk-c-session) 0 16.67%, var(--fk-c-supervision) 16.67% 33.33%, var(--fk-c-notebook) 33.33% 50%,
    var(--fk-c-protocol) 50% 66.67%, var(--fk-c-token) 66.67% 83.33%, var(--fk-c-supersync) 83.33% 100%);
}

::selection { background: var(--fk-accent); color: var(--fk-on-accent); }
