/* Theme colours. automaton.js reads --paper, --ink, --cell-text, --cell-dim, --cell-head and --box too. */
:root {
  --paper: #f2f4f3;
  --ink: #10201c;
  --muted: #43514d;
  --border: #10201c;
  --accent: #1f4fd8;
  --cell-text: #4a5a55; /* grid text at rest */
  --cell-dim: #cdd5d1;
  --cell-head: #1f4fd8;
  --box: #1f4fd8; /* fill of a flipped-open block */
  --cell: 4px; /* set by automaton.js to match the grid */
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
}
/* Dark theme: used when the device is in dark mode (unless the visitor chose light)... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c1211;
    --ink: #e6ece9;
    --muted: #9aa8a3;
    --border: #4c5a55;
    --accent: #7aa2ff;
    --cell-text: #a3b0ab;
    --cell-dim: #26322e;
    --cell-head: #7aa2ff;
    --box: #7aa2ff;
  }
}
/* ...or when the visitor chose dark with the toggle. Keep both blocks in sync. */
:root[data-theme="dark"] {
  --paper: #0c1211;
  --ink: #e6ece9;
  --muted: #9aa8a3;
  --border: #4c5a55;
  --accent: #7aa2ff;
  --cell-text: #a3b0ab;
  --cell-dim: #26322e;
  --cell-head: #7aa2ff;
  --box: #7aa2ff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.page { position: relative; min-height: 100vh; overflow: hidden; }
#automaton { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wrap { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 24px 24px 72px; display: flex; flex-direction: column; gap: 64px; }

.panel { background: var(--paper); border: 1px solid var(--border); }
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: stretch; gap: 12px; font-family: var(--mono); font-size: 13px; }
.topbar p { margin: 0; display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 44px; }
.hint { color: var(--muted); }
.status .sep { color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { min-height: 44px; padding: 0 16px; color: var(--ink); font-family: var(--mono); font-size: 13px; cursor: pointer; }
.btn:hover { background: var(--ink); color: var(--paper); }

/* Grid-text blocks. The visible letters are painted on the canvas; the real text stays
   in the page (transparent) so it can be read aloud, searched and tabbed to. */
.item { display: block; max-width: calc(var(--cell) * 200); padding: calc(var(--cell) * 3); color: inherit; text-decoration: none; cursor: default; }
a.item { cursor: pointer; }
.gt { display: block; margin: 0; overflow: hidden; white-space: nowrap; color: transparent; font-size: 16px; font-weight: 400; line-height: 1; user-select: none; }
.desc { display: block; margin: 0; padding-top: calc(var(--cell) * 2); max-width: 40em; font-size: 16px; line-height: 1.5; color: var(--paper); opacity: 0; transition: opacity 0.1s; }
.item.is-open .desc { opacity: 1; transition: opacity 0.25s 0.3s; }
.placeholder { font-family: var(--mono); font-size: 13px; }
.index { display: flex; flex-direction: column; gap: calc(var(--cell) * 4); }
/* A row of smaller links; each .item.inline is as wide as its text. */
.links { display: flex; flex-wrap: wrap; gap: calc(var(--cell) * 2) calc(var(--cell) * 6); }
.item.inline { max-width: none; }

@media (max-width: 600px) {
  .wrap { padding: 16px 12px 48px; gap: 40px; }
  .desc { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .desc, .item.is-open .desc { transition: none; } }
