/* plumlang.org
 *
 * The palette, type stack, and measure are the SAME ones `doc_css()` in
 * bootstrap/self_host/main.plum emits for the generated reference. That
 * duplication is deliberate: the reference has to stand alone in a
 * folder on someone's disk with no build step and no network, so it
 * cannot import a stylesheet from here. Keeping the two in step by hand
 * is the price of the reference being genuinely self-contained.
 *
 * If you change a colour here, change it there. */

:root {
  --bg: #fcfafb; --fg: #1c1620; --muted: #6d6270;
  --rule: #e6dce3; --accent: #8a3a67; --surface: #f4eef2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15111a; --fg: #ece5ee; --muted: #9c90a2;
    --rule: #2e2636; --accent: #dd91bb; --surface: #1f1927;
  }
}

/* Syntax highlighting. These classes are emitted by `plum highlight`
 * -- the compiler's own lexer -- and the same names and values are in
 * `doc_css()`, for the reason given at the top of this file. */
:root {
  --hl-k: #8a3a67; --hl-t: #1f6f6b; --hl-s: #3f6b2b; --hl-n: #8a5a1a;
  --hl-c: #8a8290; --hl-d: #6d6270; --hl-o: #7a7280;
}
@media (prefers-color-scheme: dark) {
  :root {
    --hl-k: #dd91bb; --hl-t: #6fc7c0; --hl-s: #9ccf7a; --hl-n: #e0b170;
    --hl-c: #7d7386; --hl-d: #9c90a2; --hl-o: #9b93a4;
  }
}
pre .k { color: var(--hl-k); }
pre .t { color: var(--hl-t); }
pre .s { color: var(--hl-s); }
pre .n { color: var(--hl-n); }
pre .c { color: var(--hl-c); font-style: italic; }
pre .d { color: var(--hl-d); font-style: italic; }
pre .o { color: var(--hl-o); }
pre .f { color: inherit; font-weight: 600; }

/* Chroma, for the languages that are NOT Plum -- the `sh` blocks.
 *
 * Hugo highlights those itself, and emits its own class names, so
 * without this they render flat while the Plum blocks beside them are
 * coloured. The mapping is deliberately coarse: Chroma has ~60 token
 * classes and shell uses a handful, so these group them onto the same
 * four variables the Plum highlighter uses. Shell and Plum then agree
 * about what a comment or a string looks like, which is the point. */
.chroma { background: none; }
.chroma .c, .chroma .ch, .chroma .cm, .chroma .c1, .chroma .cs,
.chroma .cp, .chroma .cpf { color: var(--hl-c); font-style: italic; }
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn, .chroma .kp,
.chroma .kr, .chroma .kt { color: var(--hl-k); }
.chroma .s, .chroma .sa, .chroma .sb, .chroma .sc, .chroma .dl,
.chroma .sd, .chroma .s2, .chroma .se, .chroma .sh, .chroma .si,
.chroma .sx, .chroma .sr, .chroma .s1, .chroma .ss { color: var(--hl-s); }
.chroma .m, .chroma .mb, .chroma .mf, .chroma .mh, .chroma .mi,
.chroma .il, .chroma .mo { color: var(--hl-n); }
.chroma .nb, .chroma .nf, .chroma .nt, .chroma .nc { color: var(--hl-t); }
.chroma .nv, .chroma .vc, .chroma .vg, .chroma .vi { color: inherit; font-weight: 600; }
.chroma .o, .chroma .ow, .chroma .p { color: var(--hl-o); }
.chroma .err { color: inherit; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-serif, Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.6;
}

code, pre, .mono {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* --- Chrome ------------------------------------------------------- */

header.site {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem 1.4rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
}
header.site .brand {
  font-weight: 600; font-size: 1.15rem; letter-spacing: 0.01em;
  color: var(--fg); text-decoration: none; margin-right: auto;
}
header.site nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover { color: var(--accent); }
header.site nav a[aria-current="page"] { color: var(--fg); }

footer.site {
  margin-top: 5rem; padding: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted); font-size: 0.9rem;
}
footer.site p { margin: 0.25rem 0; }

main { padding: 0 1.5rem; }
main.doc { max-width: 46rem; margin: 0 auto; }

/* --- Home --------------------------------------------------------- */

main.home { max-width: 60rem; margin: 0 auto; }

.hero { padding: 4.5rem 0 3rem; }
.hero h1 {
  margin: 0; font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.1; font-weight: 500; letter-spacing: -0.015em;
  text-wrap: balance;
}
.hero .lede {
  max-width: 34rem; margin: 1.25rem 0 0;
  color: var(--muted); font-size: 1.1rem;
}
.hero .cta { display: flex; flex-wrap: wrap; gap: 1rem; margin: 2rem 0 0; align-items: center; }
.hero .cta a { text-decoration: none; }
.hero .cta .primary {
  background: var(--accent); color: var(--bg);
  padding: 0.5rem 1.2rem; border-radius: 3px;
}
.hero .cta .primary:hover { filter: brightness(1.1); }
.hero .cta a:not(.primary) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.sample { margin: 0 0 4rem; }
.facts { margin: 0 0 2rem; }
.facts h2 {
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin: 0 0 1.5rem;
}
.facts dl {
  display: grid; gap: 2rem 2.5rem; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}
.facts dt { font-weight: 600; margin-bottom: 0.35rem; }
.facts dd { margin: 0; color: var(--muted); }

/* --- Prose -------------------------------------------------------- */

article h1 { font-size: 2rem; font-weight: 500; margin: 3rem 0 0; text-wrap: balance; }
article h2 {
  font-size: 1.35rem; font-weight: 600; margin: 2.5rem 0 0.5rem;
  padding-top: 0.6rem; border-top: 1px solid var(--rule);
}
article h3 { font-size: 1.1rem; font-weight: 600; margin: 1.75rem 0 0.35rem; }
article h4 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 0.25rem; color: var(--muted); }

.blurb { color: var(--muted); font-size: 1.05rem; margin: 0.5rem 0 0; }

.toc {
  margin: 2rem 0; padding: 0.75rem 1rem;
  background: var(--surface); border-radius: 3px; font-size: 0.92rem;
}
.toc ul { margin: 0; padding-left: 1.1rem; }
.toc > nav > ul > li > ul { display: none; } /* one level; a 600-line grammar has too many */

pre {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 3px;
  padding: 0.75rem 0.9rem; overflow-x: auto; line-height: 1.5;
}
:not(pre) > code {
  background: var(--surface); border-radius: 2px; padding: 0.1em 0.3em;
}

blockquote {
  margin: 1.25rem 0; padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--rule); color: var(--muted);
}

table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 0.35rem 0.75rem 0.35rem 0; border-bottom: 1px solid var(--rule); }
th { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

.provenance { margin-top: 4rem; color: var(--muted); font-size: 0.85rem; }

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

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding: 3rem 0 2rem; }
}
