/* docs.authorwerks.com: authorwerks.com's look (its colors, type and components, as the account site
   copies them), with the documentation's own layout: a side menu, the page, and screenshots. The
   menu bar and footer are authorwerks.com's assets/site-header.css, loaded from there. */
:root {
  color-scheme: light dark;
  --ground: #110d22;
  --surface: #1a1533;
  --surface-2: #211b3f;
  --rule: #2f2754;
  --violet: #785ed9;
  --violet-mid: #6c51d7;
  --violet-deep: #6042d3;
  --handle: #4a30b4;
  --violet-light: #a996ef;
  --lavender: #ddd7f6;
  --text: #f1eefb;
  --muted: #b4abd3;
  --good: #7fd1a7;
  --warn: #f2c66d;
  --mark: #dc2626;
  --backdrop: rgb(8 6 18 / 0.86);

  --display: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* The page width, the same on every Authorwerks site (docs.authorwerks.com set it). */
  --wrap: 76rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --glow-1: rgba(96, 66, 211, 0.30);
  --glow-2: rgba(64, 38, 162, 0.32);
  --shadow: rgb(0 0 0 / 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #f6f4fc;
    --surface: #ffffff;
    --surface-2: #efebfa;
    --rule: #ddd6f2;
    --violet-light: #5b3fd0;
    --lavender: #3a2891;
    --text: #1d1838;
    --muted: #5a5478;
    --good: #1d7a4c;
    --warn: #8a5800;
    --backdrop: rgb(29 24 56 / 0.78);
    --glow-1: rgba(120, 94, 217, 0.14);
    --glow-2: rgba(96, 66, 211, 0.10);
    --shadow: rgb(29 24 56 / 0.16);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5.5rem; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(60rem 26rem at 15% -10%, var(--glow-1), transparent 70%),
    radial-gradient(40rem 22rem at 100% 0%, var(--glow-2), transparent 70%),
    var(--ground);
  background-repeat: no-repeat;
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--body);
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--violet-light); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--lavender);
  outline-offset: 3px;
  border-radius: 4px;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); width: 100%; }
.label { font: 500 0.8125rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--violet-light); }
.muted { color: var(--muted); }
.lede { color: var(--muted); font-size: 1.15rem; max-width: 42rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.3rem; border-radius: 0.6rem;
  font: 600 1rem/1.2 var(--body); text-decoration: none;
  background: linear-gradient(180deg, var(--violet), var(--violet-mid));
  color: #fff; border: 1px solid var(--violet-deep); box-shadow: 0 2px 0 var(--handle);
}

/* ---- The front page ---------------------------------------------------------------------- */
.docs-landing { padding-block: clamp(2rem, 6vw, 4rem); display: grid; gap: 2rem; align-content: start; }
.docs-head { display: grid; gap: 0.6rem; }
.docs-head h1 { font-size: clamp(2rem, 5vw, 2.75rem); }
/* Each product, then its versions as tiles: the number large, the releases it covers, Latest / Beta. */
.docs-product-versions { display: grid; gap: 1rem; }
.docs-product-versions h2 { font: 600 1.5rem/1.2 var(--display); }
.docs-versions {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
}
.docs-version-tile {
  position: relative; display: grid; gap: 0.35rem; align-content: start; height: 100%;
  padding: 1.25rem 1.4rem 1.3rem; border-radius: 0.9rem;
  background: var(--surface); border: 1px solid var(--rule); text-decoration: none; color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.docs-version-tile.is-latest { border-color: var(--violet); }
.docs-version-tile:hover { border-color: var(--violet-light); transform: translateY(-2px); }
.docs-version-number { font: 600 clamp(2.75rem, 7vw, 3.5rem)/1 var(--display); letter-spacing: -0.01em; }
.docs-version-releases { color: var(--muted); font-size: 0.95rem; }
.docs-version-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; min-height: 1.5rem; }
.docs-tag {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; border: 1px solid var(--rule);
  font: 500 0.75rem/1.5 var(--mono); letter-spacing: 0.04em; color: var(--muted);
}
.docs-tag::first-letter { text-transform: uppercase; }
.docs-tag-latest { border-color: var(--violet); color: var(--violet-light); }
.docs-version-go { position: absolute; top: 1.1rem; right: 1.3rem; color: var(--violet-light); font-size: 1.25rem; transition: transform 0.15s ease; }
.docs-version-tile:hover .docs-version-go { transform: translateX(3px); }

