/* Shared by the landing page, the docs pages and the mocks.
   Fonts are self-hosted (SIL Open Font License), so the site makes no third-party requests. */

@font-face {
  font-family: "Literata";
  src: url("fonts/literata.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* The page is e-ink grey, the same family as the plugin icon. Blue is the lit screen. */
  --paper: #e3e3dd;
  --panel: #eeeee8;
  --ink: #1c1c1c;
  --ink-soft: #50504a;
  --rule: #bcbcb3;
  --accent: #2a3fe0;
  --on-accent: #ffffff;

  /* E-ink screens keep these colours in both themes. */
  --eink: #e9e9e2;
  --eink-ink: #1c1c1c;
  --bezel: #2b2b29;

  --serif: "Literata", "Iowan Old Style", Georgia, serif;
  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171716;
    --panel: #21211f;
    --ink: #e7e7e0;
    --ink-soft: #a9a9a0;
    --rule: #3d3d39;
    --accent: #98a4ff;
    --on-accent: #10122b;
    --bezel: #050505;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 0.12em;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--wide {
  --wrap: 78rem;
}

/* Header and footer */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
}
.brand img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
}
.site-nav {
  display: flex;
  gap: 1.4rem;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
}

.site-footer {
  margin-top: 5rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
}
.site-footer p {
  margin: 0;
  max-width: 60ch;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border: 1.5px solid var(--ink);
  border-radius: 0.5rem;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.button:hover {
  background: var(--panel);
}
.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.button--primary:hover {
  background: var(--accent);
  filter: brightness(1.12);
}

/* Docs pages */

.docs {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 3.5rem;
  margin-top: 2rem;
}
.docs-nav {
  align-self: start;
  position: sticky;
  top: 1.5rem;
}
.docs-nav ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.docs-nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-left: 2px solid var(--rule);
  color: var(--ink-soft);
  text-decoration: none;
}
.docs-nav a:hover {
  color: var(--ink);
}
.docs-nav a[aria-current="page"] {
  border-left-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}

.prose {
  max-width: 44rem;
}
.prose h1 {
  margin: 0 0 1.2rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
}
.prose h2 {
  margin: 2.6rem 0 0.8rem;
  font-size: 1.6rem;
}
.prose h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.2rem;
  font-weight: 600;
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.1rem;
}
.prose li {
  margin-bottom: 0.35rem;
}
.prose li > ul,
.prose li > ol {
  margin-top: 0.35rem;
}
.prose .lede {
  color: var(--ink-soft);
  font-size: 1.2rem;
}
.prose code {
  padding: 0.1em 0.3em;
  border-radius: 0.25rem;
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}
.prose pre {
  margin: 0 0 1.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background: var(--panel);
  overflow-x: auto;
}
.prose pre code {
  padding: 0;
  background: none;
  overflow-wrap: normal;
}
.prose blockquote {
  margin: 0 0 1.2rem;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--ink);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--panel);
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}
.prose .table-scroll {
  margin: 0 0 1.2rem;
  overflow-x: auto;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.prose th,
.prose td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.prose th {
  border-bottom-color: var(--ink);
  font-weight: 600;
}
.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}
.docs-edit {
  margin-top: 3rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

@media (max-width: 50rem) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 0.5rem;
  }
  .docs-nav {
    position: static;
  }
  .docs-nav ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.4rem;
  }
  .docs-nav a {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--rule);
    border-radius: 2rem;
  }
  .docs-nav a[aria-current="page"] {
    border-color: var(--ink);
  }
}
