/* Yack's documentation pages (mix docs.site): the look of the Yack overview,
   light or dark as the app is set (theme.js), else as the system is. */

@font-face {
  font-family: "TeX Gyre Adventor";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/texgyreadventor-bold-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #4a4a4a;
  --strong: #1c1c1c;
  --muted: #8d8d8d;
  --rule: #d9d9d9;
  --head-bg: #f3f3f3;
  --accent: #e8902a;
  --link: #3b5bdb;
  --code-bg: #f4f4f5;
  --shadow: 0 6px 24px rgb(0 0 0 / 0.12);
  --icon-filter: none;
  --icon-blend: multiply;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: oklch(25.26% 0.014 253.1);
    --text: oklch(88% 0.012 256);
    --strong: oklch(97.8% 0.029 256.8);
    --muted: oklch(68% 0.02 256);
    --rule: oklch(38% 0.016 253);
    --head-bg: oklch(30.33% 0.016 252.42);
    --link: oklch(75% 0.12 277);
    --code-bg: oklch(30.33% 0.016 252.42);
    --shadow: 0 6px 24px rgb(0 0 0 / 0.5);
    --icon-filter: invert(1);
    --icon-blend: screen;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(25.26% 0.014 253.1);
  --text: oklch(88% 0.012 256);
  --strong: oklch(97.8% 0.029 256.8);
  --muted: oklch(68% 0.02 256);
  --rule: oklch(38% 0.016 253);
  --head-bg: oklch(30.33% 0.016 252.42);
  --link: oklch(75% 0.12 277);
  --code-bg: oklch(30.33% 0.016 252.42);
  --shadow: 0 6px 24px rgb(0 0 0 / 0.5);
  --icon-filter: invert(1);
  --icon-blend: screen;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 300 1rem/1.6 "Graphik", system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--link); }

/* The masthead: the bison, the wordmark and the documents. */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.brand { display: flex; align-items: baseline; gap: 0.4rem; text-decoration: none; color: var(--strong); }
.brand .logo {
  width: 1.9rem;
  height: 1.9rem;
  align-self: center;
  background: currentColor;
  mask: url("images/logo.svg") no-repeat center / contain;
}

.yack { font-family: "TeX Gyre Adventor", system-ui, sans-serif; font-weight: 700; color: var(--strong); }
.tagline { color: var(--muted); }
.brand .yack { font-size: 1.35rem; }

.masthead nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.masthead nav a, .docs-foot a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover, .docs-foot a:hover { color: var(--strong); }
.masthead nav a[aria-current="page"] { color: var(--strong); }

/* The document. */
.doc { max-width: 52rem; margin: 0 auto; padding: 1rem 1rem 3rem; }

.doc h1, .doc h2, .doc h3 { color: var(--strong); line-height: 1.25; }
.doc h1 { font-weight: 300; font-size: 2.2rem; margin: 1.5rem 0 1rem; }
.doc h2 {
  font-family: "Produkt", ui-serif, Georgia, serif;
  font-weight: 300;
  font-size: 1.75rem;
  margin: 3rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.doc h3 { font-family: "Produkt", ui-serif, Georgia, serif; font-weight: 300; font-size: 1.3rem; margin: 2rem 0 0.5rem; }
.doc strong { font-weight: 500; color: var(--strong); }
.doc p, .doc li { max-width: 46rem; }
.doc li { margin: 0.25rem 0; }

.doc img { max-width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); margin: 1rem 0; }
.doc img[src$=".svg"] { background: #ffffff; padding: 0.75rem; }
.caption { font-weight: 400; color: var(--strong); margin-bottom: 0; }

.doc table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.95rem; }
.doc th, .doc td { border: 1px solid var(--rule); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
.doc th { background: var(--head-bg); font-weight: 400; color: var(--strong); }
.doc td img {
  height: 1.3rem;
  width: auto;
  margin: 0;
  box-shadow: none;
  border-radius: 0;
  filter: var(--icon-filter);
  mix-blend-mode: var(--icon-blend);
}
.doc td:has(> img:only-child) { width: 2.2rem; text-align: center; }

.doc code { background: var(--code-bg); border-radius: 4px; padding: 0.05rem 0.3rem; font-size: 0.9em; }
.doc pre { background: var(--code-bg); border-radius: 6px; padding: 0.8rem 1rem; overflow-x: auto; }
.doc pre code { background: none; padding: 0; }

/* A document's contents, under its title. */
.contents { margin: 0 0 2rem; padding: 0.75rem 1.25rem; border: 1px solid var(--rule); border-radius: 6px; }
.contents-title { color: var(--strong); font-weight: 400; margin: 0 0 0.25rem; }
.contents ol { list-style: none; padding-left: 0; margin: 0; }
.contents ol ol { padding-left: 1.25rem; font-size: 0.95em; }
.contents li { margin: 0.15rem 0; }
.contents a { text-decoration: none; }
.contents a:hover { text-decoration: underline; }

/* The overview's cover. */
.cover { text-align: center; padding: 2.5rem 0 1rem; }
.cover-logo {
  width: 9rem;
  height: 9rem;
  margin: 0 auto;
  background: var(--strong);
  mask: url("images/logo.svg") no-repeat center / contain;
}
.cover .wordmark { font-size: 3rem; margin: 1rem 0; max-width: none; }
.cover .wordmark .tagline { font-size: 2rem; }
.cover .promise { color: var(--accent); font-weight: 400; font-size: 1.1rem; max-width: none; }
.cover-page .masthead .brand { visibility: hidden; }

/* Text beside a picture, side by side when there's room. */
.aside { display: flex; gap: 1.5rem; align-items: flex-start; }
.aside > img { width: 40%; flex: none; }
@media (max-width: 40rem) {
  .aside { flex-direction: column; }
  .aside > img { width: 100%; }
}

/* The documents, at the foot. */
.docs-foot { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; border-top: 1px solid var(--rule); }
.docs-foot-title { color: var(--strong); font-weight: 400; margin: 0 0 0.5rem; }
.docs-foot ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 0; margin: 0; }
.docs-foot a[aria-current="page"] { color: var(--strong); }

@media print {
  @page { size: A4; margin: 18mm 16mm; }
  .masthead nav, .docs-foot { display: none; }
  .doc { max-width: none; padding: 0; }
  .doc h2 { break-before: page; border-top: none; }
  .doc img, .doc table, .aside { break-inside: avoid; }
}
