/* keyshroud.dev/docs. The tokens are the ones of the home page (site/index.html). */
:root {
  --bg: #faf9f6; --bg-2: #f2f0ea; --surface: #ffffff; --text: #151a2d; --muted: #5b6072; --line: #e2dfd6;
  --accent: #6d5df6; --accent-soft: rgba(109, 93, 246, .1); --accent-ink: #ffffff;
  --term-bg: #12141c; --term-line: #252936; --term-text: #e6e8ee; --term-dim: #8a90a0;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e15; --bg-2: #10131c; --surface: #151824; --text: #e9ebf3; --muted: #9aa1b5; --line: #242838;
    --accent: #8b7ffa; --accent-soft: rgba(139, 127, 250, .14); --accent-ink: #0c0e15;
    --term-bg: #090a0f; --term-line: #20232f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
code, pre { font-family: var(--mono); }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* top bar, as on the home page */
.bar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.bar nav { display: flex; align-items: center; gap: 4px; }
.bar nav a { color: var(--muted); text-decoration: none; font-size: 14.5px; padding: 6px 10px; border-radius: 6px; }
.bar nav a:hover, .bar nav a[aria-current] { color: var(--text); background: var(--accent-soft); }
.bar nav a.gh { color: var(--text); border: 1px solid var(--line); background: var(--surface); margin-left: 6px; }
@media (max-width: 560px) { .bar nav a.opt { display: none; } }

/* page: sidebar, article, headings of the page */
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 44px; padding-top: 20px; padding-bottom: 64px; }
.side h4, .toc h4 { margin: 22px 0 8px; font: 600 11.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
.side ul, .toc ul { margin: 0; padding: 0; list-style: none; }
.side a, .toc a { display: block; padding: 4px 10px; margin-left: -10px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 14.5px; line-height: 1.45; }
.side a:hover, .toc a:hover { color: var(--text); }
.side a[aria-current] { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.side.wide, .toc { display: none; }
.menu { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 16px; margin-bottom: 8px; }
.menu summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 14.5px; }
.menu .side { padding-bottom: 14px; }
.menu .side h4:first-child { margin-top: 6px; }
@media (min-width: 900px) {
  .page { grid-template-columns: 228px minmax(0, 1fr); padding-top: 28px; }
  .menu { display: none; }
  .side.wide { display: block; position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; padding-bottom: 16px; }
  .side.wide h4:first-child { margin-top: 12px; }
}
@media (min-width: 1160px) {
  .page { grid-template-columns: 228px minmax(0, 1fr) 190px; }
  .toc { display: block; position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; }
  .toc h4 { margin-top: 12px; }
  .toc a { font-size: 13.5px; }
  .toc code { font-size: .92em; }
}

/* article */
main { min-width: 0; }
article { max-width: 46em; }
h1 { font-size: clamp(30px, 4.6vw, 40px); line-height: 1.12; letter-spacing: -0.03em; margin: 12px 0 18px; }
h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; margin: 44px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); }
h3 { font-size: 18.5px; line-height: 1.3; margin: 32px 0 8px; }
h2, h3 { scroll-margin-top: 72px; }
a.anchor { color: inherit; text-decoration: none; }
a.anchor:hover::after { content: " #"; color: var(--accent); }
p, ul, ol { margin: 0 0 16px; }
ul, ol { padding-left: 22px; }
li { margin: 5px 0; }
li > ul, li > ol { margin: 5px 0 0; }
:not(pre) > code { font-size: .88em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
h1 code, h2 code, h3 code { font-size: .9em; }
pre { position: relative; margin: 0 0 18px; padding: 15px 18px; background: var(--term-bg); color: var(--term-text); border: 1px solid var(--term-line); border-radius: 10px; font-size: 13.5px; line-height: 1.7; overflow-x: auto; }
pre code { white-space: pre; }
pre .copy { position: absolute; top: 8px; right: 8px; font: 600 12px/1 ui-sans-serif, system-ui, sans-serif; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--term-line); background: #1c1f2b; color: var(--term-dim); cursor: pointer; opacity: 0; transition: opacity .15s; }
pre:hover .copy, pre .copy:focus-visible { opacity: 1; }
@media (hover: none) { pre .copy { opacity: 1; } }
blockquote { margin: 0 0 16px; padding: 2px 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.table { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.5; }
th, td { text-align: left; vertical-align: top; padding: 9px 13px; border-bottom: 1px solid var(--line); }
th { font-size: 12.5px; letter-spacing: .02em; color: var(--muted); background: var(--bg-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
thead:has(th:empty) { display: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

.cards { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin: 0 0 8px; }
@media (min-width: 620px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--accent); }
.card b { display: block; margin-bottom: 3px; }
.card span { color: var(--muted); font-size: 14.5px; line-height: 1.5; display: block; }

.edit { margin: 40px 0 0; font-size: 14px; color: var(--muted); }
.edit a { color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; max-width: 46em; }
.steps a { padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; line-height: 1.4; }
.steps a:hover { border-color: var(--accent); }
.steps a span { display: block; font: 600 11.5px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.steps .next { text-align: right; }

footer { border-top: 1px solid var(--line); padding: 24px 0 32px; color: var(--muted); font-size: 14px; }
footer p { margin: 0; }
footer a { color: var(--muted); }
