/*
 * The site in the push.do design system; the tokens are in tokens.css.
 *
 * The dot of push.do is a button and a lamp. Amber is only where something
 * waits for the visitor: the lit dot of the wordmark, a question without an
 * answer, the "waiting" line under a command. The shape says what one does
 * with a thing: what is pressed is a pill, what is read or filled in is a
 * box, what waits for an answer is a slab. What a terminal prints (the name
 * push.do, topic names, commands, times) is in the mono face.
 *
 * The page is a bench: the sender's commands on the left, the receiver (the
 * feed of the example's topic) on the right, from 960px. Below that the
 * feed comes right after the first command.
 */
:root {
  --edge: clamp(var(--space-4), 5vw, 72px); /* the page's side margin */
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5625; /* body: 16/25 */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, .stamp { font-family: var(--font-mono); }
:not(pre) > code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  background: var(--raised);
  font-size: 0.875em;
  /* A name stays in one piece while it fits in a line. */
  display: inline-block;
  max-inline-size: 100%;
  overflow-wrap: anywhere;
  vertical-align: baseline;
  line-height: 1.4;
}
.offscreen { position: fixed; inset-inline-start: -9999px; }

/* ---- the wordmark: the dot of push.do is a lamp */

.brand {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.dot {
  flex: none;
  inline-size: 0.34em;
  block-size: 0.34em;
  margin-inline: 0.1em;
  border-radius: 50%;
  background: currentColor;
}
/* Lit while a question waits in the feed. */
.waiting .brand .dot {
  background: var(--lamp);
  box-shadow: 0 0 0 0.03em var(--lamp-edge), 0 0 0 0.16em var(--lamp-halo);
  animation: lamp 2.4s ease-in-out infinite;
}
@keyframes lamp {
  0%, 100% { box-shadow: 0 0 0 0.03em var(--lamp-edge), 0 0 0 0.06em var(--lamp-halo); }
  50% { box-shadow: 0 0 0 0.03em var(--lamp-edge), 0 0 0 0.22em var(--lamp-halo); }
}
@media (prefers-reduced-motion: reduce) {
  .waiting .brand .dot { animation: none; }
}

/* ---- the bar */

.bar {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  block-size: calc(var(--size-bar) + env(safe-area-inset-top));
  padding-block-start: env(safe-area-inset-top);
  padding-inline: var(--edge);
  background: var(--plate);
  border-block-end: 1px solid var(--line);
}
.bar-nav {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: clamp(var(--space-3), 3vw, var(--space-5));
  font-size: 14px;
  line-height: 18px;
  white-space: nowrap;
}
.bar-nav a { text-decoration: none; }
.bar-nav a:hover { text-decoration: underline; }
/* A phone's bar has no room for both links; the web app is linked from the
   feed and the footer. */
@media (max-width: 519.98px) {
  .bar-nav a[data-link="web"] { display: none; }
}

/* ---- controls: what is pressed is a pill, what is filled in is a box */

button {
  font: 600 14px/18px var(--font-sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: var(--size-control);
  padding: 0 var(--space-5);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--ink); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
/* The language in the bar looks like the links beside it. */
button.lang {
  padding-inline: var(--space-1);
  border-color: transparent;
  background: none;
  font-weight: 400;
}
button.lang:hover:not(:disabled) { border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
input[type="text"] {
  font: 400 16px/22px var(--font-sans);
  inline-size: 100%;
  min-block-size: var(--size-control);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-box);
  background: var(--raised);
  color: var(--ink);
}
input[type="text"].code { font: 500 15px/22px var(--font-mono); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.row input { flex: 1; min-inline-size: min(12rem, 100%); }
.notice { margin: var(--space-2) 0 0; color: var(--danger); font-size: 14px; line-height: 20px; }
.note { color: var(--ink-muted); font-size: 14px; line-height: 20px; }

/* ---- text */

h1 {
  max-inline-size: 12.5em;
  margin: 0;
  /* display: 56/58, on a phone 36/38 */
  font-size: clamp(36px, 20px + 4.2vw, 56px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
h2 {
  margin: var(--space-12) 0 var(--space-2);
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.012em;
}
h3 { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; }
p { margin: 0 0 var(--space-3); max-inline-size: 36rem; }
.lead { margin-block: var(--space-5) 0; max-inline-size: 34rem; }

/* ---- the bench: commands on the left, the feed on the right */

.intro, .more { padding-inline: var(--edge); min-inline-size: 0; }
.intro { padding-block: clamp(var(--space-8), 7vw, 80px) var(--space-6); }
.more { padding-block: 0 var(--space-16); }
.more h2:first-child { margin-block-start: var(--space-8); }
/* The bench: dots of line on plate. A thing lies on it, or will. */
.recv {
  padding: var(--space-6) var(--edge) var(--space-8);
  border-block: 1px solid var(--line);
  background-color: var(--plate);
  background-image: radial-gradient(var(--line) 1px, transparent 1.5px);
  background-size: var(--space-6) var(--space-6);
}
@media (min-width: 960px) {
  .bench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 42%);
    grid-template-areas: "intro recv" "more recv";
  }
  .intro { grid-area: intro; }
  .more { grid-area: more; }
  .intro, .more { padding-inline-end: clamp(var(--space-6), 4vw, var(--space-16)); }
  .recv {
    grid-area: recv;
    padding: clamp(var(--space-8), 7vw, 80px) clamp(var(--space-6), 4vw, 56px) 40px;
    border-block: 0;
    border-inline-start: 1px solid var(--line);
  }
  .feed {
    position: sticky;
    inset-block-start: calc(var(--size-bar) + var(--space-8));
    max-inline-size: 30rem;
    margin-inline: auto;
  }
  .feed-body { max-block-size: calc(100dvh - var(--size-bar) - 190px); overflow-y: auto; }
}

/* ---- a command: what to type, and under it what comes back */

.command {
  max-inline-size: 44rem;
  margin-block-start: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  background: var(--raised);
  overflow: hidden;
}
.command-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-block-size: 44px;
  padding: 5px 6px 5px var(--space-3);
  border-block-end: 1px solid var(--line);
  color: var(--ink-muted);
  font: 400 13px/18px var(--font-mono);
}
.command-actions { display: flex; gap: 6px; }
/* The small size: only here, in the head of a command. */
.command-head button { min-block-size: var(--size-control-small); padding-inline: var(--space-3); font-size: 13px; }
pre {
  margin: 0;
  padding: var(--space-3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 21px;
}
/* A command and its output wrap as a terminal wraps them: at the edge. */
pre.cmd, .out pre { line-break: anywhere; word-break: break-all; }
/* The prompt is not part of what "Copy" takes. */
pre.cmd::before { content: "$ "; color: var(--ink-muted); user-select: none; }
.out { border-block-start: 1px dashed var(--line-strong); }
.out pre { color: var(--ink-muted); }
.out .state { margin: 0; padding: 10px var(--space-3); font-size: 14px; line-height: 20px; max-inline-size: none; }
.out .state + pre { padding-block-start: 0; }
/* "Waiting for your answer": a quiet amber line with a lit lamp. */
.out .state.pending {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--lamp-soft);
  color: var(--signal);
  font-weight: 600;
  line-height: 18px;
}
.out .state.pending::before {
  content: "";
  flex: none;
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--lamp-edge);
  background: var(--lamp);
  box-shadow: 0 0 0 3px var(--lamp-halo);
}
.out .state.pending + pre { padding-block-start: var(--space-3); }

/* ---- the feed: a thing on the bench */

.feed {
  border: 1px solid var(--line);
  border-radius: var(--radius-slab);
  background: var(--ground);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}
.feed-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: 44px;
  padding: 6px var(--space-4);
  background: var(--plate);
  border-block-end: 1px solid var(--line);
}
.feed-head code {
  min-inline-size: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-status {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}
.feed-body { min-block-size: 232px; padding: var(--space-1) var(--space-4) var(--space-4); }
.feed-empty { margin: 0; padding-block: 76px; color: var(--ink-muted); text-align: center; text-wrap: balance; }
.feed-foot { padding: 10px var(--space-4); border-block-start: 1px solid var(--line); font-size: 14px; line-height: 20px; }

/* A message: one line of a log, the time in its own column. */
.message {
  display: grid;
  grid-template-columns: var(--size-stamp) minmax(0, 1fr);
  column-gap: var(--space-3);
  padding-block: var(--space-3);
}
.message + .message { border-block-start: 1px solid var(--line); }
.stamp { color: var(--ink-muted); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.message .stamp { padding-block-start: 3px; }
.message h3 { overflow-wrap: anywhere; }
.text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-2) 0 0; padding: 0; }
.tags li {
  padding-inline: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  color: var(--ink-muted);
  font: 400 12px/18px var(--font-mono);
}
/* High priority: the colour never stands alone, the tag says the word. */
.message.high .stamp { color: var(--danger); font-weight: 700; }
.tags li.urgent { border-color: var(--danger); color: var(--danger); }

