/*
 * The look of the web app, on the tokens of the push.do design system
 * (tokens.css, linked before this file; the design is
 * docs/superpowers/specs/2026-11-21-push-do-design-system.md).
 *
 * Amber means "your move": it fills only what waits for the person (the lit
 * dot of the wordmark, a question with no answer, the count of a topic with
 * one). The shape says what one does with a thing: pressed is a pill, read or
 * filled in is a box, waiting for an answer is a slab. What a terminal prints
 * (the wordmark, topic names and addresses, commands, times) is in the
 * monospace face; texts written by people are in the sans. No side bars on
 * cards, one shadow (the hint on the bench), and nothing moves but the halo
 * of the lit dot.
 *
 * Two columns from 800px: the topic list beside the open screen. Keep the
 * width in step with TWO_COLUMNS in js/view.js.
 */
:root {
  --side: 320px;          /* the column of the topic list */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/25px var(--font-sans);
  -webkit-text-size-adjust: 100%;
}
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
code, pre, .code, .stamp, .count { font-family: var(--font-mono); }
.muted, .meta { color: var(--ink-muted); }
.meta { font-size: 13px; line-height: 18px; margin: var(--space-1) 0 0; }
.notice { color: var(--danger); font-size: 14px; line-height: 20px; margin: var(--space-2) 0 0; }
.offscreen { position: fixed; inset-inline-start: -9999px; }

/* ---- 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(--space-4);
  background: var(--plate);
  border-block-end: 1px solid var(--line);
}
/* The wordmark: the dot of push.do is a lamp, lit while a question waits in
   any topic. */
.brand {
  display: inline-flex;
  align-items: baseline;
  font: 800 16px/1 var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand .dot {
  flex: none;
  inline-size: 0.34em;
  block-size: 0.34em;
  margin-inline: 0.1em;
  border-radius: 50%;
  background: currentColor;
}
.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; }
}
.bar-title {
  min-inline-size: 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- the two panes */

.side {
  background: var(--plate);
  padding: var(--space-4) var(--space-2) calc(var(--space-4) + env(safe-area-inset-bottom));
}
main {
  min-inline-size: 0;
  padding: var(--space-5) var(--space-4) calc(var(--space-8) + env(safe-area-inset-bottom));
}
main > * { max-inline-size: 46rem; }
@media (max-width: 799.98px) {
  /* One column: the list, or the screen opened from it. */
  .side { min-block-size: calc(100dvh - var(--size-bar) - env(safe-area-inset-top)); }
  body:not([data-view="list"]) .side,
  body[data-view="list"] main { display: none; }
}
@media (min-width: 800px) {
  .shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); align-items: start; }
  .side {
    position: sticky;
    inset-block-start: calc(var(--size-bar) + env(safe-area-inset-top));
    block-size: calc(100dvh - var(--size-bar) - env(safe-area-inset-top));
    overflow-y: auto;
    border-inline-end: 1px solid var(--line);
    padding-inline: var(--space-3);
  }
  main { padding: var(--space-8) var(--space-12) var(--space-16); }
  .bar { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); gap: 0; padding-inline: 0; }
  .brand { justify-self: start; margin-inline-start: var(--space-6); }
  /* The list is beside the screen: it shows which topic is open, and no way
     back to it is needed. */
  .bar-title, .head .to-list { display: none; }
}

/* ---- controls: pressed, so pills; filled in, so boxes */

button, .button {
  font: 600 14px/18px var(--font-sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: var(--size-control);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--raised);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
button:hover:not(:disabled), .button:hover { border-color: var(--ink); }
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.danger { color: var(--danger); border-color: var(--danger); margin-block-start: var(--space-8); }
button.danger:hover:not(:disabled) { border-color: var(--danger); }
.back::before { content: "‹"; }
.add::before { content: "+"; font-family: var(--font-mono); }
.add[aria-current="page"] { border-color: var(--ink); }
input[type="text"], input[type="email"], select {
  font: 400 16px/22px var(--font-sans);
  inline-size: 100%;
  min-block-size: var(--size-control);
  padding: 0 var(--space-3);
  border-radius: var(--radius-box);
  border: 1px solid var(--line-strong);
  background: var(--raised);
  color: var(--ink);
}
input[type="text"].code, .entries .what code { font: 500 15px/22px var(--font-mono); }
input[type="checkbox"] { inline-size: 18px; block-size: 18px; accent-color: var(--ink); }

/* ---- the topic list */

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-inline: var(--space-3) var(--space-1);
  margin-block-end: var(--space-3);
}
.side-head h2 { font: 600 17px/24px var(--font-sans); margin: 0; }
.side > .muted { margin: var(--space-4) var(--space-3); font-size: 14px; line-height: 20px; }
.status {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  padding: var(--space-3);
  margin-block-end: var(--space-3);
  font-size: 14px;
  line-height: 20px;
}
.status p { margin: 0 0 var(--space-2); }
.status p:last-child { margin-block-end: 0; }
.status.warn { border-color: var(--danger); }
.side .status .primary { inline-size: 100%; }
/* One main button on a screen: beside a view that has its own, the list's
   is an ordinary one. */
