:root {
  color-scheme: dark;
  --background: #0c0820;
  --background-deep: #08051a;
  --surface: #17102d;
  --surface-raised: #231842;
  --text: #f9f4ff;
  --text-soft: #ddd5ec;
  --text-muted: #b8afcb;
  --primary: #a889ff;
  --primary-strong: #7a55e8;
  --accent: #ffb3d4;
  --border: #392a59;
  --hairline: rgba(57, 42, 89, 0.72);
  --measure: 40rem;
  --page: 70rem;
  --gutter: 1.25rem;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--background-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  background-image:
    url("/sky.svg"),
    linear-gradient(180deg, #120c2c 0, var(--background) 32rem, var(--background-deep) 100%);
  background-size: 640px 640px, 100% 100%;
  background-repeat: repeat-x, no-repeat;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body:has(.home),
body:has(.lost) {
  background-repeat: repeat, no-repeat;
}

::selection {
  background: rgba(168, 137, 255, 0.35);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration-line: underline;
  text-decoration-color: rgba(168, 137, 255, 0.4);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

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

.skip {
  position: absolute;
  top: -100px;
  left: var(--gutter);
  z-index: 10;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.9375rem;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

.site-header {
  border-bottom: 1px solid var(--hairline);
}

.header-inner,
.footer-inner {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

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

.brand-mark {
  width: 0.95em;
  height: 0.95em;
  flex: none;
  fill: var(--accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem;
  margin: 0 -0.75rem;
  font-size: 0.9375rem;
}

.site-nav a {
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
}

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

.site-nav a[aria-current="page"] {
  background: rgba(168, 137, 255, 0.14);
  color: var(--text);
}

main {
  flex: 1;
  width: 100%;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--text);
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw + 1.25rem, 2.75rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.4;
}

p,
ul,
ol,
table {
  margin: 0;
}

ul,
ol {
  padding-left: 1.25rem;
}

li {
  padding-left: 0.25rem;
}

li + li {
  margin-top: 0.5rem;
}

ul > li::marker {
  color: var(--primary);
}

ol > li::marker {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

strong {
  color: var(--text);
  font-weight: 650;
}

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

.doc {
  display: grid;
  grid-template-columns: minmax(0, var(--measure));
  justify-content: center;
  max-width: var(--page);
  margin: 0 auto;
  padding: 3.5rem var(--gutter) 5rem;
  color: var(--text-soft);
}

.doc > * {
  grid-column: 1;
  margin-top: 1rem;
}

.doc > :first-child {
  margin-top: 0;
}

.doc > h2 {
  margin-top: 3.25rem;
  scroll-margin-top: 1.5rem;
}

.doc > h3 {
  margin-top: 2rem;
}

.doc > h2 + *,
.doc > h3 + * {
  margin-top: 0.625rem;
}

.doc > h2 + h3 {
  margin-top: 1.5rem;
}

.doc > .meta {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.doc > .meta + * {
  margin-top: 2rem;
}

.doc > .meta + .draft + * {
  margin-top: 2rem;
}

.n {
  margin-right: 0.35em;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.draft {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: 14px;
  background: rgba(255, 179, 212, 0.07);
  color: var(--text-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.draft::before {
  content: "\2726";
  color: var(--accent);
}

.toc {
  padding: 1.25rem 1.25rem 1.25rem 1rem;
  border-radius: var(--radius);
  background: rgba(23, 16, 45, 0.72);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.toc ol {
  margin: 0;
  padding-left: 1.75rem;
}

.toc li + li {
  margin-top: 0.5rem;
}

.toc a {
  color: var(--text-soft);
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  background: rgba(23, 16, 45, 0.72);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.55;
}

th,
td {
  padding: 0.875rem 1rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(35, 24, 66, 0.7);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

tbody tr + tr td {
  border-top: 1px solid var(--hairline);
}

td:first-child {
  color: var(--text);
}

.site-footer {
  border-top: 1px solid var(--hairline);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-inner {
  display: grid;
  gap: 1rem 2rem;
  padding-top: 2.25rem;
  padding-bottom: 2.5rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

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

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

.footer-note {
  display: grid;
  gap: 0.25rem;
}

.footer-note p {
  margin: 0;
}

.home {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2rem;
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
  text-align: center;
}

.hero-art {
  width: min(78vw, 22rem);
}

.wheel {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.hero-copy {
  display: grid;
  align-content: center;
  justify-items: center;
}

.home h1 {
  font-size: clamp(2.5rem, 4vw + 1.5rem, 3.75rem);
  letter-spacing: -0.035em;
}

.lede {
  max-width: 26rem;
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: clamp(1.125rem, 0.5vw + 1rem, 1.3125rem);
  line-height: 1.5;
}

.soon {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 2rem;
  padding: 0.625rem 1.125rem;
  border-radius: 999px;
  background: rgba(23, 16, 45, 0.85);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 550;
  line-height: 1.4;
}

.soon::before {
  content: "\2726";
  color: var(--accent);
  font-size: 0.8125rem;
}

.lost {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.75rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5rem var(--gutter);
  text-align: center;
}

.lost .wheel {
  width: 11rem;
  margin-bottom: 1.25rem;
}

.lost p {
  margin: 0;
}

@media (min-width: 48rem) {
  :root {
    --gutter: 2rem;
  }

  .toc ol {
    column-count: 2;
    column-gap: 2.5rem;
  }

  .toc li {
    break-inside: avoid;
  }

  .toc li + li {
    margin-top: 0;
  }

  .toc li {
    padding-bottom: 0.5rem;
  }

  .toc ol {
    margin-bottom: -0.5rem;
  }

  .footer-inner {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .footer-nav {
    justify-content: flex-end;
  }

  .footer-note {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--hairline);
  }
}

@media (min-width: 64rem) {
  .home {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    justify-items: start;
    gap: 4rem;
    min-height: min(46rem, calc(100vh - 12rem));
    text-align: left;
  }

  .hero-copy {
    order: -1;
    justify-items: start;
  }

  .hero-art {
    justify-self: center;
    width: min(100%, 30rem);
  }

  .doc.has-toc {
    grid-template-columns: 15rem minmax(0, var(--measure));
    column-gap: 4.5rem;
  }

  .doc.has-toc > * {
    grid-column: 2;
  }

  .doc.has-toc > .toc {
    grid-column: 1;
    grid-row: 1 / span 400;
    align-self: start;
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    margin-top: 0.5rem;
    padding: 0;
    border-radius: 0;
    background: none;
    font-size: 0.875rem;
  }

  .doc.has-toc > .toc ol {
    column-count: 1;
  }

  .doc.has-toc > .toc li {
    padding-bottom: 0.625rem;
  }

  .doc.has-toc > .toc a {
    color: var(--text-muted);
  }

  .doc.has-toc > .toc a:hover {
    color: var(--text);
  }
}

@media (max-width: 40rem) {
  body {
    font-size: 1rem;
  }

  .header-inner {
    padding-top: 0.875rem;
    padding-bottom: 0.625rem;
  }

  .soon {
    display: block;
    max-width: 19rem;
    padding: 0;
    background: none;
    box-shadow: none;
    color: var(--text-soft);
    font-weight: 500;
    text-wrap: balance;
  }

  .soon::before {
    margin-right: 0.5rem;
  }

  .site-nav {
    width: calc(100% + 1.25rem);
    margin: 0 -0.625rem;
    font-size: 0.875rem;
  }

  .site-nav a {
    padding: 0.375rem 0.625rem;
  }

  .doc {
    padding-top: 2.25rem;
    padding-bottom: 3.5rem;
  }

  .doc > h2 {
    margin-top: 2.75rem;
    font-size: 1.25rem;
  }

  .table-wrap.stack {
    overflow: visible;
  }

  .stack table,
  .stack tbody,
  .stack tr,
  .stack td {
    display: block;
  }

  .stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .stack tr {
    padding: 0.875rem 1rem;
  }

  .stack tbody tr + tr {
    border-top: 1px solid var(--hairline);
  }

  .stack tbody tr + tr td {
    border-top: 0;
  }

  .stack td {
    padding: 0;
  }

  .stack td + td {
    margin-top: 0.5rem;
  }

  .stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
  }

  .stack td:first-child {
    font-weight: 600;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .wheel-ring {
    animation: wheel-turn 240s linear infinite;
  }

  .wheel-sign {
    transform-box: fill-box;
    transform-origin: center;
    animation: wheel-turn 240s linear infinite reverse;
  }
}

@keyframes wheel-turn {
  to {
    transform: rotate(360deg);
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .doc,
  strong,
  h1,
  h2,
  h3,
  td:first-child {
    color: #000;
  }

  a {
    color: #000;
  }

  .site-nav,
  .site-footer,
  .skip,
  .toc {
    display: none;
  }

  .table-wrap,
  .draft {
    background: none;
    box-shadow: none;
  }
}
