@font-face {
  font-family: "Baloo 2";
  src: url("fonts/baloo2.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.woff2") format("woff2");
  font-weight: 500 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ground: #fff7ee;
  --card: #ffffff;
  --shadow: #f0e2d3;
  --line: #efe3d6;
  --rule: #e3d8cb;
  --ink: #1e1a2e;
  --muted: #6b6479;
  --label: #5e566b;
  --accent: #ff5b3a;
  --accent-deep: #b8321b;
  --accent-soft: #ffe3da;
  --link: #e2462a;
  --yellow: #ffc83d;
  --yellow-soft: #fff0c2;
  --blue: #3aa0ff;
  --purple: #7b5cff;
  --green: #2bc48a;
  --sand: #e7dccf;
  /* A switch that is off: 3.7:1 on a card, so it is seen */
  --switch-off: #8c8279;
  --scrim: #1e1a2e73;
  --display: "Baloo 2", system-ui, sans-serif;
}

/* Going from one page to another, the old one stays in sight until the new
   one is ready, and fades into it */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  background: var(--ground);
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 14px 4rem;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button,
.file-picker {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
a:focus-visible,
.file-picker:focus-within {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

main,
#feed,
form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 2px 0 var(--shadow);
}

.empty {
  color: var(--muted);
  text-align: center;
}

.hint {
  margin: 0;
  padding-left: 4px;
  font-size: 13px;
  color: var(--muted);
}

.message {
  margin: 0;
  font-weight: 700;
  color: var(--label);
}

.message:empty {
  display: none;
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
}

.topbar h1,
.topbar h2 {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
}

.wordmark {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
}

.wordmark:hover {
  color: var(--accent);
  text-decoration: none;
}

.icon-button {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--shadow);
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
}

.icon-button:hover {
  color: var(--ink);
  text-decoration: none;
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
}

.account-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
}

.account-link:hover {
  color: inherit;
}

/* On a phone the avatar alone says who is logged in */
@media (max-width: 28rem) {
  .account-name {
    display: none;
  }
}

.account-name {
  font-weight: 800;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The bell, with how many notifications are unread on its corner */
.bell {
  position: relative;
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  /* The deep one: white on the bright accent is too faint at this size */
  background: var(--accent-deep);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  /* A ring of the ground keeps it apart from the button */
  box-shadow: 0 0 0 2px var(--ground);
}

.way-out {
  display: flex;
  justify-content: center;
  margin: 32px 0 0;
}

#logout {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--shadow);
  font-weight: 800;
  font-size: 14px;
}

/* Avatars */

.avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  font-weight: 800;
  color: #fff;
  background: var(--purple);
}

.avatar.small {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.avatar.medium {
  width: 36px;
  height: 36px;
  font-size: 15px;
}

.avatar.tiny {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.avatar.large {
  width: 96px;
  height: 96px;
  border: 4px solid var(--card);
  box-shadow: 0 3px 0 var(--shadow);
  font-family: var(--display);
  font-size: 40px;
}

.avatar.huge {
  width: 144px;
  height: 144px;
  border: 5px solid var(--card);
  box-shadow: 0 3px 0 var(--shadow);
  font-family: var(--display);
  font-size: 64px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.tone-0 {
  background: var(--yellow);
  color: var(--ink);
}

.avatar.tone-1 {
  background: var(--blue);
}

.avatar.tone-2 {
  background: var(--accent);
}

.avatar.tone-3 {
  background: var(--purple);
}

.avatar.tone-4 {
  background: var(--green);
}

.avatar.tone-none {
  background: var(--sand);
  color: var(--muted);
}

/* Buttons */

.primary {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  box-shadow: 0 3px 0 var(--accent-deep);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
}

.primary.wide {
  padding: 16px;
  font-size: 17px;
}

.primary:disabled {
  background: var(--line);
  box-shadow: none;
  color: var(--muted);
}

/* A link that looks like a button */
a.primary {
  display: block;
  text-align: center;
}

a.primary:hover {
  color: #fff;
  text-decoration: none;
}

/* Form fields */

.field {
  display: grid;
  gap: 8px;
}

.field label {
  padding-left: 4px;
  font-weight: 800;
  font-size: 14px;
  color: var(--label);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--card);
  font-weight: 700;
  font-size: 17px;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

.with-reveal {
  position: relative;
}

.with-reveal input {
  padding-right: 64px;
}

.reveal {
  position: absolute;
  top: 0;
  right: 6px;
  height: 100%;
  border: 0;
  padding: 0 10px;
  background: none;
  font-weight: 800;
  font-size: 14px;
  color: var(--label);
}

.note {
  display: flex;
  gap: 10px;
  margin: 0;
  border-radius: 18px;
  padding: 12px 14px;
  background: var(--yellow-soft);
  font-size: 14px;
}

.note b {
  font-weight: 800;
}

/* The label is the visible control; the input stays reachable by keyboard */
.file-picker input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 18px;
  padding: 14px;
  background: var(--yellow-soft);
  font-weight: 800;
  font-size: 15px;
}

.file-picker.dark {
  display: inline-flex;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
}

.file-picker.light {
  display: inline-flex;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--shadow);
}

/* Login and invite pages */

.hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 72px 4px 36px;
  text-align: center;
}

