/* Shared design tokens, typography and light/dark theme for every page. */

:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --ink: #1b1b1a;
  --muted: #5f5f5a;
  --faint: #8c8c86;
  --line: #e6e5de;
  --accent: #1f6fa8;
  --accent-soft: rgba(31, 111, 168, 0.09);
  --code-bg: #f1f0ea;

  /* Diagram palette (animated thumbnails) */
  --d-red: #ec8a80;
  --d-green: #86c28a;
  --d-purple: #aa97e3;
  --d-amber: #f2c46d;
  --d-blue: #74b3e8;
  --d-pink: #e8a3d6;
  --d-box-text: #3a2a05;

  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #141414;
  --surface: #1c1c1b;
  --ink: #ecebe6;
  --muted: #a9a8a1;
  --faint: #7a7a74;
  --line: #2e2e2c;
  --accent: #7fb8e6;
  --accent-soft: rgba(127, 184, 230, 0.12);
  --code-bg: #232322;

  --d-red: #d9776e;
  --d-green: #72ad77;
  --d-purple: #9887d4;
  --d-amber: #e0b35e;
  --d-blue: #5f9fd6;
  --d-pink: #cf8dbe;

  color-scheme: dark;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.theme-toggle {
  align-items: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
  width: 34px;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline;
}
