:root {
  color-scheme: light dark;
  --paper: #fbfaf7;
  --raised: #ffffff;
  --ink: #1f2328;
  --soft: #626a73;
  --line: #e3e0d8;
  --accent: #2b5fd9;
  --on-accent: #ffffff;
  --add: #e4f4e8;
  --add-edge: #2f9e57;
  --remove: #fbe9e7;
  --remove-edge: #cf4436;
  --warn: #fdf1d6;
  --warn-ink: #7a5300;
  --mark: #ffe9a8;
  --amber: #d99000;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Charter, "Iowan Old Style", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16181c;
    --raised: #1e2126;
    --ink: #e7e5e0;
    --soft: #9aa2ac;
    --line: #30343b;
    --accent: #7ea3ff;
    --on-accent: #10131a;
    --add: #17301f;
    --add-edge: #4cc27a;
    --remove: #3a1d1a;
    --remove-edge: #ef7566;
    --warn: #3a2f12;
    --warn-ink: #f2cf7e;
    --mark: #6a5310;
    --amber: #f2cf7e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 .6rem; }

.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .55rem 1.25rem;
  background: var(--raised);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.crumb { color: var(--soft); }
.crumb::before { content: "/"; margin-right: 1rem; color: var(--line); }
.bar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.tab { padding: .25rem .6rem; border-radius: 6px; color: var(--soft); }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.on { color: var(--ink); background: var(--paper); font-weight: 600; }
.spacer { flex: 1; }
.who { color: var(--soft); font-size: .9rem; }

main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .75rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.rows li p { flex-basis: 100%; margin: 0; color: var(--soft); font-size: .95rem; }
.rows form { margin-left: auto; }
.meta { color: var(--soft); font-size: .88rem; }
.search { display: flex; gap: .5rem; max-width: 36rem; margin: 0 0 1.25rem; }
.search input { flex: 1; margin-top: 0; }
.search button { height: 2.4rem; padding-block: 0; }
.empty { color: var(--soft); }

label { display: block; font-size: .9rem; color: var(--soft); }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  color: var(--ink);
  font: inherit;
}
input, select { height: 2.4rem; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  padding: .45rem .9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
button:hover { border-color: var(--soft); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.danger { color: var(--remove-edge); border-color: var(--remove-edge); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 400; }

.stack { display: grid; gap: .8rem; }
.narrow { max-width: 22rem; }
.inline { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.inline label { flex: 1 1 12rem; }
/* A device login's code, read side by side with the terminal. */
.code { font: 600 1.6rem/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.confirm { margin-bottom: .6rem; max-width: 26rem; }

.alert {
  padding: .6rem .8rem;
  border-radius: 6px;
  background: var(--warn);
  color: var(--warn-ink);
}
.alert code { user-select: all; overflow-wrap: anywhere; }

.doc {
  max-width: 44rem;
  font: 1.08rem/1.65 var(--serif);
  overflow-wrap: anywhere;
}
.doc h1, .doc h2, .doc h3 { font-family: var(--sans); line-height: 1.25; }
.doc h1 { font-size: 1.7rem; }
.doc h2 { font-size: 1.25rem; margin-top: 1.6rem; }
.doc pre {
  padding: .8rem;
  overflow-x: auto;
  border-radius: 6px;
  background: var(--raised);
  border: 1px solid var(--line);
  font-size: .9rem;
}
.doc code { font-size: .92em; }
.doc table { border-collapse: collapse; display: block; overflow-x: auto; }
.doc th, .doc td { padding: .3rem .6rem; border: 1px solid var(--line); }
.doc img { max-width: 100%; }
.doc figure.audio { margin: 1rem 0; }
.doc figure.audio figcaption { font: .9rem var(--sans); color: var(--soft); margin-bottom: .3rem; }
.doc figure.audio audio { width: 100%; }
.doc blockquote, blockquote {
  margin: .5rem 0;
  padding-left: .75rem;
  border-left: 3px solid var(--line);
  color: var(--soft);
}
mark { background: var(--mark); color: inherit; border-radius: 2px; }

.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tag {
  padding: .05rem .5rem;
  border-radius: 999px;
  background: var(--line);
  color: var(--soft);
  font-size: .78rem;
  font-weight: 600;
}
.tag:hover { color: var(--ink); text-decoration: none; }

.source { max-width: 44rem; margin: 1.5rem 0; }
.source summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.source pre {
  margin: .6rem 0 0;
  padding: .8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  font-size: .9rem;
}

.hint { margin: 0; color: var(--soft); font-size: .82rem; }

.bare { display: grid; place-items: center; min-height: 100vh; }
.card {
  width: min(24rem, calc(100vw - 2rem));
  margin: 1rem;
  padding: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
}
.card .brand { margin: 0 0 1rem; }

.heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; margin-bottom: 1rem; }
.heading h1 { margin: 0; flex: 1; }
.views { display: flex; gap: .25rem; }
.views .tab.on { background: var(--raised); border: 1px solid var(--line); }

/* A waterfall: each tile as tall as its cover, columns filled top to bottom. */
.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 4 10rem;
  column-gap: .75rem;
}
.tile {
  display: flex;
  flex-direction: column;
  break-inside: avoid;
  margin-bottom: .75rem;
  border-radius: 12px;
  overflow: hidden;
  background: var(--raised);
  box-shadow: 0 1px 2px rgb(0 0 0 / .06);
}
.tile > .name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: .6rem .7rem .4rem;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
}
.byline {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0 .7rem .7rem;
  color: var(--soft);
  font-size: .8rem;
}
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
  font-size: .7rem;
  font-weight: 700;
}
.author { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.when { flex: none; }
.cover { display: block; background: var(--line); }
/* A picture keeps its own shape, within reason. */
.cover img { display: block; width: 100%; height: auto; min-height: 7rem; max-height: 24rem; object-fit: cover; }
/* No picture: the start of the text is the cover. */
.cover.text {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  aspect-ratio: 4 / 5;
  padding: 2.4rem 1rem 1.4rem;
  background: hsl(var(--hue) 70% 90%);
  color: hsl(var(--hue) 40% 18%);
  overflow: hidden;
}
.cover.text:hover { text-decoration: none; }
.cover .quote {
  position: absolute;
  top: -.1rem;
  left: .8rem;
  font: 700 4rem/1 var(--serif);
  opacity: .3;
}
.cover .overview {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.35;
}
/* Narrow tiles, as on a phone: smaller words, so six lines still fit. */
.tile { container-type: inline-size; }
@container (max-width: 13rem) {
  .cover .overview { font-size: 1.02rem; }
  .cover .quote { font-size: 3rem; }
}
@media (prefers-color-scheme: dark) {
  .tile { box-shadow: none; border: 1px solid var(--line); }
  .cover.text { background: hsl(var(--hue) 30% 22%); color: hsl(var(--hue) 50% 90%); }
}
.hue-0 { --hue: 185; }
.hue-1 { --hue: 150; }
.hue-2 { --hue: 40; }
.hue-3 { --hue: 330; }
.hue-4 { --hue: 215; }
.hue-5 { --hue: 95; }
.hue-6 { --hue: 15; }
.hue-7 { --hue: 265; }

.choice { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: 1rem; }
.choice input { width: auto; height: auto; margin: 0; }
.grants li { align-items: center; }
.grants select { width: auto; min-width: 11rem; margin: 0 0 0 auto; }

@media (max-width: 760px) {
  .doc { font-size: 1.02rem; }
}

/* Not read yet: a dot that never moves the name, and the name in full weight.
   In a list it hangs in the margin to the left; on a tile it sits on the cover. */
.dot {
  position: absolute;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--accent);
}
.rows a.title { position: relative; }
.rows a.title > .dot { left: -.9rem; top: calc(.75em - .25rem); }
.rows li.unread > a strong { font-weight: 700; }
.rows li:not(.unread) > a strong { font-weight: 500; }
.tile { position: relative; }
.tile > .dot {
  top: .6rem;
  right: .6rem;
  width: .7rem;
  height: .7rem;
  box-shadow: 0 0 0 2px var(--raised);
}
.tile.unread > .name { font-weight: 700; }
.mark { margin: 0 0 .75rem; }

