/* AgentJS site: one text face, one code face, two colours that mean something (the two ends of a scale). */

:root {
  --paper: #f6f4ee;
  --ink: #1f1d1a;
  --muted: #5f5a52;
  --rule: #d8d2c5;
  --code-ground: #eeebe3;
  --pole-a: #8f2d45;
  --pole-b: #9aae2f;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 40rem;
  --wide: 60rem;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.1875rem;
  line-height: 1.55;
  font-optical-sizing: auto;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

.site-head {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.25rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
}
.site-head .name { font-weight: 600; text-decoration: none; letter-spacing: 0.01em; }
.site-head .name span { color: var(--muted); font-weight: 400; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }

main { max-width: var(--wide); margin: 0 auto; }

.prose { max-width: var(--measure); }

h1 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
}
h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 3rem 0 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}
h3 { font-size: 1.1875rem; font-weight: 600; margin: 1.75rem 0 0.25rem; }

p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }

.lede { font-size: 1.3rem; line-height: 1.45; color: var(--ink); }
.small { font-size: 1rem; color: var(--muted); }

code, pre, .mono { font-family: var(--mono); }
:not(pre) > code { font-size: 0.85em; background: var(--code-ground); padding: 0.05em 0.3em; border-radius: 2px; }

pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--code-ground);
  border-left: 2px solid var(--ink);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
  tab-size: 2;
}

/* The list of examples on the landing page */
.plates { list-style: none; padding: 0; margin: 0; max-width: var(--measure); }
.plates li { display: grid; grid-template-columns: 2.5rem 1fr; gap: 0 0.5rem; padding: 0.75rem 0; border-bottom: 1px solid var(--rule); margin: 0; }
.plates .num { font-family: var(--mono); font-size: 0.875rem; color: var(--muted); padding-top: 0.2rem; }
.plates a { font-weight: 600; }
.plates p { margin: 0.15rem 0 0; font-size: 1.0625rem; }

/* An example page: the running simulation as a plate with its caption */
.plate { margin: 1.5rem 0 1rem; }
.plate .stage {
  position: relative;
  width: 100%;
  background: #fffdf8;
  border: 1px solid var(--rule);
  line-height: 0;
}
.plate .stage canvas { display: block; max-width: 100%; }
.plate figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0 0;
  font-size: 1rem;
  color: var(--muted);
}
.readout { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink); }
.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

button, select, input[type="range"] { font: inherit; }
button {
  font-family: var(--mono);
  font-size: 0.8125rem;
  padding: 0.35rem 0.8rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
}
button:hover { background: var(--ink); color: var(--paper); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
label.mono { font-size: 0.8125rem; display: inline-flex; gap: 0.5rem; align-items: center; color: var(--ink); }
input[type="range"] { accent-color: var(--ink); width: 9rem; }

.key { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1rem; white-space: nowrap; }
.swatch { width: 0.75rem; height: 0.75rem; display: inline-block; border: 1px solid var(--ink); }
.swatch.a { background: var(--pole-a); border-color: var(--pole-a); }
.swatch.b { background: var(--pole-b); border-color: var(--pole-b); }
.swatch.ink { background: var(--ink); }
.swatch.hollow { background: transparent; }
.swatch.round { border-radius: 50%; }

.classes { font-family: var(--mono); font-size: 0.875rem; }

.source-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; }
.source-head p { margin: 0; }
pre.source { max-height: none; }

.site-foot {
  max-width: var(--wide);
  margin: 4rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 1rem;
  color: var(--muted);
}

@media (max-width: 30rem) {
  body { font-size: 1.0625rem; padding: 0 1rem 3rem; }
  .lede { font-size: 1.15rem; }
  pre { font-size: 0.75rem; padding: 0.8rem; }
  .plates li { grid-template-columns: 2rem 1fr; }
}

/* Under a plate: what the colours and shapes mean */
.legend { margin: 0 0 1.5rem; }

/* The NSMnum example: how each type's answers divide between the places in its list, and none */
.bars { margin: 1rem 0 1.5rem; display: grid; gap: 0.75rem; }
.bar-row { display: grid; grid-template-columns: 5rem 1fr; gap: 0.25rem 1rem; align-items: start; }
.bar-title { font-family: var(--mono); font-size: 0.8125rem; font-weight: 600; padding-top: 0.15rem; }
.bar-cell { display: grid; grid-template-columns: 3.5rem 1fr 2.75rem; gap: 0 0.5rem; align-items: center; font-family: var(--mono); font-size: 0.8125rem; }
.bar-track { display: block; height: 0.6rem; background: var(--code-ground); }
.bar-fill { display: block; height: 100%; background: var(--ink); }
.bar-fill[data-none="true"] { background: transparent; box-shadow: inset 0 0 0 1px var(--ink); }
.bar-share { text-align: right; }
.bar-row { grid-template-columns: 5rem 1fr; }
.bar-row > .bar-cell { grid-column: 2; }

@media (max-width: 30rem) {
  .bar-row { grid-template-columns: 1fr; }
  .bar-row > .bar-cell { grid-column: 1; }
}

.prose h2:first-child { margin-top: 2rem; }
.source-head h2 { margin-bottom: 0.25rem; }

.controls label.mono { margin-right: 0.75rem; }
