:root { --bg: #ffd400; --ink: #111111; --magnet: #1d3bff; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 500 1rem/1.5 system-ui, sans-serif; }
a { color: inherit; text-underline-offset: 4px; }
a:hover { color: var(--magnet); }
a:focus-visible, summary:focus-visible { outline: 3px solid var(--magnet); outline-offset: 3px; }

/* Home and scene pages: header, picture, footer filling the window */
body.home, body.scene { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 24px; }
.bar.bottom { align-items: flex-end; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.stage { position: relative; flex: 1; min-height: 0; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage canvas { cursor: crosshair; touch-action: none; }

.logo { font-weight: 800; font-size: 1.6rem; letter-spacing: -.04em; text-decoration: none; }
nav.main { display: flex; gap: 18px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
h1 { font-weight: 800; font-size: 1.5rem; letter-spacing: -.03em; line-height: 1.1; }
.desc { max-width: 34em; opacity: .85; font-size: .95rem; margin-top: 4px; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; text-align: right; font-size: .95rem; }
summary { cursor: pointer; }
details ul { list-style: none; margin-top: 6px; }
details pre { font: inherit; font-size: .9rem; white-space: pre-wrap; margin-top: 6px; max-width: 30em; }
.math { text-align: left; }

/* Gallery and 404: ordinary scrolling document */
body.plain { padding: 24px; }
.plain .wrap { max-width: 960px; margin: 0 auto; }
.plain h1 { font-size: clamp(2rem, 6vw, 3.4rem); margin: 32px 0 8px; }
.plain p { max-width: 34em; margin-bottom: 24px; }
.plain ul.grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px 20px; margin-bottom: 32px; }
.plain ul.grid li a { display: block; text-decoration: none; }
.plain ul.grid li a:hover { text-decoration: underline; }
canvas.thumb { display: block; width: 100%; height: auto; aspect-ratio: 200 / 130; margin-bottom: 6px; }
.plain .pager { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 40px; }

@media (max-width: 640px) {
  .bar { padding: 12px 16px; flex-wrap: wrap; }
  .bar.bottom { flex-direction: column; align-items: stretch; }
  .side { align-items: flex-start; text-align: left; }
    h1 { font-size: 1.25rem; }
}
