/* zeminlab.com
   A one-bit desktop. Black and white only: a dotted desk, a menu bar, icons, and windows you can open and drag.
   Films are shown as one-bit dithered prints; point at a print, or press it, to see the photograph.
   Pixelify Sans sets the machine's own words (menus, titles, buttons, icon names); Courier Prime sets what you read.
   Without JavaScript the same content is shown as a column of plain windows. */

@font-face { font-family: "Pixelify Sans"; src: url("/fonts/PixelifySans-latin.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("/fonts/CourierPrime-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("/fonts/CourierPrime-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #FFFFFF;   /* windows, menu bar, the light dots of the desk */
  --ink: #000000;     /* everything else */
  --ui: "Pixelify Sans", "Courier Prime", "Courier New", monospace;
  --text: "Courier Prime", "Courier New", Courier, monospace;
  --menu-h: 46px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--text); }
a { color: inherit; text-underline-offset: 3px; }
a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
a:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }
img { max-width: 100%; height: auto; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.todo { text-decoration: underline dotted; text-underline-offset: 4px; }

/* ---------- menu bar ---------- */
.menu { position: fixed; inset: 0 0 auto; z-index: 5; height: var(--menu-h); display: flex; align-items: center; gap: 2px;
  padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px));
  background: var(--paper); border-bottom: 2px solid var(--ink); font: 400 17px/1 var(--ui); }
.menu button { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--ink); color: var(--paper); }
.menu button:focus-visible { outline: 2px dashed var(--paper); outline-offset: -6px; }
.menu button:hover svg rect, .menu button:focus-visible svg rect { fill: var(--paper); }
.menu-mark svg { display: block; shape-rendering: crispEdges; }
.clock { margin-left: auto; padding: 0 8px; font-variant-numeric: tabular-nums; }
html:not(.js) .menu button, html:not(.js) .clock { display: none; }
html:not(.js) .menu { position: static; }

/* ---------- desk ---------- */
.desk { position: fixed; inset: var(--menu-h) 0 0; overflow: hidden; background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Crect width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3C/svg%3E");
  background-size: 4px 4px; image-rendering: pixelated; }
html:not(.js) .desk { position: static; overflow: visible; min-height: calc(100% - var(--menu-h)); padding: 24px 16px 48px; }

/* ---------- icons ---------- */
.icons { position: absolute; top: 18px; right: max(18px, env(safe-area-inset-right, 0px)); z-index: 1;
  display: grid; gap: 10px; max-height: calc(100% - 36px); }
html:not(.js) .icons { display: none; }
.icon { width: 108px; min-height: 96px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0;
  background: none; border: 0; color: var(--ink); font: 400 15px/1.2 var(--ui); text-align: center; cursor: pointer; text-decoration: none; }
.icon:hover { background: none; color: var(--ink); }
.icon svg { width: 48px; height: 48px; display: block; shape-rendering: crispEdges; }
.icon span { background: var(--paper); padding: 1px 5px; }
.icon:hover span, .icon[aria-pressed="true"] span { background: var(--ink); color: var(--paper); }
.icon:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; background: var(--paper); }

