/* The guides under /docs. Their look comes from the two logos they belong to: LunarSide's crescent moon and
   four-pointed star, violet on a night sky, and Luawe's, the same moon inside a dashed orbit. So the page is the
   night, the one bright colour is the moon's violet, lines that part things are dashed like the orbit, and a
   heading is marked with the star. Code is coloured as the game's own editor colours it. */
@font-face {
  font-family: "Bebas Neue";
  src: url("/fonts/bebas-neue.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: "Space Mono";
  src: url("/fonts/space-mono.woff2") format("woff2");
  font-display: swap;
}

:root {
  --night: #12081c; /* the logos' sky */
  --shade: #1a0d28; /* a step up from it: code, the list of pages */
  --dusk: #240e34; /* the moon's dark side: what is pointed at, a note */
  --rim: #3a2152; /* lines */
  --moon: #a842f5; /* the moon */
  --glow: #c99bff; /* its light: links */
  --text: #e4daf0; /* (a little under white: the game's text face is a heavy one) */
  --dim: #b3a3c7;
  --faint: #86769c;
  /* code, as the editor has it */
  --code-word: #b99cff;
  --code-name: #6fc8ff;
  --code-text: #63d99a;
  --code-number: #ffd65c;
  --code-note: #8d7fa6;
  --careful: #ffd65c;
  --head: "Bebas Neue", "Impact", sans-serif;
  --body: "Fredoka", "Segoe UI", system-ui, sans-serif;
  --mono: "Space Mono", "Cascadia Mono", "Consolas", monospace;
  /* a four-pointed star, as in the logos */
  --star: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
  color-scheme: dark;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--glow);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #fff;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 5;
  padding: 8px 14px;
  background: var(--moon);
  color: #fff;
  border-radius: 8px;
}

.skip:focus {
  top: 12px;
}

/* ---- the bar along the top */
.top {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  background: rgba(18, 8, 28, 0.92);
  border-bottom: 1px dashed var(--rim);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand .name {
  font-family: var(--head);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.06em;
  padding-top: 3px;
}

.brand .of {
  color: var(--faint);
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.to-pages {
  display: none;
  margin-left: auto;
  font-size: 15px;
  white-space: nowrap;
}

/* ---- the list of pages, the page, and what is on it */
.frame {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  max-width: 1360px;
  margin: 0 auto;
}

.pages {
  position: sticky;
  top: 61px;
  align-self: start;
  max-height: calc(100vh - 61px);
  overflow-y: auto;
  padding: 26px 18px 40px 24px;
  border-right: 1px dashed var(--rim);
}

.pages section + section {
  margin-top: 22px;
}

.pages h2 {
  margin: 0 0 6px;
  padding: 0 0 0 8px;
  border: 0;
  font-family: var(--head);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.pages h2::before {
  display: none;
}

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

.pages a {
  position: relative;
  display: block;
  padding: 4px 8px 4px 24px;
  border-radius: 7px;
  color: var(--dim);
  font-size: 15.5px;
  line-height: 1.4;
  text-decoration: none;
}

.pages a:hover {
  background: var(--dusk);
  color: #fff;
}

.pages a[aria-current="page"] {
  color: #fff;
  font-weight: 500;
}

/* (the page that is open: the star stands by it) */
.pages a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0.55em;
  width: 11px;
  height: 11px;
  background: var(--moon);
  clip-path: var(--star);
}

main {
  min-width: 0;
  padding: 34px 48px 64px;
}

article {
  max-width: 46rem;
}

.moon {
  display: none;
}

h1 {
  margin: 0 0 14px;
  font-family: var(--head);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 64px);
  line-height: 0.95;
  letter-spacing: 0.04em;
}

h1 + p {
  font-size: 19.5px;
  line-height: 1.55;
  color: var(--dim);
}

h2,
h3,
h4 {
  position: relative;
  margin: 0;
  font-weight: 400;
}

h2 {
  margin-top: 46px;
  padding-top: 26px;
  border-top: 1px dashed var(--rim);
  font-family: var(--head);
  font-size: 33px;
  line-height: 1.05;
  letter-spacing: 0.05em;
}

/* (a heading's star, in the margin) */
h2::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 30px;
  width: 18px;
  height: 18px;
  background: var(--moon);
  clip-path: var(--star);
}

h3 {
  margin-top: 34px;
  font-family: var(--body);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.3;
}

h4 {
  margin-top: 26px;
  font-weight: 600;
  font-size: 17px;
  color: var(--dim);
}

.anchor {
  color: inherit;
  text-decoration: none;
}

.anchor:hover {
  color: var(--glow);
}

p,
ul,
ol {
  margin: 14px 0 0;
}

article ul,
article ol {
  padding-left: 1.5em;
}

article li + li {
  margin-top: 5px;
}

article li::marker {
  color: var(--moon);
}

strong {
  font-weight: 600;
  color: #fff;
}

hr {
  margin: 40px 0 0;
  border: 0;
  border-top: 1px dashed var(--rim);
}

/* ---- code */
code,
pre {
  font-family: var(--mono);
}

:not(pre) > code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--dusk);
  font-size: 0.86em;
  color: #f1e8ff;
  white-space: nowrap;
}

.code {
  margin-top: 16px;
  border: 1px solid var(--rim);
  border-radius: 12px;
  background: var(--shade);
  overflow: hidden;
}

