/* The classic presentation of Wren's site (site/classic/): one column of text in a page about one screen across, a
   nav line of plain links, Verdana for the text and Trebuchet for the headings, blue underlined links that turn
   purple once visited, thin grey rules; light and dark. The pages are the modern site's content (src/tools/docsite
   puts it in this frame), so the modern classes that carry it are made plain here. */

/* tokens */
:root {
  --bg: #ffffff;
  --fg: #1b1b1b;
  --muted: #5a5650;
  --rule: #b9b3aa;
  --link: #0645ad;
  --link-visited: #5b2a86;
  --accent: #c2560f;
  --code-bg: #f3f1ee;
  --box-bg: #f8f7f5;
  --font-body: Verdana, Geneva, "DejaVu Sans", sans-serif;
  --font-head: "Trebuchet MS", "Lucida Grande", "DejaVu Sans", sans-serif;
  --font-mono: "Courier New", "DejaVu Sans Mono", monospace;
  --gutter: 16px;
  --column: 62rem;
  --measure: 68ch;
  --news-width: 17rem;
  --side-width: 15rem;   /* the columns stack under 760px (a media query cannot read a variable) */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161514; --fg: #e8e4de; --muted: #a59f96; --rule: #4a4640;
    --link: #8ab4f8; --link-visited: #c58af9; --accent: #f08a3c; --code-bg: #24221f; --box-bg: #1d1c1a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161514; --fg: #e8e4de; --muted: #a59f96; --rule: #4a4640;
  --link: #8ab4f8; --link-visited: #c58af9; --accent: #f08a3c; --code-bg: #24221f; --box-bg: #1d1c1a;
  color-scheme: dark;
}

/* the page */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 var(--font-body);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  padding-block: 18px 28px;
  overflow-wrap: break-word;
}
.page { max-width: var(--column); margin: 0 auto; }
a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
img, svg, video { max-width: 100%; height: auto; }
code, pre, kbd { font-family: var(--font-mono); }
code { font-size: 0.95em; background: var(--code-bg); padding: 0 0.2em; }
pre { background: var(--code-bg); border: 1px solid var(--rule); padding: 0.5rem 0.7rem; overflow-x: auto; line-height: 1.35; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--rule); }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: var(--gutter); top: 4px; background: var(--bg); padding: 0.2rem 0.5rem; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the masthead, the nav line and the footer */
.masthead { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.masthead img { width: 48px; height: 48px; }
.masthead .name { font: bold 2.1rem/1 var(--font-head); letter-spacing: -0.01em; color: var(--fg); text-decoration: none; }
.masthead .tagline { font-style: italic; color: var(--muted); }
nav.site { margin-top: 0.6rem; padding-block: 0.35rem; border-block: 1px solid var(--rule); }
nav.site a { white-space: nowrap; }
nav.site a[aria-current="page"] { color: var(--fg); font-weight: bold; text-decoration: none; }
nav.site .sep { color: var(--muted); padding-inline: 0.25rem; }
.foot { margin-top: 1.4rem; padding-top: 0.4rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.92em; }

/* text */
main { display: block; min-width: 0; margin-top: 1.1rem; }
h1, h2, h3, h4 { font-family: var(--font-head); text-wrap: balance; }
h1 { font-size: 1.45rem; font-weight: normal; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 0.35rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.3rem; }
h4 { font-size: 0.95rem; margin: 0.9rem 0 0.3rem; }
p { margin: 0 0 0.7rem; max-width: var(--measure); }
ul, ol { margin: 0 0 0.7rem; padding-left: 1.3rem; max-width: var(--measure); }
li + li { margin-top: 0.2rem; }
dl { max-width: var(--measure); }
dt { font-weight: bold; margin-top: 0.4rem; }
dd { margin: 0 0 0.3rem 1.3rem; }
blockquote { margin: 0 0 0.7rem; padding-left: 0.8rem; border-left: 3px solid var(--rule); color: var(--muted); }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; margin-bottom: 0.7rem; }
th, td { text-align: left; padding: 0.15rem 0.9rem 0.15rem 0; vertical-align: baseline; }
th { border-bottom: 1px solid var(--rule); font-family: var(--font-head); }
tbody tr + tr td { border-top: 1px solid var(--rule); }
.table-box { overflow-x: auto; max-width: 100%; }