.hero .wordmark {
  font-size: 40px;
}

.hero p,
.welcome p:last-child {
  margin: 0;
  color: var(--muted);
}

.welcome {
  display: grid;
  gap: 6px;
  padding: 16px 4px 22px;
}

.welcome .wordmark {
  font-size: 24px;
}

.welcome h1 {
  margin: 10px 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.1;
}

.welcome p:last-child {
  font-size: 15px;
}

#login,
#new-user {
  gap: 20px;
  padding: 0 4px;
}

.picture-field {
  display: flex;
  align-items: center;
  gap: 16px;
}

.picture-field > div {
  display: grid;
  gap: 8px;
  justify-items: start;
}

/* Profile page */

#profile {
  gap: 28px;
  padding: 20px 4px 0;
}

.profile-picture {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.profile-picture-frame {
  position: relative;
}

.camera-badge {
  position: absolute;
  right: 0;
  bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 4px solid var(--ground);
  border-radius: 50%;
  background: var(--accent);
  font-size: 20px;
  cursor: pointer;
}

.picture-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* Leads from the profile page to the pages only an admin sees */
.secondary {
  display: block;
  margin: 14px 4px 0;
  border-radius: 999px;
  padding: 16px;
  background: var(--card);
  box-shadow: 0 2px 0 var(--shadow);
  font-weight: 800;
  font-size: 17px;
  text-align: center;
  color: var(--ink);
}

.secondary:hover {
  color: var(--ink);
  text-decoration: none;
}

/* Notifications, on the profile page */

.push {
  display: grid;
  gap: 10px;
  padding: 14px 4px 0;
}

.push h2 {
  margin: 0;
  font-size: 17px;
}

.push .secondary {
  margin: 0;
  border: 0;
}

.push-kinds {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 0;
  padding: 0;
}

.push-kinds[hidden] {
  display: none;
}

.push-kinds legend {
  margin-bottom: 8px;
  padding: 0;
}

/* A kind of notification, with a switch for it on the right */
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  border-radius: 16px;
  padding: 4px 14px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--shadow);
  font-weight: 700;
  cursor: pointer;
}

.switch input {
  appearance: none;
  flex: none;
  position: relative;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--switch-off);
  cursor: pointer;
  transition: background 0.15s;
}

.switch input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #1e1a2e40;
  transition: transform 0.15s;
}

.switch input:checked {
  background: var(--accent);
}

.switch input:checked::before {
  transform: translateX(20px);
}

.switch input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* With the colours of the system the track is drawn as an outline, and the
   knob tells on from off by its place */
@media (forced-colors: active) {
  .switch input {
    border: 2px solid ButtonText;
  }

  .switch input::before {
    top: 1px;
    left: 1px;
    background: ButtonText;
  }

  .switch input:checked {
    background: Highlight;
  }
}

@media (prefers-reduced-motion: reduce) {
  .switch input,
  .switch input::before {
    transition: none;
  }
}

/* Users page */

