/* Magic with AI, the text features (D-037): the curator's label in the
   cartela, the story page and the guardian's list of characters. The
   story page is a .room-viewer.obra, so it takes the room's wall, tone and
   veil from obra.css; this file sets the reading column. */

/* ---------- Busy: a quiet spinner and a status line ---------- */
.ai-text-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}
.ai-text-status[hidden] { display: none; }
.obra-actions .ai-text-status { flex-basis: 100%; }
.ai-spinner {
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ai-text-spin 0.9s linear infinite;
}
@keyframes ai-text-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-spinner { animation: none; border-right-color: currentColor; opacity: 0.6; } }
form[aria-busy="true"] button { opacity: 0.55; cursor: progress; }

/* ---------- The curator's label, under the description ---------- */
.obra-curator {
  margin: 0.85rem auto 0;
  max-width: 30rem;
  padding: 0;
}
.obra-curator figcaption {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.obra-curator blockquote { margin: 0.3rem 0 0; padding: 0; }
.obra-curator blockquote p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.08rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.curator-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.9rem;
  margin: 0.2rem 0 0;
}
.curator-tools form.inline { display: contents; }
.curator-tools button.curator-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
}
.curator-tools button.curator-tool .icon { width: 1rem; height: 1rem; }
.curator-tools button.curator-tool:hover { color: var(--ink); background: var(--veil); }
.curator-tools button.curator-tool:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- The story page: a calm column to read in bed ---------- */
.cuento-sheet {
  max-width: 34rem;
  margin: 0.75rem auto 0;
  padding: clamp(1.25rem, 5vw, 2.5rem) clamp(1.1rem, 5vw, 2.75rem) clamp(1.5rem, 5vw, 2.5rem);
  border-radius: 1.25rem;
  background: var(--veil);
  text-align: center;
}
.cuento-art {
  display: block;
  width: min(9.5rem, 46%);
  margin: 0 auto 1.1rem;
}
.cuento-art .mat { padding: 0.55rem; }
.cuento-art img { max-height: 11rem; width: 100%; object-fit: contain; }
.cuento-eyebrow {
  margin: 0 0 0.4rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.cuento-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.85rem, 7vw, 2.6rem);
  line-height: 1.1;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.cuento-text {
  margin: 1.1rem 0 0;
  text-align: left;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 4.6vw, 1.38rem);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.cuento-text p { margin: 0 0 0.9em; text-wrap: pretty; }
.cuento-text p:last-child { margin-bottom: 0; }
.cuento-help {
  margin: 0.9rem auto 0;
  max-width: 26rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.45;
}
.cuento-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
}
.cuento-actions form { display: block; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.cuento-actions .button.quiet { border-color: color-mix(in srgb, var(--ink) 18%, transparent); }
.cuento-listen[hidden], .cuento-listen [hidden] { display: none; }
.cuento-listen .icon { flex: none; }
.cuento-note {
  margin: 1.1rem 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.cuento-sheet[aria-busy="true"] .cuento-text { opacity: 0.45; transition: opacity 0.3s; }

/* ---------- The saga, on the guardian's artist page ---------- */
.characters { margin: 2.25rem 0 0; max-width: 40rem; }
.characters-help { margin: 0 0 0.75rem; font-size: 0.9rem; }
.character-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.character-list li { border-bottom: 1px solid var(--line); }
.character summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.75rem;
  align-items: baseline;
  min-height: 2.75rem;
  padding: 0.7rem 0.25rem;
  cursor: pointer;
  list-style: none;
}
.character summary::-webkit-details-marker { display: none; }
.character-name { font-family: var(--serif); font-size: 1.2rem; line-height: 1.2; overflow-wrap: anywhere; }
.character-count { grid-column: 2; grid-row: 1; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.character-desc { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; line-height: 1.35; overflow-wrap: anywhere; }
.character-form { display: grid; gap: 0.75rem; max-width: none; padding: 0.25rem 0.25rem 1rem; border: 0; border-radius: 0; background: none; }
.character-form label { display: grid; gap: 0.3rem; font-size: 0.9rem; }
.character-form input { width: 100%; min-width: 0; }
.character-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.character-buttons .character-delete:hover { color: var(--danger); }
