/* Nocturnal Help: one stylesheet for every page, in nocturnaldesk.com's colors and type. System
   fonts only, so nothing loads from elsewhere. */

:root {
  --bg: #0b0a14;
  --bg-raised: #12111e;
  --bg-card: #161527;
  --border: #26243d;
  --border-strong: #37345a;
  --text: #eceaf7;
  --text-muted: #a8a5c2;
  --text-faint: #8a87a6;
  --violet: #8b7cf6;
  --violet-bright: #a99dff;
  --violet-ink: #0f0d24;
  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1240px;
  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Cascadia Code', Consolas, ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16.5px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--violet-bright);
  text-underline-offset: 3px;
}

a:hover {
  color: #c4bcff;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--violet);
  color: var(--violet-ink);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 10;
}

.skip:focus {
  left: 12px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 10, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand img {
  height: 28px;
  width: auto;
  display: block;
}

.brand-help {
  color: var(--text-muted);
  font: 600 17px/1 var(--font-display);
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
}

.search {
  flex: 1 1 auto;
  max-width: 420px;
  display: flex;
  gap: 8px;
}

.search input {
  width: 100%;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 7px 12px;
}

.search input::placeholder {
  color: var(--text-faint);
}

.search input:focus-visible {
  outline-offset: 1px;
}

.home-link {
  margin-left: auto;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

.home-link:hover {
  color: var(--text);
}

/* Layout: the page's text, with the list of pages beside it on wide screens and after it on
   narrow ones. */

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-areas: 'side content';
  gap: 48px;
  padding-top: 36px;
  padding-bottom: 64px;
}

.layout--wide {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'content';
}

.content {
  grid-area: content;
  min-width: 0;
  max-width: 820px;
}

.layout--wide .content {
  max-width: none;
}

.side {
  grid-area: side;
  align-self: start;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-right: 6px;
  font-size: 14.5px;
}

.side h2 {
  font: 600 12px/1.4 var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 22px 0 6px;
}

.side h2:first-child {
  margin-top: 0;
}

.side ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side a {
  display: block;
  padding: 4px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.4;
}

.side a:hover {
  color: var(--text);
  background: var(--bg-card);
}

.side a[aria-current='page'] {
  color: var(--text);
  background: var(--bg-card);
  box-shadow: inset 2px 0 0 var(--violet);
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'content' 'side';
    gap: 40px;
  }

  .side {
    position: static;
    max-height: none;
    overflow: visible;
    border-top: 1px solid var(--border);
    padding-top: 24px;
  }

  .home-link {
    display: none;
  }
}

@media (max-width: 560px) {
  .site-header .wrap {
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .search {
    max-width: none;
    flex-basis: 100%;
  }
}

/* The page's text */

.crumb {
  margin: 0 0 6px;
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 500;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.hero h1,
.card h2 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.prose h1 {
  font-size: 38px;
  margin: 0 0 18px;
}

.prose h2 {
  font-size: 25px;
  margin: 44px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.prose h3 {
  font-size: 19px;
  margin: 30px 0 8px;
}

.prose h4 {
  font-size: 16.5px;
  margin: 24px 0 6px;
}

.prose p,
.prose ul,
.prose ol,
.prose pre,
.prose blockquote,
.prose .table {
  margin: 0 0 16px;
}

.prose ul,
.prose ol {
  padding-left: 24px;
}

.prose li {
  margin: 4px 0;
}

.prose li > p {
  margin: 0 0 8px;
}

.prose li > ul,
.prose li > ol {
  margin: 4px 0 6px;
}

.prose strong {
  font-weight: 600;
  color: #f4f2fc;
}

.prose .anchor {
  float: left;
  margin-left: -22px;
  width: 22px;
  color: var(--text-faint);
  text-decoration: none;
  opacity: 0;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose .anchor:focus-visible {
  opacity: 1;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 3px;
  overflow-wrap: anywhere;
}

.prose pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.5;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 14px;
  overflow-wrap: normal;
  white-space: pre;
}

.prose blockquote {
  border-left: 3px solid var(--violet);
  background: var(--bg-raised);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 16px;
  color: var(--text-muted);
}

.prose blockquote > :last-child {
  margin-bottom: 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.prose .table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

.prose th {
  background: var(--bg-raised);
  font-weight: 600;
  color: var(--text);
}

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

.prose td:first-child code {
  white-space: nowrap;
  overflow-wrap: normal;
}

.ext::after {
  content: '\2197';
  font-size: 0.85em;
  margin-left: 2px;
}

/* On this page, and next and previous */

.toc {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin: 0 0 28px;
  font-size: 15px;
}

.toc h2 {
  font: 600 12px/1.4 var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 6px;
  padding: 0;
  border: 0;
}

.toc ul {
  margin: 0;
  padding-left: 18px;
  columns: 2 220px;
  column-gap: 28px;
}

.toc li {
  margin: 2px 0;
  break-inside: avoid;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 48%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.pager a:hover {
  border-color: var(--border-strong);
  background: var(--bg-card);
}

.pager span {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
}

.pager__next {
  margin-left: auto;
  text-align: right;
}

/* Home */

.hero {
  padding: 28px 0 36px;
  max-width: 760px;
}

.hero h1 {
  font-size: clamp(36px, 6vw, 52px);
  margin: 0 0 12px;
}

.lead {
  color: var(--text-muted);
  font-size: 19px;
  margin: 0 0 24px;
}

.search--big {
  max-width: 600px;
}

.search--big input {
  font-size: 17px;
  padding: 11px 14px;
}

.hero__start {
  margin: 16px 0 0;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 10px;
  font: 600 16px/1.2 var(--font);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--violet);
  color: var(--violet-ink);
}

.btn-primary:hover {
  background: var(--violet-bright);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.card h2 {
  font-size: 19px;
  margin: 0 0 10px;
}

.card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.card li {
  margin: 5px 0;
}

.card a {
  text-decoration: none;
}

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

/* Search results */

.results {
  margin-top: 24px;
}

.results__count {
  color: var(--text-muted);
}

.results__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.results__list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.results__list a {
  font-weight: 600;
  font-size: 17px;
}

.results__list p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 14px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 22px;
  padding-bottom: 28px;
}

.site-footer p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}