/* ---- A page: the side menu and the page -------------------------------------------------- */
.docs { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); padding-block: 2rem 4rem; align-items: start; }
.docs-side { position: sticky; top: 5rem; max-height: calc(100vh - 6rem); overflow-y: auto; display: grid; gap: 1.25rem; padding-right: 0.25rem; }
.docs-product { display: grid; gap: 0.4rem; }
.docs-product-name { font: 600 1.15rem/1.25 var(--display); color: var(--text); text-decoration: none; }
.docs-version { position: relative; }
.docs-version summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem; border: 1px solid var(--rule); border-radius: 999px;
  font: 500 0.85rem/1.3 var(--body); color: var(--muted); background: var(--surface);
}
.docs-version summary::-webkit-details-marker { display: none; }
.docs-version summary::after { content: "▾"; font-size: 0.75rem; }
.docs-version[open] summary { border-color: var(--violet-light); color: var(--text); }
.docs-version ul {
  position: absolute; z-index: 5; margin: 0.4rem 0 0; padding: 0.35rem; list-style: none; min-width: 14rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 0.6rem; box-shadow: 0 12px 30px var(--shadow);
}
.docs-version li a { display: block; padding: 0.4rem 0.6rem; border-radius: 0.4rem; color: var(--text); text-decoration: none; font-size: 0.95rem; }
.docs-version li a:hover, .docs-version li a[aria-current] { background: var(--surface-2); }
.docs-version .muted { font-size: 0.85rem; }
.docs-latest { color: var(--violet-light); }

.docs-nav { display: grid; gap: 0.35rem; }
.docs-nav-group { margin: 0.75rem 0 0.15rem; font: 500 0.75rem/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.docs-nav-group:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.docs-nav a { display: block; padding: 0.32rem 0.7rem; border-radius: 0.45rem; color: var(--text); text-decoration: none; font-size: 0.97rem; line-height: 1.35; border-left: 2px solid transparent; }
.docs-nav a:hover { background: var(--surface-2); }
.docs-nav a[aria-current="page"] { background: var(--surface-2); color: var(--violet-light); font-weight: 600; border-left-color: var(--violet); }

.docs-menu-button {
  display: none; margin-bottom: 1rem; padding: 0.55rem 1rem; border-radius: 0.6rem; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--rule); font: 500 0.95rem/1.2 var(--body);
}

.docs-page { min-width: 0; max-width: 52rem; display: grid; gap: 1.75rem; align-content: start; }
.docs-toc { border-left: 2px solid var(--rule); padding-left: 1rem; }
.docs-toc-title { margin: 0 0 0.35rem; font: 500 0.75rem/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.docs-toc ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.15rem; color: var(--muted); }
.docs-toc a { text-decoration: none; }
.docs-toc a:hover { text-decoration: underline; }

/* The page's text. */
.docs-body { display: grid; gap: 1.1rem; }
.docs-body > * { margin: 0; }
.docs-body h2 { font-size: 1.7rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.docs-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.docs-body h3 { font-size: 1.25rem; margin-top: 0.6rem; }
.docs-body p, .docs-body li { max-width: 46rem; }
.docs-body ul, .docs-body ol { padding-left: 1.4rem; display: grid; gap: 0.4rem; }
.docs-body ol.marks { list-style: none; padding-left: 0; gap: 0.6rem; }
.docs-body ol.marks > li { display: grid; grid-template-columns: 1.7rem 1fr; gap: 0.6rem; align-items: start; }
.docs-body strong { font-weight: 600; }
.docs-body code { font: 500 0.88em/1.4 var(--mono); padding: 0.1rem 0.35rem; border-radius: 0.35rem; background: var(--surface-2); }
.docs-body .lede { margin-bottom: 0.25rem; }
.docs-body table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
.docs-body th, .docs-body td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.docs-body th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 0.75rem; background: var(--surface); }
.table-wrap table th, .table-wrap table td { border-bottom-color: var(--rule); }
.table-wrap tr:last-child td { border-bottom: 0; }

