/* Title screen: game name, the two heroes, one big Play button. */

.title-screen {
  align-items: center;
  gap: var(--space-4);
  overflow-y: auto;
}
.title-screen > * { flex-shrink: 0; }

.title-screen .top-bar { align-self: stretch; }

/* Link out to thecreativeclara.com: a pill that presses like the icon
   buttons beside it. */
.title-screen__site {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-primary-text);
  box-shadow: 0 5px 0 var(--color-border-strong);
  font-weight: 800;
  text-decoration: none;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.title-screen__site:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--color-border-strong); }

.title-screen__site-img {
  height: calc(var(--tap-min) - 2 * var(--space-1));
  width: auto;
}

/* Narrow phones: the picture alone, so the bar still fits on one line. */
@media (max-width: 420px) {
  .title-screen__site { padding-inline: var(--space-2); }
  .title-screen__site-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

.title-screen__heading {
  font-size: clamp(2.4rem, 7vmin, 4.5rem);
  font-weight: 900;
  text-align: center;
  line-height: 1.05;
  color: var(--color-primary-dark);
  /* A white outline keeps the title readable wherever it sits on the sky. */
  text-shadow:
    0 3px 0 var(--color-surface),
    0 -2px 0 var(--color-surface),
    3px 0 0 var(--color-surface),
    -3px 0 0 var(--color-surface);
}

.title-screen__heroes {
  flex: 1;
  min-height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(var(--space-6), 10vw, 160px);
  width: 100%;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  height: 100%;
  justify-content: flex-end;
}

.hero__img {
  height: min(30vh, 250px);
  width: auto;
  min-height: 0;
  object-fit: contain;
  pointer-events: none;
  animation: hero-bob calc(2.4s * var(--motion-scale)) ease-in-out infinite;
}

/* Out of step with the first hero so they don't bob in unison. */
.hero--second .hero__img { animation-delay: -1.2s; }

.hero__name {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: var(--font-size-md);
  font-weight: 800;
  box-shadow: var(--shadow-card);
}

.hero__stars {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text);
}
.hero__stars .icon { fill: var(--color-sun); stroke: var(--color-sun-dark); }

/* The sticker they're saving for: "Minnie Mouse: 12 more". */
.hero__goal {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  max-width: 100%;
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  font-size: var(--font-size-sm);
  font-weight: 800;
  text-align: center;
}
.hero__goal .icon { flex: none; }
.hero__goal.is-empty { visibility: hidden; }

/* "Solo: level 3": this child's own journey, in their colour. */
.hero__solo {
  background: var(--color-surface);
  color: var(--color-text);
  border: 3px solid var(--hero-color, var(--color-primary));
  box-shadow: 0 4px 0 var(--hero-color, var(--color-primary));
  white-space: nowrap;
}
.hero__solo:active:not(:disabled) { box-shadow: 0 1px 0 var(--hero-color, var(--color-primary)); }
.hero__solo .icon { fill: var(--hero-color, var(--color-primary)); stroke: var(--hero-color, var(--color-primary)); }

/* Play in the middle, the sticker book and the shop either side. The side
   buttons share one width so Play stays centred. */
.title-screen__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-5);
  width: 100%;
  margin-bottom: var(--space-3);
}
.title-screen__book { justify-self: end; }
.title-screen__shop { justify-self: start; }
/* The goal shows under each hero here, so the shop sign keeps to the purses
   (with the goal bars too it ran off the side of an iPad). */
.title-screen__shop .shop-entry__goal { display: none; }
.title-screen__play .icon { fill: currentColor; }

@media (orientation: portrait) {
  .title-screen__actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .title-screen__play { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
}

@keyframes hero-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Clara's rainbow stripe (from her website) under the game's name. */
.title-screen .rainbow-stripe { align-self: center; width: min(520px, 60%); margin-top: calc(var(--space-2) * -1); }

/* ---------- Phones (queries explained in tokens.css) ---------------------- */

@media (max-width: 600px), (max-height: 500px) {
  .title-screen { gap: var(--space-2); }
  .title-screen__heading { font-size: clamp(1.7rem, 8vmin, 2.4rem); }
  .title-screen .rainbow-stripe { height: 6px; margin-top: 0; }
  /* Each hero gets a share of the width and its picture fills whatever
     height is left, rather than a fixed height that overflows. */
  .title-screen__heroes { gap: var(--space-2); }
  .hero { flex: 0 1 24%; min-width: 0; gap: var(--space-1); }
  .hero__img { flex: 1 1 0; width: 100%; height: auto; }
  .hero__name { padding-inline: var(--space-3); white-space: nowrap; }
  .hero__stars { white-space: nowrap; }
  .hero__goal { padding-inline: var(--space-2); font-size: .75rem; }
  .hero { flex-basis: 36%; }
  .title-screen__actions { gap: var(--space-3); margin-bottom: var(--space-1); }
}

/* Upright: Play across the full width, the book and the shop under it. */
@media (max-width: 600px) and (orientation: portrait) {
  .title-screen__heroes { align-items: center; }
  /* Faces sized by their width, names right under them. */
  .hero { height: auto; }
  .hero__img { flex: none; }
  .title-screen__play { width: 100%; padding-inline: var(--space-4); white-space: nowrap; font-size: clamp(1.1rem, 5.5vw, var(--font-size-lg)); }
  .hero { flex-basis: 44%; }
  /* The faces are narrow here: "▶ Solo:" over "level 3". */
  .hero__solo { flex-wrap: wrap; column-gap: var(--space-1); row-gap: 0; width: 100%; padding: var(--space-1) var(--space-2); font-size: var(--font-size-sm); }
  .hero__solo-level { flex-basis: 100%; text-align: center; }
  .title-screen__book,
  .title-screen__shop,
  .title-screen__shop .shop-entry { justify-self: stretch; width: 100%; min-width: 0; }
}

/* On its side: the name sits between the corner buttons to save a row. */
@media (max-height: 500px) and (orientation: landscape) {
  .title-screen .top-bar {
    position: absolute;
    top: max(var(--space-2), env(safe-area-inset-top));
    left: max(var(--space-3), env(safe-area-inset-left));
    right: max(var(--space-3), env(safe-area-inset-right));
    z-index: 1;
    pointer-events: none;
  }
  .title-screen .top-bar > * { pointer-events: auto; }
  .title-screen__heading { line-height: var(--tap-min); font-size: clamp(1.6rem, 7vmin, 2.2rem); }
  .title-screen .rainbow-stripe { width: min(360px, 45%); margin-top: calc(var(--space-2) * -1); }
  .hero { flex-basis: 20%; max-width: 180px; }
}