@media (min-width: 800px) {
  body:has(main .primary) .side .status .primary { background: var(--raised); border-color: var(--line-strong); color: var(--ink); }
}
.topics { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.topics a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: 52px;
  padding: 6px var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-box);
  color: var(--ink);
  text-decoration: none;
}
.topics a:hover { border-color: var(--line); }
.topics a[aria-current="page"] { background: var(--raised); border-color: var(--line-strong); }
.topics .name { flex: 1; min-inline-size: 0; display: grid; }
.topics .display, .topics code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topics .display { font: 500 16px/22px var(--font-sans); }
.topics code { font: 400 13px/18px var(--font-mono); color: var(--ink-muted); }
.topics code.solo { font: 500 15px/22px var(--font-mono); color: var(--ink); }
.topics .unread .display, .topics .unread code.solo { font-weight: 700; }
/* The count: unread events on ink; questions waiting, in amber. */
.count {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-inline-size: 24px;
  block-size: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--on-ink);
  font: 600 12px/1 var(--font-mono);
}
.count.waiting { background: var(--lamp); color: var(--lamp-ink); box-shadow: 0 0 0 1px var(--lamp-edge); }
/* The foot of the list: "Sign in", or the address leading to the account. */
.side-foot { margin-block-start: var(--space-6); padding-inline: var(--space-3) var(--space-1); }
.side-foot .button { max-inline-size: 100%; }
.side-foot .button span { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; }
.side-foot .button[aria-current="page"] { border-color: var(--ink); }
.bell-off {
  flex: none;
  inline-size: 15px;
  block-size: 15px;
  background: var(--ink-muted);
  -webkit-mask: url(icons/bell-off.svg) center / contain no-repeat;
  mask: url(icons/bell-off.svg) center / contain no-repeat;
}

/* ---- the second column with no topic open: the bench, and the hint lying
   on it */

.pick { display: none; }
@media (min-width: 800px) {
  body[data-view="list"] main {
    min-block-size: calc(100dvh - var(--size-bar));
    display: grid;
    place-items: center;
    background-color: var(--plate);
    background-image: radial-gradient(var(--line) 1px, transparent 1.5px);
    background-size: var(--space-6) var(--space-6);
  }
  .pick {
    display: grid;
    justify-items: center;
    gap: var(--space-4);
    max-inline-size: 26rem;
    padding: var(--space-5) var(--space-6);
    border-radius: var(--radius-slab);
    background: var(--ground);
    box-shadow: var(--shadow-float);
    color: var(--ink-muted);
    text-align: center;
  }
  .pick p { margin: 0; }
}

/* ---- the head of a screen */

.head { display: flex; align-items: flex-start; gap: var(--space-3); margin-block-end: var(--space-5); }
.head .title { flex: 1; min-inline-size: 0; }
h1 {
  font: 700 24px/30px var(--font-sans);
  letter-spacing: -0.012em;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}
@media (min-width: 800px) {
  h1 { font-size: 32px; line-height: 38px; letter-spacing: -0.02em; margin-block-start: 1px; }
}
.address { display: block; margin-block-start: 2px; font: 500 14px/20px var(--font-mono); color: var(--ink-muted); overflow-wrap: anywhere; }
/* In a team topic's address, @team leads to the team: a link in the
   address's own colour, told by its underline. */
.address a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
h2 { font: 600 17px/24px var(--font-sans); margin-block: var(--space-8) var(--space-3); }
/* What the app scrolls to (a section's heading, a new token) stops below
   the bar, not under it. */
main h2, main .commands { scroll-margin-block-start: calc(var(--size-bar) + env(safe-area-inset-top) + var(--space-4)); }

/* ---- the feed: a log, one line per message, a slab per question */