/* A question asked before acting; the summary reads as the action itself. */
.ask summary { cursor: pointer; color: var(--accent); list-style: none; }
.ask summary::-webkit-details-marker { display: none; }
.ask[open] summary { color: var(--soft); }
.ask-body { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .5rem; }
.ask-body p { margin: 0; }
.ask-body form { margin: 0; }
.more { margin: 1.25rem 0 0; text-align: center; }
.after { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.25rem; margin-top: 2rem; font-size: .88rem; }

/* Usage: a gauge per limit, the plan's settled terms folded away. */
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem 2rem; max-width: 44rem; }
.gauge-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.gauge-head label { color: var(--ink); font-size: 1rem; font-weight: 500; }
.gauge .hint { margin-top: .35rem; }
meter {
  display: block;
  width: 100%;
  height: .6rem;
  margin-top: .4rem;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
meter::-webkit-meter-bar { height: .6rem; border: 0; border-radius: 999px; background: var(--line); }
meter::-webkit-meter-optimum-value { background: var(--accent); border-radius: 999px; }
meter::-webkit-meter-suboptimum-value { background: var(--amber); border-radius: 999px; }
meter::-webkit-meter-even-less-good-value { background: var(--remove-edge); border-radius: 999px; }
meter::-moz-meter-bar { background: var(--accent); border-radius: 999px; }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--amber); }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--remove-edge); }
.plan { margin-top: 1.25rem; max-width: 44rem; }
.plan summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.plan p { margin: .5rem 0 .75rem; color: var(--soft); font-size: .92rem; }