/* the home: a text column and a news column */
.columns { display: grid; grid-template-columns: minmax(0, 1fr) var(--news-width); gap: 2rem; margin-top: 1.1rem; }
.columns main { margin-top: 0; }
.columns aside { border-left: 1px solid var(--rule); padding-left: 1.2rem; min-width: 0; }
.columns aside h2 { font-size: 1.35rem; margin-top: 0; letter-spacing: 0.04em; text-transform: uppercase; }
.columns td.n { text-align: right; padding-right: 0.3rem; white-space: nowrap; font-weight: bold; }
.columns td.u { color: var(--muted); white-space: nowrap; }
.columns tbody tr + tr td { border-top: 0; }
.download { margin: 0.2rem 0 0.9rem; }
.download a { font-weight: bold; }
.download .small { color: var(--muted); }
.item { margin-bottom: 0.9rem; }
.date { font-family: var(--font-mono); color: var(--accent); font-weight: bold; }
.all { color: var(--muted); }
@media (max-width: 760px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .columns aside { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 0.6rem; }
}

/* the modern site's blocks, made plain */
.wrap, .section, .page-head, .rows, .row, .cards, .split, .steps, .timeline, .release-body { display: block; }
.section > .wrap > h2, .section h2 { border-bottom: 1px solid var(--rule); padding-bottom: 0.15rem; }
.eyebrow { margin: 0 0 0.1rem; color: var(--muted); font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.06em; }
.intro { max-width: var(--measure); }
.fine, .legend, .caption { color: var(--muted); font-size: 0.92em; }
.num { font-weight: bold; }
.more { margin-top: 0.3rem; }
.card { margin: 0 0 0.9rem; max-width: var(--measure); }
.card h3 { margin-top: 0.6rem; }
.list.yes, .list.no { padding-left: 1.3rem; }
a.btn { font-weight: bold; }
a.btn::after { content: " \00bb"; }
button, .btn:is(button) {
  font: inherit;
  color: var(--fg);
  background: var(--box-bg);
  border: 1px solid var(--rule);
  padding: 0.2rem 0.7rem;
  cursor: pointer;
}
button:disabled { color: var(--muted); cursor: default; }

/* the gallery: captures in a grid, the caption under each */
ul.gallery { list-style: none; padding: 0; max-width: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
ul.gallery li + li { margin-top: 0; }
ul.gallery figure { margin: 0; }
ul.gallery .frame { display: block; border: 1px solid var(--rule); }
ul.gallery .frame img { display: block; width: 100%; height: auto; }
ul.gallery figcaption { margin-top: 0.3rem; font-size: 0.92em; }

/* the gallery's viewer (gallery.js) */
.lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: var(--gutter); box-sizing: border-box; border: 0; background: var(--bg); color: var(--fg); }
.lightbox[open] { display: flex; flex-direction: column; gap: 0.6rem; }
html.lightbox-open { overflow: hidden; }
.lightbox-stage { position: relative; flex: 1 1 auto; min-height: 0; cursor: zoom-out; }
.lightbox-stage img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.lightbox-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; border-top: 1px solid var(--rule); padding-top: 0.4rem; }
.lightbox-caption { flex: 1 1 20rem; margin: 0; }
.lightbox-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.lightbox-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.lightbox a.btn::after { content: none; }