.dark-pill {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.soft-pill {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 14px;
  background: var(--ground);
  font-weight: 800;
  font-size: 14px;
}

.user-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 14px;
  padding: 14px 0;
}

.user-row + .user-row {
  border-top: 2px solid var(--line);
}

.user-row .avatar {
  width: 44px;
  height: 44px;
}

.user-info {
  flex: 1;
  min-width: 0;
  display: grid;
}

.user-name {
  font-weight: 800;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-seen {
  font-size: 13px;
  color: var(--muted);
}

.sheet-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-person .avatar {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.sheet-person h2,
.sheet-title h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.1;
}

.sheet-person p,
.sheet-title p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--muted);
}

input.link-box {
  border: 2px dashed var(--accent);
  background: var(--ground);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 500;
  /* An iPhone zooms in on a focused field with smaller text */
  font-size: 16px;
  text-overflow: ellipsis;
}

input.link-box:focus {
  border-color: var(--accent);
}

/* Password pages */

#new-password {
  gap: 20px;
  padding: 0 4px;
}

/* Composer */

.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 22px;
  padding: 12px;
}

.composer-prompt {
  flex: 1;
  border: 0;
  padding: 8px 0;
  background: none;
  text-align: left;
  font-size: 15px;
  color: var(--muted);
}

.tile {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  background: var(--yellow-soft);
  font-size: 18px;
}

dialog.screen {
  width: 100%;
  max-width: 30rem;
  height: 100dvh;
  max-height: none;
  margin: 0 auto;
  border: 0;
  padding: 0 14px 30px;
  background: var(--ground);
  color: inherit;
}

dialog.screen::backdrop {
  background: var(--ground);
}

.compose-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.byline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.byline .name {
  font-weight: 800;
  font-size: 15px;
}

.compose-card textarea {
  width: 100%;
  border: 0;
  padding: 0;
  background: none;
  resize: vertical;
  font-size: 19px;
  line-height: 1.45;
  caret-color: var(--accent);
}

.compose-card textarea:focus {
  outline: none;
}

.image-count {
  margin: 0;
  padding: 0 6px;
  font-weight: 800;
  font-size: 15px;
}