/* ---------- windows ---------- */
.win { position: absolute; display: flex; flex-direction: column; max-height: calc(100% - 20px);
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); outline: none; }
.win-bar { position: relative; flex: none; height: 38px; display: flex; align-items: center; justify-content: center;
  border-bottom: 2px solid var(--ink); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.win.top .win-bar::before { content: ""; position: absolute; inset: 9px 8px;
  background: repeating-linear-gradient(to bottom, var(--ink) 0 2px, var(--paper) 2px 4px); }
.win-bar h2 { position: relative; margin: 0; padding: 0 12px; max-width: 70%; background: var(--paper);
  font: 600 16px/38px var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-close { position: absolute; left: 12px; top: 9px; z-index: 1; width: 20px; height: 20px; padding: 0;
  border: 2px solid var(--ink); background: var(--paper); cursor: pointer; }
.win-close::after { content: ""; position: absolute; inset: -12px; }
.win-close:hover { background: var(--ink); }
.win-close:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }
.win-body { min-height: 0; overflow: auto; padding: 16px 18px 18px; }
.zoom { position: absolute; z-index: 999; border: 1px dashed var(--ink); pointer-events: none; }
.ghost { position: absolute; z-index: 998; border: 2px dotted var(--ink); pointer-events: none; }

/* text inside a window (and inside a plain window without JavaScript) */
.win-body p, .p p { margin: 0 0 .8em; max-width: 62ch; }
.win-body h1, .p h1, .win-body h3, .p h3 { margin: .1em 0 .4em; font: 600 22px/1.2 var(--ui); }
.win-body h2, .p h2:not(.p-title) { margin: 1.3em 0 .35em; font: 600 17px/1.3 var(--ui); }
.win-body cite, .p cite { font-style: normal; }
.win-body ul, .p ul { margin: 0 0 .8em; padding-left: 1.2em; max-width: 62ch; }
.win-body li, .p li { margin-bottom: .3em; }
.meta { display: grid; gap: 4px; margin: 0 0 1em; }
.meta div { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 1ch; }
.meta dt { font-family: var(--ui); }
.meta dd { margin: 0; }
.note { font-size: 14px; }
.empty-frame { display: grid; place-items: center; min-height: 140px; margin: 0 0 16px; padding: 16px; border: 2px dashed var(--ink); text-align: center; }
.empty-frame p { margin: 0; }

/* the Coverage drawing, in one bit */
.diagram { margin: 1em 0 1.2em; }
.diagram svg { display: block; width: 100%; height: auto; }
.d-frame rect, .d-frame-top { fill: none; stroke: var(--ink); stroke-width: 2; }
.d-photo rect { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.d-path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 5; }
.d-cam { fill: var(--ink); }
.d-known { fill: var(--paper); }
.d-legend { font-size: 14px; }
.diagram figcaption { font-size: 14px; max-width: 62ch; }

/* About */
.big-mark { display: block; width: 100%; height: auto; margin: 6px 0 16px; shape-rendering: crispEdges; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn { min-height: 44px; display: inline-flex; align-items: center; padding: 0 18px; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--paper); color: var(--ink); font: 400 16px/1 var(--ui); text-decoration: none; cursor: pointer; }
.btn.default { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.btn:hover, .btn:focus-visible { background: var(--ink); color: var(--paper); }
.btn:focus-visible { outline: 2px dashed var(--ink); outline-offset: 6px; }

/* a folder of works */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
.item { display: flex; flex-direction: column; gap: 6px; padding: 0; background: none; border: 0; color: var(--ink);
  font: 15px/1.25 var(--ui); text-align: left; cursor: pointer; }
.item canvas, .item .no-pic { display: block; width: 100%; height: auto; aspect-ratio: 1920 / 1400; border: 2px solid var(--ink);
  background: var(--paper); image-rendering: pixelated; }
.item .no-pic { border-style: dashed; }
.item .t { align-self: flex-start; padding: 1px 4px; }
.item:hover .t, .item:focus-visible .t { background: var(--ink); color: var(--paper); }
.item:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
.item .y { padding: 0 4px; font: 14px/1.3 var(--text); }

/* a work */
.pic { position: relative; margin: 0; border: 2px solid var(--ink); line-height: 0; background: var(--paper); cursor: pointer; }
.pic canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s steps(6); }
.pic:hover img, .pic[aria-pressed="true"] img { opacity: 1; }
.pic:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
.label { margin-top: 14px; }
.label h3 { margin-bottom: .2em; }
.label .fact { margin: 0; }
.label .statement { margin-top: .8em; }
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; font: 15px/1 var(--ui); }

/* Snake */
.corner { position: absolute; left: max(18px, env(safe-area-inset-left, 0px)); bottom: max(14px, env(safe-area-inset-bottom, 0px)); z-index: 1; }
html:not(.js) .corner { display: none; }
.g-stage { position: relative; }
.g-canvas { display: block; width: 100%; height: auto; border: 2px solid var(--ink); image-rendering: pixelated; touch-action: none; background: var(--paper); }
.g-canvas:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }
.g-over { position: absolute; inset: 2px; display: grid; place-items: center; text-align: center; }
.g-over .card { background: var(--paper); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 12px 16px; max-width: 80%; }
.g-over p { margin: 0 0 10px; }
.g-status { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; font: 15px/1.3 var(--ui); font-variant-numeric: tabular-nums; }
.pad { display: none; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 52px); gap: 6px; justify-content: center; margin-top: 12px; }
.pad button { display: grid; place-items: center; padding: 0; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); cursor: pointer; touch-action: manipulation; }
.pad button:active, .pad button:focus-visible { background: var(--ink); }
.pad button:active svg path, .pad button:focus-visible svg path { fill: var(--paper); }
.pad button:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }
.pad .up { grid-column: 2; grid-row: 1; } .pad .left { grid-column: 1; grid-row: 2; } .pad .down { grid-column: 2; grid-row: 2; } .pad .right { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) { .pad { display: grid; } }

/* ---------- without JavaScript: the same windows, one under another ---------- */
.plain { display: grid; gap: 28px; max-width: 680px; margin: 0 auto; }
html.js .plain { display: none; }
.p { background: var(--paper); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.p > .p-title { margin: 0; padding: 0 12px; border-bottom: 2px solid var(--ink); font: 600 16px/38px var(--ui); text-align: center; }
.p > :not(.p-title) { margin-left: 18px; margin-right: 18px; }
.p > :nth-child(2) { margin-top: 16px; }
.p > :last-child { margin-bottom: 18px; }
.p-list { list-style: none; padding: 0 !important; }
.p-stills { list-style: none; padding: 0 !important; display: grid; gap: 10px; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .icons { position: relative; top: 0; right: 0; display: flex; justify-content: space-around; padding: 10px 6px 0; max-height: none; }
  .icon { width: auto; flex: 1 1 0; min-width: 0; min-height: 88px; }
  .icon span { overflow-wrap: anywhere; }
  .win { left: 8px !important; right: 8px !important; top: 112px !important; width: auto !important; max-height: calc(100% - 120px) !important; }
  .win-bar { cursor: default; }
  .menu .wide { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pic img { transition: none; }
}