/* A question: a slab across the feed, amber while it waits. */
.question {
  margin-block: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  background: var(--raised);
}
.question h3 { overflow-wrap: anywhere; }
.question .text { margin-block-start: var(--space-1); }
.question-state {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  max-inline-size: none;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 18px;
  font-weight: 600;
}
.question-state .stamp { margin-inline-start: auto; font-weight: 400; }
.answer { margin: var(--space-2) 0 0; font-weight: 600; overflow-wrap: anywhere; }
.options { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: var(--space-4); }
/* An option is a pill at one line, 40px or 44px high; on a second line it
   keeps the same corners and its text keeps its air. */
.option {
  padding-block: var(--space-2);
  border-radius: 22px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: start;
}
.own { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: var(--space-2); }
.own input { flex: 1; min-inline-size: min(13rem, 100%); }
/* The lamp does not change with the theme: the same colours in light and dark. */
.question[data-state="pending"] {
  border-color: var(--lamp-edge);
  border-radius: var(--radius-slab);
  background: var(--lamp);
  color: var(--lamp-ink);
}
.question[data-state="pending"] .question-state,
.question[data-state="pending"] .stamp { color: var(--lamp-ink); }
.question[data-state="pending"] .question-state::before {
  content: "";
  flex: none;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--lamp-ink);
}
.question[data-state="pending"] button { background: var(--lamp-ink); border-color: var(--lamp-ink); color: var(--lamp-paper); }
.question[data-state="pending"] .own button { background: none; color: var(--lamp-ink); }
.question[data-state="pending"] input { border-color: var(--lamp-ink); background: var(--lamp-paper); color: var(--lamp-ink); }
.question[data-state="pending"] input::placeholder { color: var(--lamp-ink); opacity: 0.62; }
.question[data-state="pending"] :focus-visible { outline-color: var(--lamp-ink); }
/* Red is unreadable on amber: an error here is dark and bold. */
.question[data-state="pending"] .notice { color: var(--lamp-ink); font-weight: 600; }