.previews {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.previews:empty {
  display: none;
}

.preview {
  position: relative;
  height: 160px;
  border-radius: 20px;
  overflow: hidden;
}

/* Until the image is uploaded, and if it could not be */
.preview p {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 44px 12px 12px;
  background: var(--sand);
  color: var(--label);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.preview.failed p {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview:first-child::before {
  content: "Forside";
  position: absolute;
  top: 8px;
  left: 8px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.preview button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #1e1a2ecc;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.has-images .file-picker {
  justify-content: center;
  border: 2px dashed var(--rule);
  border-radius: 20px;
  padding: 16px;
  background: none;
  color: var(--label);
}

/* Posts */

.post {
  position: relative;
  overflow: hidden;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
}

.post-byline {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.post-name {
  margin: 0;
  font-weight: 800;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.post-time {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}

.post-time:hover {
  color: var(--muted);
}

/* The link is the whole card, so a click anywhere on it opens the post, and
   what the browser marks as touched or in focus is the card */
.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

/* Inside the edge, where the card does not cut it off */
.card-link:focus-visible {
  outline-offset: -3px;
}

/* Reactions are the one thing on the card that is not the link */
.post .reaction,
.post .who-reacted {
  position: relative;
  z-index: 1;
}

/* The button for what the one who posted can do with the post */
.post-menu-button {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ground);
  box-shadow: none;
}

/* Said after the time of a post or a comment whose text has been changed */
.edited {
  font-weight: 600;
}

.post-time .edited::before {
  content: "· ";
}

.post .text {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.images {
  display: grid;
  gap: 3px;
}

/* An image has a width of its own, which must not widen its column */
.images > * {
  min-width: 0;
}

.images.pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.images.album {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 120px 120px;
}

.images.album > :first-child {
  grid-row: span 2;
}

.images a,
.images img {
  display: block;
  width: 100%;
  height: 100%;
}

.images img {
  object-fit: cover;
}

.images.pair img {
  aspect-ratio: 1;
}

.images.single img {
  height: auto;
  max-height: 32rem;
}

/* On a post's own page a tap on the images opens them in the lightbox */
.opens-lightbox {
  position: relative;
}

.opens-lightbox img {
  cursor: zoom-in;
}

.opens-lightbox .photo:active img {
  opacity: 0.85;
}

/* Says the images can be opened; a tap on it goes to the image below */
.open-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 999px;
  padding: 4px 12px;
  background: #1e1a2ecc;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  pointer-events: none;
}

.more {
  position: relative;
  min-height: 0;
}

.more::after {
  content: attr(data-more);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e1a2e99;
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  pointer-events: none;
}

/* The lightbox: a post's images over the whole screen, to swipe between */

dialog.lightbox {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  background: #000;
  color: #fff;
  /* lightbox.js handles every gesture, so the page itself is never zoomed */
  touch-action: none;
}

dialog.lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

dialog.lightbox::backdrop {
  background: #000;
}

/* What is behind the lightbox stays where it was */
html:has(dialog.lightbox[open]) {
  overflow: hidden;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px;
}

.lightbox-counter {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.lightbox-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #ffffff26;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
}

.lightbox-button:hover {
  background: #ffffff40;
}

/* Only lightbox.js scrolls it, to the image a swipe or a button goes to */
.lightbox-track {
  display: flex;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-slide {
  position: relative;
  flex: 0 0 100%;
  overflow: hidden;
}

/* As large as fits, at its own shape, in the middle of the slide */
.lightbox-slide img {
  position: absolute;
  inset: 0;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  margin: auto;
  /* Zooming scales it from here; lightbox.js moves it to where it belongs */
  transform-origin: 0 0;
  cursor: zoom-in;
  -webkit-user-drag: none;
}

.lightbox-track.zoomed img {
  cursor: grab;
}

/* A strip of miniatures below the images, the one in view picked out */
.lightbox-thumbs {
  position: relative;
  display: flex;
  gap: 6px;
  padding: 8px 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
  /* Scrolled sideways by a finger, unlike the rest of the lightbox */
  touch-action: pan-x;
}

.lightbox-thumbs::-webkit-scrollbar {
  display: none;
}

.lightbox-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #ffffff26;
  opacity: 0.5;
  cursor: pointer;
}

/* In the middle when they all fit, from the start when they do not */
.lightbox-thumb:first-child {
  margin-left: auto;
}

.lightbox-thumb:last-child {
  margin-right: auto;
}

.lightbox-thumb:hover {
  opacity: 0.8;
}

.lightbox-thumb[aria-current="true"] {
  border-color: #fff;
  opacity: 1;
}

.lightbox-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}

/* Arrows for a mouse; on a touch screen the images are swiped instead */
.lightbox-step {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  font-size: 32px;
}

.lightbox-step.previous {
  left: 12px;
}

.lightbox-step.next {
  right: 12px;
}

.lightbox-step:disabled {
  visibility: hidden;
}

@media (hover: none) {
  .lightbox-step {
    display: none;
  }
}

/* Reactions */

.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px 14px;
}

.reaction {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--ground);
  font-weight: 800;
  font-size: 15px;
}

.reaction[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.add-reaction {
  border-color: var(--ink);
  padding: 4px 12px;
  background: var(--ink);
  color: #fff;
}

/* The link to who reacted, to the right of the emojis */
.who-reacted {
  align-self: center;
  margin-left: auto;
  border: 0;
  padding: 0;
  background: none;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
}

/* In the feed the count of comments is what is pushed to the right */
.comment-total + .who-reacted {
  margin-left: 8px;
}

.who-reacted-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
}

.who-reacted-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.who-reacted-emoji {
  flex: none;
  font-size: 22px;
}

dialog.sheet {
  width: 100%;
  max-width: 30rem;
  margin: auto auto 0;
  border: 0;
  border-radius: 32px 32px 0 0;
  padding: 12px 18px 30px;
  background: var(--card);
  color: inherit;
}

dialog.sheet[open] {
  display: grid;
  gap: 14px;
}

dialog.sheet::backdrop {
  background: var(--scrim);
}

dialog.sheet::before {
  content: "";
  justify-self: center;
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--rule);
}