/* the architecture: the layers as rows of boxes */
.diagram { margin: 0.4rem 0 0.7rem; }
.layer { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.6rem; padding: 0.4rem 0; border-top: 1px solid var(--rule); }
.layer .name { font-family: var(--font-head); font-weight: bold; }
.boxes { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.box { flex: 1 1 11rem; border: 1px solid var(--rule); padding: 0.25rem 0.45rem; background: var(--box-bg); }
.box b { display: block; }
.box span { color: var(--muted); font-size: 0.92em; }
.box.wasm { border-color: var(--accent); }
.box.ext { border-style: dashed; }
.arrow { display: none; }
.legend i { display: inline-block; width: 0.8em; height: 0.8em; border: 1px solid var(--rule); background: var(--box-bg); vertical-align: -0.1em; }
.legend i.wasm { border-color: var(--accent); }
.legend i.ext { border-style: dashed; }
td.n { font-family: var(--font-mono); white-space: nowrap; }
@media (max-width: 760px) { .layer { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; } }

/* the changelog's releases */
.release { padding: 0.3rem 0 0.2rem; border-top: 1px solid var(--rule); }
.release .rail { display: none; }
.release-date { margin: 0; color: var(--accent); font-family: var(--font-mono); font-weight: bold; }
.release-title { display: flex; align-items: baseline; gap: 0.6rem; }
.release-title h3 { margin: 0.1rem 0 0.2rem; font-size: 1.1rem; }
.badge { font-size: 0.85em; color: var(--muted); border: 1px solid var(--rule); padding: 0 0.3rem; }

/* write a page: the files of the example */
.code { margin: 0 0 0.9rem; }
.code .file { font-family: var(--font-mono); font-size: 0.92em; color: var(--muted); border: 1px solid var(--rule); border-bottom: 0; padding: 0.1rem 0.7rem; background: var(--box-bg); }
.code pre { margin: 0; }
.k { color: var(--link-visited); font-weight: bold; }
.s { color: #2b7a0b; }
.c { color: var(--muted); font-style: italic; }
.f { color: var(--link); }
.t { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .s { color: #8fce6c; } }
:root[data-theme="dark"] .s { color: #8fce6c; }

/* the pricing and thanks pages */
.offer { border: 1px solid var(--rule); background: var(--box-bg); padding: 0.6rem 1rem 0.8rem; max-width: 26rem; margin: 0.4rem 0 0.9rem; }
.offer h2 { margin-top: 0; border: 0; }
.offer .price { font: bold 2rem/1.1 var(--font-head); margin: 0 0 0.2rem; }
.info { font-size: 0.85em; }
.facts > div { margin-bottom: 0.3rem; }
.faq details { border-top: 1px solid var(--rule); padding: 0.3rem 0; max-width: var(--measure); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: bold; }
.faq details > div { padding-top: 0.3rem; }
.key { font-family: var(--font-mono); background: var(--code-bg); border: 1px solid var(--rule); padding: 0.4rem 0.6rem; word-break: break-all; margin-bottom: 0.6rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0 0.7rem; }

/* the docs: the text, the sections beside it */
.doc-columns { display: grid; grid-template-columns: var(--side-width) minmax(0, 1fr); gap: 2rem; margin-top: 1.1rem; }
.doc-columns main { margin-top: 0; grid-column: 2; grid-row: 1; }
.doc-side { grid-column: 1; grid-row: 1; border-right: 1px solid var(--rule); padding-right: 1rem; min-width: 0; font-size: 0.92em; }
.doc-sec-title { font-family: var(--font-head); font-weight: bold; margin: 0.8rem 0 0.2rem; }
.doc-links { padding-left: 0.9rem; margin: 0; }
.doc-links li + li { margin-top: 0.1rem; }
.doc-links a.active { color: var(--fg); font-weight: bold; text-decoration: none; }
.doc-group summary { cursor: pointer; }
.doc-search { position: relative; }
.doc-search input { width: 100%; box-sizing: border-box; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--rule); padding: 0.15rem 0.3rem; }
.doc-search-results { position: absolute; left: 0; top: 100%; z-index: 5; width: min(28rem, 80vw); background: var(--bg); border: 1px solid var(--rule); padding: 0.3rem 0.5rem; }
.doc-search-results ul { list-style: none; padding: 0; margin: 0; }
.doc-search-results a { display: block; padding: 0.2rem 0; }
.doc-search-results .r-sec { display: block; color: var(--muted); font-size: 0.85em; }
.doc-search-results strong { display: block; }
.doc-search-results .r-snip { display: block; color: var(--fg); font-size: 0.9em; }
.doc-crumbs ol { list-style: none; padding: 0; margin: 0 0 0.6rem; color: var(--muted); }
.doc-crumbs li { display: inline; }
.doc-crumbs li + li::before { content: " \00bb  "; }
.doc-toc { display: inline-block; border: 1px solid var(--rule); background: var(--box-bg); padding: 0.3rem 1rem 0.4rem 0.7rem; margin: 0.2rem 0 0.8rem; max-width: 100%; box-sizing: border-box; }
.doc-toc-title { font-family: var(--font-head); font-weight: bold; margin: 0 0 0.2rem; }
.doc-toc ul { margin: 0; padding-left: 1.1rem; }
.doc-toc li.lvl3 { margin-left: 1rem; }
.doc-main h2 { border-bottom: 1px solid var(--rule); padding-bottom: 0.15rem; }
.anchor { margin-left: 0.3rem; color: var(--muted); text-decoration: none; visibility: hidden; }
:is(h1, h2, h3, h4):hover .anchor, .anchor:focus-visible { visibility: visible; }
.doc-note { border-left: 3px solid var(--accent); padding: 0.1rem 0 0.1rem 0.7rem; margin: 0 0 0.7rem; }
.doc-chart { margin: 0.5rem 0 0.9rem; }
.doc-chart svg { max-width: 100%; height: auto; }
.doc-chart figcaption { color: var(--muted); font-size: 0.92em; }
.doc-seq { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 0.4rem; border-top: 1px solid var(--rule); }
.doc-seq span { color: var(--muted); }
.doc-seq span::after { content: ": "; }
.doc-next { margin-left: auto; text-align: right; }
.doc-edit { color: var(--muted); font-size: 0.92em; }
@media (max-width: 760px) {
  .doc-columns { grid-template-columns: minmax(0, 1fr); }
  .doc-columns main, .doc-side { grid-column: 1; grid-row: auto; }
  .doc-side { border-right: 0; border-top: 1px solid var(--rule); padding-right: 0; padding-top: 0.4rem; }
}