/* ---- the sections under the bench */

.band { border-block-start: 1px solid var(--line); }
.band-in { max-inline-size: 76rem; padding: var(--space-2) var(--edge) var(--space-16); }
.agent .command { margin-block-start: var(--space-8); }
@media (min-width: 960px) {
  .agent {
    max-inline-size: 86rem;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);
    column-gap: clamp(var(--space-8), 5vw, 72px);
    align-items: start;
  }
  .agent .command { margin-block-start: 56px; }
}
.steps { margin: var(--space-8) 0 0; padding: 0; list-style: none; counter-reset: step; max-inline-size: 34rem; }
.steps > li {
  position: relative;
  padding: 0 0 var(--space-6) 2.5rem;
  counter-increment: step;
}
/* The number is read, so it is in a box; a circle here would be a lamp. */
.steps > li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0;
  inline-size: 24px;
  block-size: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  background: var(--raised);
  color: var(--ink-muted);
  font: 700 13px/1 var(--font-mono);
}
.steps h3 { margin-block-end: var(--space-2); }
.steps p { margin: var(--space-2) 0 0; }
/* The fragment is a file with lines of its own: they are not rewrapped. */
.snippet pre { white-space: pre; overflow-x: auto; }

/* A sheet of facts: the name on the left, what it means on the right. */
.facts { margin: var(--space-4) 0 0; max-inline-size: 54rem; border-block-start: 1px solid var(--line); }
.facts dt { padding-block-start: var(--space-3); font-weight: 600; }
.facts dd { margin: 0; padding-block: 2px var(--space-3); border-block-end: 1px solid var(--line); }
@media (min-width: 640px) {
  .facts { display: grid; grid-template-columns: 13rem minmax(0, 1fr); }
  .facts dt, .facts dd { padding-block: var(--space-3); border-block-end: 1px solid var(--line); }
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-6);
  padding: var(--space-5) var(--edge) calc(var(--space-5) + env(safe-area-inset-bottom));
  background: var(--plate);
  border-block-start: 1px solid var(--line);
  font-size: 14px;
  line-height: 20px;
}

/* ---- the docs page */

.doc { max-inline-size: 50rem; padding: clamp(var(--space-8), 6vw, var(--space-16)) var(--edge) 80px; }
/* title-1 */
.doc h1 { font-size: clamp(28px, 20px + 2vw, 32px); line-height: 1.1875; letter-spacing: -0.02em; }
.doc h1 + p { margin-block-start: var(--space-5); }
.doc h2 { margin-block-start: var(--space-16); padding-block-start: var(--space-5); border-block-start: 1px solid var(--line); }
.doc h3 { margin-block: var(--space-8) var(--space-2); }
.doc p, .doc ul, .doc ol { max-inline-size: 40rem; }
.doc ul, .doc ol { margin: 0 0 var(--space-3); padding-inline-start: 1.25rem; }
.doc li { margin-block: var(--space-1); }
.doc .command { margin-block: var(--space-3) var(--space-5); }
.doc .toc { margin: var(--space-6) 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px var(--space-5); font-size: 15px; }
.doc table { inline-size: 100%; margin-block: var(--space-3) var(--space-5); border-collapse: collapse; font-size: 15px; }
.doc th, .doc td { padding: 9px var(--space-3) 9px 0; border-block-end: 1px solid var(--line); text-align: start; vertical-align: top; }
.doc th { font-weight: 600; white-space: nowrap; }
.doc .scroll { overflow-x: auto; }

/* ---- fingers: after everything else, so that no rule above makes a
   target smaller */

@media (pointer: coarse) {
  button, .command-head button { min-block-size: 44px; }
}
