/* The reading pages. Self-contained: these are served without the app, so
   nothing here depends on the palette JavaScript applies. Light and dark
   both come from the reader's own preference. */
:root {
  color-scheme: light dark;
  --paper: light-dark(#ffffff, #14161b);
  --ink: light-dark(#242424, #e6e7ea);
  --ink-soft: light-dark(#5a5f6a, #a7adba);
  --ink-faint: light-dark(#8b909c, #767d8c);
  --edge: light-dark(#e4e4e2, #2a2e37);
  --panel: light-dark(#faf9f7, #1b1e25);
  --accent: light-dark(#1a5c8a, #7cc0ea);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: 46rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1.5rem;
}
/* the wordmark, set the way the app sets it */
.wordmark {
  font-family: var(--mono);
  font-size: 1.2rem;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
}
.wm-bold { font-weight: 700; }
.wm-caret {
  display: inline-block;
  width: .5em;
  height: 1em;
  margin-left: .18em;
  vertical-align: text-bottom;
  background: var(--accent);
}
.topnav { display: flex; gap: 1.1rem; font-size: .88rem; }
.topnav a { color: var(--ink-soft); text-decoration: none; }
.topnav a:hover { color: var(--ink); }

main {
  flex: 1;
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .7rem;
}
.eyebrow a { color: var(--ink-faint); text-decoration: none; }
.eyebrow a:hover { color: var(--accent); }

h1 {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: .6rem;
}
h2 {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 2.4rem 0 .7rem;
}
.tagline {
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin-bottom: 1.6rem;
  max-width: 38rem;
}
p { margin-bottom: 1rem; max-width: 38rem; }

/* the quick facts, above the prose */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .9rem 1.5rem;
  padding: 1.1rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
}
.facts dt {
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.facts dd { font-size: .95rem; }

.cta { margin: 1.8rem 0 .3rem; }
.cta a {
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
  color: var(--paper);
  background: var(--accent);
  padding: .65rem 1.25rem;
  border-radius: 8px;
}
.cta a:hover { filter: brightness(1.1); }
.cta-note { font-size: .88rem; color: var(--ink-faint); }

.docs, .others, .langlist { list-style: none; }
.docs li { margin-bottom: .45rem; }
.docs a { color: var(--accent); }

.others {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .5rem;
}
.others a {
  display: inline-block;
  font-size: .85rem;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--edge);
  border-radius: 99px;
  padding: .18rem .7rem;
}
.others a:hover { color: var(--ink); border-color: var(--ink-faint); }

/* the index */
.langlist { margin-top: 1.6rem; }
.langlist li { border-top: 1px solid var(--edge); }
.langlist li:last-child { border-bottom: 1px solid var(--edge); }
.langlist a {
  display: block;
  padding: .95rem .2rem;
  text-decoration: none;
  color: var(--ink);
}
.langlist a:hover { background: var(--panel); }
.langlist strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.02rem;
}
.langlist span {
  display: block;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.5;
}

.foot {
  max-width: 46rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--edge);
  color: var(--ink-faint);
  font-size: .85rem;
}
.foot a { color: var(--ink-faint); font-family: var(--mono); }

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

/* ---------------- the tree below a language ---------------- */

.crumbs {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-faint);
  margin-bottom: .9rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4em;
}
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* a set: an anchored section of the tour page, not a page of its own */
.set { scroll-margin-top: 1.5rem; }
.set h2 { margin-top: 2rem; }
.steps { list-style: none; }
.steps li { border-top: 1px solid var(--edge); padding: .7rem 0; }
.steps li:last-child { border-bottom: 1px solid var(--edge); }
.steps a { font-weight: 600; text-decoration: none; color: var(--ink); }
.steps a:hover { color: var(--accent); }
.steps span {
  display: block;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.5;
  max-width: 38rem;
}

.how { margin: 0 0 1rem 1.1rem; }
.how li { margin-bottom: .35rem; max-width: 38rem; }

.vocab {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .4rem;
  margin-bottom: 1rem;
}
.vocab code {
  font-family: var(--mono);
  font-size: .82rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: .1rem .45rem;
}

.nextprev {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.6rem 0;
  font-size: .9rem;
}
.nextprev a { color: var(--accent); text-decoration: none; }
.nextprev a:hover { text-decoration: underline; }

/* the snippet itself, colored from the token runs already on the row */
.code {
  font-family: var(--mono);
  font-size: .88rem;
  line-height: 1.65;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
  margin-bottom: 1.4rem;
}
.t-keyword, .t-keyword-declaration, .t-keyword-reserved, .t-keyword-namespace,
.t-keyword-constant, .t-operator-word {
  color: light-dark(#8250df, #d2a8ff);
}
.t-keyword-type, .t-name-class, .t-name-builtin, .t-name-builtin-pseudo {
  color: light-dark(#953800, #ffa657);
}
.t-name-function, .t-name-function-magic, .t-name-decorator {
  color: light-dark(#6639ba, #d2a8ff);
}
.t-literal-string, .t-literal-string-single, .t-literal-string-double,
.t-literal-string-doc, .t-literal-string-escape, .t-literal-string-interpol,
.t-literal-string-affix, .t-literal-string-backtick, .t-literal-string-char {
  color: light-dark(#0a3069, #a5d6ff);
}
.t-literal-number, .t-literal-number-integer, .t-literal-number-float,
.t-literal-number-hex, .t-literal-number-oct, .t-literal-number-bin {
  color: light-dark(#0550ae, #79c0ff);
}
.t-comment, .t-comment-single, .t-comment-multiline, .t-comment-hashbang,
.t-comment-preproc, .t-comment-special {
  color: light-dark(#6e7781, #8b949e);
  font-style: italic;
}
.t-name-tag { color: light-dark(#116329, #7ee787); }
.t-name-attribute { color: light-dark(#0550ae, #79c0ff); }
.t-operator, .t-punctuation { color: var(--ink-soft); }
