/*
 * SPDX-FileCopyrightText: 2026 Anton Wiklund and Solid Memo contributors
 *
 * SPDX-License-Identifier: MIT
 */

/*
 * The docs' pages (docsSite.ts), their one stylesheet: the pages allow no
 * other (style-src 'self'). The colors are the app's own, as the About
 * page has them (apps/web/public/about/index.html); with no script, the
 * pages follow the browser's light or dark, and so do the diagrams.
 */
:root {
  color-scheme: light;
  --bg: #f7f6f1;
  --surface: #ffffff;
  --text: #16202a;
  --text-muted: #545c68;
  --border: #e4e1d5;
  --link: #25603a;
  --code-bg: #efede4;
  --note-bg: #fbf3d5;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #11171e;
    --surface: #19212b;
    --text: #ecebe4;
    --text-muted: #9ba6b2;
    --border: #2a3644;
    --link: #74cc8e;
    --code-bg: #1f2833;
    --note-bg: #2e2a1a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    1.0625rem / 1.6 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  overflow-wrap: break-word;
}

header.site,
main,
footer {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1rem;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.skip:focus {
  top: 1rem;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

header.site nav {
  display: flex;
  gap: 1.25rem;
  font-weight: 600;
}

header.site p {
  margin: 0;
  color: var(--text-muted);
}

/* Every page, under "All pages": closed until opened, on a line of its own. */
.pages {
  flex-basis: 100%;
}

.pages summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--link);
}

.pages > nav > ul {
  columns: 15rem;
  column-gap: 1.5rem;
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.pages > nav > ul > li {
  break-inside: avoid;
  font-weight: 600;
}

.pages ul ul {
  margin: 0.125rem 0 0.5rem;
  padding-left: 1rem;
  font-weight: 400;
}

.pages [aria-current="page"] {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.3;
  margin: 2rem 0 0.5rem;
}

h1 {
  font-size: 2.25rem;
  line-height: 1.2;
  margin-top: 1.5rem;
}

h2 {
  font-size: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 1.25rem;
}

h4,
h5,
h6 {
  font-size: 1.0625rem;
}

li {
  margin: 0.25rem 0;
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  border-radius: 0.25rem;
  padding: 0.1em 0.3em;
}

pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--code-bg);
  border-radius: 0.5rem;
  line-height: 1.45;
}

pre code {
  padding: 0;
  background: none;
  font-size: 0.875rem;
}

blockquote {
  margin: 1rem 0;
  padding: 0 1rem;
  border-left: 0.25rem solid var(--border);
  color: var(--text-muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.table {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface);
}

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

figure {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

figcaption {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

figure details {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
}

figure .note,
.archive {
  margin: 1rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--note-bg);
  border-radius: 0.5rem;
}

.toc {
  margin: 1.5rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.toc p {
  margin: 0;
  font-weight: 600;
}

.toc ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pager a[rel="next"] {
  margin-left: auto;
}

footer {
  padding-top: 0.5rem;
  padding-bottom: 2.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 30rem) {
  h1 {
    font-size: 1.875rem;
  }
}
