/* The site's one look: black, hard edges, white. Each door has a second colour of its own: red, or the paper door's green.
   The letters are Paper Kit's: Pixel Operator for everything read or pressed, PX Garamond for a heading. Both are
   pixel fonts, drawn at 16px or a whole multiple of it. Their licences are in the repository's licences folder. */

@font-face { font-family: "Pixel Operator"; src: url("/assets/PixelOperator.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: "PX Garamond"; src: url("/assets/PXGaramond-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: block; }
/* The hidden characters of a password: a square of pixels in place of a browser's round dot (tools/mask-font.py). */
@font-face { font-family: "Pixel Mask"; src: url("/site/pixel-mask.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: block; unicode-range: U+2022, U+25CF; }
/* The 1 of a heading: the field's own 1, since PX Garamond's reads as a capital I (tools/one-font.py). */
@font-face { font-family: "Pixel One"; src: url("/site/pixel-one.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: block; unicode-range: U+31; }

:root {
  --ink: #ffffff;
  --ground: #000000;
  --one: #ff2a1c;                                     /* the 1.computer door's red */
  --paper: #2ee66e;                                   /* the paper door's green */
  --hot: var(--one);
  --bad: var(--one);
  --dim: #a8a8a8;                                     /* 8.3:1 on the ground */
  --far: #767676;                                     /* what is later still: 4.6:1, the least words are given */
  --veil: #000000bf;
  --tap: 40px;                                        /* the least a finger is given */
  --edge: 2px;
  --ui: "Pixel Operator", ui-monospace, monospace;
  --serif: "Pixel One", "PX Garamond", Georgia, serif;
  color-scheme: dark;
}
:root[data-door="paper"] { --hot: var(--paper); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/20px var(--ui);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; }
canvas { image-rendering: pixelated; }
.px { color: inherit; }
.px.head { font: 32px/32px var(--serif); }
[hidden] { display: none !important; }
p.words { margin: 0; color: var(--dim); }

/* ---- a door */

body.door { overflow: hidden; overscroll-behavior: none; }
/* The field is as tall as the screen with a browser's bars hidden, so its box stays the same as they slide. */
#field { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; display: block; touch-action: none; cursor: crosshair;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
/* The window growing out of the glyph pressed, or shrinking back into it: black inside, its edge in the door's ink. */
.grow { position: fixed; z-index: 5; box-sizing: border-box; border: 2px solid; background: #000; pointer-events: none; }
.grow[hidden] { display: none; }
#stage { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; pointer-events: none; z-index: 6;
  padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.skip { position: fixed; left: 8px; top: 8px; z-index: 7; opacity: 0; pointer-events: none;
  background: var(--ground); color: var(--ink); border: var(--edge) solid var(--ink); padding: 4px 8px; }
.skip:focus-visible { opacity: 1; pointer-events: auto; outline: none; }
.plain { position: fixed; inset: auto 0 16px 0; text-align: center; }

/* ---- a window: carried by its bar, which is only a line of small words */

.win {
  pointer-events: auto;
  width: min(340px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--ground);
  border: var(--edge) solid var(--ink);
  animation: pop 110ms steps(3, jump-none) 1;
}
@keyframes pop { 0% { transform: scale(0.6); } 100% { transform: scale(1); } }
/* At a door the field grows the window out of the glyph pressed, and it shows itself at its full size: it does not pop. */
body.door .win { animation: none; }
.win.wide { width: min(500px, 100%); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px;
  padding: 0 0 0 8px; color: var(--dim); border-bottom: 1px solid var(--dim);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.win.carried .bar { cursor: grabbing; color: var(--ink); }
.shut { position: relative; background: none; color: var(--dim); border: 0; width: 28px; height: 24px; padding: 0 0 2px; cursor: pointer; flex: none; }
.shut::before { content: ""; position: absolute; inset: 0 0 -16px -12px; }      /* drawn 28 by 24, pressed over 40 by 40 reaching in from the corner */
.shut:hover, .shut:focus-visible { background: var(--hot); color: var(--ground); outline: none; }
.inside { display: grid; gap: 12px; padding: 16px 12px 8px; outline: none; }
.form { display: grid; gap: 12px; }
.row { display: grid; gap: 4px; color: var(--dim); }
.entry {
  width: 100%; min-height: 40px; padding: 8px;
  background: var(--ground); color: var(--ink); caret-color: var(--hot);
  border: var(--edge) solid var(--ink); border-radius: 0; outline: none;
  font: 16px/20px var(--ui);                                   /* 16px: a phone does not zoom in on it */
}
input[type="password"] { font-family: "Pixel Mask", var(--ui); }      /* still a password field: only its dots are drawn by us */
.entry:focus { border-color: var(--hot); box-shadow: inset 0 0 0 2px var(--hot); }   /* thicker as well as coloured */
.entry:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px var(--ground) inset; }
.key {
  min-height: 44px; padding: 8px 12px; cursor: pointer;
  background: var(--ink); color: var(--ground); border: var(--edge) solid var(--ink); border-radius: 0;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.key:hover, .key:focus-visible { background: var(--hot); border-color: var(--hot); outline: none; }
.key:active { transform: translate(2px, 2px); }
.key:disabled { opacity: 0.5; cursor: wait; }
.key.quiet { background: var(--ground); color: var(--ink); }
.key.quiet:hover, .key.quiet:focus-visible { background: var(--ground); color: var(--hot); border-color: var(--hot); }
.tick { display: flex; gap: 8px; align-items: center; min-height: 44px; cursor: pointer; }
.tick input { appearance: none; width: 18px; height: 18px; margin: 0; flex: none; border: var(--edge) solid var(--ink); background: var(--ground); border-radius: 0; }
.tick input:checked { background: var(--hot); box-shadow: inset 0 0 0 3px var(--ground); }
.tick input:focus-visible { outline: var(--edge) solid var(--hot); outline-offset: 2px; }
/* a window's "remember this ..." stands in the window's middle, as its buttons' words do, not at its left edge */
.win .inside > label.tick[for] { justify-content: center; }
.said { margin: 0; padding: 4px 12px 12px; color: var(--bad); min-height: 8px; }
.said:empty { padding-bottom: 4px; }
.said.good { color: var(--ink); }
.qr { display: block; justify-self: center; border: var(--edge) solid var(--ink); line-height: 0; }
.secret { justify-self: center; font: inherit; letter-spacing: 1px; user-select: all; word-break: break-all; text-align: center; }
.codes { margin: 0; padding: 8px; border: var(--edge) solid var(--ink); font: inherit; line-height: 24px; letter-spacing: 1px; text-align: center; user-select: all;
  white-space: pre-wrap; overflow-wrap: anywhere; }             /* a long link is broken to fit; it does not run out of the window */
.codes.command { letter-spacing: 0; text-align: left; color: var(--ink); }   /* a line to paste: read as it is typed */
.win p.fact { margin: 0; overflow-wrap: anywhere; }

/* ---- after signing in */

body.home { min-height: 100%; }
#home { max-width: 720px; margin: 0 auto; padding: 20px 16px calc(32px + env(safe-area-inset-bottom)); display: grid; gap: 24px; }
body.home #stage { background: var(--veil); pointer-events: none; }
body.home #stage:empty { display: none; }
body.home #stage > * { pointer-events: auto; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: var(--edge) solid var(--ink);
  min-width: 0; }                                               /* a long name is cut short; it does not widen the page */
.who { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-way { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--tap); }
.home-way:hover, .home-way:focus-visible { color: var(--hot); outline: none; }
/* The paper door where the site carries no kit: the path to a computer, and the way to the account. */
.first { min-height: calc(100vh - 52px - env(safe-area-inset-bottom)); min-height: calc(100dvh - 52px - env(safe-area-inset-bottom));
  display: grid; align-content: center; justify-items: center; gap: 20px; }
.first .key { min-width: min(280px, 100%); }
.first > p.words, .first .path { max-width: 420px; }
/* The path from the invitation to a linked computer: done steps dim and marked, the one to do now in full, later ones faint. */
.path { margin: 0; padding: 0 0 0 24px; display: grid; gap: 16px; width: 100%; }
.path li > div { display: grid; gap: 8px; justify-items: start; }
.path li::marker { color: var(--ink); }
.path li.done { color: var(--dim); }
.path li.done::marker { color: var(--dim); }
.path li.done .tag { color: var(--hot); }
.path li.now, .path li.next { color: var(--ink); }
.path li.now::marker { color: var(--hot); }
.path li.later { color: var(--far); }
.path li .small-way { padding: 0; min-height: var(--tap); }
/* The link window: one way under another, the likeliest first. */
.way { padding-top: 12px; border-top: 1px solid var(--dim); }
.row > .key.small { justify-self: start; }
.win p.state { color: var(--hot); }
.small-way { color: var(--dim); min-height: 44px; display: flex; align-items: center; padding: 0 8px; }
.small-way:hover, .small-way:focus-visible { color: var(--hot); outline: none; }
.first .said { padding: 0; min-height: 0; text-align: center; }
.first p.words { text-align: center; }
a.key { text-decoration: none; }
button.small-way { background: none; border: 0; font: inherit; cursor: pointer; }
.launch { display: grid; gap: 16px; }
.tile { display: flex; align-items: center; gap: 16px; padding: 16px; min-height: 104px; text-decoration: none;
  background: var(--ink); color: var(--ground); border: var(--edge) solid var(--ink); box-shadow: 6px 6px 0 0 var(--hot); }
.tile.paper { box-shadow: 6px 6px 0 0 var(--paper); }
.tile.one { box-shadow: 6px 6px 0 0 var(--one); }
.tile:hover, .tile:focus-visible { transform: translate(3px, 3px); box-shadow: 3px 3px 0 0 var(--hot); outline: none; }
.tile.paper:hover, .tile.paper:focus-visible { box-shadow: 3px 3px 0 0 var(--paper); }
.tile.one:hover, .tile.one:focus-visible { box-shadow: 3px 3px 0 0 var(--one); }
.art { display: flex; gap: 8px; flex: none; }
.pixels { display: block; image-rendering: pixelated; }
.tile .words { display: grid; gap: 8px; min-width: 0; }
.empty { display: grid; gap: 8px; padding: 16px; border: var(--edge) dashed var(--dim); }
.account { display: grid; gap: 16px; }
.part { display: grid; gap: 8px; padding-top: 12px; border-top: var(--edge) solid var(--dim); }
.part > .px, .part > summary { margin-bottom: 4px; color: var(--dim); }
details.part > div:not(.line) { display: grid; gap: 8px; }      /* the panel's lines stand as far apart as any other part's */
summary { cursor: pointer; list-style: none; min-height: var(--tap); display: flex; align-items: center; gap: 8px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; width: 12px; color: var(--hot); }
details[open] > summary::before { content: "-"; }
summary:focus-visible { outline: var(--edge) solid var(--hot); outline-offset: 2px; }
.line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 36px; }
.fact { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.key.small { min-height: var(--tap); padding: 4px 8px; flex: none; background: var(--ground); color: var(--ink); }
.line > .keys { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 1 auto; }      /* a line's controls go under its words together */
.key.small:hover, .key.small:focus-visible { background: var(--hot); color: var(--ground); }
.gap { height: 8px; }
.list { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.account > .said { padding: 0; min-height: 0; }
/* The runs accounts shared (/shared): one line each, which opens it. */
.shared { display: grid; gap: 8px; }
a.run { display: grid; gap: 4px; padding: 8px 12px; min-height: 44px; color: var(--ink); text-decoration: none; border: var(--edge) solid var(--dim); }
a.run:hover, a.run:focus-visible { border-color: var(--hot); outline: none; }
a.run .when, a.run .made { color: var(--dim); overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .tile { gap: 12px; padding: 12px; }
  .key.small { min-height: 44px; }
}

/* ---- the Cloud panel (public/site/cloud.js), the site's owner's alone: bars, chips and a small table, in the page's own
   black and white, with one colour for each kind of work */
:root { --w-sessions: #3ec8ff; --w-replays: #ffd23f; --w-live: #2ee66e; --w-feeds: #ff6bd6; --w-storage: #ff9640; --w-rest: #a8a8a8; }
.cloud { display: grid; gap: 20px; }
.cloud-block { display: grid; gap: 10px; min-width: 0; }
.cloud-head { color: var(--dim); }
.cloud-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.cloud .big { font: 32px/32px var(--ui); color: var(--ink); }
.meter { display: flex; height: 24px; border: var(--edge) solid var(--ink); background: var(--ground); overflow: hidden; }
.meter.small { height: 12px; border-width: 1px; border-color: var(--dim); }
.meter .seg { display: block; height: 100%; min-width: 2px; }
.meter.covered .seg { opacity: 0.4; }
.seg.sessions, .dot.sessions { background: var(--w-sessions); }
.seg.replays, .dot.replays { background: var(--w-replays); }
.seg.live, .dot.live { background: var(--w-live); }
.seg.feeds, .dot.feeds { background: var(--w-feeds); }
.seg.storage, .dot.storage { background: var(--w-storage); }
.seg.rest, .dot.rest { background: var(--w-rest); }
.seg.mine { background: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 8px; border: var(--edge) solid var(--ink); color: var(--ink); }
.chip.quiet { border-color: var(--dim); color: var(--dim); }
.chip.none { border-style: dashed; border-color: var(--far); color: var(--far); }
.chip.warm { border-color: var(--one); color: var(--one); }
.chip.value { border-color: var(--dim); }
.chip .dot, .chip.switch .dot { display: inline-block; width: 10px; height: 10px; flex: none; }
.chip.switch.on .dot { background: var(--paper); }
.chip.switch.off { border-color: var(--one); color: var(--one); }
.chip.switch.off .dot { background: var(--one); }
.chip.none .dot { opacity: 0.4; }
.cloud-accounts { display: grid; gap: 6px; }
.acct { display: grid; grid-template-columns: minmax(0, 10em) minmax(60px, 1fr) auto; align-items: center; gap: 8px; }
.acct .fig { color: var(--dim); white-space: nowrap; }
.units .unit { display: grid; gap: 4px; padding: 8px 10px; border: var(--edge) solid var(--ink); min-width: 120px; flex: 1 1 120px; }
.units .unit.none { border-style: dashed; border-color: var(--far); color: var(--dim); }
.units .unit.none .big { color: var(--dim); }
.steps { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.step { display: grid; gap: 4px; color: var(--dim); }
.entry.small { width: 7em; min-height: 40px; }
.scale { display: grid; gap: 4px; }
.scale-row { display: grid; grid-template-columns: 6em 7em minmax(0, 1fr); align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px; text-align: left;
  background: var(--ground); color: var(--ink); border: 1px solid var(--dim); font: inherit; cursor: pointer; }
.scale-row.head { border: 0; color: var(--dim); cursor: default; min-height: 24px; }
.scale-row .big { font-size: 24px; line-height: 24px; }
.scale-row .largest { color: var(--dim); overflow-wrap: anywhere; }
.scale-row:hover, .scale-row:focus-visible { border-color: var(--hot); outline: none; }
.fact.limited { color: var(--dim); }
@media (max-width: 480px) {
  .acct { grid-template-columns: minmax(0, 1fr) auto; }
  .acct .meter { grid-column: 1 / -1; grid-row: 2; }
  .scale-row { grid-template-columns: 4.5em 6em; }
  .scale-row .largest { display: none; }
  .scale-row.head > :last-child { display: none; }
}

/* ---- the account page in Paper Kit's own look. The page and its windows
   take the kit's own tokens (studio.css :root, light and dark as the system asks): its grounds, its two inks and its
   accent in place of black, white and the door's green; a button is a filled raised block with no outline, the one
   to press next the kit's primary; a part is set off by its panel, not a rule; corners stay square. The door and its
   field keep their own black (body.door). Nothing new: every value is one of the kit's. */
body.home {
  --ground: #F4F2EC; --panel: #ECE9E2; --raised: #E3DFD6; --hover: #DDD8CE; --select: #B3A6D1;
  --ink: #272A31; --dim: #585C67; --far: #585C67; --hot: #66538D; --bad: #914918; --primary-ink: #F4F2EC; --frame: #726D86;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  body.home {
    --ground: #000000; --panel: #09090D; --raised: #171623; --hover: #221F33; --select: #453D6B;
    --ink: #C5C3CF; --dim: #9693A1; --far: #9693A1; --hot: #9C92AC; --bad: #F5A06D; --primary-ink: #000000; --frame: #7A768C;
    color-scheme: dark;
  }
}
body.home .top { border-bottom: 0; padding-bottom: 0; }
body.home .part { border-top: 0; background: var(--panel); padding: 16px; }
body.home .key { background: var(--hot); color: var(--primary-ink); border: 0; }
body.home .key:hover, body.home .key:focus-visible { background: var(--hot); filter: brightness(1.15); }
body.home .key.quiet, body.home .key.small { background: var(--raised); color: var(--ink); border: 0; }
body.home .key.quiet:hover, body.home .key.quiet:focus-visible, body.home .key.small:hover, body.home .key.small:focus-visible { background: var(--hover); color: var(--ink); filter: none; }
body.home .key:active { transform: none; }
body.home .entry { background: var(--raised); border: 0; }
body.home .entry:focus { box-shadow: inset 0 0 0 2px var(--hot); }
body.home .win { background: var(--panel); border: 0; box-shadow: 0 0 0 2px var(--frame); }
body.home .bar { border-bottom: 0; background: var(--raised); }
body.home .tick input { border-color: var(--dim); background: var(--raised); }
body.home .chip, body.home .units .unit, body.home a.run { border-color: var(--dim); }
body.home .meter { border: 0; background: var(--raised); }
/* a line's words on the left and its controls on the right, at every width */
body.home .line { flex-wrap: nowrap; }
body.home .line > .fact { flex: 1 1 auto; }
body.home .line > .fact + :is(.key, .keys) { margin-left: auto; }
body.home .line > .keys { flex: none; }
@media (max-width: 480px) { body.home .line { flex-wrap: wrap; } }
