/* The pages of the site of boids. Layout: one field (a canvas) with a narrow strip of readings below it. */
:root {
  --field: #e8eff5;
  --panel: #f7fafc;
  --ink: #142230;
  --muted: #586b7c;
  --line: #cfdbe5;
  --boid: #2c4257;
  --rock: #93a6b7;
  --warm: #b4481c;
  --cool: #0d7a78;
  /* The colors of the animals, and of the grounds of the games. */
  --wool: #f6f1e6; --fur: #8a5a33; --gold: #d49a12; --leaf: #4c8a3c; --plum: #7a4a8c;
  --edge: rgba(20, 34, 48, 0.42); --shade: rgba(20, 34, 48, 0.16);
  --grass: #dce8cf; --water: #d3e5ee; --sand: #efe5cf; --floor: #e6e3dd; --night: #1b2633;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --field: #0c151e; --panel: #131f2b; --ink: #e4edf4; --muted: #8fa3b5; --line: #26384a;
    --boid: #c3d3e1; --rock: #44586c; --warm: #f08c4e; --cool: #4fcabf;
    --wool: #e8e0cd; --fur: #b98154; --gold: #f0c04a; --leaf: #7ab65c; --plum: #b88ad3;
    --edge: rgba(0, 0, 0, 0.55); --shade: rgba(0, 0, 0, 0.32);
    --grass: #1b2b1e; --water: #0e2130; --sand: #2c2517; --floor: #202126; --night: #070c13;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--panel); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55; }
a { color: var(--cool); }
.page { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 22px; }
nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
nav .name { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--ink); text-decoration: none; margin-right: auto; }
nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
nav a:hover, nav a[aria-current="page"] { color: var(--ink); }
h1 { font-family: var(--display); font-size: 2rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-family: var(--display); font-size: 1.15rem; font-weight: 600; margin: 0 0 6px; }
h3 { font-family: var(--display); font-size: 0.95rem; font-weight: 600; margin: 0 0 4px; }
p { margin: 0; }
.lead { color: var(--muted); max-width: 66ch; font-size: 1.05rem; }
.head { display: flex; flex-direction: column; gap: 10px; }
.field { position: relative; background: var(--field); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
canvas { display: block; width: 100%; height: auto; }
.source {
  position: absolute; left: 10px; top: 10px; font-family: var(--data); font-size: 0.72rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px;
}
.strip { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; min-height: 44px; }
.readings { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.reading { display: flex; flex-direction: column; gap: 2px; }
.reading span { font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.reading b { font-family: var(--data); font-weight: 400; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.controls { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
button, select {
  font: 500 0.85rem var(--body); color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 6px 12px; cursor: pointer; touch-action: manipulation;
}
button:hover, select:hover { border-color: var(--muted); }
button:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--cool); outline-offset: 2px; }
button[aria-pressed="true"], button.main { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.keys { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.9rem; }
.keys button { min-width: 64px; padding: 10px 12px; user-select: none; }
/* The keys of a game: a pad of four arrows, and the keys of the actions. */
.pad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 44px); gap: 6px; }
.pad [data-key="up"] { grid-column: 2; grid-row: 1; }
.pad [data-key="left"] { grid-column: 1; grid-row: 2; }
.pad [data-key="down"] { grid-column: 2; grid-row: 2; }
.pad [data-key="right"] { grid-column: 3; grid-row: 2; }
.pad button, button.key { padding: 0; min-width: 0; height: 44px; user-select: none; -webkit-user-select: none; }
button.key { width: 80px; }
button.down { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.keys p { margin: 0; flex: 1 1 260px; min-width: 0; }
/* Keys with no pad (Rock Patrol): each key has the size of its text. */
.keys.plain button.key { width: auto; height: auto; min-width: 64px; padding: 10px 12px; }
/* A phone (scene.js). The field uses all the width of the screen. In
   portrait the world is turned, so the canvas is tall: its height has a
   limit, and the field with its bars is on the screen at one time. */
.hud, .thumbs { display: none; }
.field.phone { margin-left: -16px; margin-right: -16px; border-radius: 0; border-left: 0; border-right: 0; }
.field.phone canvas { width: auto; height: auto; max-width: 100%; margin: 0 auto; }
/* The readings, in a bar at the top of the field. */
.field.phone .hud {
  display: flex; flex-wrap: wrap; gap: 0 12px; align-items: baseline; min-height: 30px; padding: 5px 10px 4px 74px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.field.phone .hud .reading { flex-direction: row; gap: 5px; align-items: baseline; }
.field.phone .hud .reading span { font-size: 0.62rem; }
.field.phone .hud .reading b { font-size: 0.82rem; }
.field.phone .source { left: 8px; top: 5px; font-size: 0.62rem; padding: 1px 6px; }
/* The message of the game, in a band below the readings (scene.js). */
.band { display: none; }
.field.phone .band {
  display: block; position: absolute; z-index: 3; left: 0; right: 0; padding: 7px 12px; font-size: 0.86rem; line-height: 1.4;
  background: color-mix(in srgb, var(--panel) 90%, transparent); border-bottom: 1px solid var(--line); cursor: pointer;
}
.field.phone .band.end { border-bottom: 2px solid var(--ink); font-weight: 500; }
/* The keys of the game, on the field at the bottom corners, near the thumbs. */
.field.phone .thumbs {
  display: flex; position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; justify-content: space-between; align-items: flex-end;
  gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); pointer-events: none;
}
/* On a tall screen, the keys are in a bar below the canvas (scene.js). */
.field.phone.bar .thumbs { position: static; background: var(--panel); border-top: 1px solid var(--line); padding: 8px 12px; }
.field.phone.bar .thumb.right { flex-direction: row; flex-wrap: wrap-reverse; justify-content: flex-end; }
.thumb { display: flex; gap: 6px; align-items: flex-end; pointer-events: auto; }
.thumb.right { flex-direction: column-reverse; align-items: stretch; }
.field.phone .thumbs:not(:has(button:not([hidden]))) { display: none; }
.field.phone .pad { grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 48px); }
.field.phone .thumbs button { height: 48px; font-size: 0.8rem; touch-action: none; -webkit-tap-highlight-color: transparent; }
.field.phone .thumbs button.key { width: auto; min-width: 72px; padding: 0 10px; }
/* A key on the field shows what is below it. */
.field.phone:not(.bar) .thumbs button:not(.down):not(.main) { background: color-mix(in srgb, var(--panel) 30%, transparent); border-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px 28px; border-top: 1px solid var(--line); padding-top: 18px; }
.notes p, .notes li { color: var(--muted); font-size: 0.92rem; }
code, pre { font-family: var(--data); font-size: 0.85em; }
code { color: var(--ink); }
pre { margin: 0; padding: 14px 16px; background: var(--field); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; line-height: 1.5; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px 28px; align-items: start; }
.two > * { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
textarea {
  width: 100%; min-height: 420px; resize: vertical; font-family: var(--data); font-size: 0.82rem; line-height: 1.5;
  color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; tab-size: 2;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.error { color: var(--warm); font-size: 0.92rem; min-height: 1.5em; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.wide { overflow-x: auto; }
footer { border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: 0.9rem; }
/* On a phone, a page has one column, with the field first. The tools of
   a page (data-phone="tools") are just below the field. */
@media (max-width: 700px) and (orientation: portrait), (max-height: 500px) and (orientation: landscape) {
  .page > .field ~ *, .two > * > *, [data-phone="open"] > * { order: 1; }
  .page > .field ~ [data-phone="tools"], .two > * > .field, .two > * > [data-phone="tools"], [data-phone="open"] > [data-phone="tools"] { order: 0; }
  .two { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .two > *, [data-phone="open"] { display: contents; }
  [data-phone="tools"] { margin-top: -12px; }
  .two [data-phone="tools"] { margin-top: 0; }
}