/* One of the things to do that a sheet lets its reader choose between */
.sheet-choice {
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--ground);
  font-weight: 800;
  font-size: 16px;
  text-align: left;
}

.sheet-choice.danger {
  color: var(--accent-deep);
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
}

.sheet-head p {
  margin: 0;
  font-weight: 800;
  font-size: 14px;
  color: var(--muted);
}

.quick-emojis {
  display: flex;
  justify-content: space-between;
}

.emoji-choice {
  border: 0;
  padding: 0;
  background: none;
  font-size: 26px;
  line-height: 1.3;
  border-radius: 12px;
}

.quick-emojis .emoji-choice {
  width: 48px;
  height: 48px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--ground);
}

.emoji-choice[aria-pressed="true"] {
  background: var(--accent-soft);
}

.quick-emojis .emoji-choice[aria-pressed="true"] {
  border-color: var(--accent);
}

.rule-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 800;
  font-size: 14px;
  color: var(--label);
}

.rule-label::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--shadow);
}

/* How to get to the emojis with a keyboard of keys: a phone shows its own */
#any-emoji-hint {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  #any-emoji-hint {
    display: block;
  }
}

/* On a post in the feed: how many comments the post has */
.comment-total {
  align-self: center;
  margin-left: auto;
  font-weight: 800;
  font-size: 14px;
  color: var(--muted);
}

/* Comments */

/* Room to scroll the last comment up from under the comment field */
.comments {
  display: grid;
  gap: 14px;
  padding-bottom: 96px;
}

.comments h2 {
  margin: 0;
  padding: 0 6px;
  font-weight: 800;
  font-size: 15px;
}

.comment-list,
.replies {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A comment scrolled to is not left under the comment field */
.comment-list li {
  scroll-margin-bottom: 120px;
}

.comment-line {
  display: flex;
  gap: 10px;
}

.comment-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: start;
}

.bubble {
  border-radius: 4px 18px 18px 18px;
  padding: 10px 12px;
  background: var(--card);
}

.comment.replying > .comment-line > .comment-body > .bubble {
  box-shadow: 0 0 0 2px var(--accent);
}

.comment-name,
.comment-text {
  margin: 0;
}

.comment-name {
  font-weight: 800;
  font-size: 14px;
}

.comment-text {
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* An image alone is a comment, and has no text to make room for */
.comment-text:empty {
  display: none;
}

/* The image of a comment or a reply, under its text */
.comment-image {
  display: block;
  width: fit-content;
  max-width: min(15rem, 100%);
  margin-top: 6px;
}

.comment-image img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 20rem;
  border-radius: 12px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding-left: 4px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
}

.comment-meta[hidden],
.comment-text[hidden] {
  display: none;
}

.reply-to,
.edit-comment,
.delete-comment,
.cancel-edit {
  border: 0;
  padding: 0;
  background: none;
  font-weight: 800;
  color: var(--muted);
}

/* The reactions to a comment or a reply, under its bubble: smaller than
   those of the post */
.comment-body > .reactions {
  gap: 4px;
  padding: 0 0 0 4px;
}

.comment-body > .reactions .reaction {
  padding: 2px 8px;
  font-size: 13px;
}

.comment-body > .reactions .reaction:not(.add-reaction, [aria-pressed="true"]) {
  background: var(--card);
}

/* What is left of a deleted comment that has replies */
.comment-line.deleted > .avatar {
  background: var(--sand);
}

.comment-line.deleted > .comment-body > .bubble {
  border: 2px dashed var(--rule);
  background: none;
  color: var(--muted);
  font-style: italic;
}

/* The field a comment is edited in, where its text was */
.comment-editor {
  gap: 8px;
  margin-top: 4px;
}

.comment-editor textarea {
  width: 100%;
  min-height: 44px;
  max-height: 240px;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--ground);
  /* iPhones zoom in on a field with smaller text when it is tapped */
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  field-sizing: content;
  caret-color: var(--accent);
}

.comment-editor textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.comment-editor-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-size: 13px;
}

