/* Spec 056: the hero builder, the kid's heroes, and the banner about photos of people. Tokens only:
   the one colour that is not a token is a swatch's own (the hero's colour, content), set through the
   CSS object model as --swatch, never an inline style. The hero pictures are SVG with presentation
   attributes from the catalog. */

.heroes,
.builder {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.heroes-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.heroes-new {
  min-height: calc(var(--touch-kid) * 1.5);
}

.heroes-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* Spec 063: the card is one button: a tap, a click or Enter anywhere on it opens the builder. */
.hero-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: 100%;
  padding: var(--space-3);
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: var(--elevation-rest);
  text-align: center;
  cursor: pointer;
}

.hero-card:hover,
.hero-card:active {
  background: var(--accent-soft);
}

.hero-card .hero-art {
  width: 120px;
  height: 144px;
}

.builder-top {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.builder-preview {
  flex: 0 0 auto;
  width: 170px;
  height: 204px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--elevation-raised);
  padding: var(--space-2);
}

.builder-preview .hero-art {
  width: 100%;
  height: 100%;
}

.builder-words {
  min-width: 0;
}

.builder-heading {
  margin: 0;
}

.builder-photo {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}

.hero-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.hero-tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-width: var(--touch-kid);
  min-height: var(--touch-kid);
  padding: var(--space-2) var(--space-3);
  border: 3px solid var(--surface-muted);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--font-md);
  font-weight: 600;
  cursor: pointer;
}

.hero-tile[aria-pressed="true"] {
  background: var(--crayon-yellow);
  color: var(--on-crayon);
  border-color: var(--crayon-yellow);
}

.hero-tile:focus-visible,
.hero-chip:focus-visible {
  outline: var(--focus-width) solid var(--focus);
  outline-offset: var(--focus-offset);
}

.hero-tile .hero-art {
  width: 84px;
  height: 100px;
}

.hero-swatch {
  display: block;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--hairline);
  background: var(--swatch);
}

.hero-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
}

.hero-chip .hero-art {
  width: 84px;
  height: 100px;
}

/* Spec 056 (US3): why a photo of a person is not turned into a character. Calm by default, louder
   right after a photo was refused for a face. Spec 183: one padding all round (the panel's, as the app's
   Panel), so a wrapped button has as much room under it as beside it. */
.people-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
}

.people-banner p {
  margin: 0;
  flex: 1 1 18rem;
}

/* Spec 211 amendment (the owner on build 42 saw the panel beside his dog's photo and read it as about the dog): on the
   maker's hero step it is a quiet line under "Make a new hero" until a photo is refused; then the panel, ringed. */
.maker .people-banner:not(.loud) {
  padding: 0;
  background: none;
  color: var(--text-secondary);
}

/* Louder, not another colour: the sun button must keep its contrast on the banner. */
.people-banner.loud {
  outline: 4px solid var(--crayon-orange);
  outline-offset: 0;
  box-shadow: var(--elevation-raised);
}

@media (max-width: 480px) {
  .builder-top {
    flex-direction: column;
    align-items: stretch;
  }

  .builder-preview {
    align-self: center;
    width: 150px;
    height: 180px;
  }

  .hero-tile .hero-art,
  .hero-chip .hero-art {
    width: 72px;
    height: 86px;
  }
}

/* Spec 057: more heroes on the friend step (a name beside each picture). Tokens only. */
.maker-cast {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cast-names {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Spec 183: with no drawing to name the list takes no place, so it adds no second gap in a step's column. */
.cast-names:empty {
  display: none;
}

.cast-names .cast-name {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
}

.cast-name img {
  width: 56px;
  height: 56px;
  flex: none;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.cast-name input {
  flex: 1 1 auto;
  min-width: 0;
}

/* Spec 111: the hero card's "Change" is a pencil, and its bin a compact icon under the card. */
.hero-edit {
  pointer-events: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text);
}

.hero-edit .icon {
  width: 22px;
  height: 22px;
}

.heroes-grid > li {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.hero-icons {
  justify-content: center;
}