.day > h2 {
  margin: var(--space-6) 0 0;
  padding-block-end: 6px;
  border-block-end: 1px solid var(--line);
  color: var(--ink-muted);
  font: 600 14px/18px var(--font-sans);
}
.day:first-child > h2 { margin-block-start: 0; }
.day > h2::first-letter { text-transform: uppercase; }
.item {
  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 { padding-block-start: 3px; color: var(--ink-muted); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item h3 { font: 600 17px/24px var(--font-sans); margin: 0; overflow-wrap: anywhere; }
.text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.item h3 + .text { margin-block-start: 2px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space-2) 0 0; padding: 0; }
.tags li {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  color: var(--ink-muted);
  font: 400 12px/18px var(--font-mono);
}
/* A message of high priority: a red time, and the word "urgent" first among
   the tags. */
.message.high .stamp { color: var(--danger); font-weight: 700; }
.tags li.urgent { border-color: var(--danger); color: var(--danger); }

/* A question: a box across the feed once answered or expired; an amber slab,
   the same in both themes, 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.focus { outline: 2px solid var(--ink); outline-offset: 2px; }
.question h3 { font: 600 17px/24px var(--font-sans); margin: 0; 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);
  font: 600 14px/18px var(--font-sans);
  color: var(--ink-muted);
}
.question-state .stamp { margin-inline-start: auto; padding: 0; font-weight: 400; color: inherit; }
.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-4); }
.options + .own { margin-block-start: var(--space-2); }
.own input { flex: 1; min-inline-size: 10rem; }
.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 { 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"] .option { background: var(--lamp-ink); border-color: var(--lamp-ink); color: var(--lamp-paper); }
.question[data-state="pending"] .send { background: none; border-color: var(--lamp-ink); color: var(--lamp-ink); }
.question[data-state="pending"] input[type="text"] { border-color: var(--lamp-ink); background: var(--lamp-paper); color: var(--lamp-ink); }
.question[data-state="pending"] input[type="text"]::placeholder { color: var(--lamp-ink); opacity: 0.62; }
.question[data-state="pending"] :focus-visible { outline-color: var(--lamp-ink); }
/* Danger is unreadable on amber: a notice on the slab is bold lamp ink. */
.question[data-state="pending"] .notice { color: var(--lamp-ink); font-weight: 600; }
.empty { display: grid; gap: var(--space-1); }
.empty p { margin: 0 0 var(--space-2); }

/* ---- forms and commands */

.form { display: grid; gap: var(--space-2); }
.form label { font: 600 14px/18px var(--font-sans); margin-block-start: var(--space-3); }
.form p { margin: var(--space-1) 0; font-size: 14px; line-height: 20px; }
.form .check { display: flex; gap: var(--space-3); align-items: center; font-weight: 400; }
.form > button[type="submit"] { justify-self: start; margin-block-start: var(--space-3); }
.row { display: flex; gap: var(--space-2); }
.row input { flex: 1; min-inline-size: 0; }
.row.actions { flex-wrap: wrap; margin-block-start: var(--space-3); }
.commands { display: grid; gap: var(--space-3); margin-block: var(--space-2); }
.command { border: 1px solid var(--line); border-radius: var(--radius-box); background: var(--raised); overflow: hidden; }
.command-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 44px;
  padding: 0 6px 0 var(--space-3);
  border-block-end: 1px solid var(--line);
  color: var(--ink-muted);
  font: 400 13px/18px var(--font-mono);
}
.command-head button { min-block-size: var(--size-control-small); padding-inline: var(--space-3); font-size: 13px; }
/* A command's box clips what sticks out of it: the focus ring of its
   button is drawn inside the button. */
.command-head button:focus-visible { outline-offset: -4px; }
pre { margin: 0; padding: var(--space-3); white-space: pre-wrap; line-break: anywhere; word-break: break-all; font: 400 13px/21px var(--font-mono); }
/* The prompt is not part of the command: it is neither selected nor copied. */
pre code::before { content: "$ "; color: var(--ink-muted); -webkit-user-select: none; user-select: none; }

/* ---- the lists of a team: a box of rows, each a thing (a topic, a member,
   a token) and the pills of what one can do with it */

.entries { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-box); background: var(--raised); }
.entries li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3); }
.entries li + li { border-block-start: 1px solid var(--line); }
/* The thing keeps its width, and the pills go to the next line when both
   do not fit. */
.entries .what { flex: 1 1 auto; min-inline-size: 0; display: grid; overflow-wrap: anywhere; }
.entries .what .meta { margin: 0; }
.entries .row { flex-wrap: wrap; align-items: center; }
/* A word among a row's pills ("In your topics") is a hint. */
.entries .row .muted { font-size: 14px; line-height: 20px; }
/* A form after a list box keeps the distance of the section's parts. */
.entries + .form { margin-block-start: var(--space-4); }
.entries li > .notice { flex-basis: 100%; margin: 0; }
/* A hint under a heading, the size of the hints of a form. */
.note { margin: 0 0 var(--space-3); font-size: 14px; line-height: 20px; }
.commands > p { margin: 0; }

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

@media (pointer: coarse) {
  button, .button, .option, .command-head button { min-block-size: 44px; }
  .command-head button { padding-inline: var(--space-4); }
  /* @team in a topic's address: a taller target, the line where it was
     (the padding of a word in a line moves nothing). */
  .address a { padding-block: var(--space-3); }
}