.comment-editor-buttons .primary {
  padding: 8px 14px;
  font-size: 14px;
}

.replies {
  margin-top: 4px;
  border-left: 3px solid var(--line);
  padding-left: 10px;
}

.replies:empty {
  display: none;
}

.replies .comment-line {
  gap: 8px;
}

.replies .comment-body {
  gap: 4px;
}

.replies .bubble {
  border-radius: 4px 16px 16px 16px;
  padding: 8px 12px;
}

/* The comment field stays at the bottom of the screen */
.comment-composer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  max-width: 30rem;
  margin: 0 auto;
  gap: 8px;
  border-top: 2px solid var(--shadow);
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
}

.comment-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.comment-composer-row .avatar {
  margin-bottom: 4px;
}

.comment-composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 160px;
  border: 0;
  border-radius: 22px;
  padding: 10px 16px;
  background: var(--ground);
  font-weight: 700;
  /* iPhones zoom in on a field with smaller text when it is tapped */
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  field-sizing: content;
  caret-color: var(--accent);
}

.comment-composer textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* The button to pick an image to send, beside the field */
.file-picker.attach {
  flex: none;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  background: var(--ground);
  font-size: 18px;
}

/* The image picked to send, over the field until it is sent */
.comment-image-preview {
  position: relative;
  justify-self: start;
  max-width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: var(--sand);
}

.comment-image-preview[hidden] {
  display: none;
}

.comment-image-preview img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 96px;
  object-fit: cover;
}

/* Until the image is uploaded, and if it could not be */
.comment-image-preview p {
  margin: 0;
  padding: 12px 46px 12px 12px;
  color: var(--label);
  font-weight: 700;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.comment-image-preview p:empty {
  display: none;
}

.comment-image-preview.failed p {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.comment-image-preview button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #1e1a2ecc;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.send {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}

.send:disabled {
  background: var(--line);
  color: var(--muted);
}

.replying-to {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0 4px;
  font-weight: 800;
  font-size: 13px;
  color: var(--label);
}

.replying-to[hidden] {
  display: none;
}

.replying-to button {
  border: 0;
  padding: 2px 6px;
  background: none;
  font-weight: 800;
  color: var(--muted);
}

/* What went wrong, said for a little while over the top of the page */
.notice {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 14px;
  left: 14px;
  z-index: 3;
  max-width: 28rem;
  margin: 0 auto;
  border-radius: 16px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  text-align: center;
}

/* The browser's own pulling down to load the page anew is left out, and with
   it the page bouncing at the top, so the app's own is the only one */
html {
  overscroll-behavior-y: none;
}

/* Comes down from over the top of the page as it is pulled, turning as it
   goes, and spins once let go, while the page loads anew */
.puller {
  --pulled: 0px;
  --turned: 0deg;
  position: fixed;
  top: calc(-48px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  box-shadow: 0 2px 8px var(--scrim);
  transform: translateY(var(--pulled));
  transition: transform 0.2s ease-out;
  pointer-events: none;
}

.puller.pulling {
  transition: none;
}

.puller.ready,
.puller.loading {
  color: var(--accent);
}

.puller svg {
  transform: rotate(var(--turned));
}

.puller.loading {
  --pulled: 72px;
}

@media (prefers-reduced-motion: no-preference) {
  .puller.loading svg {
    animation: spin 0.8s linear infinite;
  }
}

@keyframes spin {
  to {
    transform: rotate(calc(var(--turned) + 360deg));
  }
}

@media (forced-colors: active) {
  .puller {
    border: 2px solid CanvasText;
  }
}

/* The notifications, under a heading for each day */
.notifications {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notifications .group {
  margin: 14px 4px 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
}

.notification {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: inherit;
}

.notification:hover {
  color: inherit;
  text-decoration: none;
}

.notification.unread {
  background: var(--accent-soft);
}

.notification-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* A post with pictures says so on a line of its own */
.notification-body {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.notification time {
  font-size: 13px;
  color: var(--muted);
}

.notification .dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  /* The bright accent is too close to the tint of the card */
  background: var(--accent-deep);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