/* Audio and video: a small label, on a tile over the cover's corner. */
.badge {
  display: inline-block;
  padding: .05rem .45rem;
  border-radius: 999px;
  background: var(--line);
  color: var(--soft);
  font: 600 .72rem var(--sans);
  letter-spacing: .02em;
  text-transform: uppercase;
}
/* Top right, beside the unread dot and clear of the cover's own mark. */
.tile > .badge {
  position: absolute;
  top: .55rem;
  right: 1.8rem;
  background: rgb(0 0 0 / .62);
  color: #fff;
}
.player { display: block; width: 100%; margin: 1rem 0; }
video.player { max-height: 75vh; background: #000; border-radius: 8px; }
img.poster { display: block; max-width: 100%; max-height: 18rem; margin: 1rem 0 0; border-radius: 8px; }

/* Tasks: a box to tick in the text, a count in lists. */
.doc li:has(> .box, > .task, > p > .box, > p > .task) { list-style: none; }
.doc li:has(> .box, > .task, > p > .box, > p > .task) { margin-left: -1.4rem; }
form.task { display: inline; }
.box {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  margin: 0 .5em 0 0;
  padding: 0;
  vertical-align: -.15em;
  border: 1.5px solid var(--soft);
  border-radius: 4px;
  background: transparent;
  cursor: default;
}
button.box { cursor: pointer; }
button.box:hover { border-color: var(--accent); }
.box.done { background: var(--accent); border-color: var(--accent); position: relative; }
.box.done::after {
  content: "";
  position: absolute;
  left: 30%;
  top: 8%;
  width: 30%;
  height: 58%;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tasks {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--soft);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rows .tasks { margin-left: .6rem; }
.byline .tasks { margin-left: auto; }
.tasks progress {
  width: 2.4rem;
  height: .35rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
  appearance: none;
}
.tasks progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.tasks progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.tasks progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.tasks.all progress::-webkit-progress-value { background: var(--add-edge); }
.tasks.all progress::-moz-progress-bar { background: var(--add-edge); }
