/* view: the universe ------------------------------------------------------
 * One map of every person (a star) and every song (a place), on its own dark
 * field. The sky is one canvas the view draws (views/universe.js
 * `painterOf`, listen/skymarks.js for each mark's colour, opacity and size):
 * this sheet gives it its box, the stage's star size (--u-dot) and the
 * colours it reads (listen.css's --sky-* tokens). Names are HTML links over
 * the sky. The head sits
 * above the sky (the way back, Since last look and the key's "i" on one row,
 * then the counts and what the map is), so a framing never puts a star under
 * its words. Tokens are listen.css's (the --sky-* set); nothing here defines
 * a colour. The dock's reserve on #view stays: the stage's height leaves room
 * for it. A wide screen (≥ 900px, Desktop 2c) holds the same parts in the
 * 1200 column, the stage at most 620 tall.
 */

#view[data-view="universe"] {
  max-width: none;
}

/* the head: back and the two buttons, then the eyebrow, the counts, the map's line, and the load's or the invitation */
.universe-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "back acts"
    "eyebrow eyebrow"
    "caption caption"
    "note note"
    "line line";
  align-items: center;
  column-gap: 12px;
  padding: 6px var(--gutter) 12px;
}

.universe-back {
  grid-area: back;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font: 600 var(--t-meta) / 1.2 var(--sans);
  color: var(--fg-muted);
}

.universe-acts {
  grid-area: acts;
  display: flex;
  align-items: center;
  gap: 6px;
}

.universe-look {
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: none;
  color: var(--fg);
  font: 600 var(--t-meta) / 1.2 var(--sans);
}

.universe-look:disabled {
  opacity: 0.4;
}

.universe-i {
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: none;
  color: var(--fg-muted);
  font: italic 400 15px / 1 var(--serif);
}

.universe-i[aria-expanded="true"] {
  border-color: var(--fg-muted);
  color: var(--fg);
}

.universe-eyebrow {
  grid-area: eyebrow;
  margin-top: 6px;
  font-size: var(--t-meta);
  color: var(--fg-muted);
}

.universe-caption {
  grid-area: caption;
  margin-top: 6px;
  font: 400 28px / 1.05 var(--serif);
  letter-spacing: -0.025em;
  color: var(--fg);
  text-wrap: balance;
}

.universe-note {
  grid-area: note;
  margin-top: 6px;
  font-size: var(--t-meta);
  color: var(--fg-muted);
}

.universe-line {
  grid-area: line;
  margin-top: 8px;
  font-size: var(--t-meta);
  color: var(--fg-muted);
}

/* the key: a card over the sky's top right, beside the zoom, opened by "i"; everyone and every song, then a swatch and a word for each mark the sky can show */
.universe-body {
  position: relative;
}

.universe-key {
  position: absolute;
  top: 8px;
  right: 60px;
  z-index: 3;
  width: min(260px, calc(100% - 72px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sky-field);
  font-size: var(--t-meta);
  color: var(--fg-muted);
}

.universe-whole {
  margin-bottom: 8px;
}

.universe-key-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--fg);
}

.universe-key-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.universe-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sky-not-yet);
}

.universe-key-row[data-mark="heard"] .universe-swatch {
  background: var(--sky-heard);
}

.universe-key-row[data-mark="saved"] .universe-swatch {
  background: none;
  border: 2px solid var(--sky-saved);
}

.universe-key-row[data-mark="trail"] .universe-swatch {
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--sky-heard);
}

.universe-key-row[data-mark="place"] .universe-swatch {
  border-radius: 2px;
  background: var(--sky-place);
  opacity: 0.6;
}

.universe-key-row[data-mark="fresh"] .universe-swatch {
  background: var(--sky-fresh);
}

.universe-key-row[data-mark="now"] .universe-swatch {
  background: none;
  border: 2px solid var(--sky-now);
}

.universe-key-row[data-mark="next"] .universe-swatch {
  background: none;
  border: 1.5px dashed var(--sky-next);
}

.universe-key-row[data-mark="seen"] .universe-swatch {
  background: var(--sky-field);
  border: 1.5px solid var(--sky-heard);
  opacity: 0.8;
}

/* the stage: everything below the head down to the dock */
.universe-stage {
  /* a star is never under 10px across (8a: "never under 5px", a radius), 8px
     on a wide screen (2c); the view reads it, and sizes every mark under a
     star from it (skymarks.js stageSizes) */
  --u-dot: 10px;
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  background: var(--sky-field);
  height: max(
    240px,
    calc(
      100svh - var(--u-above, 220px) - var(--drawer-mini) - 24px -
        env(safe-area-inset-bottom, 0px)
    )
  );
}

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

