/* Bedrock, design tokens, reset, base typography */

:root {
  /* Neutrals */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #eef1f8;
  --line: #e2e6f0;
  --line-strong: #cfd5e6;
  --ink: #141a30;
  --ink-2: #3c4463;
  --muted: #6b7392;

  /* Brand */
  --primary: #4c5fd5;
  --primary-ink: #ffffff;
  --primary-soft: #eaecfb;
  --primary-strong: #3a4bc0;
  --accent: #f2601f;
  --accent-soft: #fdeee7;

  /* Semantic */
  --ok: #0e9f6e;
  --ok-soft: #e4f7ef;
  --bad: #dc2f55;
  --bad-soft: #fdeaee;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --info: #2b6cb0;
  --info-soft: #e8f1fb;

  /* Code surface (same in both themes) */
  --code-bg: #131829;
  --code-bg-2: #1b2138;
  --code-line: #2a3150;
  --code-ink: #e7ebf8;
  --code-kw: #ff8fb0;
  --code-str: #9ee493;
  --code-num: #ffcf70;
  --code-fn: #8ecbff;
  --code-com: #7f88ab;
  --code-op: #d2b7ff;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-1: 0 1px 2px rgba(20, 26, 48, .06), 0 2px 8px rgba(20, 26, 48, .05);
  --shadow-2: 0 8px 30px rgba(20, 26, 48, .12);
  --topbar-h: 58px;
  --sidebar-w: 300px;
  --maxw: 780px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0d1020;
  --surface: #151a2e;
  --surface-2: #1a2038;
  --surface-3: #212844;
  --line: #262e4c;
  --line-strong: #353f66;
  --ink: #eef1fa;
  --ink-2: #c3cae0;
  --muted: #8a93b4;

  --primary: #8091ff;
  --primary-ink: #0d1020;
  --primary-soft: #232a4d;
  --primary-strong: #9aa7ff;
  --accent: #ff8a4f;
  --accent-soft: #33231b;

  --ok: #3ddba0;
  --ok-soft: #12301f;
  --bad: #ff7b96;
  --bad-soft: #33161f;
  --warn: #ffc76b;
  --warn-soft: #322616;
  --info: #7cc0ff;
  --info-soft: #16263c;

  --code-bg: #0a0e1c;
  --code-bg-2: #121729;
  --code-line: #232a45;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .25);
  --shadow-2: 0 10px 34px rgba(0, 0, 0, .45);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.55rem); margin-top: 1.9em; }
h3 { font-size: 1.12rem; margin-top: 1.6em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin: .3em 0; }
a { color: var(--primary); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { color: var(--primary-strong); }
strong { font-weight: 700; color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

code, kbd, samp, pre { font-family: var(--mono); }

:not(pre) > code {
  font-size: .875em;
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: .12em .38em;
  border-radius: 6px;
  color: var(--ink);
  white-space: nowrap;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: var(--primary-ink);
  padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
