/*
  One stylesheet, no fonts and no imports: a tile is served from the publisher's own domain
  under the site CSP, which permits no third-party origin for anything. The palette is card/'s
  family with a parchment page and an ink-blue accent, for a character sheet's feel.
*/
:root {
  --ink: #1d1b18;
  --muted: #5d574d;
  --paper: #f6f1e7;
  --panel: #fffdf8;
  --rule: #ddd3c1;
  --accent: #2b5f8a;
  --ok: #2e6b3f;
  --bad: #9a3324;
  --wait: #7a6a3a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7dd;
    --muted: #a9a294;
    --paper: #15140f;
    --panel: #1f1d17;
    --rule: #39352b;
    --accent: #8cc0ea;
    --ok: #8fd19e;
    --bad: #f0a493;
    --wait: #d9c27e;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.page {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 3rem;
  display: grid;
  gap: 1.25rem;
}

.card,
.character,
.calls {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 0.875rem;
  padding: 1.25rem;
}

.card {
  padding-top: 0;
  overflow: hidden;
}

/* app.bsky.actor.profile banners are 3:1; the placeholder is a quiet gradient. */
.banner {
  aspect-ratio: 3 / 1;
  margin: 0 -1.25rem;
  background: linear-gradient(120deg, var(--rule), var(--paper));
}

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

.head {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-top: -2.5rem;
}

.avatar {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid var(--panel);
  background: radial-gradient(circle at 50% 38%, var(--muted) 0 22%, transparent 23%),
    radial-gradient(circle at 50% 100%, var(--muted) 0 42%, transparent 43%), var(--rule);
  overflow: hidden;
}

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

.who {
  min-width: 0;
  padding-bottom: 0.25rem;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 1.625rem;
}

h2 {
  font-size: 1.25rem;
}

.did {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font: 0.8125rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

/* A profile description keeps its own line breaks; it is plain text, never markup. */
.bio {
  margin: 1rem 0 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.status {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Placeholder text says what it is: muted and italic until the live value replaces it. */
.placeholder {
  color: var(--muted);
  font-style: italic;
}

.arrived {
  animation: arrive 900ms ease-out;
}

@keyframes arrive {
  from {
    background-color: color-mix(in srgb, var(--accent) 28%, transparent);
  }
  to {
    background-color: transparent;
  }
}

.character {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: start;
}

.sprite {
  margin: 0;
  text-align: center;
}

.sprite canvas {
  display: block;
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  border-radius: 0.5rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  cursor: pointer;
}

.sprite canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sprite figcaption {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.summary {
  margin: 0.25rem 0 0.75rem;
  color: var(--muted);
}

dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

dl:empty {
  display: none;
}

/* A stat block, as a character sheet draws one: the label small, the value large. */
dl > div {
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background: var(--paper);
  text-align: center;
}

dt {
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.calls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

button {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.375rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

button:hover:not(:disabled),
button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.log {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.375rem;
  font-size: 0.8125rem;
}

.log li {
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  background: var(--paper);
}

.log .method {
  font: 0.75rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.log .detail {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.log .outcome {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log .ok {
  color: var(--ok);
}

.log .refused,
.log .failed {
  color: var(--bad);
}

.log .pending {
  color: var(--wait);
}

.log .divider {
  display: block;
  background: none;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

.note {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.note:empty {
  display: none;
}

@media (max-width: 30rem) {
  .character {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .log li {
    grid-template-columns: 1fr auto;
  }

  .log .detail {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arrived {
    animation: none;
  }
}

[hidden] {
  display: none !important;
}