/* The numbers drawn on the screenshots, in the text. */
.mark-num {
  display: inline-grid; place-items: center; width: 1.55rem; height: 1.55rem; border-radius: 50%;
  background: var(--mark); color: #fff; font: 700 0.85rem/1 var(--body); box-shadow: 0 0 0 2px #fff; vertical-align: 0.1em;
}
ol.marks .mark-num { margin-top: 0.1rem; }
/* Each number's color, the same as its frame and badge on the screenshots (annotate.py). */
.mark-1 { background: #dc2626; } .mark-2 { background: #2563eb; } .mark-3 { background: #16a34a; }
.mark-4 { background: #ea580c; } .mark-5 { background: #9333ea; } .mark-6 { background: #0d9488; }
.mark-7 { background: #c026d3; } .mark-8 { background: #ca8a04; } .mark-9 { background: #64748b; }

/* Keys. */
kbd {
  display: inline-block; min-width: 1.6em; padding: 0.05rem 0.4rem; text-align: center;
  font: 500 0.82em/1.5 var(--mono); color: var(--text);
  background: var(--surface); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 0.35rem;
}
/* A shortcut: the whole combination in one cap (keys() in _inc/page.php), the + between keys muted. */
kbd.keys, .keys-wrap { white-space: nowrap; }
kbd.keys .plus { color: var(--muted); margin: 0 0.3em; font-weight: 400; }

/* Tips and notes. */
.note { padding: 0.9rem 1.1rem; border-radius: 0.75rem; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--violet); }
.note p + p { margin-top: 0.5rem; }
.note-warn { border-left-color: var(--warn); }

/* Screenshots (light or dark, as the system is), each a button that opens the large view. */
.shot { margin: 0.25rem 0; display: grid; gap: 0.6rem; min-width: 0; }
.shot-zoom {
  display: block; width: 100%; padding: 0; margin: 0; cursor: zoom-in;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 0.7rem; overflow: hidden;
  box-shadow: 0 10px 30px var(--shadow);
}
.shot-narrow .shot-zoom { width: auto; max-width: min(100%, 34rem); justify-self: start; }
.shot picture { display: block; }
.shot img { display: block; width: 100%; height: auto; }
.shot-narrow img { width: auto; max-width: 100%; }
.shot figcaption { color: var(--muted); font-size: 0.93rem; }

dialog.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: clamp(0.5rem, 3vw, 2rem);
  border: 0; background: transparent;
}
dialog.lightbox::backdrop { background: var(--backdrop); }
body:has(dialog.lightbox[open]) { overflow: hidden; }
.lightbox-frame { width: 100%; height: 100%; display: grid; place-items: center; overflow: auto; }
.lightbox-frame img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 0.5rem; cursor: zoom-out; }
.lightbox-close {
  position: fixed; top: 0.9rem; right: 0.9rem; z-index: 2; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.4); background: rgb(0 0 0 / 0.5); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer;
}

/* Previous and Next. */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.docs-pager a { display: grid; gap: 0.25rem; padding: 0.9rem 1.1rem; border: 1px solid var(--rule); border-radius: 0.75rem; background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; }
.docs-pager a:hover { border-color: var(--violet-light); }
.docs-pager-next { grid-column: 2; text-align: right; }

/* The footer as wide as the docs. */

/* ---- Narrow screens: the side menu folds away behind its button --------------------------- */
@media (max-width: 56rem) {
  .docs { grid-template-columns: minmax(0, 1fr); padding-top: 1.25rem; }
  .docs-side { display: none; position: static; max-height: none; padding: 1rem; border: 1px solid var(--rule); border-radius: 0.9rem; background: var(--surface); }
  .docs-side.is-open { display: grid; }
  .docs-menu-button { display: inline-flex; justify-self: start; }
  .docs-page { order: 0; }
  .docs-body h2 { font-size: 1.45rem; }
}
@media (max-width: 30rem) {
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager-next { grid-column: 1; }
  .docs-body ol.marks > li { grid-template-columns: 1.6rem 1fr; }
}

/* Downloads (Open-source components): each file, what it is and its size, its SHA-256 under it. */
table.downloads td.nowrap { white-space: nowrap; }
table.downloads tr.download-sha td { padding-top: 0; font-size: 0.8rem; color: var(--muted, inherit); opacity: 0.85; }
table.downloads tr.download-sha code { word-break: break-all; font-size: 0.78rem; }
table.downloads tr:has(+ tr.download-sha) td { border-bottom: 0; padding-bottom: 0.2rem; }
.download-version { color: var(--muted, inherit); font-size: 0.95rem; }