.code pre {
  margin: 0;
  padding: 15px 18px;
  overflow-x: auto;
  font-size: 14.5px;
  line-height: 1.62;
  tab-size: 4;
}

.code .k {
  color: var(--code-word);
}

.code .b {
  color: var(--code-name);
}

.code .s {
  color: var(--code-text);
}

.code .n {
  color: var(--code-number);
}

.code .c {
  color: var(--code-note);
}

/* (what a script printed: as the editor's Output shows it) */
.code.output {
  background: #0d0514;
  border-style: dashed;
}

.code.output pre {
  padding-top: 6px;
  color: var(--dim);
}

.says {
  margin: 0;
  padding: 9px 18px 0;
  font-size: 13.5px;
  color: var(--faint);
}

/* (how a function is called: on the reference pages, under its name) */
.code.signature {
  display: inline-block;
  max-width: 100%;
  margin-top: 10px;
  border: 0;
  background: var(--dusk);
}

.code.signature pre {
  padding: 8px 14px;
  font-size: 15px;
}

/* (the reference pages: a function's or a value's name, as a script writes it, never in capitals) */
.reference h3 {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px dashed var(--rim);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 20px;
  color: #fff;
}

/* ---- notes and tables */
.note {
  position: relative;
  margin-top: 18px;
  padding: 13px 18px 13px 46px;
  border: 1px dashed var(--moon);
  border-radius: 12px;
  background: rgba(168, 66, 245, 0.07);
}

.note::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 19px;
  width: 16px;
  height: 16px;
  background: var(--moon);
  clip-path: var(--star);
}

.note p {
  margin: 0;
}

.note.careful {
  border-color: var(--careful);
  background: rgba(255, 214, 92, 0.06);
}

.note.careful::before {
  background: var(--careful);
}

.table {
  margin-top: 18px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

th {
  text-align: left;
  font-weight: 500;
  color: var(--faint);
  font-size: 14.5px;
}

th,
td {
  padding: 8px 14px 8px 0;
  border-bottom: 1px dashed var(--rim);
  vertical-align: top;
}

/* ---- the pages before and after */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 46rem;
  margin-top: 56px;
}

.pager a {
  flex: 1 1 220px;
  padding: 12px 18px;
  border: 1px dashed var(--rim);
  border-radius: 12px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--moon);
  background: var(--dusk);
}

.pager span {
  display: block;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--faint);
}

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

/* ---- "On this page", at the right when there is room */
.toc {
  display: none;
}

.toc h2 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  font-family: var(--head);
  font-size: 17px;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.toc h2::before {
  display: none;
}

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

.toc a {
  display: block;
  padding: 3px 0;
  color: var(--dim);
  font-size: 14.5px;
  line-height: 1.4;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.toc a:hover {
  color: #fff;
}

@media (min-width: 1240px) {
  .frame {
    grid-template-columns: 264px minmax(0, 1fr) 232px;
  }
  .toc {
    display: block;
    position: sticky;
    top: 61px;
    align-self: start;
    max-height: calc(100vh - 61px);
    overflow-y: auto;
    padding: 40px 24px 40px 8px;
  }
}

/* ---- the foot */
.foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px 30px;
  border-top: 1px dashed var(--rim);
  color: var(--faint);
  font-size: 14.5px;
}

.foot img {
  flex: none;
  border-radius: 9px;
}

.foot p {
  margin: 0;
  max-width: 62rem;
}

/* ---- the guide's first page: the logo, big, with its orbit turning slowly behind it */
.front main {
  position: relative;
}

.front .moon {
  display: block;
  position: relative;
  float: right;
  width: 300px;
  height: 300px;
  margin: 4px 0 20px 36px;
}

.front .moon img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.front .orbit {
  position: absolute;
  inset: -17%;
  border: 2px dashed rgba(168, 66, 245, 0.28);
  border-radius: 50%;
  animation: turn 240s linear infinite;
}

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

.front h1 {
  font-size: clamp(72px, 13vw, 148px);
  letter-spacing: 0.06em;
  text-shadow: 0 0 34px rgba(168, 66, 245, 0.45);
}

.front h1 + p {
  font-size: 22px;
  color: var(--text);
}

.front article {
  max-width: 54rem;
}

.front h2 {
  clear: both;
}

/* ---- narrow screens: the page first, the list of pages under it */
@media (max-width: 940px) {
  .frame {
    display: flex;
    flex-direction: column;
  }
  main {
    order: 1;
  }
  .pages {
    order: 2;
  }
  .to-pages {
    display: block;
  }
  .brand .of {
    display: none;
  }
  main {
    padding: 26px 20px 44px 30px;
  }
  h2::before {
    left: -22px;
    width: 14px;
    height: 14px;
    top: 34px;
  }
  .pages {
    position: static;
    max-height: none;
    border-right: 0;
    border-top: 1px dashed var(--rim);
    padding: 24px 20px 30px;
  }
  .pages ul {
    columns: 2 180px;
  }
  .front .moon {
    float: none;
    width: 200px;
    height: 200px;
    margin: 18px auto 34px;
  }
  .top {
    padding: 8px 16px;
  }
  html {
    scroll-padding-top: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .front .orbit {
    animation: none;
  }
}

@media print {
  .top,
  .pages,
  .toc,
  .pager,
  .skip {
    display: none;
  }
  .frame {
    display: block;
  }
  html,
  body {
    background: #fff;
    color: #000;
  }
}
