/* ============================================================
   tags.css — homebrew tags and refs drawn as chips in rendered text
   ============================================================ */

/* ─── CHIPS ──────────────────────────────────────────────── */
/* Inline, so a chip wraps with the sentence around it; `clone` keeps the
   border and padding on both halves of a wrapped chip. */
.tag-chip {
  display: inline;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  line-height: 1.6;
}

/* A chip inside a chip (the spell in "Gain Mending") sits a little tighter. */
.tag-chip .tag-chip { padding: 0 3px; }

/* ─── REFS ───────────────────────────────────────────────── */
.tag-ref {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  cursor: help;
}
.tag-ref:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* Spell names are italic in the rules text, so they are here too. */
.tag-ref[data-ref-kind="spell"] { font-style: italic; }

.tag-ref.missing {
  color: var(--text-dim);
  background: none;
  border-style: dashed;
  text-decoration: line-through;
}

/* ─── EFFECT TAGS ────────────────────────────────────────── */
.tag-effect {
  color: var(--text);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent-soft) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}
.tag-effect .tag-effect { font-weight: 500; }

.tag-choice-label {
  color: var(--accent);
  font-variant: small-caps;
  letter-spacing: 0.03em;
}

/* Half-built: a required field is missing or holds the wrong kind of value. */
.tag-effect.has-problems { border-style: dashed; border-color: var(--danger); }
.tag-missing { color: var(--danger); font-weight: 700; }

/* ─── BROKEN TAGS ────────────────────────────────────────── */
/* Its own text, so nothing the author wrote vanishes; it does nothing. */
.tag-invalid {
  color: var(--text-dim);
  text-decoration: underline wavy var(--danger);
  text-underline-offset: 3px;
}

/* ─── REF HOVER CARD ─────────────────────────────────────── */
.tag-tip-subtitle { font-style: italic; }

/* ─── CHOICE PICKERS ─────────────────────────────────────── */
/* A /choice on an owned card (src/js/tag-choices.js). All spans, since it sits
   inside a paragraph of the description; each picker breaks onto its own line. */
.tag-choice-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 6px 0;
  padding: 6px 8px;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: default;
}
.tag-choice-head {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tag-choice-picker[data-status="made"] > .tag-choice-head { color: var(--accent); }
.tag-choice-stale { font-size: 11px; font-style: italic; color: var(--danger); }

.tag-choice-options { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-choice-option {
  padding: 2px 6px;
  font-size: 11.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: 3px;
  cursor: pointer;
}
.tag-choice-option:hover:not(:disabled) { border-color: var(--accent); }
.tag-choice-option[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tag-choice-option:disabled { cursor: default; }
.tag-choice-option:disabled:not([aria-pressed="true"]) { opacity: 0.5; }
/* The option's chip already has the button's frame around it. */
.tag-choice-option > .tag-chip { border: none; background: none; padding: 0; }

/* A choice inside a picked option asks on its own line beneath. */
.tag-choice-nested { flex-basis: 100%; }
.tag-choice-nested > .tag-choice-picker { margin: 2px 0 0; background: var(--panel); }
