/* Shared styles of the Markwork documentation pages (docs/docs/*.html). The color tokens are the same as the landing page. */
:root {
  --bg: #fbfbfa;
  --bg-alt: #f2f3f1;
  --text: #1f2328;
  --muted: #5d6670;
  --line: #dfe2de;
  --accent: #2f6fdb;
  --accent-text: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --card: #fff;
  --code-bg: #eceeea;
  --warn: #9a6200;
  --warn-soft: #fdf3dc;
  --shadow: 0 18px 50px -18px rgba(20, 30, 50, .35), 0 2px 6px rgba(20, 30, 50, .08);
  --top: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181b; --bg-alt: #1c1f23; --text: #e8eaec; --muted: #9aa3ad; --line: #2c3036;
    --accent: #6ea2ff; --accent-text: #0c1424; --card: #1f2227; --code-bg: #262a30;
    --warn: #f0b44c; --warn-soft: #2e2618;
    --shadow: 0 18px 50px -18px rgba(0, 0, 0, .8), 0 2px 6px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --bg: #16181b; --bg-alt: #1c1f23; --text: #e8eaec; --muted: #9aa3ad; --line: #2c3036;
  --accent: #6ea2ff; --accent-text: #0c1424; --card: #1f2227; --code-bg: #262a30;
  --warn: #f0b44c; --warn-soft: #2e2618;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .8), 0 2px 6px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 system-ui, -apple-system, "Segoe UI", "Noto Sans", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
code, kbd, pre { font-family: ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", Menlo, monospace; }
code { background: var(--code-bg); padding: .1em .38em; border-radius: 5px; font-size: .86em; overflow-wrap: anywhere; }
kbd {
  background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: .05em .45em; font-size: .82em; white-space: nowrap;
}

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top);
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 20px;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 9px; }
.brand svg { width: 24px; height: 24px; }
.brand span { color: var(--muted); font-weight: 500; }
.top nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.top nav a { color: var(--muted); text-decoration: none; font-size: .93rem; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.menu-btn {
  display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 6px 10px; font: inherit; font-size: .9rem; cursor: pointer;
}

/* Three-column layout */
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr) 220px; min-height: calc(100vh - var(--top)); }
.side {
  position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto;
  border-right: 1px solid var(--line); padding: 18px 14px 40px; background: var(--bg);
}
.side input {
  width: 100%; font: inherit; font-size: .9rem; padding: 7px 11px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text);
}
.side h4 {
  margin: 18px 8px 6px; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.side h4:first-of-type { margin-top: 4px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a {
  display: block; padding: 5px 10px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: .93rem;
}
.side li a:hover { background: var(--bg-alt); }
.side li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .badge { font-size: .7rem; font-weight: 700; color: var(--accent); margin-left: 6px; }
.side .empty { color: var(--muted); font-size: .9rem; padding: 4px 10px; }

main.doc { padding: 40px 48px 80px; max-width: 860px; width: 100%; }
.toc { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 40px 16px; font-size: .88rem; }
.toc p { margin: 0 0 8px; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-block; }
  .top nav a.hide-sm { display: none; }
  .top { padding: 0 16px; gap: 12px; }
  .side {
    position: fixed; z-index: 15; top: var(--top); left: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .18s; box-shadow: var(--shadow);
  }
  body.nav-open .side { transform: none; }
  main.doc { padding: 28px 16px 64px; }
}

/* Document contents */
.doc .eyebrow { color: var(--accent); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 6px; }
.doc h1 { font-size: clamp(1.9rem, 4.5vw, 2.5rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px; }
.doc .lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 28px; }
.doc h2 { font-size: 1.45rem; letter-spacing: -.01em; margin: 44px 0 10px; padding-top: 8px; }
.doc h3 { font-size: 1.1rem; margin: 28px 0 6px; }
.doc p, .doc li { overflow-wrap: break-word; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: .3em 0; }
.doc figure { margin: 22px 0; }
.doc figure img { border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card); }
.doc .narrow-fig img { width: auto; max-width: min(100%, 520px); margin-inline: auto; }
.doc figcaption { color: var(--muted); font-size: .88rem; margin-top: 10px; text-align: center; }
pre {
  background: #14161a; color: #e6e9ee; border-radius: 10px; padding: 14px 18px; overflow-x: auto;
  font-size: .88rem; line-height: 1.6; margin: 14px 0;
}
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
pre .c { color: #7d8794; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--bg-alt); white-space: nowrap; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 12px 16px; margin: 18px 0; }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout strong:first-child { display: block; margin-bottom: 2px; }
.callout p { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; }
.cards a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--text); text-decoration: none; }
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; margin-bottom: 4px; }
.cards span { color: var(--muted); font-size: .92rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1em .55em; border-radius: 99px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }

/* Previous / next */
.pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 56px; }
.pager a { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; text-decoration: none; color: var(--text); background: var(--card); }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-size: .8rem; }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 480px) { .pager { grid-template-columns: minmax(0, 1fr); } .pager .next { grid-column: 1; } }
