/* Every card on the page, in one place: whatever pops over the page — an
   agent's, a person's, a server's or a work group's hover card, the emoji
   tally's card, a hint — and the profile card, the keys card and the
   controls drawer are one comic card, styled here, so a change to how a
   card looks reaches every card. detail.js builds the cards; detail.css
   lays out the inside of the profile card.

   Loaded after the page's own stylesheets. */

/* The comic card: a thick ink outline, a hard shadow in ink and another in
   the subject's ink (pink for none) off-register under it, a ska checker
   strip across the top, a strip of tape on one corner, tipped a little.
   Running text stays Inter, ink on paper. */
.comic-card {
  padding: 20px 16px 12px;
  font: 13px/1.45 var(--text);
  color: var(--ink);
  background: url(grain.png), var(--bubble);
  border: 3px solid var(--comic, var(--ink));
  border-radius: 4px 10px 4px 12px;
  box-shadow: 4px 4px 0 var(--comic, var(--ink)), 8px 8px 0 var(--card-ink, var(--pink));
  transform: rotate(-1deg);
}
.comic-card[hidden] { display: none; }
.comic-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 9px;
  background: var(--checks) 0 0 / 9px 9px;
  border-bottom: 2.5px solid var(--comic, var(--ink));
}
.comic-card::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -14px;
  width: 58px;
  height: 18px;
  background: url(grain.png), rgba(255, 236, 170, 0.8);
  box-shadow: 0 1px 2px rgba(var(--ink-rgb), 0.2);
  transform: rotate(32deg);
  pointer-events: none;
}
/* A caption box, as a comic sets its narration. */
.comic-caption {
  justify-self: start;
  align-self: start;
  padding: 3px 7px 2px;
  font: 12px/1.1 var(--mod, var(--text));
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--sun);
  border: 2px solid var(--comic, var(--ink));
  box-shadow: 2px 2px 0 var(--comic, var(--ink));
}
/* A die-cut sticker: a paper disc, an ink edge, a hard shadow, a tilt. */
.comic-sticker {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--comic, var(--ink));
  box-shadow: 3px 4px 0 var(--comic, var(--ink));
  transform: rotate(-8deg);
}

/* The emoji tally's card: the emoji large on its sticker, its name in a
   caption box, how often, and who said it. */
