@font-face {
  font-family: Onest;
  src: url('/assets/onest-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --page: #f7f6f3;
  --raised: #ffffff;
  --sunken: #eeece7;
  --line: #dcd8d0;
  --ink: #1d1c1a;
  --muted: #5d5a54;
  --accent: #1d1c1a;
  --focus: #2f5bd3;
  --ok: #2e6b3a;
  --error: #a3341f;
  --radius: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #161614;
    --raised: #1f1e1c;
    --sunken: #262522;
    --line: #3a3833;
    --ink: #f1efea;
    --muted: #b3afa6;
    --accent: #f1efea;
    --focus: #8aa8ff;
    --ok: #7fc28d;
    --error: #f08b74;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 1.0625rem/1.65 Onest, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--page);
}

.skip:focus {
  top: 1rem;
  z-index: 10;
}

.wrap {
  width: min(100% - 2rem, 1160px);
  margin-inline: auto;
}

.narrow {
  width: min(100% - 2rem, 680px);
}

/* Header and footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  min-height: 64px;
  padding-block: 0.5rem;
}

.brand {
  font-weight: 650;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand span {
  font-weight: 400;
  color: var(--muted);
}

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

.site-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--muted);
}

.site-header nav a:hover,
.site-header nav a[aria-current='page'] {
  color: var(--ink);
  text-decoration: underline;
}

main {
  padding-block: 3rem 5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Type */

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 650;
}

h1 {
  font-size: clamp(2rem, 4vw + 1rem, 3.25rem);
  margin: 0 0 1rem;
}

.label {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 550;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lead {
  font-size: 1.25rem;
  color: var(--muted);
  max-width: 40em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--page);
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  text-decoration: none;
  opacity: 0.88;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* Home */

.intro {
  margin-bottom: 3rem;
}

.theme-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.theme-card {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
  overflow: hidden;
}

.theme-card img {
  width: 100%;
  aspect-ratio: 800 / 560;
  object-fit: cover;
  object-position: top;
  border-bottom: 1px solid var(--line);
}

.theme-card__text {
  padding: 1.5rem;
}

.theme-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.theme-card p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.theme-card__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}

.theme-card__links a:not(.button) {
  color: var(--ink);
}

/* Documentation */

.docs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

.docs__toc ol {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.docs__toc li {
  padding-block: 0.125rem;
}

.docs__toc a {
  text-decoration: none;
}

.docs__toc a:hover {
  text-decoration: underline;
}

@media (min-width: 1000px) {
  .docs {
    grid-template-columns: 220px minmax(0, 760px);
    gap: 4rem;
    align-items: start;
  }

  .docs__toc {
    position: sticky;
    top: 6rem;
    font-size: 0.9375rem;
  }
}

@media (max-width: 999px) {
  .docs__toc {
    padding: 1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--raised);
  }
}

.prose h2 {
  margin: 3rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 1.625rem;
}

.prose h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.25rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1rem;
}

.prose li + li {
  margin-top: 0.375rem;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.375rem;
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: 3px;
  background: var(--sunken);
  font: 0.875em/1.4 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunken);
  overflow-x: auto;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: 0.875rem;
  overflow-wrap: normal;
}

.table {
  margin: 0 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--raised);
}

th,
td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--sunken);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

td:first-child {
  white-space: nowrap;
}

/* Support form */

.form {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
}

.field {
  display: grid;
  align-content: start;
  gap: 0.375rem;
}

.field-row {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 600px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  font-weight: 550;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form .button {
  justify-self: start;
}

.form__status {
  margin: 0;
  min-height: 1.5em;
}