/* the sky's canvas (home's tile draws one too, in its own box) */
.universe-sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* names: HTML links laid over the sky, placed by the view */
.universe-names {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.universe-name {
  position: absolute;
  left: 0;
  top: 0;
  height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
  font: italic 400 13px / 16px var(--serif);
  color: var(--sky-name);
  /* a halo in the field's colour, so a name reads on the field whatever is
     drawn under it (2026-10-26: "too hard to read"); the count after a song
     inherits it */
  text-shadow: var(--sky-halo);
}

/* a song place: its title and, after it, how many people sing it, centred
   together on the place in the box views/universe.js paintNames gives it;
   the title is what is cut when the box is too narrow, never the count */
.universe-name[data-kind="song"] {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.universe-name-t {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.universe-name[data-kind="song"]::after {
  content: attr(data-n);
  flex: none;
  font: normal 400 10.5px / 16px var(--sans);
  color: var(--fg-muted);
}

/* a song a saved person sings */
.universe-name[data-saved] {
  color: var(--sky-saved);
}

.universe-name[data-kind="person"] {
  font: normal 600 12px / 16px var(--sans);
  color: var(--sky-saved);
}

/* the door's subject: the one name that stands at every zoom; colour and a
   line only, never a font change (its box was placed at the base metrics) */
.universe-name[data-door] {
  color: var(--sky-now);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* the overlay: what plays next, the line to it, and the flash, HTML over the sky */
.universe-over {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.universe-next {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1.5px dashed var(--sky-next);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* the star the listener tapped, waiting to play: ringed orange (8a) */
.universe-next.is-chosen {
  border: 1.5px solid var(--sky-fresh);
}

/* the line from the star sounding (or the newest played) to what plays next */
.universe-trace {
  position: absolute;
  height: 0;
  border-top: 1px dashed var(--sky-next);
  transform-origin: 0 0;
  opacity: 0.7;
}

.universe-trace.is-chosen {
  border-top-color: var(--sky-fresh);
}

/* the flash rests dimmed; its entry is the bright moment, so with less
   motion the name still shows, dimmed */
.universe-flash {
  position: absolute;
  max-width: 220px;
  transform: translate(-50%, calc(-100% - 12px));
  text-align: center;
  white-space: nowrap;
  color: var(--sky-name);
  text-shadow: var(--sky-halo);
  opacity: 0.35;
  animation: u-flash 450ms ease-out;
}

.universe-flash-who {
  display: block;
  font: normal 600 12px / 16px var(--sans);
}

.universe-flash-song {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font: italic 400 13px / 16px var(--serif);
}

/* the name of the person sounding: it comes once their cover has sounded,
   and goes, so it never stands over the song places for long */
.universe-flash.is-play {
  opacity: 0;
  animation: u-flash-play 2400ms ease-out;
}

@keyframes u-flash-play {
  from {
    opacity: 1;
  }
  60% {
    opacity: 0.6;
  }
  to {
    opacity: 0;
  }
}

@keyframes u-flash {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.35;
  }
}

/* the zoom, at the stage's top right: on a short window the stage's foot
   can sit under the dock, its top never does */
.universe-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.universe-zoom button {
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--sky-place);
  border-radius: 50%;
  background: var(--sky-field);
  color: var(--sky-name);
  font: 600 20px / 1 var(--sans);
}

.universe-zoom button:disabled {
  opacity: 0.35;
}

/* the said line: top centre, over the sky, never in the way of a tap */
.universe-said {
  position: absolute;
  top: 8px;
  left: 50%;
  max-width: calc(100% - 128px);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  transform: translateX(-50%);
  background: var(--sky-field);
  color: var(--sky-name);
  text-align: center;
  pointer-events: none;
}

.universe-said:empty {
  visibility: hidden;
}

@media (min-width: 561px) {
  .universe-said {
    max-width: 60%;
  }
}

/* A wide screen (Desktop 2c): the 1200 column, 40px in; the counts larger;
   the stage the column's width and at most 620 tall, still above the dock;
   a star 8px across. */
@media (min-width: 900px) {
  #view[data-view="universe"] {
    max-width: 1200px;
  }

  .universe {
    padding: 0 40px;
  }

  .universe-top {
    padding: 8px 0 16px;
  }

  .universe-caption {
    font: 300 36px / 1 var(--serif);
    letter-spacing: -0.03em;
  }

  .universe-note {
    font-size: 12.5px;
  }

  .universe-key {
    top: 16px;
    right: 64px;
  }

  .universe-stage {
    --u-dot: 8px;
    height: min(
      620px,
      max(
        320px,
        calc(100svh - var(--u-above, 220px) - var(--drawer-mini) - 24px)
      )
    );
  }
}