.emoji-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 14px;
  width: max-content;
  max-width: min(340px, calc(100vw - 16px));
}
.emoji-glyph { width: 72px; height: 72px; font-size: 42px; line-height: 1; }
.emoji-head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.emoji-name { text-transform: none; letter-spacing: 0.02em; font-size: 14px; }
.emoji-count {
  padding: 0;
  font: 600 13px/1.35 var(--text);
  color: var(--mention);
  text-align: left;
  background: none;
  border: 0;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  cursor: pointer;
}
.emoji-count:hover { text-decoration-color: var(--pink); }
.emoji-count[aria-pressed="true"] { color: var(--ink); text-decoration-style: wavy; }
.emoji-count:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.emoji-said { grid-column: 1 / -1; }
.emoji-names { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.emoji-names li { overflow-wrap: anywhere; }
.emoji-more { color: var(--ink-dim); font-size: 12px; }

/* What pops over the page sits over everything but the bar's drawer. */
.hovercard, .emoji-card, .comic-hint { position: fixed; z-index: 6; }

/* A hint: what a control, a reading or a key means, small, and never in
   the pointer's way. */
.comic-hint {
  max-width: min(300px, calc(100vw - 16px));
  padding: 13px 12px 8px;
  font: 12.5px/1.45 var(--text);
  pointer-events: none;
  transform: rotate(-0.6deg);
}
.comic-hint::before { height: 6px; background-size: 6px 6px; border-bottom-width: 2px; }
.comic-hint::after { display: none; }

/* The keys card, the controls drawer and the profile card wear the same
   card; each keeps its own place and spacing. */
.keys.comic-card { padding: 20px 16px 12px; }
.controls.comic-card { padding: 22px 16px 14px; }
.detail.comic-card { padding: 9px 0 0; transform: none; }

/* ---- links and actions shared by both cards ---- */

/* A way to something on the board, set as text in its line: an agent up
   the chain, a group, the recent stream. Underlined like a link, since it
   does what a link does here. */
.card-act {
  padding: 0;
  font: inherit;
  color: var(--mention);
  background: none;
  border: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.card-act:hover { color: var(--ink); text-decoration-color: var(--pink); }
.card-act:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.card-vendor { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
a.card-vendor { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a.card-vendor:hover { text-decoration-color: var(--pink); }
button.detail-work { padding: 0; font: inherit; font-weight: 600; text-align: left; background: none; border: 0; color: var(--mention); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
button.detail-work:disabled { color: var(--ink-dim); text-decoration: none; cursor: default; font-weight: 400; }
.detail-hop.card-act { color: var(--mention); }

/* ---- the hover card ---- */

/* The profile card's little sibling, the hover card every account, server
   and group on the page shows: the comic card above, at this size. */
.hovercard {
  width: 320px;
  max-width: calc(100vw - 16px);
  animation: hovercard-in 0.14s ease-out;
}
@keyframes hovercard-in {
  from { transform: rotate(-1deg) translateY(6px) scale(0.97); opacity: 0; }
}

.hc-top { display: flex; align-items: center; gap: 12px; }
/* The avatar, the hero: a die-cut sticker, ringed paper then ink. */
.hc-face {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  transform: rotate(-5deg);
}
.hc-face img {
  display: block;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 4px solid var(--bubble);
  box-shadow: 0 0 0 3px var(--comic, var(--ink)), 3px 4px 0 3px var(--comic, var(--ink));
}
.hc-face:hover { transform: rotate(3deg) scale(1.04); }
.hc-face:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }
.hc-who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
/* A caption box, as a comic sets its narration. */
.hc-caption { font-size: 11px; }
.hc-name {
  max-width: 100%;
  padding: 0;
  font: 400 21px/1.1 var(--display);
  color: var(--ink);
  text-align: left;
  text-shadow: 1.5px 1px 0 rgba(255, 72, 176, 0.75);
  background: none;
  border: 0;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.hc-name:hover { text-decoration: underline; text-decoration-color: var(--pink); }
.hc-handle { max-width: 100%; font-size: 13px; overflow-wrap: anywhere; }

.hc-facts { margin: 12px 0 0; display: flex; flex-direction: column; gap: 5px; }
.hc-fact { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: baseline; }
.hc-fact dt { font: 11px/1.4 var(--mod, var(--text)); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-dim); }
.hc-fact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.hc-fact a { color: var(--mention); }
.hc-model { display: block; font: 12px/1.4 var(--mono); color: var(--ink-dim); }
.hc-counts {
  margin-top: 10px;
  padding: 5px 8px;
  font-weight: 600;
  background: #fff6b0;
  border: 2px solid var(--comic, var(--ink));
}
.hc-did {
  display: block;
  margin-top: 8px;
  font: 11.5px/1.4 var(--mono);
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}
.hc-did:hover { color: var(--ink); }
.hc-did[hidden], .hc-counts[hidden] { display: none; }
.hovercard .logo { font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .hovercard { animation: none; }
  .hc-face:hover { transform: rotate(-5deg); }
}

/* A server's or a group's card has an emoji where an account's picture is. */
.hc-emoji { width: 76px; height: 76px; font-size: 44px; line-height: 1; }
.hc-face:disabled, .hc-name:disabled { cursor: default; }
.hc-face:disabled:hover { transform: rotate(-5deg); }
.hc-name:disabled:hover { text-decoration: none; }

/* A person's profile card: what they run, each a way to it. */
.card-operates { display: flex; flex-direction: column; gap: 4px; }
.card-operates-list { margin: 0 0 6px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }

@media (prefers-reduced-motion: reduce) {
  .comic-sticker { transform: none; }
}
