/* Kritzel Studio manual. Plain CSS, no build step. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1c22;
  --muted: #5f5d68;
  --line: #e6e3ec;
  --accent: #6d4fc2;
  --accent-soft: #efe9fb;
  --code-bg: #f1eff5;
  --shadow: 0 1px 2px rgba(20, 16, 40, .06), 0 8px 24px rgba(20, 16, 40, .08);
  --note-bg: #f4f0fc;
  --warn-bg: #fff6e5;
  --warn-line: #e9b44c;
  --radius: 10px;
  --sidebar: 270px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121116;
    --surface: #1b1a21;
    --text: #ecebf1;
    --muted: #a5a2b2;
    --line: #2d2b36;
    --accent: #c9b6f2;
    --accent-soft: #2a2438;
    --code-bg: #24222c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --note-bg: #221e2e;
    --warn-bg: #2b2416;
    --warn-line: #b8862c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--surface); padding: 8px 12px; border-radius: 6px; z-index: 100;
}
.skip:focus { left: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; }
.brand img { border-radius: 8px; }
.brand small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.topbar-links { display: flex; align-items: center; gap: 10px; }
.lang-switch, .menu-toggle {
  font: inherit; font-size: 15px; color: var(--text); text-decoration: none;
  border: 1px solid var(--line); background: var(--surface);
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.lang-switch:hover, .menu-toggle:hover { border-color: var(--accent); }
.menu-toggle { display: none; }

/* Layout */
.shell { display: flex; max-width: 1280px; margin: 0 auto; }
.sidebar {
  position: sticky; top: 60px; align-self: flex-start;
  width: var(--sidebar); flex: none; height: calc(100vh - 60px); overflow-y: auto;
  padding: 28px 16px 28px 24px;
  border-right: 1px solid var(--line);
}
.sidebar-title { margin: 0 0 8px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc { list-style: none; margin: 0; padding: 0; counter-reset: ch -1; }
.toc li { counter-increment: ch; }
.toc a {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 15px; line-height: 1.35;
}
.toc li:not(:first-child) a::before { content: counter(ch) ". "; color: var(--muted); }
.toc a:hover { background: var(--accent-soft); }
.toc .current a { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-support { margin: 24px 10px 0; font-size: 14px; }

.content { flex: 1; min-width: 0; padding: 32px 48px 48px; }
article { max-width: 820px; }

/* Typography */
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; margin: .2em 0 .6em; }
h2 { font-size: 1.5rem; margin: 2.2em 0 .6em; padding-top: .6em; border-top: 1px solid var(--line); }
h1 + h2 { margin-top: .4em; padding-top: 0; border-top: 0; }
h3 { font-size: 1.15rem; margin: 1.8em 0 .4em; }
p, ul, ol, table, figure { margin: 0 0 1.1em; }
li { margin: .25em 0; }
code, kbd {
  font: .88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg); border-radius: 5px; padding: .1em .35em;
}
kbd { border: 1px solid var(--line); border-bottom-width: 2px; white-space: nowrap; }

.lead { font-size: 1.15rem; color: var(--muted); }

/* Tables */
.table-wrap, table { display: block; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: var(--accent-soft); }

/* Screenshots */
figure.shot { margin: 1.4em 0 1.6em; }
figure.shot img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow);
  background: #000;
}
figure.shot.narrow { max-width: 460px; }
figure.shot.tall { max-width: 360px; }
figure.shot figcaption { margin-top: .6em; font-size: 14.5px; color: var(--muted); }

/* Callouts: a blockquote followed by {: .note} or {: .warning} */
blockquote { margin: 0 0 1.2em; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--note-bg); border-radius: 0 var(--radius) var(--radius) 0; }
blockquote p:last-child { margin-bottom: 0; }
blockquote.warning { border-left-color: var(--warn-line); background: var(--warn-bg); }

/* Overview cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 1.4em 0 2em; padding: 0; list-style: none; }
.cards li { margin: 0; }
.cards a {
  display: block; height: 100%; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; color: var(--accent); margin-bottom: 4px; }
.cards span { font-size: 15px; color: var(--muted); }

/* Pager + footer */
.pager { display: flex; justify-content: space-between; gap: 16px; max-width: 820px; margin-top: 3em; }
.pager a {
  flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; background: var(--surface);
}
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-size: 13px; }
.pager .next { text-align: right; }
.pager .prev:only-child { flex: 0 1 50%; }
.pager .next:only-child { margin-left: auto; flex: 0 1 50%; }
.footer { max-width: 820px; margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

/* Landing page */
.landing { max-width: 720px; margin: 0 auto; padding: 12vh 16px 64px; text-align: center; }
.landing img { border-radius: 22px; box-shadow: var(--shadow); }
.landing h1 { margin-top: .6em; }
.landing .choices { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 2em; }
.landing .choices a {
  min-width: 240px; padding: 18px 22px; border-radius: 14px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow);
}
.landing .choices a:hover { border-color: var(--accent); }
.landing .choices strong { display: block; font-size: 1.2rem; color: var(--accent); }
.landing .choices span { color: var(--muted); font-size: 15px; }
.landing .small { margin-top: 3em; font-size: 14px; color: var(--muted); }

/* Narrow screens */
@media (max-width: 900px) {
  .content { padding: 24px 16px 40px; }
  .menu-toggle { display: inline-block; }
  .topbar { padding: 0 16px; }
  .brand small { display: none; }
  .sidebar {
    display: none; position: fixed; top: 60px; left: 0; right: 0; bottom: 0; width: auto; height: auto;
    background: var(--bg); z-index: 15; border-right: 0; padding: 20px 16px;
  }
  .sidebar.open { display: block; }
  h1 { font-size: 1.7rem; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
  .pager .prev:only-child, .pager .next:only-child { flex-basis: auto; margin-left: 0; }
}
